/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

PreElecAlgorithm.cc
Go to the documentation of this file.
00001 #include "PreElecSimSvc/PreElecAlgorithm.h"
00002 
00003 #include "Event/GenHeader.h"
00004 #include "Event/SimHeader.h"
00005 #include "Event/RegistrationSequence.h"
00006 
00007 #include "RootIOSvc/IRootIOSvc.h"
00008 #include "RootIOSvc/RootIOAddress.h"
00009 #include "PerGenEvent/PerGenHeader.h"
00010 #include "PerSimEvent/PerSimHeader.h"
00011 
00012 #include "GaudiKernel/IDataManagerSvc.h"
00013 
00014 using namespace std;
00015 using namespace DayaBay;
00016 
00017 PreElecAlgorithm::PreElecAlgorithm(const string& name, ISvcLocator* pSvcLocator) 
00018                  :DybAlgorithm<SimHeader>(name,pSvcLocator)
00019 {
00020   info()<< "Construct:PreElecAlgorithm()!"<< endreq;
00021 }
00022 
00023 StatusCode PreElecAlgorithm::initialize()
00024 {
00025   StatusCode status= this->GaudiAlgorithm::initialize();
00026   if(status.isFailure()) 
00027   { 
00028     error()<< "Error when initializing  GaudiAlgorithm"<< endreq;
00029     return status;
00030   }
00031    
00032   info()<< "PreElecAlgorithm ininalize()"<< endreq;
00033 
00034   //Initialize the PreElecSimSvc
00035   IService* isvc = 0;
00036   StatusCode sc = serviceLocator()->service("PreElecSimSvc", isvc, false);
00037   if(sc.isFailure()) 
00038   {
00039     error()<< "Service : PreElecSimSvc could not be retrieved"<< endreq;
00040     return sc;
00041   }
00042   isvc->addRef();
00043   sc = isvc->queryInterface(IPreElecSimSvc::interfaceID(), (void**)&m_preElecSimSvc);
00044   if(sc.isFailure()) 
00045   {
00046     error()<< "Service PreElecSvc does not implement IPreElecSimSvc"<< endreq;
00047   }
00048   return sc;
00049 }
00050 
00051 StatusCode PreElecAlgorithm::execute() 
00052 {
00053   info()<< "Now into PreElecAlgorithm executation!"<< endreq;
00054 
00055   SimHitHeader* shh = 0;
00056   vector<const SimHeader*> shs;
00057   shh = m_preElecSimSvc->getSimHitHeader(shs, m_hitEarliest, m_hitLatest);
00058 
00059   if(!shh)
00060   {
00061     error()<< "Error when get one SimHitHeader!"<< endreq;
00062     return StatusCode::FAILURE;
00063   }
00064   info()<< "SimHitHeader's address: "<< shh<< endreq;
00065 
00066   map<short int, SimHitCollection*> shc = shh->hitCollection();
00067   for(map<short int, SimHitCollection*>::iterator mit = shc.begin(); mit != shc.end(); mit++)
00068   {
00069     vector<SimHit*> vsh = mit->second->collection();
00070     info()<< MSG::INFO<< "In Det"<< mit->first
00071           << " : SimHit's num = "<< vsh.size()<< endreq;
00072   }
00073 
00074   //delete shh;
00075   for(vector<const SimHeader*>::size_type i = 0; i < shs.size(); i++)
00076   {
00077     delete shs[i];
00078   }
00079 
00080   info()<< "PreElecAlgorithm execute() finalized!" << endreq;
00081   return StatusCode::SUCCESS;
00082 }
00083 
00084 StatusCode PreElecAlgorithm::finalize() 
00085 {
00086   info()<< "PreElecAlgorithm finalize()"<< endreq;
00087   return StatusCode::SUCCESS;
00088 }
00089 
00090 PreElecAlgorithm::~PreElecAlgorithm()
00091 {
00092   info()<< "Destruct:~PreElecAlgorithm()!"<< endreq;
00093 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:15:00 for PreElecSimSvc by doxygen 1.7.4