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