BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtDecay Class Reference

#include <EvtDecay.h>

+ Inheritance diagram for EvtDecay:

Public Member Functions

 EvtDecay (const string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
double ampsLenu (vector< double > Vexp, std::vector< double > vpars)
 
double ampsLbenu (vector< double > Vexp, std::vector< double > vpars)
 
double HV (double i, double j, vector< double > Vexp, std::vector< double > vpars)
 
double HA (double i, double j, vector< double > Vexp, std::vector< double > vpars)
 
double getObsXsection (double mhds, int mode)
 

Public Attributes

IDataInfoSvctmpInfoSvc
 
DataInfoSvcdataInfoSvc
 

Detailed Description

Definition at line 65 of file EvtDecay.h.

Constructor & Destructor Documentation

◆ EvtDecay()

EvtDecay::EvtDecay ( const string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 82 of file EvtDecay.cxx.

82 :Algorithm( name, pSvcLocator )
83{
84
85
86
87 // these can be used to specify alternative locations or filenames
88 // for the EvtGen particle and channel definition files.
89
90 declareProperty("DecayDecDir", m_DecayDec = "");
91 declareProperty("PdtTableDir", m_PdtTable = "");
92 declareProperty("userDecayTableName", userDecFileName = "NONE");
93 declareProperty("DecayTopology", m_DecayTop = ""); // output decay topology to a file specified by user
94 declareProperty("DecayRecord", m_DecayRec = ""); // output decay topology of one particle specified by user to a file
95 declareProperty("ParentParticle", m_ParentPart = "NONE");// Mothor particle name in pdt.table for only running BesEvtGen
96 declareProperty("Multiplicity", m_Ncharge = false); // output ncharge number of an event
97 declareProperty("NutupleFile",m_NtupleFile = false); // output Ntuple file
98 declareProperty("mDIY",_mDIY= false); // mDIY model
99 declareProperty("FDPdata",m_SB3File = ""); // Fit Dalitz Plot (FDP) data file name (*.root)
100 declareProperty("FDPHisT",m_SB3HT = ""); // histogram title of Dalitz plot in data file
101 declareProperty("FDPpart",m_FDPparticle =""); //to assign the FDP parent particle name (string)
102 declareProperty("TruthFile",m_truthFile ="");
103 declareProperty("TruthPart",m_truthPart ="");
104 declareProperty("Psi3SopenCharm",m_Psi4040OpenCharm=false);
105 declareProperty("Psi2openCharm", m_Psi2openCharm=false);
106 declareProperty("SetMthrForConExc",m_SetMthr=0.0);
107 declareProperty("statDecays",m_statDecays=false);
108 declareProperty("TagLundCharmModel", m_tagLundModel=false);
109 m_mystring.clear();
110 declareProperty("FileForTrackGen", m_mystring);
111 //for polarized charmonium production
112 m_polarization.clear();//= diag{1+Pe, 0, 1-Pe} with electron polarization Pe
113 declareProperty("polarization", m_polarization);
114 declareProperty("eBeamPolarization", m_eBeamPolarization=-1);
115 m_cluster0.clear();m_wind0.clear();
116 m_cluster1.clear();m_wind1.clear();
117 m_cluster2.clear();m_wind2.clear();
118 declareProperty("cluster0",m_cluster0);
119 declareProperty("cluster1",m_cluster1);
120 declareProperty("cluster2",m_cluster2);
121 declareProperty("masswin0",m_wind0);
122 declareProperty("masswin1",m_wind1);
123 declareProperty("masswin2",m_wind2);
124 declareProperty("OutputP4",m_outputp4="");
125 declareProperty("ReadMeasuredEcms", m_RdMeasuredEcms = false);
126 m_ReadTruth.clear();
127 declareProperty("ReadTruth",m_ReadTruth);
128 //ReadTruth={{"ParentName"},{"i0","i1","i2"},{"j0","j1","j2","j3"}}, where the first part. is Parent->getDaug(i0)->getDaug(i1)->getDaug(i2),
129 //and second particle is Parent ->getDaug(j0)->getDaug(j1)->getDaug(j2)->getDaug(j3);
130}

Member Function Documentation

◆ ampsLbenu()

double EvtDecay::ampsLbenu ( vector< double >  Vexp,
std::vector< double >  vpars 
)

◆ ampsLenu()

double EvtDecay::ampsLenu ( vector< double >  Vexp,
std::vector< double >  vpars 
)

◆ execute()

StatusCode EvtDecay::execute ( )

Definition at line 328 of file EvtDecay.cxx.

329{
330
331 MsgStream log(messageService(), name());
332 // log << MSG::INFO << "EvtDecay executing" << endreq;
333 //------------------
334 string key = "GEN_EVENT";
335 // retrieve event from Transient Store (Storegate)
336 SmartDataPtr<McGenEventCol> McEvtColl(eventSvc(), "/Event/Gen");
337
338 m_numberEvent += 1;
339 writeFlag = 0;
340 //std::cout<<"EvtNumber= "<<m_numberEvent<<std::endl;
341 if ( McEvtColl == 0 )
342 {
343 HepMC::GenEvent* evt=new GenEvent();
344 evt->set_event_number(m_numberEvent);
345
346 //read Ecms from the database
347 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
348 int runNo=eventHeader->runNumber();
349 int event=eventHeader->eventNumber();
350 bool newRunFlag=0;
351 if(runNo != 0 && runNo != m_runNo){m_runNo=runNo;newRunFlag = true;}else{newRunFlag=false;}
352 if(m_RdMeasuredEcms&& newRunFlag){// using cms energy of beam read from database
353 runNo = std::abs(runNo);
354 ReadME theME(runNo);
355 if(theME.isRunNoValid()){
356 dbEcms=theME.getEcms();
357 std::cout<<"Read Ecms= "<<dbEcms<<std::endl;
358 if(dbEcms!=0){
359 std::cout<<"INFO: Read the MeasuredEcms"<<std::endl;
360 }
361 else{
362 std::cout<<"ERROR: Can not read the MeasuredEcms, try to turn off the ReadEcmsDB"<<std::endl;
363 return StatusCode::FAILURE;
364 }
365 }
366 }
367 //end of read Ecms
368
369 callBesEvtGen( evt );
370 if(!(m_DecayTop=="")) evt->print(outfile);
371
372 //create a Transient store
373 McGenEventCol *mcColl = new McGenEventCol;
374 McGenEvent* mcEvent = new McGenEvent(evt);
375 mcColl->push_back(mcEvent);
376 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
377 if(sc != SUCCESS) return StatusCode::FAILURE;
378
379 } else // (McEvtColl != 0)
380 {
381 McGenEventCol::iterator mcItr;
382 for( mcItr = McEvtColl->begin(); mcItr != McEvtColl->end(); mcItr++ )
383 {
384 HepMC::GenEvent* hEvt = (*mcItr)->getGenEvt();
385 // MeVToGeV( hEvt );
386
387 callEvtGen( hEvt );
388
389 if(!(m_DecayTop=="")) hEvt->print(outfile);
390 // GeVToMeV( hEvt );
391 // if(!(m_DecayRec=="")) outfile2<<std::endl;
392 if(!(m_DecayRec=="")) std::cout<<std::endl;
393 };
394 }
395 if( m_NtupleFile ){ m_tuple->write();}
396 return StatusCode::SUCCESS;
397}
int runNo
Definition: DQA_TO_DB.cxx:12
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition: Taupair.h:42

◆ finalize()

StatusCode EvtDecay::finalize ( )

Definition at line 950 of file EvtDecay.cxx.

951{
952
953 if(EvtCalHelAmp::nevt>0){
954 double H2=EvtCalHelAmp::_H2;
955 double H1=EvtCalHelAmp::_H1;
956 double H0=EvtCalHelAmp::_H0;
957 double H2err=EvtCalHelAmp::_H2err;
958 double H1err=EvtCalHelAmp::_H1err;
959 double H0err=EvtCalHelAmp::_H0err;
960 int nd = EvtCalHelAmp::nevt;
961 std::cout<<"Calculated helicity amplitude sqaured are:"<<std::endl;
962 std::cout<<"|H_{2}|^2=|H_{-2}|^2= "<<H2/nd<<" +/- "<<sqrt(H2err/nd)<<endl;
963 std::cout<<"|H_{1}|^2=|H_{-1}|^2= "<<H1/nd<<" +/- "<<sqrt(H1err/nd)<<endl;
964 //std::cout<<"|H_{0}|^2= "<<H0/nd <<" +/- "<<sqrt(H0err/nd)<<endl;
965 }
966 MsgStream log(messageService(), name());
967 truth.close();
968 log << MSG::INFO << "EvtDecay finalized" << endreq;
969 fstream Forfile;
970 Forfile.open("fort.16",ios::in);
971 char delcmd[300];
972 strcpy(delcmd,"rm -f ");
973 strcat(delcmd,"fort.16");
974 // if(Forfile)system(delcmd);
975
976 fstream Forfile2;
977 Forfile2.open("fort.22",ios::in);
978 strcpy(delcmd,"rm -f ");
979 strcat(delcmd,"fort.22");
980 // if(Forfile2)system(delcmd);
981
982 // To get the branching fraction of the specified mode in Lundcharm Model
983 /*
984 EvtLundCharm lundcharmEvt;
985 int nevt=lundcharmEvt.getTotalEvt();
986 std::cout<<"The total number of the specified mode is "<<nevt<<std::endl;
987 */
988 int totalEvt=0;
989 if(!(m_SB3File=="" || m_SB3HT=="")){
990 for(int i=0;i<500;i++){totalEvt=totalEvt+br[i];}
991 for(int i=0;i<500;i++){
992 double bi=1.0*br[i]/totalEvt;
993 std::cout<<"Branching fraction of channel "<<i<<" is: "<<bi<<std::endl;
994 if(br[i]==0) break;
995 }
996 }
997
998 if(m_statDecays){
999 int totalEvt=0;
1000 for(int i=0;i<=totalChannels;i++){totalEvt=totalEvt+br[i];}
1001 std::cout<<"==================Statistical first chain decay ==============================="<<std::endl;
1002 std::cout<<"i-th channel Events Generated Branching fraction generated "<<std::endl;
1003 for(int i=0;i<=totalChannels;i++){
1004 std::cout<<"| "<<i<<" "<<br[i]<<" "<<br[i]*1.0/totalEvt<<std::endl;
1005
1006 }
1007 std::cout<<"--------------------------------------------------------------------------------"<<std::endl;
1008 std::cout<<" sum: "<<totalEvt<<" "<<"1"<<std::endl;
1009 std::cout<<"================== End of statistical first chain decay ========================"<<std::endl;
1010 }
1011
1012 return StatusCode::SUCCESS;
1013}
static double _H0err
Definition: EvtCalHelAmp.hh:58
static double _H1err
Definition: EvtCalHelAmp.hh:58
static double _H0
Definition: EvtCalHelAmp.hh:58
static int nevt
Definition: EvtCalHelAmp.hh:59
static double _H1
Definition: EvtCalHelAmp.hh:58
static double _H2
Definition: EvtCalHelAmp.hh:58
static double _H2err
Definition: EvtCalHelAmp.hh:58

◆ getObsXsection()

double EvtDecay::getObsXsection ( double  mhds,
int  mode 
)

◆ HA()

double EvtDecay::HA ( double  i,
double  j,
vector< double >  Vexp,
std::vector< double >  vpars 
)

◆ HV()

double EvtDecay::HV ( double  i,
double  j,
vector< double >  Vexp,
std::vector< double >  vpars 
)

◆ initialize()

StatusCode EvtDecay::initialize ( )

Definition at line 133 of file EvtDecay.cxx.

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
146 EvtGlobalSet::SV.clear();
147 for(int i=0;i<m_mystring.size();i++){EvtGlobalSet::SV.push_back(m_mystring[i]);}
148
149 EvtGlobalSet::iVV.clear();
150 EvtGlobalSet::dVV.clear();
151 std::vector<std::vector<int> >myivv;
152 std::vector<std::vector<double> >mydvv;
153
154 EvtConExc::SetMthr=m_SetMthr;
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 }
169 if(theivv.size()) EvtGlobalSet::iVV.push_back(theivv);
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 }
177 if(thedvv.size()) EvtGlobalSet::dVV.push_back(thedvv);
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 // Save the random number seeds in the event
186 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("EVTGEN");
187 const long s = engine->getSeed();
188 p_BesRndmGenSvc->setGenseed(s+1);
189
190 m_seeds.clear();
191 m_seeds.push_back(s);
192 totalChannels = 0;
193
194 // open an interface to EvtGen
195
196 if ( m_DecayDec == "") { //use default DECAY.DEC and pdt.table if not defined by user
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]; //output user decay cards to log file
207 std::cout<<"===================== user decay card ========================"<<std::endl;
208 strcpy(catcmd, "cat ");
209 strcat(catcmd, userDecFileName.c_str());
210 system(catcmd);
211
214
215 // write decay cards to the root file: pingrg@2009-09-09
216 StatusCode status;
217 status = service("DataInfoSvc",tmpInfoSvc);
218 if (status.isSuccess()) {
219 log << MSG::INFO << "got the DataInfoSvc" << endreq;
220 dataInfoSvc=dynamic_cast<DataInfoSvc *>(tmpInfoSvc);
221 dataInfoSvc->setDecayCard(userDecFileName);
222 } else {
223 log << MSG::ERROR << "could not get the DataInfoSvc" << endreq;
224 return StatusCode::FAILURE;
225 }
226
227
228
229 m_RandomEngine = new EvtBesRandom(engine);
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 //for output Ntuple file, pingrg-2009-09-07
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);
321 SuperBody3decay.setHTitle(histitle);
322 SuperBody3decay.init();
323 }
324
325 return StatusCode::SUCCESS;
326}
XmlRpcServer s
Definition: HelloServer.cpp:11
void setDecayCard(string card)
Definition: DataInfoSvc.cxx:50
static double SetMthr
Definition: EvtConExc.hh:140
DataInfoSvc * dataInfoSvc
Definition: EvtDecay.h:75
IDataInfoSvc * tmpInfoSvc
Definition: EvtDecay.h:74
Definition: EvtGen.hh:46
void readUDecay(const char *const udecay_name)
Definition: EvtGen.cc:126
static std::vector< std::string > SV
Definition: EvtGlobalSet.hh:19
static std::vector< std::vector< double > > dVV
Definition: EvtGlobalSet.hh:21
static std::vector< std::vector< int > > iVV
Definition: EvtGlobalSet.hh:22
void init()
Definition: EvtHis2F.cc:98
void setHTitle(const char *htitle)
Definition: EvtHis2F.cc:40
void setFile(const char *dtfile)
Definition: EvtHis2F.cc:35
virtual void setGenseed(long)=0
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.

Member Data Documentation

◆ dataInfoSvc

DataInfoSvc* EvtDecay::dataInfoSvc

Definition at line 75 of file EvtDecay.h.

Referenced by initialize().

◆ tmpInfoSvc

IDataInfoSvc* EvtDecay::tmpInfoSvc

Definition at line 74 of file EvtDecay.h.

Referenced by initialize().


The documentation for this class was generated from the following files: