BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtDecay.cxx
Go to the documentation of this file.
1//*****************************************************************************
2//
3// EvtDecay.cxx
4//
5// EvtDecay algorithm takes generated event from transient store, and decay
6// particles, including weak decays of its secondary particles.
7// EvtDecay can be used as a TopAlg in conjunction with algorithms Pythia,
8// KKMC or a SingleParticleGun.
9//
10// History:
11// Original LHCb code by Witold Pokorski and Patric Robbe.
12// August 2002: Malte Muller, adopted for ATHENA to work inside algorithm PythiaBModule (only private version within 3.0.0)
13// Sept 2003: James Catmore, adopted for 6.0.3 (not reeased in 6.0.3 ony private version) to work inside PythiaBModule.
14// Nov 2003: M.Smizanska, rewritten a) to be standalone EvtDecay algorithm so it can be combined
15// with any type of Pythia generator b) to match to new LHCb(CDF) code dedicated to LHC, c) to work in 7.3.0.
16// EvtDecay first time released in 7.3.0 20.Nov. 2003
17// Dec 2003: M.Smizanska: define user's input - decay table
18// Feb 2004 J Catmore, addition of random seed facility. TEMPORARY FIX
19// Oct 2005 A. Zhemchugov, adapted for BES3
20// May 2006 K.L He, set spin density matrix for e+e- -> V
21// Sept.2007, R.G.Ping, change to the BesEvtGen
22// Jan. 2008, R.G.Ping, to print McTruth table to the file DecayTopology when only doing generation, not simulation
23// Feb. 2008, R.G.Ping, add an option to only run the BesEvtGen
24// Mar. 2008, R.G. Ping, user options "DecayDecDir" and "PdtTableDir" are changed.
25// Mar. 2008-03, R.G. Ping, dump the user decay card to the bosslog file
26//*****************************************************************************
27
28// Header for this module:-
29#include "EvtDecay.h"
30#include "ReadME.h"
35#include "EvtGen.hh"
40#include "EvtGlobalSet.hh"
43// Framework Related Headers:-
44#include "HepMC/GenEvent.h"
45#include "HepMC/GenVertex.h"
46#include "HepMC/GenParticle.h"
47#include "EventModel/EventHeader.h"
48#include "GaudiKernel/SmartDataPtr.h"
49#include "DataInfoSvc/IDataInfoSvc.h"
50#include "DataInfoSvc/DataInfoSvc.h"
51#include "GaudiKernel/MsgStream.h"
52#include "GaudiKernel/ISvcLocator.h"
53#include "GaudiKernel/AlgFactory.h"
54#include "GaudiKernel/DataSvc.h"
55#include "GaudiKernel/SmartDataPtr.h"
56#include "GaudiKernel/IPartPropSvc.h"
57
58#include "BesKernel/IBesRndmGenSvc.h"
59#include "GeneratorObject/McGenEvent.h"
60#include "CLHEP/Random/Ranlux64Engine.h"
61#include "CLHEP/Random/RandFlat.h"
62
63#include <stdlib.h>
64#include <string.h>
65
66static string mydecayrec;
67static double _amps_max;
68int nchr = 0;
69int nchr_e = 0;
70int nchr_mu= 0;
71int nchr_pi= 0;
72int nchr_k = 0;
73int nchr_p = 0;
74int N_gamma=0;
75int N_gammaFSR = 0;
76int fst[50];
77int EvtDecay::m_runNo=0;
78
79EvtDecay::EvtDecay(const string& name, ISvcLocator* pSvcLocator):Algorithm( name, pSvcLocator )
80{
81
82
83
84 // these can be used to specify alternative locations or filenames
85 // for the EvtGen particle and channel definition files.
86
87 declareProperty("DecayDecDir", m_DecayDec = "");
88 declareProperty("PdtTableDir", m_PdtTable = "");
89 declareProperty("userDecayTableName", userDecFileName = "NONE");
90 declareProperty("DecayTopology", m_DecayTop = ""); // output decay topology to a file specified by user
91 declareProperty("DecayRecord", m_DecayRec = ""); // output decay topology of one particle specified by user to a file
92 declareProperty("ParentParticle", m_ParentPart = "NONE");// Mothor particle name in pdt.table for only running BesEvtGen
93 declareProperty("Multiplicity", m_Ncharge = false); // output ncharge number of an event
94 declareProperty("NutupleFile",m_NtupleFile = false); // output Ntuple file
95 declareProperty("mDIY",_mDIY= false); // mDIY model
96 declareProperty("FDPdata",m_SB3File = ""); // Fit Dalitz Plot (FDP) data file name (*.root)
97 declareProperty("FDPHisT",m_SB3HT = ""); // histogram title of Dalitz plot in data file
98 declareProperty("FDPpart",m_FDPparticle =""); //to assign the FDP parent particle name (string)
99 declareProperty("TruthFile",m_truthFile ="");
100 declareProperty("TruthPart",m_truthPart ="");
101 declareProperty("Psi3SopenCharm",m_Psi4040OpenCharm=false);
102 declareProperty("Psi2openCharm", m_Psi2openCharm=false);
103 declareProperty("statDecays",m_statDecays=false);
104 declareProperty("TagLundCharmModel", m_tagLundModel=false);
105 m_mystring.clear();
106 declareProperty("FileForTrackGen", m_mystring);
107 //for polarized charmonium production
108 m_polarization.clear();//= diag{1+Pe, 0, 1-Pe} with electron polarization Pe
109 declareProperty("polarization", m_polarization);
110 declareProperty("eBeamPolarization", m_eBeamPolarization=-1);
111 m_cluster0.clear();m_wind0.clear();
112 m_cluster1.clear();m_wind1.clear();
113 m_cluster2.clear();m_wind2.clear();
114 declareProperty("cluster0",m_cluster0);
115 declareProperty("cluster1",m_cluster1);
116 declareProperty("cluster2",m_cluster2);
117 declareProperty("masswin0",m_wind0);
118 declareProperty("masswin1",m_wind1);
119 declareProperty("masswin2",m_wind2);
120 declareProperty("OutputP4",m_outputp4="");
121 declareProperty("ReadMeasuredEcms", m_RdMeasuredEcms = false);
122 m_ReadTruth.clear();
123 declareProperty("ReadTruth",m_ReadTruth);
124 //ReadTruth={{"ParentName"},{"i0","i1","i2"},{"j0","j1","j2","j3"}}, where the first part. is Parent->getDaug(i0)->getDaug(i1)->getDaug(i2),
125 //and second particle is Parent ->getDaug(j0)->getDaug(j1)->getDaug(j2)->getDaug(j3);
126}
127
128
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
142 EvtGlobalSet::SV.clear();
143 for(int i=0;i<m_mystring.size();i++){EvtGlobalSet::SV.push_back(m_mystring[i]);}
144
145 EvtGlobalSet::iVV.clear();
146 EvtGlobalSet::dVV.clear();
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 }
163 if(theivv.size()) EvtGlobalSet::iVV.push_back(theivv);
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 }
171 if(thedvv.size()) EvtGlobalSet::dVV.push_back(thedvv);
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 // Save the random number seeds in the event
180 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("EVTGEN");
181 const long s = engine->getSeed();
182 p_BesRndmGenSvc->setGenseed(s+1);
183
184 m_seeds.clear();
185 m_seeds.push_back(s);
186 totalChannels = 0;
187
188 // open an interface to EvtGen
189
190 if ( m_DecayDec == "") { //use default DECAY.DEC and pdt.table if not defined by user
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]; //output user decay cards to log file
201 std::cout<<"===================== user decay card ========================"<<std::endl;
202 strcpy(catcmd, "cat ");
203 strcat(catcmd, userDecFileName.c_str());
204 system(catcmd);
205
208
209 // write decay cards to the root file: pingrg@2009-09-09
210 StatusCode status;
211 status = service("DataInfoSvc",tmpInfoSvc);
212 if (status.isSuccess()) {
213 log << MSG::INFO << "got the DataInfoSvc" << endreq;
214 dataInfoSvc=dynamic_cast<DataInfoSvc *>(tmpInfoSvc);
215 dataInfoSvc->setDecayCard(userDecFileName);
216 } else {
217 log << MSG::ERROR << "could not get the DataInfoSvc" << endreq;
218 return StatusCode::FAILURE;
219 }
220
221
222
223 m_RandomEngine = new EvtBesRandom(engine);
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 //for output Ntuple file, pingrg-2009-09-07
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);
315 SuperBody3decay.setHTitle(histitle);
316 SuperBody3decay.init();
317 }
318
319 return StatusCode::SUCCESS;
320}
321
322StatusCode EvtDecay::execute()
323{
324
325 MsgStream log(messageService(), name());
326 // log << MSG::INFO << "EvtDecay executing" << endreq;
327 //------------------
328 string key = "GEN_EVENT";
329 // retrieve event from Transient Store (Storegate)
330 SmartDataPtr<McGenEventCol> McEvtColl(eventSvc(), "/Event/Gen");
331
332 m_numberEvent += 1;
333 writeFlag = 0;
334 //std::cout<<"EvtNumber= "<<m_numberEvent<<std::endl;
335 if ( McEvtColl == 0 )
336 {
337 HepMC::GenEvent* evt=new GenEvent();
338 evt->set_event_number(m_numberEvent);
339
340 //read Ecms from the database
341 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
342 int runNo=eventHeader->runNumber();
343 int event=eventHeader->eventNumber();
344 bool newRunFlag=0;
345 if(runNo != 0 && runNo != m_runNo){m_runNo=runNo;newRunFlag = true;}else{newRunFlag=false;}
346 if(m_RdMeasuredEcms&& newRunFlag){// using cms energy of beam read from database
347 runNo = std::abs(runNo);
348 ReadME theME(runNo);
349 if(theME.isRunNoValid()){
350 dbEcms=theME.getEcms();
351 std::cout<<"Read Ecms= "<<dbEcms<<std::endl;
352 if(dbEcms!=0){
353 std::cout<<"INFO: Read the MeasuredEcms"<<std::endl;
354 }
355 else{
356 std::cout<<"ERROR: Can not read the MeasuredEcms, try to turn off the ReadEcmsDB"<<std::endl;
357 return StatusCode::FAILURE;
358 }
359 }
360 }
361 //end of read Ecms
362
363 callBesEvtGen( evt );
364 if(!(m_DecayTop=="")) evt->print(outfile);
365
366 //create a Transient store
367 McGenEventCol *mcColl = new McGenEventCol;
368 McGenEvent* mcEvent = new McGenEvent(evt);
369 mcColl->push_back(mcEvent);
370 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
371 if(sc != SUCCESS) return StatusCode::FAILURE;
372
373 } else // (McEvtColl != 0)
374 {
375 McGenEventCol::iterator mcItr;
376 for( mcItr = McEvtColl->begin(); mcItr != McEvtColl->end(); mcItr++ )
377 {
378 HepMC::GenEvent* hEvt = (*mcItr)->getGenEvt();
379 // MeVToGeV( hEvt );
380
381 callEvtGen( hEvt );
382
383 if(!(m_DecayTop=="")) hEvt->print(outfile);
384 // GeVToMeV( hEvt );
385 // if(!(m_DecayRec=="")) outfile2<<std::endl;
386 if(!(m_DecayRec=="")) std::cout<<std::endl;
387 };
388 }
389 if( m_NtupleFile ){ m_tuple->write();}
390 return StatusCode::SUCCESS;
391}
392
393// main procedure, loops over all particles in given event,
394// converts them to EvtGenParticles,
395// feeds them to EvtGen,
396// converts back to HepMC particles and puts them in the event.
397
398StatusCode EvtDecay::callEvtGen( HepMC::GenEvent* hepMCevt )
399{
400 MsgStream log(messageService(), name());
401 nchr = 0;
402 nchr_e = 0;
403 nchr_mu= 0;
404 nchr_pi= 0;
405 nchr_k = 0;
406 nchr_p = 0;
407 N_gamma=0;
408 N_gammaFSR = 0;
409 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
410
411 for (int i=0;i<13;i++) fst[i]=0;
412 HepMC::GenEvent::particle_const_iterator itp;
413 AllTrk_index=0;
414 for( itp=hepMCevt->particles_begin(); itp!=hepMCevt->particles_end(); ++itp )
415 {
416 // This is the main loop.
417 // We iterate over particles and we look for ones that
418 // should be decayed with EvtGen.
419 //
420 // status == 1 - undecayed Pythia particle (also for particles that are not supposed to decay)
421 // status == 999 - particle already decayed by EvtGen
422 // status == 899 - particle was supposed to decay by EvtGen - but found no model
423 // this may be also intentional - such events are then excluded from
424 // being written into persistent output.
425 // ISTHEP(IHEP):
426 // status code for entry IHEP, with the following meanings:
427 //
428 // = 0 : null entry.
429 // = 1 : an existing entry, which has not decayed or fragmented. This is the main class of entries, which represents the `final state' given by the generator.
430 // = 2 : an entry which has decayed or fragmented and is therefore not appearing in the final state, but is retained for event history information.
431 // = 3 : a documentation line, defined separately from the event history. This could include the two incoming reacting particles, etc.
432 // = 4 - 10 : undefined, but reserved for future standards.
433 // = 11 - 200 : at the disposal of each model builder for constructs specific to his program, but equivalent to a null line in the context of any other program.
434 // = 201 - : at the disposal of users, in particular for event tracking in the detector.
435
436 HepMC::GenParticle* hepMCpart=*itp;
437 int stat = hepMCpart->status();
438
439
440 if ( stat != 1 ) continue;
441
442 loop_to_select_eventsB:
443 int id = hepMCpart->pdg_id();
444 parentPDGcode=id;
445 hepMCpart->set_status(899);
447 string parentName=EvtPDL::name(eid);
448
449 double en =(hepMCpart->momentum()).e();
450 double pex=(hepMCpart->momentum()).px();
451 double pey=(hepMCpart->momentum()).py();
452 double pez=(hepMCpart->momentum()).pz();
453
454 EvtVector4R p_init(en,pex,pey,pez);
455 parentMass=p_init.mass();
456 EvtPDL::reSetMass(eid,parentMass);
457
459
460 // set spin density matrix for e+ e- -> V
461 bool parentFlag=false;
462 if( writeFlag==0 && part->getSpinType() == EvtSpinType::VECTOR) {
463 if(m_polarization.size()>0) {
464 part->setPolarizedSpinDensity(m_polarization[0],m_polarization[1],m_polarization[2]);
465 }else if(m_eBeamPolarization>0){
466 part->setPolarizedSpinDensity(1+ m_eBeamPolarization,0,1- m_eBeamPolarization);
467 } else{
468 part->setVectorSpinDensity();
469 }
470 parentFlag=true;
471 writeFlag++;
472 } else {
473 int id = hepMCpart->pdg_id();
474 if( id == 22 ) {N_gamma ++;fst[0]++;} //fst[0]:photon
475 if( id == -22 ){N_gammaFSR ++;}
476 if( id == 11 ) {fst[1]++;} else if(id == -11){fst[2]++;} // fst[1]: electron ; fst[]: positron
477 else if(id == 13){fst[3]++;} // fst[3]: mu-
478 else if(id == -13){fst[4]++;} // fst[4]: mu+
479 else if(id == 211){fst[5]++;} // fst[5]: pi+
480 else if(id ==-211){fst[6]++;} // fst[6]: pi-
481 else if(id == 321){fst[7]++;} // fst[7]: K+
482 else if(id ==-321){fst[8]++;} // fst[8]: K-
483 else if(id ==2212){fst[9]++;} // fst[9]: pronton
484 else if(id ==-2212){fst[10]++;} // fst[10]: anti-proton
485 else if(id == 2112){fst[11]++;} // fst[11]: nucleon
486 else if(id ==-2112){fst[12]++;} // fst[12]: ant-nucleon
487 if( fabs(id) == 11) {nchr_e++;}
488 if( fabs(id) == 13) {nchr_mu++;}
489 if( fabs(id) == 211) {nchr_pi++;}
490 if( fabs(id) == 321) {nchr_k++;}
491 if( fabs(id) == 2212) {nchr_p++;}
492
493 //std::cout<<"id= "<<id<<" AllTrk_index= "<<AllTrk_index<<std::endl;
494 if( m_NtupleFile==true ){
495 m_Trk_index[AllTrk_index]=id;
496 m_px_trk[AllTrk_index]=pex;
497 m_py_trk[AllTrk_index]=pey;
498 m_pz_trk[AllTrk_index]=pez;
499 m_en_trk[AllTrk_index]=en ;
500
501 AllTrk_index++;
502 Trk_index[AllTrk_index]=0;
503 }
504
505
506 }
507
508 // for SuperBody3decay generator
509 // EvtVector4R pd1,pd2,pd3;
510 EvtVector4R fdp_init;
511 EvtId fdp_ppid;
512 if(m_FDPparticle!=""){
513 findPart(part);
514 fdp_ppid = FDP_id;
515 fdp_init = FDP_init;
516 } else{
517 fdp_ppid = eid;
518 fdp_init = p_init;
519 }
520
521 if(!(m_SB3File=="" || m_SB3HT=="") && parentFlag && first ){
522 SuperBody3decay_make(fdp_ppid, fdp_init );
523 }
524
525 loop_to_select_eventsA:
526 m_Gen->generateDecay(part);
527 if(m_truthFile!="" && m_truthPart!=""){
528 if(EvtPDL::name(part->getId())==m_truthPart ){
529 int ndaug = part->getNDaug();
530 for(int id=0;id<ndaug;id++){
531 EvtParticle* sonp=part->getDaug(id);
532 EvtVector4R son=sonp->getP4();
533 truth<<son.get(0)<<" "<<son.get(1)<<" "<<son.get(2)<<" "<<son.get(3)<<std::endl;
534 }
535 }
536 }
537 double ratio,rdm;
538 if(_mDIY && parentFlag && m_ampscalflag ) _amps_max=CalAmpsMax(part);
539 if(_mDIY && parentFlag) {
540 rdm=EvtRandom::Flat(0.0, 1.0);
541 double amps=CalAmpsMDIY( part );
542 ratio=amps/_amps_max;
543 }
544 if(_mDIY && parentFlag && ratio<=rdm){ goto loop_to_select_eventsA;}
545
546 //-------- For superbody3------------------------------
547 bool accept;
548 if(m_FDPparticle==""){FDP_part=part;}
549 if(!(m_SB3File=="" || m_SB3HT=="") && parentFlag ){ accept=SuperBody3decay_judge( FDP_part); }
550 if(!(m_SB3File=="" || m_SB3HT=="") && parentFlag && !accept){
551 part->deleteTree();
552 writeFlag=0;
553 goto loop_to_select_eventsB;
554 }else if(!(m_SB3File=="" || m_SB3HT=="") && parentFlag && accept){
555 countChannel(FDP_part);
556 }
557 //-------- for psi4040 open charm inclusive decay
558 if((m_Psi2openCharm || m_Psi4040OpenCharm) && parentFlag ){
559 if(getModel(part) == "OPENCHARM"){
560 std::cout<<"OPENCHARM model need to set Psi2openCharm and Psi3SopenCharm to be false!"<<std::endl;
561 abort();
562 }
563 EvtPsi3Sdecay opencharm(en, part);
564 bool theDecay = opencharm.choseDecay();
565 if(!theDecay ) {
566 part->deleteTree();
567 writeFlag=0;
568 goto loop_to_select_eventsB;
569 }
570 }
571 //------------- dump the decay tree to the event model
572 // if(Nchannel>=0) part->dumpTree();
573 // part->printTree();
574
575 if(parentFlag){
576 EvtDecayTag theTag(part);
577 unsigned int modeTag, multiplicityTag;
578 modeTag = theTag.getModeTag();
579 if( getModel(part) == "OPENCHARM"||getModel(part) == "LUNDCHARM" && m_tagLundModel){
580 multiplicityTag = decayType(part);
581 //debugging
582 // std::cout<<"Opencharm Mode: "<<decayType(part)<<std::endl;
583 } else {
584 multiplicityTag = theTag.getMultTag() + decayType(part);
585 }
586
587 //std::cout<<"StdHep= "<<EvtPDL::getStdHep(part->getId())<<" getChannel "<<part->getChannel()<<" flag1,flag2= "<<modeTag<<" "<<multiplicityTag<<std::endl;
588 if(eventHeader == 0) std::cout << "event header unavailable: " << std::endl;
589 if (eventHeader != 0) {
590 eventHeader->setFlag1(modeTag);
591 eventHeader->setFlag2(multiplicityTag);
592 //std::cout<<"flag1,flag2= "<<modeTag<<" "<<multiplicityTag<<std::endl;
593 }
594 }
595
596 if(!(m_DecayRec=="")) mydecayrec=part->writeTreeRec(m_DecayRec);
597 //-- decay statistics
598 if(m_statDecays && parentFlag ) countChannel(part);
599 // ----------- pingrg 2008-03-25 ---------
600
601 if ( log.level() <= MSG::DEBUG ) part->printTree() ;
602 log << MSG::DEBUG << "Converting particles to HepMC" << endreq;
603
604 makeHepMC(part, hepMCevt, hepMCpart);
605 if(part->getNDaug()!=0)
606 hepMCpart->set_status(999);
607
608 //debug
609
610 if(part->getId()==EvtPDL::getId(m_outputp4)){
611 int nds=part->getNDaug();
612 for(int i=0;i<nds;i++){
613 if(EvtPDL::name(part->getDaug(i)->getId())=="gammaFSR") continue;
614 EvtVector4R vp1=part->getDaug(i)->getP4Lab();
615 std::cout<<"vvpp "<<vp1.get(0)<<" "<<vp1.get(1)<<" "<<vp1.get(2)<<" "<<vp1.get(3)<<std::endl;
616 }
617 }
618
619 if(m_ReadTruth.size())ReadTruth(part,m_ReadTruth);
620 //if(part->getId()==EvtPDL::getId("psi(4260)")) std::cout<<"mydebug "<<part->getP4().mass()<<std::endl;
621 part->deleteTree();
622 };
623
624 for( itp=hepMCevt->particles_begin(); itp!=hepMCevt->particles_end(); ++itp )
625 {
626 if (!(*itp)->end_vertex() && ( (*itp)->status()==899 || (*itp)->status()==999 ))
627 (*itp)->set_status(1);
628 }
629 //nchr = nchr_e + nchr_mu + nchr_pi + nchr_k +nchr_p;
631 if(m_Ncharge == true ) {std::cout<<"Multiplicity: TotoalCharge_e_mu_pi_K_p_gamma_gammaFSR: "
632 <<nchr <<" "
633 <<nchr_e <<" "
634 << nchr_mu <<" "
635 << nchr_pi <<" "
636 << nchr_k <<" "
637 <<nchr_p <<" "
638 <<N_gamma <<" "
639 <<N_gammaFSR<<endl;}
640 if(m_Ncharge == true ){std::cout<<"FinalStates: "
641 <<fst[0]<<" "
642 <<fst[1]<<" "
643 <<fst[2]<<" "
644 <<fst[3]<<" "
645 <<fst[4]<<" "
646 <<fst[5]<<" "
647 <<fst[6]<<" "
648 <<fst[7]<<" "
649 <<fst[8]<<" "
650 <<fst[9]<<" "
651 <<fst[10]<<" "
652 <<fst[11]<<" "
653 <<fst[12]<<std::endl;}
654 if( m_NtupleFile ){
655 // TotNumTrk=500;
656 m_nchr = nchr;
657 m_nchr_e = nchr_e;
658 m_nchr_mu = nchr_mu;
659 m_nchr_pi = nchr_pi;
660 m_nchr_k = nchr_k;
661 m_nchr_p = nchr_p;
662 m_gamma=N_gamma;
663 m_gammaFSR=N_gammaFSR;
664 TotNumTrk = AllTrk_index;// nchr + N_gamma + N_gammaFSR;
665 }
666 // std::cout<<"Flag= "<<eventHeader->flag1()<<" "<<eventHeader->flag2()<<std::endl;
667
668 return StatusCode::SUCCESS;
669}
670
671//****** CallBesEvtGen ************
672// This part is responsible for only ruuing BesEvtGen. //pingrg Feb. 3,2008
673//***************************************************
674StatusCode EvtDecay::callBesEvtGen( HepMC::GenEvent* hepMCevt )
675{
676 MsgStream log(messageService(), name());
677
678 nchr = -1;
679 nchr_e = 0;
680 nchr_mu= 0;
681 nchr_pi= 0;
682 nchr_k = 0;
683 nchr_p = 0;
684 N_gamma=0;
685 N_gammaFSR = 0;
686 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
687 for (int i=0;i<13;i++) fst[i]=0;
688 HepMC::GenEvent::particle_const_iterator itp;
689 // This is the main loop.
690 // We iterate over particles and we look for ones that
691 // should be decayed with EvtGen.
692 //
693 // status == 1 - undecayed Pythia particle (also for particles that are not supposed to decay)
694 // status == 999 - particle already decayed by EvtGen
695 // status == 899 - particle was supposed to decay by EvtGen - but found no model
696 // this may be also intentional - such events are then excluded from
697 // being written into persistent output.
698 // ISTHEP(IHEP):
699 // status code for entry IHEP, with the following meanings:
700 //
701 // = 0 : null entry.
702 // = 1 : an existing entry, which has not decayed or fragmented. This is the main class of entries, which represents the `final state' given by the generator.
703 // = 2 : an entry which has decayed or fragmented and is therefore not appearing in the final state, but is retained for event history information.
704 // = 3 : a documentation line, defined separately from the event history. This could include the two incoming reacting particles, etc.
705 // = 4 - 10 : undefined, but reserved for future standards.
706 // = 11 - 200 : at the disposal of each model builder for constructs specific to his program, but equivalent to a null line in the context of any other program.
707 // = 201 - : at the disposal of users, in particular for event tracking in the detector.
708
709 loop_to_select_eventsB:
710 EvtId ppid=EvtPDL::getId(m_ParentPart); //parent particle name
711 if(m_RdMeasuredEcms) EvtPDL::reSetMass(ppid,dbEcms);
712 double ppmass=EvtPDL::getMass(ppid);
713 //using Ecms from data base, for XYZ data sets
714 parentMass=ppmass;
715 int pid=EvtPDL::getStdHep(ppid);
716 parentPDGcode=pid;
717
718 EvtVector4R p_init(ppmass,0.0,0.0,0.0);
719
721 HepMC::GenParticle* hepMCpart=new GenParticle(HepLorentzVector(0,0,0,ppmass),pid,3);
722
723 bool parentFlag = false;
724 // set spin density matrix for e+ e- -> V
725 if(writeFlag ==0 && part->getSpinType() == EvtSpinType::VECTOR) {
726 if(m_polarization.size()>0) {
727 part->setPolarizedSpinDensity(m_polarization[0],m_polarization[1],m_polarization[2]);
728 } else if(m_eBeamPolarization>0){
729 part->setPolarizedSpinDensity(1+ m_eBeamPolarization,0,1- m_eBeamPolarization);
730 } else{
731 part->setVectorSpinDensity();
732 }
733 parentFlag = true;
734 writeFlag++;
735 }
736
737 // for SuperBody3decay generator
738 EvtVector4R fdp_init;
739 EvtId fdp_ppid;
740 if(m_FDPparticle!=""){
741 findPart(part);
742 fdp_ppid = FDP_id;
743 fdp_init = FDP_init;
744 } else{
745 fdp_ppid = ppid;
746 fdp_init = p_init;
747 }
748
749 if(!(m_SB3File=="" || m_SB3HT=="") && first ){ SuperBody3decay_make( fdp_ppid, fdp_init);}
750 // -----------------------------------
751
752 loop_to_select_events:
753 m_Gen->generateDecay(part); if(m_numberEvent<=1){ std::cout<<"after m_Gen->decay "<<std::endl; part->printTree();}
754
755 double ratio,rdm;
756 if(_mDIY && m_ampscalflag ) _amps_max=CalAmpsMax(part);
757
758 if(_mDIY ) {
759 for(int myloop=0;myloop<100;myloop++){
760 m_Gen->generateDecay(part);
761 double amps=CalAmpsMDIY( part);
762 ratio=amps/_amps_max;
763 rdm=EvtRandom::Flat(0.0, 1.0);
764 if( !isNumber(amps) || !isNumber(_amps_max) || ratio<=0 ) {
765 part->deleteTree();
766 part=EvtParticleFactory::particleFactory(ppid,p_init);
767 continue;
768 }else if( rdm<=ratio) {
769 break;
770 }
771 }
772 }
773
774 if(m_truthFile!="" && m_truthPart!=""){
775 if(EvtPDL::name(part->getId())==m_truthPart ){
776 int ndaug = part->getNDaug();
777 for(int id=0;id<ndaug;id++){
778 EvtParticle* sonp=part->getDaug(id);
779 EvtVector4R son=sonp->getP4();
780 truth<<son.get(0)<<" "<<son.get(1)<<" "<<son.get(2)<<" "<<son.get(3)<<std::endl;
781 }
782 }
783 }
784//--------- For superbody3
785 bool accept;
786 if(m_FDPparticle==""){FDP_part=part;}
787 if(!(m_SB3File=="" || m_SB3HT=="")){
788 accept=SuperBody3decay_judge( FDP_part);
789 }
790 if(!(m_SB3File=="" || m_SB3HT=="") && !accept) {
791 delete hepMCpart;
792 part->deleteTree();
793 goto loop_to_select_eventsB;
794 }else if(!(m_SB3File=="" || m_SB3HT=="") && parentFlag && accept){
795 countChannel(FDP_part);
796 }
797
798 int Nchannel=part->getChannel();
799
800 if(m_statDecays && parentFlag) countChannel(part);
801 //------------- dump the decay tree to the event model
802 // int Nchannel=part->getChannel();
803 // if(Nchannel>=0) part->dumpTree();
804
805 if(parentFlag){
806 EvtDecayTag theTag(part);
807 unsigned int modeTag, multiplicityTag;
808 modeTag = theTag.getModeTag();
809 if( getModel(part) == "OPENCHARM"|| getModel(part) == "LUNDCHARM" && m_tagLundModel ){
810 multiplicityTag = decayType(part);
811 //debugging
812 // std::cout<<"Opencharm Mode: "<<decayType(part)<<std::endl;
813 } else {
814 multiplicityTag = theTag.getMultTag() + decayType(part);
815 }
816 if(eventHeader == 0) std::cout << "event header unavailable: " << std::endl;
817 if (eventHeader != 0) {
818 eventHeader->setFlag1(modeTag);
819 eventHeader->setFlag2(multiplicityTag);
820 }
821 if(m_NtupleFile)m_flag1 = modeTag;
822 //std::cout<<"Flag1 "<<modeTag<<std::endl;
823 }
824
825 if(!(m_DecayRec=="")) {mydecayrec=part->writeTreeRec(m_DecayRec);std::cout<<std::endl;};
826 // ----------- pingrg 2008-03-25 ---------
827
828 if ( log.level() <= MSG::DEBUG ) part->printTree() ;
829 log << MSG::DEBUG << "Converting particles to HepMC" << endreq;
830
831 makeHepMC(part, hepMCevt, hepMCpart);
832
833 if(part->getNDaug()!=0) hepMCpart->set_status(999);
834
835 //-------------
836
837 AllTrk_index=0;
838 for( itp=hepMCevt->particles_begin(); itp!=hepMCevt->particles_end(); ++itp )
839 {
840 if (!(*itp)->end_vertex() && ( (*itp)->status()==899 || (*itp)->status()==999 ))
841 (*itp)->set_status(1);
842
843 HepMC::GenParticle* hepMCpart=*itp;
844 int stat = hepMCpart->status();
845 int id = hepMCpart->pdg_id();
846 if(abs(id)==411 ||abs(id)==413 ) { (*itp)->set_status(999);stat=999;}
847
848 if ( stat != 1 ) continue;
849 if( id == 22 ) {N_gamma ++;fst[0]++;}
850 if( id == -22 ){N_gammaFSR ++;}
851 if(id == 11 ) {fst[1]++;}
852 else if(id == -11) {fst[2]++;}
853 else if(id == 13 ) {fst[3]++;}
854 else if(id ==-13) {fst[4]++;}
855 else if(id==211) {fst[5]++;}
856 else if(id==-211) {fst[6]++;}
857 else if(id== 321) {fst[7]++;}
858 else if(id ==-321) {fst[8]++;}
859 else if(id ==2212) {fst[9]++;}
860 else if(id==-2212) {fst[10]++;}
861 else if(id == 2112){fst[11]++;}
862 else if(id==-2112) {fst[12]++;}
863 if( fabs(id) == 11) {nchr_e++;}
864 if( fabs(id) == 13) {nchr_mu++;}
865 if( fabs(id) == 211) {nchr_pi++;}
866 if( fabs(id) == 321) {nchr_k++;}
867 if( fabs(id) == 2212) {nchr_p++;}
868
869 //for Nuple
870 double en =(hepMCpart->momentum()).e();
871 double pex=(hepMCpart->momentum()).px();
872 double pey=(hepMCpart->momentum()).py();
873 double pez=(hepMCpart->momentum()).pz();
874
875 if( m_NtupleFile==true && id!=0){
876 m_Trk_index[AllTrk_index]=id;
877 m_px_trk[AllTrk_index]=pex;
878 m_py_trk[AllTrk_index]=pey;
879 m_pz_trk[AllTrk_index]=pez;
880 m_en_trk[AllTrk_index]=en ; /*
881 std::cout<<"trk# " <<AllTrk_index
882 <<" PID:" <<id
883 <<" px: " <<pex
884 <<" py: " <<pey
885 <<" pz: " <<pez
886 <<" E: " <<en<<std::endl; */
887 AllTrk_index++;
888 }
889
890 }
891
892 itp=hepMCevt->particles_begin(); // parent decaying particle status set
893 (*itp)->set_status(2);
894
895 //nchr = nchr_e + nchr_mu + nchr_pi + nchr_k +nchr_p;
897 if(m_Ncharge == true ) {std::cout<<"Multiplicity: TotoalCharge_e_mu_pi_K_p_gamma_gammaFSR: "
898 <<nchr<<" "
899 <<nchr_e<<" "
900 << nchr_mu <<" "
901 << nchr_pi <<" "
902 << nchr_k <<" "
903 <<nchr_p<<" "
904 <<N_gamma<<" "
905 <<N_gammaFSR<<endl;}
906 if(m_Ncharge == true ){std::cout<<"FinalStates: "
907 <<fst[0]<<" "
908 <<fst[1]<<" "
909 <<fst[2]<<" "
910 <<fst[3]<<" "
911 <<fst[4]<<" "
912 <<fst[5]<<" "
913 <<fst[6]<<" "
914 <<fst[7]<<" "
915 <<fst[8]<<" "
916 <<fst[9]<<" "
917 <<fst[10]<<" "
918 <<fst[11]<<" "
919 <<fst[12]<<std::endl;}
920
921 //if(nchr==3) part->printTree();
922 if( m_NtupleFile ){
923 m_nchr = nchr;
924 m_nchr_e = nchr_e;
925 m_nchr_mu = nchr_mu;
926 m_nchr_pi = nchr_pi;
927 m_nchr_k = nchr_k;
928 m_nchr_p = nchr_p;
929 m_gamma=N_gamma;
930 m_gammaFSR=N_gammaFSR;
931 TotNumTrk = AllTrk_index; //nchr + N_gamma + N_gammaFSR;
932 }
933
934 //debug
935 if(m_ReadTruth.size())ReadTruth(part,m_ReadTruth);
936
937
938 //if(part->getId()==EvtPDL::getId("psi(4260)")) std::cout<<"mydebug "<<part->getP4().mass()<<std::endl;
939 part->deleteTree();
940 return StatusCode::SUCCESS;
941}
942
943//************ end of callBesEvtGen *********************
945{
946
947 if(EvtCalHelAmp::nevt>0){
948 double H2=EvtCalHelAmp::_H2;
949 double H1=EvtCalHelAmp::_H1;
950 double H0=EvtCalHelAmp::_H0;
951 double H2err=EvtCalHelAmp::_H2err;
952 double H1err=EvtCalHelAmp::_H1err;
953 double H0err=EvtCalHelAmp::_H0err;
954 int nd = EvtCalHelAmp::nevt;
955 std::cout<<"Calculated helicity amplitude sqaured are:"<<std::endl;
956 std::cout<<"|H_{2}|^2=|H_{-2}|^2= "<<H2/nd<<" +/- "<<sqrt(H2err/nd)<<endl;
957 std::cout<<"|H_{1}|^2=|H_{-1}|^2= "<<H1/nd<<" +/- "<<sqrt(H1err/nd)<<endl;
958 //std::cout<<"|H_{0}|^2= "<<H0/nd <<" +/- "<<sqrt(H0err/nd)<<endl;
959 }
960 MsgStream log(messageService(), name());
961 truth.close();
962 log << MSG::INFO << "EvtDecay finalized" << endreq;
963 fstream Forfile;
964 Forfile.open("fort.16",ios::in);
965 char delcmd[300];
966 strcpy(delcmd,"rm -f ");
967 strcat(delcmd,"fort.16");
968 // if(Forfile)system(delcmd);
969
970 fstream Forfile2;
971 Forfile2.open("fort.22",ios::in);
972 strcpy(delcmd,"rm -f ");
973 strcat(delcmd,"fort.22");
974 // if(Forfile2)system(delcmd);
975
976 // To get the branching fraction of the specified mode in Lundcharm Model
977 /*
978 EvtLundCharm lundcharmEvt;
979 int nevt=lundcharmEvt.getTotalEvt();
980 std::cout<<"The total number of the specified mode is "<<nevt<<std::endl;
981 */
982 int totalEvt=0;
983 if(!(m_SB3File=="" || m_SB3HT=="")){
984 for(int i=0;i<500;i++){totalEvt=totalEvt+br[i];}
985 for(int i=0;i<500;i++){
986 double bi=1.0*br[i]/totalEvt;
987 std::cout<<"Branching fraction of channel "<<i<<" is: "<<bi<<std::endl;
988 if(br[i]==0) break;
989 }
990 }
991
992 if(m_statDecays){
993 int totalEvt=0;
994 for(int i=0;i<=totalChannels;i++){totalEvt=totalEvt+br[i];}
995 std::cout<<"==================Statistical first chain decay ==============================="<<std::endl;
996 std::cout<<"i-th channel Events Generated Branching fraction generated "<<std::endl;
997 for(int i=0;i<=totalChannels;i++){
998 std::cout<<"| "<<i<<" "<<br[i]<<" "<<br[i]*1.0/totalEvt<<std::endl;
999
1000 }
1001 std::cout<<"--------------------------------------------------------------------------------"<<std::endl;
1002 std::cout<<" sum: "<<totalEvt<<" "<<"1"<<std::endl;
1003 std::cout<<"================== End of statistical first chain decay ========================"<<std::endl;
1004 }
1005
1006 return StatusCode::SUCCESS;
1007}
1008
1009
1010StatusCode EvtDecay::makeHepMC(EvtParticle* part, HepMC::GenEvent* hEvt,
1011 HepMC::GenParticle* hPart)
1012{
1013 MsgStream log(messageService(), name());
1014
1015 if(part->getNDaug()!=0)
1016 {
1017 double ct=(part->getDaug(0)->get4Pos()).get(0);
1018 double x=(part->getDaug(0)->get4Pos()).get(1);
1019 double y=(part->getDaug(0)->get4Pos()).get(2);
1020 double z=(part->getDaug(0)->get4Pos()).get(3);
1021
1022 HepMC::GenVertex* end_vtx = new HepMC::GenVertex(HepLorentzVector(x,y,z,ct));
1023 hEvt->add_vertex( end_vtx );
1024 end_vtx->add_particle_in(hPart);
1025
1026 int ndaug=part->getNDaug();
1027
1028 for(int it=0;it<ndaug;it++)
1029 {
1030
1031 double e=(part->getDaug(it)->getP4Lab()).get(0);
1032 double px=(part->getDaug(it)->getP4Lab()).get(1);
1033 double py=(part->getDaug(it)->getP4Lab()).get(2);
1034 double pz=(part->getDaug(it)->getP4Lab()).get(3);
1035 int id=EvtPDL::getStdHep(part->getDaug(it)->getId());
1036 int status=1;
1037
1038 if(part->getDaug(it)->getNDaug()!=0) status=999;
1039
1040 HepMC::GenParticle* prod_part = new HepMC::GenParticle(HepLorentzVector(px,py,pz,e),id,status);
1041 end_vtx->add_particle_out(prod_part);
1042 makeHepMC(part->getDaug(it),hEvt,prod_part);
1043
1044
1045
1046 if( log.level()<MSG::INFO )
1047 prod_part->print();
1048 }
1049 }
1050
1051 return StatusCode::SUCCESS;
1052}
1053
1054
1055void EvtDecay::MeVToGeV (HepMC::GenEvent* evt)
1056{
1057 for ( HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p ) {
1058 // cout << " PDG, BAR " << (*p)->pdg_id() << " " << (*p)->barcode() << endl;
1059 // (*p)->set_momentum( (*p)->momentum() / 1000. );
1060
1061 HepMC::FourVector tmpfv((*p)->momentum().x()/1000.,
1062 (*p)->momentum().y()/1000.,
1063 (*p)->momentum().z()/1000.,
1064 (*p)->momentum().t()/1000.
1065 );
1066
1067 (*p)->set_momentum( tmpfv );
1068 }
1069}
1070
1071void EvtDecay::GeVToMeV (HepMC::GenEvent* evt)
1072{
1073 for ( HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p ) {
1074 // cout << " PDG, BAR " << (*p)->pdg_id() << " " << (*p)->barcode() << endl;
1075 // (*p)->set_momentum( (*p)->momentum() * 1000. );
1076 HepMC::FourVector tmpfv((*p)->momentum().x()*1000.,
1077 (*p)->momentum().y()*1000.,
1078 (*p)->momentum().z()*1000.,
1079 (*p)->momentum().t()*1000.
1080 );
1081
1082 (*p)->set_momentum( tmpfv );
1083 }
1084}
1085
1086
1087double EvtDecay::CalAmpsMax( EvtParticle* part )
1088{
1089 double amps_max=0;
1090 for(int i=0;i<100000;i++){
1091 m_Gen->generateDecay(part);
1092 double amps=CalAmpsMDIY(part);
1093 if(amps > amps_max) amps_max=amps;
1094 }
1095 amps_max=amps_max*1.05;
1096 m_ampscalflag = false;
1097 return amps_max;
1098}
1099
1100// EvtBesRandom class implementation, basically BesRandomSvc -> EvtGen random engine interface
1101
1102EvtBesRandom::EvtBesRandom(HepRandomEngine* engine)
1103{
1104 m_engine = engine;
1105 m_engine->showStatus();
1106}
1107
1109{}
1110
1112{
1113 return RandFlat::shoot(m_engine);
1114}
1115
1116
1117void EvtDecay::SuperBody3decay_make(EvtId ppid, EvtVector4R p_init ){
1118 double xmass2,ymass2;
1119 bool accept;
1120 EvtVector4R pd1,pd2,pd3;
1121
1122 //---- find out the pdg codes of final state and count the identical particles
1123 FinalState_make( ppid, p_init);
1124
1125 //begin to loop with events
1126 for(int i=0;i<100000;i++){
1127 regen:
1129 HepMC::GenParticle* hepMCpart=new GenParticle(HepLorentzVector(0,0,0,parentMass),parentPDGcode,3); //this line make the decay to select different channel
1130
1131 if(part->getSpinType() == EvtSpinType::VECTOR) {
1132 part->setVectorSpinDensity();
1133 }
1134 m_Gen->generateDecay(part);
1135
1136
1137 FinalState_sort(part);
1138 pd1=son0;
1139 pd2=son1;
1140 pd3=son2;
1141
1142 // std::cout<<"multi, pdg, pi= "<<multi<<" "<<pdg0<<" "<<pdg1<<" "<<pdg2<<" "<<son0<<son1<<son2<<std::endl;
1143
1144 xmass2=(pd1+pd2).mass2(); // Dalitz plot m12^2 ~ m13^2
1145 ymass2=(pd1+pd3).mass2();
1146 double xlow=SuperBody3decay.getXlow();
1147 double xup=SuperBody3decay.getXup();
1148 double ylow=SuperBody3decay.getYlow();
1149 double yup=SuperBody3decay.getYup();
1150 if(xmass2<xlow || xmass2>xup || ymass2<ylow || ymass2>yup) { part->deleteTree();goto regen;}
1151 SuperBody3decay.HFill(xmass2,ymass2);
1152
1153 if( m_NtupleFile ){
1154 m_ich=part->getChannel();
1155 m_m1=pd1.mass();
1156 m_m2=pd2.mass();
1157 m_m3=pd3.mass();
1158 m_m12=(pd1+pd2).mass();
1159 m_m23=(pd2+pd3).mass();
1160 m_m13=(pd1+pd3).mass();
1161 m_cos1=pd1.get(3)/pd1.d3mag();
1162 m_cos2=pd2.get(3)/pd2.d3mag();
1163 m_cos3=pd3.get(3)/pd3.d3mag();
1164 mass_tuple->write();
1165 }
1166 double m1=pd1.mass(); double m2=pd2.mass();double m3=pd3.mass();
1167 double mj=(pd2+pd3).mass();
1168 // std::cout<<"mass 1 2 3 chicj <<=="<<m1<<" "<<m2<<" "<<m3<<" "<<mj<<std::endl;
1169 // delete hepMCpart;
1170 }
1171
1172 SuperBody3decay.HReweight(); //reweighting Dalitz plot
1173 SuperBody3decay.setZmax(); // find out the maximum value after reweighting
1174 first=false;
1175}
1176
1177bool EvtDecay::SuperBody3decay_judge(EvtParticle* part){
1178 double xmass2,ymass2;
1179 bool accept;
1180 EvtVector4R pd1,pd2,pd3;
1181
1182
1183 FinalState_sort( part);
1184
1185 pd1=son0;
1186 pd2=son1;
1187 pd3=son2;
1188
1189
1190 xmass2=(pd1+pd2).mass2(); // Dalitz plot m12^2 ~ m13^2
1191 ymass2=(pd1+pd3).mass2();
1192 accept=SuperBody3decay.AR(xmass2,ymass2);
1193
1194 //debugging
1195 if(accept && m_NtupleFile) {
1196 _ich=part->getChannel();
1197 _m1=pd1.mass();
1198 _m2=pd2.mass();
1199 _m3=pd3.mass();
1200 _m12=(pd1+pd2).mass();
1201 _m23=(pd2+pd3).mass();
1202 _m13=(pd1+pd3).mass();
1203 _cos1=pd1.get(3)/pd1.d3mag();
1204 _cos2=pd2.get(3)/pd2.d3mag();
1205 _cos3=pd3.get(3)/pd3.d3mag();
1206 massgen_tuple->write();
1207 }
1208 // std::cout<<"mass 1 2 3 chicj>> "<<_m1<<" "<<_m2<<" "<<_m3<<" "<<_m23<<std::endl;
1209
1210 return accept;
1211}
1212
1213
1214void EvtDecay:: FinalState_make(EvtId ppid, EvtVector4R p_init){
1215 // get the final state pdg cond and count the identicle particle
1216 multi=1;
1217 identical_flag=true;
1218
1219 for(int i=1;i<10000;i++){ //sigle out the final state
1221 HepMC::GenParticle* hepMCpart=new GenParticle(HepLorentzVector(0,0,0,parentMass),parentPDGcode,3);
1222
1223 m_Gen->generateDecay(part);
1224 int nson=part->getNDaug();
1225
1226 if(nson == 2) {continue;} else
1227 if(nson ==3){
1228 EvtId xid0,xid1,xid2;
1229 xid0=part->getDaug(0)->getId();
1230 xid1=part->getDaug(1)->getId();
1231 xid2=part->getDaug(2)->getId();
1232
1233//-- pdg code
1234 pdg0=EvtPDL::getStdHep(xid0);
1235 pdg1=EvtPDL::getStdHep(xid1);
1236 pdg2=EvtPDL::getStdHep(xid2);
1237
1238 if(pdg0==pdg1 && pdg1==pdg2) {multi=3;}
1239 else if(pdg0==pdg1 ){multi=2;} // two identical particle list as 0,1 index
1240 else if(pdg0==pdg2 ){multi=2;pdg=pdg1; pdg1=pdg2; pdg2=pdg;}
1241 else if(pdg1==pdg2) {multi=2;pdg=pdg0; pdg0=pdg1; pdg1=pdg2; pdg2=pdg;}
1242 else {multi=1;}
1243 break;
1244 } else{
1245 std::cout<<"No direct three body decay channel found in decay card, I stop run"<<std::endl;
1246 ::abort();
1247 }
1248 }
1249 // std::cout<<"pdg_i "<<pdg0<<" "<<pdg1<<" "<<pdg2<<std::endl;
1250 // std::cout<<"identical particle "<<multi<<std::endl;
1251}
1252
1253void EvtDecay::FinalState_sort(EvtParticle* part){
1254 // sort the momentum to aon0, son1, son2
1255 EvtVector4R pd0,pd1,pd2;
1256 EvtId xid0,xid1,xid2;
1257 int id0,id1,id2;
1258
1259 int nson=part->getNDaug();
1260 if(nson==2){
1261 pd0=part->getDaug(0)->getP4Lab();
1262 pd1=part->getDaug(1)->getDaug(0)->getP4Lab();
1263 pd2=part->getDaug(1)->getDaug(1)->getP4Lab();
1264
1265 xid0=part->getDaug(0)->getId();
1266 xid1=part->getDaug(1)->getDaug(0)->getId();
1267 xid2=part->getDaug(1)->getDaug(1)->getId();
1268
1269 } else if(nson==3){
1270 pd0=part->getDaug(0)->getP4Lab();
1271 pd1=part->getDaug(1)->getP4Lab();
1272 pd2=part->getDaug(2)->getP4Lab();
1273
1274 xid0=part->getDaug(0)->getId();
1275 xid1=part->getDaug(1)->getId();
1276 xid2=part->getDaug(2)->getId();
1277 }
1278 //-- pdg code
1279 id0=EvtPDL::getStdHep(xid0);
1280 id1=EvtPDL::getStdHep(xid1);
1281 id2=EvtPDL::getStdHep(xid2);
1282
1283 // std::cout<<"pid before match: "<<id0<<" "<<id1<<" "<<id2<<std::endl;
1284 //-- assign sons momentum
1285 if(multi==1){
1286 assign_momentum(id0,pd0);
1287 assign_momentum(id1,pd1);
1288 assign_momentum(id2,pd2);
1289 } else if(multi==2){
1290 assign_momentum2(id0,pd0);
1291 assign_momentum2(id1,pd1);
1292 assign_momentum2(id2,pd2);
1293 if(son0.get(0)>son1.get(0)){son=son0;son0=son1;son1=son;} // change into E_0 < E_1
1294 } else if(multi==3){ // sort sons according to energy E_0 < E_1 < E_2
1295 double En0=pd0.get(0);
1296 double En1=pd1.get(0);
1297 double En2=pd2.get(0);
1298 if(En0 < En1 && En1 < En2) {son0=pd0;son1=pd1;son2=pd2;}
1299 if(En0 < En2 && En2 < En1) {son0=pd0;son1=pd2;son2=pd1;}
1300 if(En1 < En0 && En0 < En2) {son0=pd1;son1=pd0;son2=pd2;}
1301 if(En1 < En2 && En2 < En0) {son0=pd1;son1=pd2;son2=pd0;}
1302 if(En2 < En0 && En0 < En1) {son0=pd2;son1=pd0;son2=pd1;}
1303 if(En2 < En1 && En1 < En0) {son0=pd2;son1=pd1;son2=pd0;}
1304 }
1305
1306}
1307
1308
1309void EvtDecay::assign_momentum(int id0, EvtVector4R pd0){
1310 if(id0==pdg0){son0=pd0;}
1311 else if(id0==pdg1){son1=pd0;}
1312 else if(id0==pdg2){son2=pd0;}
1313 else {std::cout<<"PID= "<<id0<<" not machted, I stop"<<std::endl; ::abort();}
1314}
1315
1316void EvtDecay::assign_momentum2(int id0, EvtVector4R pd0){ // for two identicle particle case
1317 if(id0==pdg0 && identical_flag){son0=pd0;identical_flag=false;}
1318 else if(id0==pdg1){son1=pd0;identical_flag=true;}
1319 else if(id0==pdg2){son2=pd0;}
1320 else {std::cout<<"PID not machted, I stop"<<std::endl; ::abort();}
1321}
1322
1323void EvtDecay::findPart(EvtParticle* part){
1324 FDP_id=EvtPDL::getId(m_FDPparticle);
1325 int FDP_pdg=EvtPDL::getStdHep(FDP_id);
1326
1327 m_Gen->generateDecay(part);
1328 int dn=part->getNDaug();
1329
1330 if(dn!=0){
1331 for(int i=0;i<dn;i++){
1332 EvtParticle* part1=part->getDaug(i);
1333 EvtId sonid=part1->getId();
1334 int son_pdg = EvtPDL::getStdHep(sonid);
1335 if(son_pdg == FDP_pdg){
1336 FDP_init=part1->getP4Lab();
1337 FDP_part=part1;
1338 return;
1339 } else{
1340 findPart(part1);
1341 }
1342 }
1343 } //if (dn block
1344
1345}
1346
1347void EvtDecay::countChannel(EvtParticle* part){
1348 int ich=part->getChannel();
1349
1350 //debuging
1351 //if(getModel(part,ich)=="OPENCHARM" &&EvtPDL::name( part->getId() )=="psi(4260)") ich = part->getGeneratorFlag();
1352 //std::cout<<"the channel is "<<ich<<std::endl;
1353
1354 br[ich]++;
1355 if(ich>totalChannels) totalChannels = ich;
1356 //std::cout<<"EVENT IN br_i "<<br[ich]<<std::endl;
1357}
1358
1359bool EvtDecay::isCharmonium(EvtId xid){
1360EvtId psi4415 = EvtPDL::getId(std::string("psi(4415)"));
1361EvtId psi4160 = EvtPDL::getId(std::string("psi(4160)"));
1362EvtId psi4040 = EvtPDL::getId(std::string("psi(4040)"));
1363EvtId psi3770 = EvtPDL::getId(std::string("psi(3770)"));
1364EvtId psiprim = EvtPDL::getId(std::string("psi(2S)"));
1365EvtId jpsi = EvtPDL::getId(std::string("J/psi"));
1366EvtId etac = EvtPDL::getId(std::string("eta_c"));
1367EvtId etac2s = EvtPDL::getId(std::string("eta_c(2S)"));
1368EvtId hc = EvtPDL::getId(std::string("h_c"));
1369EvtId chic0 = EvtPDL::getId(std::string("chi_c0"));
1370EvtId chic1 = EvtPDL::getId(std::string("chi_c1"));
1371EvtId chic2 = EvtPDL::getId(std::string("chi_c2"));
1372EvtId chic0p = EvtPDL::getId(std::string("chi_c0p"));
1373EvtId chic1p = EvtPDL::getId(std::string("chi_c1p"));
1374EvtId chic2p = EvtPDL::getId(std::string("chi_c1p"));
1375 std::vector<EvtId> Vid; Vid.clear();
1376 Vid.push_back(psi4415);
1377 Vid.push_back(psi4160);
1378 Vid.push_back(psi4040);
1379 Vid.push_back(psi3770);
1380 Vid.push_back(psiprim);
1381 Vid.push_back(jpsi);
1382 Vid.push_back(etac);
1383 Vid.push_back(etac2s);
1384 Vid.push_back(hc);
1385 Vid.push_back(chic0);
1386 Vid.push_back(chic1);
1387 Vid.push_back(chic2);
1388 Vid.push_back(chic0p);
1389 Vid.push_back(chic1p);
1390 Vid.push_back(chic2p);
1391
1392 bool flag=true;
1393 for(int i=0;i<Vid.size();i++){ if(xid == Vid[i]) return flag;}
1394 return false;
1395}
1396
1397
1398bool EvtDecay::isCharm(EvtId xid){
1399EvtId d0 = EvtPDL::getId(std::string("D0"));
1400EvtId d0bar = EvtPDL::getId(std::string("anti-D0"));
1401EvtId dp = EvtPDL::getId(std::string("D+"));
1402EvtId dm = EvtPDL::getId(std::string("D-"));
1403EvtId d0h = EvtPDL::getId(std::string("D0H"));
1404EvtId d0l = EvtPDL::getId(std::string("D0L"));
1405EvtId dstp = EvtPDL::getId(std::string("D*+"));
1406EvtId dstm = EvtPDL::getId(std::string("D*-"));
1407EvtId ds0 = EvtPDL::getId(std::string("D*0"));
1408EvtId ds0bar = EvtPDL::getId(std::string("anti-D*0"));
1409EvtId dsp = EvtPDL::getId(std::string("D_s+"));
1410EvtId dsm = EvtPDL::getId(std::string("D_s-"));
1411EvtId dsstp = EvtPDL::getId(std::string("D_s*+"));
1412EvtId dsstm = EvtPDL::getId(std::string("D_s*-"));
1413EvtId ds0stp = EvtPDL::getId(std::string("D_s0*+"));
1414EvtId ds0stm = EvtPDL::getId(std::string("D_s0*-"));
1415
1416 std::vector<EvtId> Vid; Vid.clear();
1417 Vid.push_back(d0);
1418 Vid.push_back(d0bar);
1419 Vid.push_back(dp);
1420 Vid.push_back(dm);
1421 Vid.push_back(d0h);
1422 Vid.push_back(d0l);
1423 Vid.push_back(dstp);
1424 Vid.push_back(dstm);
1425 Vid.push_back(ds0);
1426 Vid.push_back(ds0bar );
1427 Vid.push_back(dsp );
1428 Vid.push_back(dsm );
1429 Vid.push_back(dsstp );
1430 Vid.push_back(dsstm );
1431 Vid.push_back(ds0stp );
1432 Vid.push_back(ds0stm );
1433
1434 bool flag=true;
1435 for(int i=0;i<Vid.size();i++){ if(xid == Vid[i]) return flag;}
1436 return false;
1437}
1438
1439bool EvtDecay::isRadecay(EvtParticle *par){
1440 int ndg = par->getNDaug();
1441 for(int i=0;i<ndg;i++){
1442 EvtId xid = par->getDaug(i)->getId();
1443 if(EvtPDL::getStdHep(xid) == 22){return true;}
1444 }
1445 return false;
1446}
1447
1448int EvtDecay::decayType(EvtParticle *par){
1449 /*************************************
1450 * 0: gamma light_hadrons
1451 * 1: gamma charmonium
1452 * 2: DDbar (D0 D0bar or D+D-)
1453 * 3: ligh_hadrons
1454 * 4: others
1455 *************************************/
1456 int Nchannel=par->getChannel();
1457 int ndg = par->getNDaug();
1458 int nfsr=0;
1459
1460 std::string model = getModel(par,Nchannel);
1461 if( model == "OPENCHARM" || model == "LUNDCHARM" && m_tagLundModel){ // lundcharm model tag
1462 int ldm = par->getGeneratorFlag();
1463 // std::cout<<"LundCharmFlag = "<<ldm<<std::endl;
1464 return ldm;
1465 //return 9;
1466 }
1467
1468 for(int i=0;i<ndg;i++){ //remove the FSR photon
1469 EvtId xid =par->getDaug(i)->getId();
1470 if(EvtPDL::getStdHep(xid) == -22 ){nfsr++;}
1471 }
1472
1473 if( isRadecay(par) ){
1474 for(int i=0;i<ndg;i++){
1475 EvtId xid = par->getDaug(i)->getId();
1476 if( isCharmonium(xid) ) return 1;
1477 }
1478 return 0;
1479 } else{
1480 if(ndg-nfsr ==2 ){
1481 int ndg = par->getNDaug();
1482 EvtId xd1 = par->getDaug(0)->getId();
1483 EvtId xd2 = par->getDaug(1)->getId();
1484 if( isCharm(xd1) && isCharm(xd2) ) {return 2;} else
1485 if( !isCharmonium(xd1) && !isCharmonium(xd2) && !isCharm(xd1) && !isCharm(xd2) ){
1486 return 3;
1487 }
1488 } else{ // ndg>=3
1489 bool flag = false;
1490 for(int i=0;i<ndg;i++){
1491 EvtId xid = par->getDaug(i)->getId();
1492 if( isCharmonium(xid) ) {flag = true; break;}
1493 if( isCharm(xid) ) {flag = true; break;}
1494 } // for_i block
1495 if( !flag ){return 3;} else {return 4;}
1496 }// if_ndg block
1497 }
1498
1499}
1500
1501
1502std::string EvtDecay::getModel(EvtParticle *par, int mode){
1503 EvtDecayBase* thedecay = EvtDecayTable::gettheDecay(par->getId(),mode);
1504 return thedecay->getModelName();
1505}
1506
1507std::string EvtDecay::getModel(EvtParticle *par){
1508 int mode = par->getChannel();
1509 EvtDecayBase* thedecay = EvtDecayTable::gettheDecay(par->getId(),mode);
1510 return thedecay->getModelName();
1511}
1512
1513
1514void EvtDecay::ReadTruth(EvtParticle* part,std::vector<std::vector<string> > mylist){
1515 if(mylist.size()<2) {std::cout<<" Empty list"<<std::endl;abort();}
1516 EvtVector4R vp1;
1517 for(int k=0;k<mylist[0].size();k++){
1518 if(part->getId()==EvtPDL::getId(mylist[0][k])){
1519 if(part->getDaug(1)->getId()==EvtPDL::getId("vhdr")){part=part->getDaug(1);continue;}
1520 for(int i=1;i<mylist.size();i++){
1521 EvtParticle* mypart=part;
1522 for(int j=0;j<mylist[i].size();j++){
1523 mypart=mypart->getDaug(atoi(mylist[i][j].c_str()));
1524 //std::cout<<atoi(mylist[i][j].c_str());
1525 }
1526 //std::cout<<std::endl;
1527 std::cout<<EvtPDL::name(mypart->getId())<<std::endl;
1528 vp1=mypart->getP4Lab();
1529 if( !isNumber(vp1.get(0)) ) {part->printTree(); abort();}
1530 std::cout<<"truth "<<vp1.get(0)<<" "<<vp1.get(1)<<" "<<vp1.get(2)<<" "<<vp1.get(3)<<std::endl;
1531 }
1532 }
1533 }
1534}
1535
1536int EvtDecay::isNumber(double d){return (d==d);}//if d=nan, return 0, otherwise, return 1
1537
1538#include "../user/Lenu.inc"
double mass
int runNo
Definition: DQA_TO_DB.cxx:12
Double_t x[10]
int fst[50]
Definition: EvtDecay.cxx:76
int nchr
Definition: EvtDecay.cxx:68
int nchr_mu
Definition: EvtDecay.cxx:70
int nchr_pi
Definition: EvtDecay.cxx:71
int N_gamma
Definition: EvtDecay.cxx:74
int nchr_k
Definition: EvtDecay.cxx:72
int N_gammaFSR
Definition: EvtDecay.cxx:75
int nchr_p
Definition: EvtDecay.cxx:73
int nchr_e
Definition: EvtDecay.cxx:69
XmlRpcServer s
Definition: HelloServer.cpp:11
*************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
void setDecayCard(string card)
Definition: DataInfoSvc.cxx:50
double random()
Definition: EvtDecay.cxx:1111
EvtBesRandom(HepRandomEngine *engine)
Definition: EvtDecay.cxx:1102
virtual ~EvtBesRandom()
Definition: EvtDecay.cxx:1108
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
std::string getModelName()
Definition: EvtDecayBase.hh:76
static EvtDecayBase * gettheDecay(EvtId parent, int imode)
EvtDecay(const string &name, ISvcLocator *pSvcLocator)
Definition: EvtDecay.cxx:79
DataInfoSvc * dataInfoSvc
Definition: EvtDecay.h:75
IDataInfoSvc * tmpInfoSvc
Definition: EvtDecay.h:74
StatusCode initialize()
Definition: EvtDecay.cxx:129
StatusCode finalize()
Definition: EvtDecay.cxx:944
StatusCode execute()
Definition: EvtDecay.cxx:322
Definition: EvtGen.hh:46
void readUDecay(const char *const udecay_name)
Definition: EvtGen.cc:126
void generateDecay(int stdhepid, EvtVector4R P, EvtVector4R D, EvtStdHep *evtStdHep, EvtSpinDensity *spinDensity=0)
Definition: EvtGen.cc:152
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 HReweight()
Definition: EvtHis2F.cc:137
void init()
Definition: EvtHis2F.cc:98
double getYup()
Definition: EvtHis2F.hh:69
bool AR(double xmass2, double ymass2)
Definition: EvtHis2F.cc:205
void HFill(double xmass2, double ymass2)
Definition: EvtHis2F.cc:129
void setHTitle(const char *htitle)
Definition: EvtHis2F.cc:40
double getYlow()
Definition: EvtHis2F.hh:67
void setZmax()
Definition: EvtHis2F.cc:177
double getXup()
Definition: EvtHis2F.hh:68
double getXlow()
Definition: EvtHis2F.hh:66
void setFile(const char *dtfile)
Definition: EvtHis2F.cc:35
Definition: EvtId.hh:27
static int getStdHep(EvtId id)
Definition: EvtPDL.hh:56
static void reSetMass(EvtId i, double mass)
Definition: EvtPDL.hh:68
static EvtId evtIdFromStdHep(int stdhep)
Definition: EvtPDL.cc:244
static std::string name(EvtId i)
Definition: EvtPDL.hh:64
static double getMass(EvtId i)
Definition: EvtPDL.hh:46
static EvtId getId(const std::string &name)
Definition: EvtPDL.cc:287
static EvtParticle * particleFactory(EvtSpinType::spintype spinType)
EvtVector4R getP4Lab()
Definition: EvtParticle.cc:685
EvtId getId() const
Definition: EvtParticle.cc:113
void setVectorSpinDensity()
Definition: EvtParticle.cc:138
void setPolarizedSpinDensity(double r00, double r11, double r22)
Definition: EvtParticle.cc:157
EvtSpinType::spintype getSpinType() const
Definition: EvtParticle.cc:115
const EvtVector4R & getP4() const
Definition: EvtParticle.cc:121
void printTree() const
Definition: EvtParticle.cc:897
int getGeneratorFlag()
Definition: EvtParticle.hh:146
int getNDaug() const
Definition: EvtParticle.cc:125
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
EvtVector4R get4Pos()
Definition: EvtParticle.cc:706
int getChannel() const
Definition: EvtParticle.cc:123
std::string writeTreeRec(std::string) const
Definition: EvtParticle.cc:930
void deleteTree()
Definition: EvtParticle.cc:557
static double Flat()
Definition: EvtRandom.cc:73
double mass() const
Definition: EvtVector4R.cc:39
double get(int i) const
Definition: EvtVector4R.hh:179
double d3mag() const
Definition: EvtVector4R.cc:186
virtual void setGenseed(long)=0
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.
char * c_str(Index i)
Definition: EvtCyclic3.cc:252
const double hc
Definition: TConstant.h:41