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

In This Package:

CalibProcessorAlg.cc

Go to the documentation of this file.
00001 #include "CalibProcessorAlg.h"
00002 
00003 #include "ProcessTools/ICalibProcessor.h"
00004 #include "Event/CalibReadoutHeader.h"
00005 
00006 CalibProcessorAlg::CalibProcessorAlg(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 calibrated data");
00013 }
00014 
00015 CalibProcessorAlg::~CalibProcessorAlg()
00016 {
00017 }
00018 
00019 StatusCode CalibProcessorAlg::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     ICalibProcessor* currentTool = 0;
00027     try {
00028       currentTool = tool<ICalibProcessor>(*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 CalibProcessorAlg::execute()
00041 {
00042   // Process the current calibrated data
00043   DayaBay::CalibReadoutHeader* calibHeader = 
00044     get<DayaBay::CalibReadoutHeader>("/Event/CalibReadout/CalibReadoutHeader");
00045   if(!calibHeader){
00046     error() << "Failed to get calibrated data header." << endreq;
00047     return StatusCode::FAILURE;
00048   }
00049 
00050   // Process calibrated data using the list of tools 
00051   StatusCode sc;
00052   std::vector<ICalibProcessor*>::iterator toolIter, toolEnd=m_tools.end();
00053   for(toolIter=m_tools.begin(); toolIter!=toolEnd; toolIter++){
00054     ICalibProcessor* calibTool = *toolIter;
00055     sc = calibTool->process( calibHeader );
00056     if( !sc.isSuccess() ) return sc;
00057   }
00058 
00059   return StatusCode::SUCCESS;
00060 }
00061 
00062 StatusCode CalibProcessorAlg::finalize()
00063 {
00064   // Clean up tools
00065   std::vector<ICalibProcessor*>::iterator toolIter, toolEnd=m_tools.end();
00066   for(toolIter=m_tools.begin(); toolIter!=toolEnd; toolIter++){
00067     ICalibProcessor* 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