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