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