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