138 {
139
140 MsgStream log(messageService(), name());
141 system("cat $BESEVTGENROOT/share/phokhara_9.1.fferr>phokhara_9.1.fferr");
142 system("cat $BESEVTGENROOT/share/phokhara_9.1.ffwarn>phokhara_9.1.ffwarn");
143
144 if(m_truthFile!=""){truth.open(m_truthFile.c_str());}
145 log << MSG::INFO << "EvtDecay initialize" << endreq;
146 static const bool CREATEIFNOTTHERE(true);
147 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
148 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
149 {
150 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq;
151 return RndmStatus;
152 }
153
155 for(
int i=0;i<m_mystring.size();i++){
EvtGlobalSet::SV.push_back(m_mystring[i]);}
156
159 std::vector<std::vector<int> >myivv;
160 std::vector<std::vector<double> >mydvv;
161
163
164 myivv.push_back(m_cluster0);
165 myivv.push_back(m_cluster1);
166 myivv.push_back(m_cluster2);
167
168 mydvv.push_back(m_wind0);
169 mydvv.push_back(m_wind1);
170 mydvv.push_back(m_wind2);
171
172 for(int i=0;i<myivv.size();i++){
173 std::vector<int> theivv;
174 for(int j=0;j<myivv[i].size();j++){
175 theivv.push_back(myivv[i][j]);
176 }
178 }
179
180 for(int i=0;i<mydvv.size();i++){
181 std::vector<double> thedvv;
182 for(int j=0;j<mydvv[i].size();j++){
183 thedvv.push_back(mydvv[i][j]);
184 }
186 }
187
188
189 if(m_eBeamPolarization>1) {std::cout<<"The e-beam polaziation should be in 0 to 1"<<std::endl;abort();}
190 m_numberEvent=0;
191 first = true;
192 m_ampscalflag = true;
193
194 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"EVTGEN");
195 const long s = engine->getSeed();
197
198 m_seeds.clear();
199 m_seeds.push_back(
s);
200 totalChannels = 0;
201
202
203
204 if ( m_DecayDec == "") {
205 m_DecayDec=getenv("BESEVTGENROOT");
206 m_DecayDec +="/share/DECAY.DEC";
207 }
208
209 if ( m_PdtTable == "") {
210 m_PdtTable =getenv("BESEVTGENROOT");
211 m_PdtTable +="/share/pdt.table";
212 }
213
214 char catcmd[300];
215 std::cout<<"===================== user decay card ========================"<<std::endl;
216 strcpy(catcmd, "cat ");
217 strcat(catcmd, userDecFileName.c_str());
218 system(catcmd);
219
222
223
224 StatusCode status;
226 if (status.isSuccess()) {
227 log << MSG::INFO << "got the DataInfoSvc" << endreq;
230 } else {
231 log << MSG::ERROR << "could not get the DataInfoSvc" << endreq;
232 return StatusCode::FAILURE;
233 }
234
235
236
238 m_Gen =
new EvtGen( m_DecayDec.c_str(), m_PdtTable.c_str(), m_RandomEngine );
239
240 if(userDecFileName =="NONE") log << MSG::INFO << "EvtDecay User did not define his Decay table EvtGen will use standart" << endreq;
241 if(!(userDecFileName ==
"NONE")) m_Gen->
readUDecay(userDecFileName.c_str());
242
243 if(!(m_DecayTop==" ")) {
244 outfile.open(m_DecayTop.c_str());
245 }
246
247
248
249
250 if(m_NtupleFile) {
251 NTuplePtr nt1(
ntupleSvc(),
"MYROOTFILE/Trk");
252 if(nt1) {m_tuple=nt1;}
253 else {
254 m_tuple =
ntupleSvc()->book (
"MYROOTFILE/Trk", CLID_ColumnWiseTuple,
"Generator-trk-Ntuple");
255 if(m_tuple){
256 status = m_tuple->addItem ("TotNumTrk", TotNumTrk, 0,100);
257 status = m_tuple->addIndexedItem ("Trk_index", TotNumTrk, m_Trk_index);
258 status = m_tuple->addIndexedItem ("m_px_trk", TotNumTrk, m_px_trk);
259 status = m_tuple->addIndexedItem ("m_py_trk", TotNumTrk, m_py_trk);
260 status = m_tuple->addIndexedItem ("m_pz_trk", TotNumTrk, m_pz_trk);
261 status = m_tuple->addIndexedItem ("m_en_trk", TotNumTrk, m_en_trk);
262 status = m_tuple->addIndexedItem ("FST", TotNumTrk, m_fst);
263
264 status = m_tuple->addItem ("nchr", m_nchr);
265 status = m_tuple->addItem ("nchr_e", m_nchr_e);
266 status = m_tuple->addItem ("nchr_mu", m_nchr_mu);
267 status = m_tuple->addItem ("nchr_pi", m_nchr_pi);
268 status = m_tuple->addItem ("nchr_k", m_nchr_k);
269 status = m_tuple->addItem ("nchr_p", m_nchr_p);
270 status = m_tuple->addItem ("N_gamma", m_gamma);
271 status = m_tuple->addItem ("N_gammaFSR", m_gammaFSR);
272 status = m_tuple->addItem ("Flag1", m_flag1);
273 } else {
274 log << MSG::ERROR << " Cannot book N-tuple:"<< long(m_tuple) << endmsg;
275 return StatusCode::FAILURE;
276 }
277 }
278
279 NTuplePtr nt2(
ntupleSvc(),
"MYROOTFILE/mass");
280 if(nt2) {mass_tuple=nt2;}
281 else {
282 mass_tuple =
ntupleSvc()->book (
"MYROOTFILE/mass", CLID_ColumnWiseTuple,
"Generator-mass-Ntuple");
283 if(mass_tuple){
284 status = mass_tuple->addItem ("m12", m_m12);
285 status = mass_tuple->addItem ("m13", m_m13);
286 status = mass_tuple->addItem ("m23", m_m23);
287 status = mass_tuple->addItem ("m1", m_m1);
288 status = mass_tuple->addItem ("m2", m_m2);
289 status = mass_tuple->addItem ("m3", m_m3);
290 status = mass_tuple->addItem ("costheta1", m_cos1);
291 status = mass_tuple->addItem ("costheta2", m_cos2);
292 status = mass_tuple->addItem ("costheta3", m_cos3);
293 status = mass_tuple->addItem ("ichannel", m_ich);
294 } else {
295 log << MSG::ERROR << " Cannot book N-tuple:"<< long(m_tuple) << endmsg;
296 return StatusCode::FAILURE;
297 }
298 }
299
300 NTuplePtr nt3(
ntupleSvc(),
"MYROOTFILE/massGen");
301 if(nt3) {massgen_tuple=nt3;}
302 else {
303 massgen_tuple =
ntupleSvc()->book (
"MYROOTFILE/massGen", CLID_ColumnWiseTuple,
"Generator-mass-Ntuple");
304 if(massgen_tuple){
305 status = massgen_tuple->addItem ("m12", _m12);
306 status = massgen_tuple->addItem ("m13", _m13);
307 status = massgen_tuple->addItem ("m23", _m23);
308 status = massgen_tuple->addItem ("m1", _m1);
309 status = massgen_tuple->addItem ("m2", _m2);
310 status = massgen_tuple->addItem ("m3", _m3);
311 status = massgen_tuple->addItem ("costheta1", _cos1);
312 status = massgen_tuple->addItem ("costheta2", _cos2);
313 status = massgen_tuple->addItem ("costheta3", _cos3);
314 status = massgen_tuple->addItem ("ichannel", _ich);
315 } else {
316 log << MSG::ERROR << " Cannot book N-tuple:"<< long(m_tuple) << endmsg;
317 return StatusCode::FAILURE;
318 }
319 }
320
321
322 }
323 for(int i=0;i<500;i++){br[i]=0;}
324 if(!(m_SB3File=="" && m_SB3HT=="")) {
325 const char *filename, *histitle;
326 filename=(char*)m_SB3File.c_str();
327 histitle=(char*)m_SB3HT.c_str();
328 SuperBody3decay.
setFile(filename);
330 SuperBody3decay.
init();
331 }
332
333 return StatusCode::SUCCESS;
334}
void setDecayCard(string card)
IDataInfoSvc * tmpInfoSvc
DataInfoSvc * dataInfoSvc
void readUDecay(const char *const udecay_name)
static std::vector< std::string > SV
static std::vector< std::vector< double > > dVV
static std::vector< std::vector< int > > iVV
void setHTitle(const char *htitle)
void setFile(const char *dtfile)
virtual void setGenseed(long)=0
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.