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