Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

CalXtalRecAlg Class Reference

Calorimeter crystal reconstruction algorithm. More...

#include <CalXtalRecAlg.h>

Collaboration diagram for CalXtalRecAlg:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CalXtalRecAlg (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
 initialize internal data members.

StatusCode execute ()
 Reconstruct ene & pos for all xtal hits in event.

StatusCode finalize ()
 required by Gaudi Algorithm class


Private Member Functions

StatusCode retrieve ()
 function for setting pointers to the input and output data in Gaudi TDS


Private Attributes

Event::CalDigiCol * m_calDigiCol
 pointer to input data collection in TDS

Event::CalXtalRecCol * m_calXtalRecCol
 pointer to the output data collection in TDS

IXtalRecToolm_xtalRecTool
 pointer to CalResponse tool for converting xtal digi info -> energy

StringProperty m_recToolName
 name of IXtalRecTool instantiation

INeighborXtalkToolm_xtalkTool
 pointer to NeighborXtalk tool for calculating electronic crosstalk from neighboring crystals

StringProperty m_xtalkToolName
 name of INeigbhorXtalkTool instantiation


Detailed Description

Calorimeter crystal reconstruction algorithm.

This algorithm reconstructs energy and position for each calorimeter crystal. See CalXtalResponse/XtalRecTool

Author:
A.Chekhtman

Z.Fewtrell

jobOptions:

Definition at line 36 of file CalXtalRecAlg.h.


Constructor & Destructor Documentation

CalXtalRecAlg::CalXtalRecAlg const std::string &  name,
ISvcLocator *  pSvcLocator
 

Definition at line 35 of file CalXtalRecAlg.cxx.

References m_recToolName, and m_xtalkToolName.

00035                                                                         :
00036   Algorithm(name, pSvcLocator),
00037   m_calDigiCol(0),
00038   m_calXtalRecCol(0),
00039   m_xtalRecTool(0),
00040   m_xtalkTool(0)
00041 {
00042   // declare jobOptions.txt properties
00043   declareProperty("XtalRecToolName", m_recToolName="XtalRecTool");
00044   declareProperty("NeighborXtalkToolName", m_xtalkToolName="");
00045 }


Member Function Documentation

StatusCode CalXtalRecAlg::execute  ) 
 

Reconstruct ene & pos for all xtal hits in event.

for all CalDigis in one event. It calls retrieve() method to get access to input and output TDS data. It iterates over all elements in CalDigiCol and calls XtalRecTool::calculate() method for each xtal reconstruction.

if there's no CalDigiCol then CalXtalRecAlg is not happening, go on w/ other algs

Definition at line 93 of file CalXtalRecAlg.cxx.

References INeighborXtalkTool::buildSignalMap(), IXtalRecTool::calculate(), m_calDigiCol, m_calXtalRecCol, m_xtalkTool, m_xtalRecTool, and retrieve().

00094 {
00095   StatusCode sc;
00096 
00097   //get access to TDS data collections
00098   sc = retrieve(); 
00099   if (sc.isFailure()) return sc;
00100 
00101   // non-fatal error:
00103   if (!m_calDigiCol) return StatusCode::SUCCESS;
00104 
00105   // initialize neighborXtalkTool
00106   if (m_xtalkTool)
00107     m_xtalkTool->buildSignalMap(*m_calDigiCol);  
00108        
00109   // loop over all calorimeter digis in CalDigiCol
00110   for (CalDigiCol::const_iterator digiIter = m_calDigiCol->begin(); 
00111        digiIter != m_calDigiCol->end(); digiIter++) {
00112     
00113     // if there is no digi data, then move on w/ out creating
00114     // recon TDS data for this xtal
00115     if ((*digiIter)->getReadoutCol().size() < 1) continue;
00116     
00117     const CalXtalId xtalId((*digiIter)->getPackedId());
00118     
00119     // create new object to store crystal reconstructed data  
00120     // use auto_ptr so it is autmatically deleted when we exit early
00121     // on error.
00122     auto_ptr<CalXtalRecData> recData(new CalXtalRecData((*digiIter)->getMode(), xtalId));
00123                                      
00124     // calculate energy in the crystal
00125     // used for current range only
00126     CalVec<FaceNum, bool> belowNoise;
00127     CalVec<FaceNum, bool> saturated;
00128 
00129     // convert adc values into energy/pos
00130     sc = m_xtalRecTool->calculate(**digiIter,
00131                                   *recData,
00132                                   belowNoise,
00133                                   saturated,
00134                                   m_xtalkTool);
00135     // single xtal may not be able to recon, is not failure condition.
00136     if (sc.isFailure()) continue;
00137 
00138     // skip any xtal w/ at least one LEX8 range below noise thold
00139     if (contains(belowNoise,true)) continue;
00140     
00141     // skip if recData contains no entries
00142     if (recData->getNReadouts() == 0) continue;
00143 
00144     // add new reconstructed data to the collection
00145     // release it from the auto_ptr so it is not deleted
00146     m_calXtalRecCol->push_back(recData.release());
00147   }
00148 
00149 
00150   return StatusCode::SUCCESS;
00151 }

StatusCode CalXtalRecAlg::finalize  )  [inline]
 

required by Gaudi Algorithm class

Definition at line 48 of file CalXtalRecAlg.h.

00048                         {
00049     return StatusCode::SUCCESS;
00050   }

StatusCode CalXtalRecAlg::initialize  ) 
 

initialize internal data members.

Definition at line 48 of file CalXtalRecAlg.cxx.

References m_recToolName, m_xtalkTool, m_xtalkToolName, and m_xtalRecTool.

00049 {
00050   StatusCode sc;
00051   MsgStream msglog(msgSvc(), name());
00052   msglog << MSG::INFO << "initialize" << endreq;
00053 
00054   //-- JOB OPTIONS --//
00055   sc = setProperties();
00056   if (sc.isFailure()) {
00057     msglog << MSG::ERROR << "Could not set jobOptions properties" << endreq;
00058     return sc;
00059   }
00060 
00061   //-- Xtal Recon Tool --//
00062   sc = toolSvc()->retrieveTool("XtalRecTool",
00063                                m_recToolName, 
00064                                m_xtalRecTool,
00065                                this);
00066   if (sc.isFailure() ) {
00067     msglog << MSG::ERROR << "  Unable to create " << m_recToolName << endreq;
00068     return sc;
00069   }
00070 
00071   //-- Neighbor Xtalk Tool --//
00072   if (!m_xtalkToolName.value().empty()) {
00073     sc = toolSvc()->retrieveTool("NeighborXtalkTool",
00074                                  m_xtalkToolName, 
00075                                  m_xtalkTool, 
00076                                  0); // shared by other code
00077     if (sc.isFailure() ) {
00078       msglog << MSG::ERROR << "  Unable to create " << m_xtalkToolName << endreq;
00079       return sc;
00080     }
00081   }
00082 
00083   return StatusCode::SUCCESS;
00084 }

StatusCode CalXtalRecAlg::retrieve  )  [private]
 

function for setting pointers to the input and output data in Gaudi TDS

TDS input: CalDigiCol TDS output: CalXtalrecCol

Definition at line 162 of file CalXtalRecAlg.cxx.

References m_calDigiCol, and m_calXtalRecCol.

Referenced by execute().

00163 {
00164   StatusCode sc;
00165 
00166   // get a pointer to the input TDS data collection
00167   m_calDigiCol = SmartDataPtr<CalDigiCol>(eventSvc(),
00168                                           EventModel::Digi::CalDigiCol);
00169   if (!m_calDigiCol) {
00170     if (msgSvc()->outputLevel(name()) <= MSG::VERBOSE) {
00171       // create msglog only when needed (for performance)
00172       MsgStream msglog(msgSvc(), name());
00173       msglog << MSG::VERBOSE << "No CalDigi data found"
00174              << endreq;
00175     }
00176   }
00177 
00178   m_calXtalRecCol = 0;
00179 
00180   DataObject* pnode=0;
00181 
00182   // search for CalRecon section of Event directory in TDS
00183   sc = eventSvc()->retrieveObject( EventModel::CalRecon::Event, pnode );
00184     
00185   // if the required directory doesn't exist - create it
00186   if( sc.isFailure() ) {
00187     sc = eventSvc()->registerObject( EventModel::CalRecon::Event, new DataObject);
00188     if( sc.isFailure() ) {
00189       // if cannot create the directory - write an error message
00190       // create msglog only when needed (for performance)
00191       MsgStream msglog(msgSvc(), name());
00192       msglog << MSG::ERROR << "Could not create CalRecon directory"
00193              << endreq;
00194       return sc;
00195     }
00196   }
00197     
00198   //  create output data collection
00199   m_calXtalRecCol = new CalXtalRecCol;
00200 
00201   //register output data collection as a TDS object
00202   sc = eventSvc()->registerObject(EventModel::CalRecon::CalXtalRecCol,
00203                                   m_calXtalRecCol);
00204   if (sc.isFailure()) {
00205     delete m_calXtalRecCol;
00206         return sc;
00207   }
00208   
00209   return StatusCode::SUCCESS;
00210 }


Member Data Documentation

Event::CalDigiCol* CalXtalRecAlg::m_calDigiCol [private]
 

pointer to input data collection in TDS

Definition at line 57 of file CalXtalRecAlg.h.

Referenced by execute(), and retrieve().

Event::CalXtalRecCol* CalXtalRecAlg::m_calXtalRecCol [private]
 

pointer to the output data collection in TDS

Definition at line 60 of file CalXtalRecAlg.h.

Referenced by execute(), and retrieve().

StringProperty CalXtalRecAlg::m_recToolName [private]
 

name of IXtalRecTool instantiation

Definition at line 66 of file CalXtalRecAlg.h.

Referenced by CalXtalRecAlg(), and initialize().

INeighborXtalkTool* CalXtalRecAlg::m_xtalkTool [private]
 

pointer to NeighborXtalk tool for calculating electronic crosstalk from neighboring crystals

Definition at line 69 of file CalXtalRecAlg.h.

Referenced by execute(), and initialize().

StringProperty CalXtalRecAlg::m_xtalkToolName [private]
 

name of INeigbhorXtalkTool instantiation

Definition at line 72 of file CalXtalRecAlg.h.

Referenced by CalXtalRecAlg(), and initialize().

IXtalRecTool* CalXtalRecAlg::m_xtalRecTool [private]
 

pointer to CalResponse tool for converting xtal digi info -> energy

Definition at line 63 of file CalXtalRecAlg.h.

Referenced by execute(), and initialize().


The documentation for this class was generated from the following files:
Generated on Mon Dec 1 13:29:52 2008 by doxygen 1.3.3