| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

ReadoutProcessorAlg.cc

Go to the documentation of this file.
00001 #include "ReadoutProcessorAlg.h"
00002 
00003 #include "ProcessTools/IReadoutProcessor.h"
00004 #include "Event/ReadoutHeader.h"
00005 
00006 ReadoutProcessorAlg::ReadoutProcessorAlg(const std::string& name, 
00007                                          ISvcLocator* pSvcLocator)
00008   : GaudiAlgorithm(name,pSvcLocator),
00009     m_tools()
00010 {
00011   declareProperty("Tools", m_toolNames,
00012                   "List of tool names to apply to the readout");
00013 }
00014 
00015 ReadoutProcessorAlg::~ReadoutProcessorAlg()
00016 {
00017 }
00018 
00019 StatusCode ReadoutProcessorAlg::initialize()
00020 {
00021   // Initialize the tools you want to use to process the readout
00022   std::vector<std::string>::iterator toolNameIter, 
00023     toolNameEnd=m_toolNames.end();
00024   for(toolNameIter=m_toolNames.begin(); toolNameIter!=toolNameEnd; 
00025       toolNameIter++){
00026     IReadoutProcessor* currentTool = 0;
00027     try {
00028       currentTool = tool<IReadoutProcessor>(*toolNameIter);
00029     }
00030     catch(const GaudiException& exg) {
00031       fatal() << "Failed to get tool: \"" << *toolNameIter << "\"" << endreq;
00032       return StatusCode::FAILURE;
00033     }
00034     m_tools.push_back(currentTool);
00035     info() << "Added tool " << *toolNameIter << endreq;
00036   }
00037   return StatusCode::SUCCESS;
00038 }
00039 
00040 StatusCode ReadoutProcessorAlg::execute()
00041 {
00042   // Add the current event into histograms
00043   DayaBay::ReadoutHeader* readoutHeader = 
00044     get<DayaBay::ReadoutHeader>("/Event/Readout/ReadoutHeader");
00045   if(!readoutHeader){
00046     error() << "Failed to get readout header." << endreq;
00047     return StatusCode::FAILURE;
00048   }
00049 
00050   // Process readouts using the list of tools 
00051   StatusCode sc;
00052   std::vector<IReadoutProcessor*>::iterator toolIter, toolEnd=m_tools.end();
00053   for(toolIter=m_tools.begin(); toolIter!=toolEnd; toolIter++){
00054     IReadoutProcessor* readoutTool = *toolIter;
00055     sc = readoutTool->process( readoutHeader );
00056     if( !sc.isSuccess() ) return sc;
00057   }
00058 
00059   return StatusCode::SUCCESS;
00060 }
00061 
00062 StatusCode ReadoutProcessorAlg::finalize()
00063 {
00064   // Clean up tools
00065   std::vector<IReadoutProcessor*>::iterator toolIter, toolEnd=m_tools.end();
00066   for(toolIter=m_tools.begin(); toolIter!=toolEnd; toolIter++){
00067     IReadoutProcessor* readoutTool = *toolIter;
00068     if(readoutTool) readoutTool->release();
00069   }
00070   return StatusCode::SUCCESS;
00071 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:25:37 2011 for ProcessTools by doxygen 1.4.7