#include <Sim15.h>
Inheritance diagram for Sim15:
Public Member Functions | |
Sim15 (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~Sim15 () |
virtual StatusCode | initialize () |
virtual StatusCode | execute () |
virtual StatusCode | finalize () |
virtual StatusCode | sysExecute () |
void | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
void | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
TYPE * | getDet (const std::string &location) const |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
bool | exist (const std::string &location, const bool useRootInTES=true) const |
bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
bool | existDet (const std::string &location) const |
TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
bool | registerContext () const |
INTupleSvc * | evtColSvc () const |
IAlgContextSvc * | contextSvc () const |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
SERVICE * | svc (const std::string &name, const bool create=true) const |
IUpdateManagerSvc * | updMgrSvc () const |
IDataProviderSvc * | fastContainersSvc () const |
StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
MsgStream & | msgStream (const MSG::Level level) const |
MsgStream & | always () const |
MsgStream & | fatal () const |
MsgStream & | err () const |
MsgStream & | error () const |
MsgStream & | warning () const |
MsgStream & | info () const |
MsgStream & | debug () const |
MsgStream & | verbose () const |
MsgStream & | msg () const |
const Statistics & | counters () const |
StatEntity & | counter (const std::string &tag) const |
MSG::Level | msgLevel () const |
bool | msgLevel (const MSG::Level level) const |
void | resetMsgStream () const |
bool | typePrint () const |
bool | propsPrint () const |
bool | statPrint () const |
bool | errorsPrint () const |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
StatusCode | runUpdate () |
TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
StatusCode | release (const IInterface *interface) const |
unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual StatusCode | sysStart () |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysBeginRun () |
virtual StatusCode | sysEndRun () |
virtual const std::string & | name () const |
virtual const std::string & | version () const |
virtual StatusCode | configure () |
virtual StatusCode | terminate () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual bool | isExecuted () const |
virtual void | setExecuted (bool state) |
virtual void | resetExecuted () |
virtual StatusCode | beginRun () |
virtual StatusCode | endRun () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual bool | isEnabled () const |
virtual bool | filterPassed () const |
virtual void | setFilterPassed (bool state) |
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const |
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const |
void | setOutputLevel (int level) |
IAuditorSvc * | auditorSvc () const |
IChronoStatSvc * | chronoSvc () const |
IChronoStatSvc * | chronoStatService () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | detDataService () const |
IConversionSvc * | detCnvSvc () const |
IConversionSvc * | detDataCnvService () const |
IDataProviderSvc * | eventSvc () const |
IDataProviderSvc * | evtSvc () const |
IDataProviderSvc * | eventDataService () const |
IConversionSvc * | eventCnvSvc () const |
IConversionSvc * | eventDataCnvService () const |
IHistogramSvc * | histoSvc () const |
IHistogramSvc * | histogramDataService () const |
IMessageSvc * | msgSvc () const |
IMessageSvc * | messageService () const |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | ntupleService () const |
IRndmGenSvc * | randSvc () const |
IToolSvc * | toolSvc () const |
IExceptionSvc * | exceptionSvc () const |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg) |
std::vector< Algorithm * > * | subAlgorithms () const |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
StatusCode | setProperties () |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IMonitorSvc * | monitorSvc () const |
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
unsigned long | addRef () |
StatusCode | queryInterface (const InterfaceID &riid, void **) |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Types | |
typedef std::map< std::string, StatEntity > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
typedef std::vector< IAlgTool * > | AlgTools |
typedef std::pair< IInterface *, std::string > | ServiceEntry |
typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
StatusCode | releaseTool (const IAlgTool *tool) const |
StatusCode | releaseSvc (const IInterface *svc) const |
bool | isInitialized () const |
bool | isFinalized () const |
int | outputLevel () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
Private Attributes | |
std::string | m_TopStageName |
Fifteen begin. | |
int | m_TopStageNum |
IStage * | m_TopStage |
TimeStamp | m_StartTime |
Fifteen end. | |
TimeStamp | m_CurrTime |
double | m_TimeRange |
IEventProcessor * | m_EvtLoopMgr |
bool | m_monitor |
create a root tree | |
ValidationTree * | m_valiTree |
int | m_counter |
IStageDataManager * | m_sdmgr |
Definition at line 26 of file Sim15.h.
Sim15::Sim15 | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 65 of file Sim15.cc.
00065 : 00066 GaudiAlgorithm(name, pSvcLocator) 00067 , m_TopStage(0) 00068 , m_sdmgr(0) 00069 { 00071 declareProperty("TopStage", m_TopStageName,"Name of top stage"); 00073 00074 declareProperty("TimeRange", m_TimeRange = 365*24*60*60*CLHEP::second, "Time range to simulate, default 1 year."); 00075 00076 declareProperty("Monitor", m_monitor=false,"Generate a monitor.root"); 00077 }
StatusCode Sim15::initialize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 83 of file Sim15.cc.
00084 { 00085 StatusCode sc = this->GaudiAlgorithm::initialize(); 00086 if (sc.isFailure()) return sc; 00087 00089 sc= toolSvc()->retrieveTool("Stage",m_TopStageName,m_TopStage); 00090 if( sc.isFailure() ) { 00091 error() << "Error retrieving the tool"<< m_TopStageName << endreq; 00092 } 00093 debug() << "Got top Stage \"" << m_TopStageName << "\" at " << (void*) m_TopStage << endreq; 00094 // should probably make this configurable one day 00095 sc = service("StageDataManager",m_sdmgr); 00096 if (sc.isFailure()) return sc; 00097 debug() << "Got StageDataManager at " << (void*) m_sdmgr << endreq; 00099 00100 // init root tree 00101 if(m_monitor) { 00102 m_valiTree=new ValidationTree; 00103 m_valiTree->create(); 00104 } 00105 00107 if(m_TopStageName=="SingleLoader") { 00108 // ReadoutHeader 00109 m_TopStageNum = 5; 00110 } else if(m_TopStageName=="TrigRead") { 00111 // SimReadoutHeader 00112 m_TopStageNum = 4; 00113 } else if(m_TopStageName=="Electronic") { 00114 // ElecHeader 00115 m_TopStageNum = 3; 00116 } else if (m_TopStageName=="Detector") { 00117 // SimHeader 00118 m_TopStageNum = 2; 00119 } else if (m_TopStageName=="Kinematic") { 00120 // GenHeader 00121 m_TopStageNum = 1; 00122 } 00123 00124 m_counter = 0; 00125 00126 sc = service("EventLoopMgr",m_EvtLoopMgr,false); 00127 if( sc.isFailure() ) { 00128 error() << "Failed to retrive EventLoopMgr service"<< endreq; 00129 } 00130 info()<<"Got EventLoopMgr service"<<endreq; 00131 00133 info()<<m_TimeRange/CLHEP::second<<" seconds detector simulation is required."<<endreq; 00134 00135 return StatusCode::SUCCESS; 00136 }
StatusCode Sim15::execute | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 138 of file Sim15.cc.
00139 { 00141 IStageData* pIStageData = 0; 00142 StatusCode sc = m_TopStage->nextElement(pIStageData); // get a new data 00143 if (sc.isFailure()) return sc; 00144 debug() << "consuming stage data at " << pIStageData->time() << endreq; 00145 StatusCode sc2 = m_sdmgr->consumeData(*pIStageData); 00146 if (sc2.isFailure()) return sc2; 00148 00149 00150 m_counter++; 00151 if( m_counter==1 ) m_StartTime = pIStageData->time(); 00152 m_CurrTime = pIStageData->time(); 00153 00154 info()<<"New element #"<<m_counter<<" at time "<<pIStageData->time()<<endreq; 00155 00156 // if no monitor.root is required, good to go now. 00157 if(m_monitor) { 00159 typedef HeaderStageData<DayaBay::GenHeader> GenData; 00160 typedef HeaderStageData<DayaBay::SimHeader> SimData; 00161 typedef HeaderStageData<DayaBay::ElecHeader> ElecData; 00162 typedef HeaderStageData<DayaBay::SimReadoutHeader> SimReadoutData; 00163 typedef HeaderStageData<DayaBay::ReadoutHeader> ReadoutData; 00164 00165 GenData *pGenData=0; 00166 SimData *pSimData=0; 00167 ElecData *pElecData=0; 00168 SimReadoutData *pSimReadoutData=0; 00169 ReadoutData *pReadoutData=0; 00170 00171 const DayaBay::GenHeader *pGenHeader=0; 00172 const DayaBay::SimHeader *pSimHeader=0; 00173 const DayaBay::ElecHeader *pElecHeader=0; 00174 const DayaBay::SimTrigHeader *pSimTrigHeader=0; 00175 const DayaBay::SimReadoutHeader *pSimReadoutHeader=0; 00176 const DayaBay::ReadoutHeader *pReadoutHeader=0; 00177 00178 const DayaBay::IHeader* firstHeader=0; 00179 const DayaBay::HeaderObject* pHeader=0; 00180 00181 // get the header object pointer of the top stage 00182 if(m_TopStageNum==5) { 00183 // ReadoutHeader 00184 pReadoutData=dynamic_cast<ReadoutData*>(pIStageData); 00185 pReadoutHeader=&(pReadoutData->header()); 00186 pHeader=pReadoutHeader; 00187 } else if(m_TopStageNum==4) { 00188 // SimReadoutHeader 00189 pSimReadoutData=dynamic_cast<SimReadoutData*>(pIStageData); 00190 pSimReadoutHeader=&(pSimReadoutData->header()); 00191 pHeader=pSimReadoutHeader; 00192 } else if(m_TopStageNum==3) { 00193 // ElecHeader 00194 pElecData=dynamic_cast<ElecData*>(pIStageData); 00195 pElecHeader=&(pElecData->header()); 00196 pHeader=pElecHeader; 00197 } else if (m_TopStageNum==2) { 00198 // SimHeader 00199 pSimData=dynamic_cast<SimData*>(pIStageData); 00200 pSimHeader=&(pSimData->header()); 00201 pHeader=pSimHeader; 00202 } else if (m_TopStageNum==1) { 00203 // GenHeader 00204 pGenData=dynamic_cast<GenData*>(pIStageData); 00205 pGenHeader=&(pGenData->header()); 00206 pHeader=pGenHeader; 00207 } 00208 00209 // monitor, do the rest 00210 double m_e=5.109989e-1; // MeV 00211 double m_alpha=3727.379; // MeV 00212 00214 m_valiTree->reset(); 00215 00216 // get the header object pointer of it lower stages 00217 // only the first one, for low event rate, it is enough 00218 if(pReadoutHeader!=0) { 00219 // SimReadoutHeader 00220 if(pReadoutHeader->inputHeaders().size() != 0) { 00221 firstHeader=*((pReadoutHeader->inputHeaders()).begin()); 00222 pSimReadoutHeader= dynamic_cast<const DayaBay::SimReadoutHeader*>(firstHeader); 00223 } 00224 } 00225 if(pSimReadoutHeader!=0) { 00226 debug() << "Number of input SimTrigHeaders:" << 00227 pSimReadoutHeader->inputHeaders().size() << endreq; 00228 // SimTrigHeader 00229 if(pSimReadoutHeader->inputHeaders().size() != 0) { 00230 firstHeader=*((pSimReadoutHeader->inputHeaders()).begin()); 00231 pSimTrigHeader= dynamic_cast<const DayaBay::SimTrigHeader*>(firstHeader); 00232 } 00233 } 00234 if(pSimTrigHeader!=0) { 00235 // ElecHeader 00236 if(pSimTrigHeader->inputHeaders().size() != 0) { 00237 firstHeader=*((pSimTrigHeader->inputHeaders()).begin()); 00238 pElecHeader= dynamic_cast<const DayaBay::ElecHeader*>(firstHeader); 00239 } 00240 } 00241 if(pElecHeader!=0) { 00242 // SimHeader 00243 if(pElecHeader->inputHeaders().size() != 0) { 00244 firstHeader=*((pElecHeader->inputHeaders()).begin()); 00245 pSimHeader= dynamic_cast<const DayaBay::SimHeader*>(firstHeader); 00246 } 00247 } 00248 if(pSimHeader!=0) { 00249 // GenHeader 00250 if(pSimHeader->inputHeaders().size() != 0) { 00251 firstHeader=*((pSimHeader->inputHeaders()).begin()); 00252 pGenHeader= dynamic_cast<const DayaBay::GenHeader*>(firstHeader); 00253 } 00254 } 00255 00256 00257 // event information 00258 m_valiTree->time=pIStageData->time().GetSeconds(); 00259 00260 // check ReadoutHeader information 00261 if(pReadoutHeader!=0) { 00262 m_valiTree->execSing=pReadoutHeader->execNumber(); 00263 00264 // adc tdc 00265 const DayaBay::Readout* pReadout = pReadoutHeader->readout(); 00266 DayaBay::Detector det = pReadout->detector(); 00267 00268 if(det.detectorId() == DetectorId::kAD1 || // AD information 00269 det.detectorId() == DetectorId::kAD2 || 00270 det.detectorId() == DetectorId::kAD3 || 00271 det.detectorId() == DetectorId::kAD4) { 00272 00273 // convert it to PMT Crate Readout 00274 const DayaBay::ReadoutPmtCrate* pmtcrate = 0; 00275 pmtcrate = dynamic_cast<const DayaBay::ReadoutPmtCrate*>(pReadout); 00276 00277 // channnel map 00278 const DayaBay::ReadoutPmtCrate::PmtChannelReadouts& channelMap 00279 = pmtcrate->channelReadout(); 00280 00281 DayaBay::ReadoutPmtCrate::PmtChannelReadouts::const_iterator cmci; 00282 00283 for(cmci=channelMap.begin();cmci!=channelMap.end();++cmci) { 00284 //const DayaBay::FeeChannelId& channelId = cmci->first; 00285 const DayaBay::ReadoutPmtChannel& aChannel = cmci->second; 00286 00287 //modificaton for new readout data model. Please fix me if not right. 00288 m_valiTree->adc_sum=aChannel.sumAdc(); 00289 //const vector<int>& tdc=aChannel.tdc(); 00290 //const std::map<int,int>& adc=aChannel.adc(); 00291 //int tdc_peak,adc_peak; 00292 00293 //for(unsigned long ii=0;ii<tdc.size();++ii) { 00294 // tdc[ii]; 00295 // tdc_peak=tdc[ii]; 00296 // adc_peak=adc.find(tdc_peak)->second; 00297 // m_valiTree->adc_sum+=adc_peak; 00298 //} 00299 //verbose()<<channelId<<" tdc "<<tdc_peak<<" adc "<<adc_peak<<endreq; 00300 } 00301 } // end of AD crate 00302 } // end of pReadoutHeader 00303 00304 // check SimReadoutHeader information 00305 if(pSimReadoutHeader!=0) { 00306 m_valiTree->execTrig=pSimReadoutHeader->execNumber(); 00307 00308 const DayaBay::SimReadoutHeader::SimReadoutContainer 00309 simReadout=pSimReadoutHeader->readouts(); 00310 debug()<<"No. of SimReadout: "<<simReadout.size()<<endreq; 00311 debug()<<pSimReadoutHeader->execNumber()<<endreq; 00312 } // end of pSimReadoutHeader 00313 00314 // check electrontic simulation information if available 00315 if(pElecHeader!=0) { 00316 m_valiTree->execElec=pElecHeader->execNumber(); 00317 } // end of pElecHeader 00318 00319 // check trigger header information if available 00320 if(pSimTrigHeader!=0) { 00321 debug()<<pSimTrigHeader->commandHeader()->collections().size(); 00322 } 00323 00324 // check detector simulation information if available 00325 if(pSimHeader!=0) { 00326 m_valiTree->execDets=pSimHeader->execNumber(); 00329 const DayaBay::SimHitHeader* simhitheader = pSimHeader->hits(); 00330 if(simhitheader) { 00332 const DayaBay::SimHitHeader::hc_map& hcmap = simhitheader->hitCollection(); 00333 DayaBay::SimHitHeader::hc_map::const_iterator it; 00334 00336 m_valiTree->SimHitsEntries=0; 00337 int index(0); 00338 00339 debug()<<"size of hit collection "<< hcmap.size()<<endreq; 00340 for (it=hcmap.begin(); it != hcmap.end(); ++it) { 00341 00342 DayaBay::Detector det(it->first); 00343 debug() << "Got hit collection from " << det.detName()<<" id= " 00344 << det.siteDetPackedData()<<endreq; 00345 00347 const std::vector<DayaBay::SimHit*>& hitvec=it->second->collection(); 00348 std::vector<DayaBay::SimHit*>::const_iterator it_hvec; 00349 00350 debug() <<"size of hit vector "<< hitvec.size()<<endreq; 00351 for (it_hvec=hitvec.begin(); it_hvec!=hitvec.end(); ++it_hvec) { 00352 00353 index=m_valiTree->SimHitsEntries; 00354 if(index<MaxSimHitEntries){ 00355 00356 m_valiTree->hitTime[index] = (*it_hvec)->hitTime(); 00357 m_valiTree->hitx[index] = (*it_hvec)->localPos().x(); 00358 m_valiTree->hity[index] = (*it_hvec)->localPos().y(); 00359 m_valiTree->hitz[index] = (*it_hvec)->localPos().z(); 00360 m_valiTree->sensID[index] = (*it_hvec)->sensDetId(); 00361 m_valiTree->weight[index] = (*it_hvec)->weight(); 00362 00363 // optical photon's ancestor's pdg 00364 if((*it_hvec)->ancestor().track()) { 00365 m_valiTree->ancestorPdg[index] = (*it_hvec)->ancestor().track()->particle(); 00366 } 00367 else { 00368 m_valiTree->ancestorPdg[index] = 0; 00369 } 00370 //optical photon's wavelength 00371 const DayaBay::SimPmtHit* pmthit = static_cast<const DayaBay::SimPmtHit*>(*it_hvec); 00372 m_valiTree->wavelength[index] = (*pmthit).wavelength(); 00373 m_valiTree->polx[index] = (*pmthit).pol().x(); 00374 m_valiTree->poly[index] = (*pmthit).pol().y(); 00375 m_valiTree->polz[index] = (*pmthit).pol().z(); 00376 m_valiTree->px[index] = (*pmthit).dir().x(); 00377 m_valiTree->py[index] = (*pmthit).dir().y(); 00378 m_valiTree->pz[index] = (*pmthit).dir().z(); 00379 00380 m_valiTree->SimHitsEntries = index+1; 00381 00382 } 00383 else { 00384 warning()<< " Reached the max hit limit!!!!!" <<endl; 00385 } 00386 } 00387 } 00388 } 00389 } // end of pSimHeader 00390 00392 // if(0==1) { 00393 if(pGenHeader!=0) { 00394 m_valiTree->execKine=pGenHeader->execNumber(); 00395 debug()<<"Generator name: "<<pGenHeader->generatorName()<<endreq; 00396 debug()<<"execNum: "<<pGenHeader->execNumber()<<endreq; 00397 00398 const HepMC::GenEvent* event=pGenHeader->event(); 00399 // event->print(); 00400 00401 HepMC::GenEvent::particle_const_iterator p; 00402 int count=0; 00403 for ( p = event->particles_begin(); p!=event->particles_end(); ++p ) { 00404 (*p)->print(); 00405 if((*p)->production_vertex()) { // only outgoing particle has a production vertex 00406 if( (*p)->status() == 1 || // Normal track 00407 abs((*p)->status()) > 1000 ) { // MuonProphet muon 00408 count++; 00409 00410 if(count==1) { 00411 00412 m_valiTree->trk1_pdgId=(*p)->pdg_id(); 00413 00414 m_valiTree->trk1_px=(*p)->momentum().px(); 00415 m_valiTree->trk1_py=(*p)->momentum().py(); 00416 m_valiTree->trk1_pz=(*p)->momentum().pz(); 00417 m_valiTree->trk1_e =(*p)->momentum().e(); 00418 00419 m_valiTree->trk1_x=(*p)->production_vertex()->position().x(); 00420 m_valiTree->trk1_y=(*p)->production_vertex()->position().y(); 00421 m_valiTree->trk1_z=(*p)->production_vertex()->position().z(); 00422 m_valiTree->trk1_t=(*p)->production_vertex()->position().t(); 00423 00424 debug()<<"trk1_pdgId: "<<m_valiTree->trk1_pdgId<<endreq; 00425 00426 if(m_valiTree->trk1_pdgId==22) { // gamma 00427 m_valiTree->trk1_ke=m_valiTree->trk1_e; 00428 m_valiTree->trk1_ve=m_valiTree->trk1_e; 00429 }else if (m_valiTree->trk1_pdgId==11) { // e- 00430 m_valiTree->trk1_ke=m_valiTree->trk1_e-m_e; 00431 m_valiTree->trk1_ve=m_valiTree->trk1_e-m_e; 00432 }else if (m_valiTree->trk1_pdgId==-11) { // e+ 00433 m_valiTree->trk1_ke=m_valiTree->trk1_e-m_e; 00434 m_valiTree->trk1_ve=m_valiTree->trk1_e+m_e; 00435 }else if (m_valiTree->trk1_pdgId==1000020040) { // alpha 00436 m_valiTree->trk1_ke=m_valiTree->trk1_e-m_alpha; 00437 m_valiTree->trk1_ve=m_valiTree->trk1_e-m_alpha; 00438 } 00439 } // outgoing particle 1 00440 if(count==2) { 00441 m_valiTree->trk2_pdgId=(*p)->pdg_id(); 00442 00443 m_valiTree->trk2_px=(*p)->momentum().px(); 00444 m_valiTree->trk2_py=(*p)->momentum().py(); 00445 m_valiTree->trk2_pz=(*p)->momentum().pz(); 00446 m_valiTree->trk2_e =(*p)->momentum().e(); 00447 00448 m_valiTree->trk2_x=(*p)->production_vertex()->position().x(); 00449 m_valiTree->trk2_y=(*p)->production_vertex()->position().y(); 00450 m_valiTree->trk2_z=(*p)->production_vertex()->position().z(); 00451 m_valiTree->trk2_t=(*p)->production_vertex()->position().t(); 00452 if(m_valiTree->trk2_pdgId==22) { // gamma 00453 m_valiTree->trk2_ke=m_valiTree->trk2_e; 00454 m_valiTree->trk2_ve=m_valiTree->trk2_e; 00455 }else if (m_valiTree->trk2_pdgId==11) { // e- 00456 m_valiTree->trk2_ke=m_valiTree->trk2_e-m_e; 00457 m_valiTree->trk2_ve=m_valiTree->trk2_e-m_e; 00458 }else if (m_valiTree->trk2_pdgId==-11) { // e+ 00459 m_valiTree->trk2_ke=m_valiTree->trk2_e-m_e; 00460 m_valiTree->trk2_ve=m_valiTree->trk2_e+m_e; 00461 }else if (m_valiTree->trk2_pdgId==1000020040) { // alpha 00462 m_valiTree->trk2_ke=m_valiTree->trk2_e-m_alpha; 00463 m_valiTree->trk2_ve=m_valiTree->trk2_e-m_alpha; 00464 } 00465 } // outgoing particle 2 00466 } 00467 } // end of outgoing particles 00468 } 00469 } // end of pGenHeader 00470 00472 m_valiTree->n = m_counter; 00473 m_valiTree->fill(); 00474 } 00475 00476 delete pIStageData; 00477 pIStageData=0; 00478 00479 if( (m_CurrTime-m_StartTime).GetSeconds()> (m_TimeRange/CLHEP::second) ) { 00480 info()<<m_TimeRange<<" seconds detector simulation finished. Issue scheduled stop."<<endreq; 00481 m_EvtLoopMgr->stopRun(); 00482 } 00483 00484 return StatusCode::SUCCESS; 00485 }
StatusCode Sim15::finalize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 487 of file Sim15.cc.
00488 { 00489 if(m_monitor) { 00490 m_valiTree->close(); 00491 delete m_valiTree; 00492 } 00493 00494 return this->GaudiAlgorithm::finalize(); 00495 }
std::string Sim15::m_TopStageName [private] |
int Sim15::m_TopStageNum [private] |
IStage* Sim15::m_TopStage [private] |
TimeStamp Sim15::m_StartTime [private] |
TimeStamp Sim15::m_CurrTime [private] |
double Sim15::m_TimeRange [private] |
IEventProcessor* Sim15::m_EvtLoopMgr [private] |
bool Sim15::m_monitor [private] |
ValidationTree* Sim15::m_valiTree [private] |
int Sim15::m_counter [private] |
IStageDataManager* Sim15::m_sdmgr [private] |