107 {
108
109 MsgStream log(messageService(), name());
110 if(m_truthFile!=""){truth.open(m_truthFile.c_str());}
111 log << MSG::INFO << "EvtDecay initialize" << endreq;
112 static const bool CREATEIFNOTTHERE(true);
113 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
114 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
115 {
116 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq;
117 return RndmStatus;
118 }
119
120 m_numberEvent=0;
121 first = true;
122 m_ampscalflag = true;
123
124 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"EVTGEN");
125 const long s = engine->getSeed();
127
128 m_seeds.clear();
129 m_seeds.push_back(
s);
130 totalChannels = 0;
131
132
133
134 if ( m_DecayDec == "") {
135 m_DecayDec=getenv("BESEVTGENROOT");
136 m_DecayDec +="/share/DECAY.DEC";
137 }
138
139 if ( m_PdtTable == "") {
140 m_PdtTable =getenv("BESEVTGENROOT");
141 m_PdtTable +="/share/pdt.table";
142 }
143
144 char catcmd[300];
145 std::cout<<"===================== user decay card ========================"<<std::endl;
146 strcpy(catcmd, "cat ");
147 strcat(catcmd, userDecFileName.c_str());
148 system(catcmd);
149
152
153
154 StatusCode status;
156 if (status.isSuccess()) {
157 log << MSG::INFO << "got the DataInfoSvc" << endreq;
160 } else {
161 log << MSG::ERROR << "could not get the DataInfoSvc" << endreq;
162 return StatusCode::FAILURE;
163 }
164
165
166
168 m_Gen =
new EvtGen( m_DecayDec.c_str(), m_PdtTable.c_str(), m_RandomEngine );
169
170 if(userDecFileName =="NONE") log << MSG::INFO << "EvtDecay User did not define his Decay table EvtGen will use standart" << endreq;
171 if(!(userDecFileName ==
"NONE")) m_Gen->
readUDecay(userDecFileName.c_str());
172
173 if(!(m_DecayTop==" ")) {
174 outfile.open(m_DecayTop.c_str());
175 }
176
177
178
179
180 if(m_NtupleFile) {
181 NTuplePtr nt1(
ntupleSvc(),
"MYROOTFILE/Trk");
182 if(nt1) {m_tuple=nt1;}
183 else {
184 m_tuple =
ntupleSvc()->book (
"MYROOTFILE/Trk", CLID_ColumnWiseTuple,
"Generator-trk-Ntuple");
185 if(m_tuple){
186 status = m_tuple->addItem ("TotNumTrk", TotNumTrk, 0,1000);
187 status = m_tuple->addIndexedItem ("Trk_index", TotNumTrk, m_Trk_index);
188 status = m_tuple->addIndexedItem ("m_px_trk", TotNumTrk, m_px_trk);
189 status = m_tuple->addIndexedItem ("m_py_trk", TotNumTrk, m_py_trk);
190 status = m_tuple->addIndexedItem ("m_pz_trk", TotNumTrk, m_pz_trk);
191 status = m_tuple->addIndexedItem ("m_en_trk", TotNumTrk, m_en_trk);
192 status = m_tuple->addIndexedItem ("FST", TotNumTrk, m_fst);
193
194 status = m_tuple->addItem ("nchr", m_nchr);
195 status = m_tuple->addItem ("nchr_e", m_nchr_e);
196 status = m_tuple->addItem ("nchr_mu", m_nchr_mu);
197 status = m_tuple->addItem ("nchr_pi", m_nchr_pi);
198 status = m_tuple->addItem ("nchr_k", m_nchr_k);
199 status = m_tuple->addItem ("nchr_p", m_nchr_p);
200 status = m_tuple->addItem ("N_gamma", m_gamma);
201 status = m_tuple->addItem ("N_gammaFSR", m_gammaFSR);
202 } else {
203 log << MSG::ERROR << " Cannot book N-tuple:"<< long(m_tuple) << endmsg;
204 return StatusCode::FAILURE;
205 }
206 }
207
208 NTuplePtr nt2(
ntupleSvc(),
"MYROOTFILE/mass");
209 if(nt2) {mass_tuple=nt2;}
210 else {
211 mass_tuple =
ntupleSvc()->book (
"MYROOTFILE/mass", CLID_ColumnWiseTuple,
"Generator-mass-Ntuple");
212 if(mass_tuple){
213 status = mass_tuple->addItem ("m12", m_m12);
214 status = mass_tuple->addItem ("m13", m_m13);
215 status = mass_tuple->addItem ("m23", m_m23);
216 status = mass_tuple->addItem ("m1", m_m1);
217 status = mass_tuple->addItem ("m2", m_m2);
218 status = mass_tuple->addItem ("m3", m_m3);
219 status = mass_tuple->addItem ("costheta1", m_cos1);
220 status = mass_tuple->addItem ("costheta2", m_cos2);
221 status = mass_tuple->addItem ("costheta3", m_cos3);
222 status = mass_tuple->addItem ("ichannel", m_ich);
223 } else {
224 log << MSG::ERROR << " Cannot book N-tuple:"<< long(m_tuple) << endmsg;
225 return StatusCode::FAILURE;
226 }
227 }
228
229 NTuplePtr nt3(
ntupleSvc(),
"MYROOTFILE/massGen");
230 if(nt3) {massgen_tuple=nt3;}
231 else {
232 massgen_tuple =
ntupleSvc()->book (
"MYROOTFILE/massGen", CLID_ColumnWiseTuple,
"Generator-mass-Ntuple");
233 if(massgen_tuple){
234 status = massgen_tuple->addItem ("m12", _m12);
235 status = massgen_tuple->addItem ("m13", _m13);
236 status = massgen_tuple->addItem ("m23", _m23);
237 status = massgen_tuple->addItem ("m1", _m1);
238 status = massgen_tuple->addItem ("m2", _m2);
239 status = massgen_tuple->addItem ("m3", _m3);
240 status = massgen_tuple->addItem ("costheta1", _cos1);
241 status = massgen_tuple->addItem ("costheta2", _cos2);
242 status = massgen_tuple->addItem ("costheta3", _cos3);
243 status = massgen_tuple->addItem ("ichannel", _ich);
244 } else {
245 log << MSG::ERROR << " Cannot book N-tuple:"<< long(m_tuple) << endmsg;
246 return StatusCode::FAILURE;
247 }
248 }
249
250
251 }
252 for(int i=0;i<500;i++){br[i]=0;}
253 if(!(m_SB3File=="" && m_SB3HT=="")) {
254 const char *filename, *histitle;
255 filename=(char*)m_SB3File.c_str();
256 histitle=(char*)m_SB3HT.c_str();
257 SuperBody3decay.
setFile(filename);
259 SuperBody3decay.
init();
260 }
261
262 return StatusCode::SUCCESS;
263}
void setDecayCard(string card)
DataInfoSvc * dataInfoSvc
IDataInfoSvc * tmpInfoSvc
void readUDecay(const char *const udecay_name)
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.