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