86 MsgStream log(
msgSvc(), name());
87 log << MSG::INFO <<
"initialize()" << endreq;
92 static const bool CREATEIFNOTTHERE(
true);
93 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
94 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
96 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
102 status = service(
"G4Svc",tmpSvc);
103 if (status.isSuccess()) {
104 log << MSG::INFO <<
"got the G4Svc" << endreq;
105 m_G4Svc=
dynamic_cast<G4Svc *
>(tmpSvc);
107 log << MSG::ERROR <<
"could not get the G4Svc" << endreq;
108 return StatusCode::FAILURE;
112 StatusCode sc_det = service(
"DetVerSvc",
detVerSvc);
113 if( sc_det.isFailure() ) {
114 log << MSG::ERROR <<
"can't retrieve DetVerSvc instance" << endreq;
119 log << MSG::INFO <<
"** ~~~ZZZ~~~ ** : retrieved DetectorStage = " << phase << endreq;
122 if( phase>2 ) { m_tof = 4; }
125 if(m_G4Svc->MdcRootFlag())
128 if(m_G4Svc->TofRootFlag())
131 if(m_G4Svc->EmcRootFlag())
134 if(m_G4Svc->MucRootFlag())
137 log << MSG::INFO <<
"Four sub-detector construction flags: " <<m_mdc<<
" "<<m_tof<<
" "<<m_emc<<
" "<<m_muc<<endreq;
143 log << MSG::INFO <<
"Instantiating BESIII Detector" << endreq;
146 sensitiveManager->
SetLogLevel(m_G4Svc->LogLevel());
150 m_G4Svc->SetUserInitialization(detectorConstruction);
152 switch(m_physicsList)
155 m_G4Svc->SetUserInitialization(
new QBBC);
158 m_G4Svc->SetUserInitialization(
new QGS_BIC);
161 m_G4Svc->SetUserInitialization(
new QGSP_BERT);
164 m_G4Svc->SetUserInitialization(
new QGSP_BERT_HP);
167 m_G4Svc->SetUserInitialization(
new QGSP_BIC_AllHP);
170 m_G4Svc->SetUserInitialization(
new QGSP_BIC);
173 m_G4Svc->SetUserInitialization(
new FTF_BIC);
176 m_G4Svc->SetUserInitialization(
new FTFP_BERT_ATL);
179 m_G4Svc->SetUserInitialization(
new FTFP_BERT);
182 m_G4Svc->SetUserInitialization(
new FTFP_BERT_HP);
185 m_G4Svc->SetUserInitialization(
new FTFP_BERT_TRV);
188 m_G4Svc->SetUserInitialization(
new FTFQGSP_BERT);
191 m_G4Svc->SetUserInitialization(
new FTFP_BERT);
204 m_G4Svc->SetUserInitialization(actionInit);
235 return StatusCode::SUCCESS;
296 MsgStream log(
msgSvc(), name());
297 NTuplePtr nt1(
ntupleSvc(),
"FILE802/n1");
298 NTuple::Tuple* tupleTof1;
299 if(nt1) tupleTof1 = nt1;
301 tupleTof1 =
ntupleSvc()->book(
"FILE802/n1",CLID_ColumnWiseTuple,
"BesSim");
302 m_G4Svc->SetTupleTof1(tupleTof1);
304 NTuplePtr nt2(
ntupleSvc(),
"FILE802/n2");
305 NTuple::Tuple* tupleTof2;
306 if(nt2) tupleTof2 = nt2;
308 tupleTof2 =
ntupleSvc()->book(
"FILE802/n2",CLID_ColumnWiseTuple,
"BesSim");
309 m_G4Svc->SetTupleTof2(tupleTof2);
311 NTuplePtr nt3(
ntupleSvc(),
"FILE802/n3");
312 NTuple::Tuple* tupleTof3;
313 if(nt3) tupleTof3 = nt3;
315 tupleTof3 =
ntupleSvc()->book(
"FILE802/n3",CLID_ColumnWiseTuple,
"BesSim");
316 m_G4Svc->SetTupleTof3(tupleTof3);
327 return StatusCode::SUCCESS;