1 #include "StarEvtGenDecayer.h"
3 #include "EvtGenBase/EvtParticle.hh"
4 #include "EvtGenBase/EvtParticleFactory.hh"
6 #include "EvtGenBase/EvtPDL.hh"
7 #include "EvtGenBase/EvtRandom.hh"
9 #include "EvtGenBase/EvtHepMCEvent.hh"
10 #include "EvtGenBase/EvtSimpleRandomEngine.hh"
11 #include "EvtGenBase/EvtMTRandomEngine.hh"
12 #include "EvtGenBase/EvtAbsRadCorr.hh"
13 #include "EvtGenBase/EvtDecayBase.hh"
14 #include "EvtGenExternal/EvtExternalGenList.hh"
17 #include "TParticle.h"
18 #include "TLorentzVector.h"
19 #include "TClonesArray.h"
21 #include "StMessMgr.h"
24 using namespace HepMC;
33 mEvtGenRandomEngine =
new EvtMTRandomEngine(stime);
40 std::list<EvtDecayBase*> extraModels = genList.getListOfModels();
43 TString decay =
"StRoot/StarGenerator/EvtGen1_06_00/DECAY.DEC";
44 TString evt =
"StRoot/StarGenerator/EvtGen1_06_00/evt.pdl";
48 decay =
"$(STAR)/"+decay; decay = gSystem->ExpandPathName( decay.Data() );
49 evt =
"$(STAR)/"+evt; evt = gSystem->ExpandPathName( evt.Data() );
52 mEvtGen =
new EvtGen( decay,
65 delete mEvtGenRandomEngine;
72 void StarEvtGenDecayer::Init()
74 LOG_INFO <<
" Init Done" << endm;
79 LOG_INFO <<
"Decay pdgid=" << pdgId << endm;
88 mEvtGen->generateDecay(mParticle);
99 EvtVector4R p_init(_p->E(), _p->Px(), _p->Py(), _p->Pz());
100 EvtId parentID = EvtPDL::evtIdFromLundKC(pdg);
101 mParticle = EvtParticleFactory::particleFactory(parentID, p_init);
109 TClonesArray &array = *_array;
113 theEvent.constructEvent(mParticle);
116 theEvent.getEvent()->
print(std::cout);
120 Int_t particle_barcode[100];
126 particle_barcode[nparts]=(*part)->barcode();
131 particle_barcode[nparts]=(*part)->barcode();
137 for(Int_t np=0;np<nparts;np++) {
139 int firstmother=0, firstdaughter=0, lastdaughter=0;
140 int firstmother_barcode=-1, firstdaughter_barcode=-1;
145 for(
int i=0;i<nparts;i++) {
146 if(particle_barcode[i]==firstmother_barcode) firstmother=i;
147 if(particle_barcode[i]==firstdaughter_barcode) {
154 new(array[np]) TParticle(p->
pdg_id(), p->
status()==1?11:-11,
156 firstdaughter, lastdaughter,
166 new(array[np]) TParticle(p->
pdg_id(), p->
status()==1?91:-91,
168 firstdaughter, lastdaughter,
180 cout<<np<<
" "<<((TParticle*)array[np])->GetStatusCode()
181 <<
" "<<((TParticle*)array[np])->GetFirstDaughter()
182 <<
" "<<((TParticle*)array[np])->GetLastDaughter()
183 <<
" "<<((TParticle*)array[np])->Vx()
184 <<
" "<<((TParticle*)array[np])->T()<<
" ";
185 ((TParticle*)array[np])->Print();
191 void StarEvtGenDecayer::SetForceDecay(Int_t type)
193 LOG_ERROR <<
"StarEvtGenDecayer::SetForceDecay method is not implemented in this class" <<endm;
196 void StarEvtGenDecayer::ForceDecay()
198 LOG_ERROR <<
"StarEvtGenDecayer::ForceDecay method is not implemented in this class" <<endm;
203 LOG_ERROR <<
"StarEvtGenDecayer::GetPartialBranchingRatio method is not implemented in this class" <<endm;
207 void StarEvtGenDecayer::ReadDecayTable()
209 LOG_ERROR <<
"StarEvtGenDecayer::ReadDecayTable method is not implemented in this class" <<endm;
214 return (EvtPDL::getctau(EvtPDL::evtIdFromLundKC(pdg)) * 3.3333e-12) ;
219 mEvtGen->readUDecay(decayTable);
224 mVertex->set(r->T(),r->X(),r->Y(),r->Z());
StarEvtGenDecayer(EvtGen *evtGen=NULL)
Class constructor.
int pdg_id() const
particle ID
double z() const
return z
std::vector< HepMC::GenParticle * >::const_iterator particles_in_const_iterator
const iterator for incoming particles
int barcode() const
particle barcode
std::vector< HepMC::GenParticle * >::const_iterator particles_out_const_iterator
const iterator for outgoing particles
Float_t GetPartialBranchingRatio(Int_t ipart)
Return the branching ratio for the spdcified PDG ID.
void SetDecayTable(TString decayTable)
Modify EvtGen behavior.
double e() const
return E
double y() const
return y
~StarEvtGenDecayer()
Class destructor.
double px() const
return px
GenVertex * production_vertex() const
pointer to the production vertex
double pz() const
return pz
void ClearEvent()
Clear the event.
int status() const
HEPEVT decay status.
vertex_const_iterator vertices_end() const
end vertex iteration
void SetVertex(TLorentzVector *r)
Modify initial vertex position.
double x() const
return x
Int_t ImportParticles(TClonesArray *particles=0)
Returns the decay products in a TClonesArray of TParticle.
int particles_out_size() const
number of outgoing particles
void Decay(Int_t pdgId, TLorentzVector *p)
Decays the particle specified by PDG id and lorentz vector.
void print(std::ostream &ostr=std::cout) const
dumps to ostr
GenParticle * barcode_to_particle(int barCode) const
assign a barcode to a particle
particles_out_const_iterator particles_out_const_begin() const
begin iteration of outgoing particles
const FourVector & position() const
vertex position and time
const FourVector & momentum() const
standard 4 momentum
void setDiagonalSpinDensity()
vertex_const_iterator vertices_begin() const
begin vertex iteration
Float_t GetLifetime(Int_t pdgid)
Return teh lifetime in seconds for the specified particle.
GenVertex * end_vertex() const
pointer to the decay vertex
double py() const
return py
particles_in_const_iterator particles_in_const_begin() const
begin iteration of incoming particles
double t() const
return t
void AppendParticle(Int_t pdgid, TLorentzVector *p=0)
Add a particle with specified PDG ID to the stack.
The GenParticle class contains information about generated particles.