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