79 {
80
81 MsgStream log(
msgSvc(), name() );
82 log << MSG::INFO << "initialize()" << endmsg;
83 m_nEvent = 0;
84 m_nRun = 1;
85
86
87 static const bool CREATEIFNOTTHERE( true );
88 StatusCode RndmStatus = service( "BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE );
89 if ( !RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc )
90 {
91 log << MSG::ERROR << " Could not initialize Random Number Service" << endmsg;
92 return RndmStatus;
93 }
94
95 StatusCode status;
96 IG4Svc* tmpSvc;
97 status = service( "G4Svc", tmpSvc );
98 if ( status.isSuccess() )
99 {
100 log << MSG::INFO << "got the G4Svc" << endmsg;
101
102 m_G4Svc = tmpSvc;
103 }
104 else
105 {
106 log << MSG::ERROR << "could not get the G4Svc" << endmsg;
107 return StatusCode::FAILURE;
108 }
109
111 StatusCode sc_det = service(
"DetVerSvc",
detVerSvc );
112 if ( sc_det.isFailure() )
113 {
114 log << MSG::ERROR << "can't retrieve DetVerSvc instance" << endmsg;
115 return sc_det;
116 }
117
119 log << MSG::INFO << "** ~~~ZZZ~~~ ** : retrieved DetectorStage = " << phase << endmsg;
120
121
122
123 if ( phase > 2 ) { m_tof = 4; }
124
125
127
129
131
133
134 log << MSG::INFO << "Four sub-detector construction flags: " << m_mdc << " " << m_tof << " "
135 << m_emc << " " << m_muc << endmsg;
136
137 ReadBoostRoot* readBoost =
138 new ReadBoostRoot( m_mdc, m_tof, m_emc, m_muc, m_field, m_formatAR, m_tuning, m_hitOut );
139 BesMdcGeoParameter* mdcGeoService;
140 mdcGeoService = new BesMdcGeoParameter;
141
142 log << MSG::INFO << "Instantiating BESIII Detector" << endmsg;
143
144 BesSensitiveManager* sensitiveManager = new BesSensitiveManager;
145 sensitiveManager->
SetLogLevel( m_G4Svc->LogLevel() );
146
147 BesDetectorConstruction* detectorConstruction = new BesDetectorConstruction();
148 detectorConstruction->
SetPipeSCM( m_pipeSCM );
149 m_G4Svc->SetUserInitialization( detectorConstruction );
150
151 switch ( m_physicsList )
152 {
153 case 1: m_G4Svc->SetUserInitialization( new QBBC ); break;
154 case 2: m_G4Svc->SetUserInitialization( new QGS_BIC ); break;
155 case 3: m_G4Svc->SetUserInitialization( new QGSP_BERT ); break;
156 case 4: m_G4Svc->SetUserInitialization( new QGSP_BERT_HP ); break;
157 case 5: m_G4Svc->SetUserInitialization( new QGSP_BIC_AllHP ); break;
158 case 6: m_G4Svc->SetUserInitialization( new QGSP_BIC ); break;
159 case 7: m_G4Svc->SetUserInitialization( new FTF_BIC ); break;
160 case 8: m_G4Svc->SetUserInitialization( new FTFP_BERT_ATL ); break;
161 case 9: m_G4Svc->SetUserInitialization( new FTFP_BERT ); break;
162 case 10: m_G4Svc->SetUserInitialization( new FTFP_BERT_HP ); break;
163 case 11: m_G4Svc->SetUserInitialization( new FTFP_BERT_TRV ); break;
164 case 12: m_G4Svc->SetUserInitialization( new FTFQGSP_BERT ); break;
165 default: m_G4Svc->SetUserInitialization( new FTFP_BERT ); break;
166 }
167
168 BesActionInitializer* actionInit = new BesActionInitializer();
176
177 m_G4Svc->SetUserInitialization( actionInit );
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207 return StatusCode::SUCCESS;
208}
void SetAsciiFile(std::string file)
void SetAsciiFlag(std::string flag)
void SetBesGenActionFlag(G4bool flag)
void SetTDSFlag(G4bool flag)
void SetTuningFile(std::vector< std::string > file)
void SetRootFile(std::string file)
void SetRootFlag(G4bool flag)
void SetPipeSCM(G4int value)
void SetLogLevel(G4int level)
StatusCode bookEmcRootFile()
StatusCode bookMdcRootFile()
StatusCode bookMucRootFile()
StatusCode bookTofRootFile()