/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 #include "ReconProcessorAlg.h" 00002 00003 #include "ProcessTools/IReconProcessor.h" 00004 #include "Event/RecHeader.h" 00005 00006 ReconProcessorAlg::ReconProcessorAlg(const std::string& name, 00007 ISvcLocator* pSvcLocator) 00008 : GaudiAlgorithm(name,pSvcLocator), 00009 m_tools() 00010 { 00011 declareProperty("Location", m_location="/Event/Rec/AdSimple", 00012 "Location of reconstructed data"); 00013 declareProperty("Tools", m_toolNames, 00014 "List of tool names to apply to the recon data"); 00015 } 00016 00017 ReconProcessorAlg::~ReconProcessorAlg() 00018 { 00019 } 00020 00021 StatusCode ReconProcessorAlg::initialize() 00022 { 00023 // Initialize the tools you want to use to process the readout 00024 std::vector<std::string>::iterator toolNameIter, 00025 toolNameEnd=m_toolNames.end(); 00026 for(toolNameIter=m_toolNames.begin(); toolNameIter!=toolNameEnd; 00027 toolNameIter++){ 00028 IReconProcessor* currentTool = 0; 00029 try { 00030 currentTool = tool<IReconProcessor>(*toolNameIter); 00031 } 00032 catch(const GaudiException& exg) { 00033 fatal() << "Failed to get tool: \"" << *toolNameIter << "\"" << endreq; 00034 return StatusCode::FAILURE; 00035 } 00036 m_tools.push_back(currentTool); 00037 info() << "Added tool " << *toolNameIter << endreq; 00038 } 00039 return StatusCode::SUCCESS; 00040 } 00041 00042 StatusCode ReconProcessorAlg::execute() 00043 { 00044 // Add the current event into histograms 00045 DayaBay::RecHeader* reconHeader = 00046 get<DayaBay::RecHeader>(m_location); 00047 if(!reconHeader){ 00048 error() << "Failed to get reconstructed data header." << endreq; 00049 return StatusCode::FAILURE; 00050 } 00051 00052 // Process reconstructed data using the list of tools 00053 StatusCode sc; 00054 std::vector<IReconProcessor*>::iterator toolIter, toolEnd=m_tools.end(); 00055 for(toolIter=m_tools.begin(); toolIter!=toolEnd; toolIter++){ 00056 IReconProcessor* currentTool = *toolIter; 00057 sc = currentTool->process( reconHeader ); 00058 if( !sc.isSuccess() ) return sc; 00059 } 00060 00061 return StatusCode::SUCCESS; 00062 } 00063 00064 StatusCode ReconProcessorAlg::finalize() 00065 { 00066 // Clean up tools 00067 std::vector<IReconProcessor*>::iterator toolIter, toolEnd=m_tools.end(); 00068 for(toolIter=m_tools.begin(); toolIter!=toolEnd; toolIter++){ 00069 IReconProcessor* currentTool = *toolIter; 00070 if(currentTool) currentTool->release(); 00071 } 00072 return StatusCode::SUCCESS; 00073 }