1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 ///////////////////////////////////////////////////////////////////////////
16 // Implementation of AliDecayer using EvtGen package. //
18 // Giuseppe E. Bruno & Fiorella Fionda //
19 // (Giuseppe.Bruno@ba.infn.it) (Fiorella.Fionda@ba.infn.it) //
20 ///////////////////////////////////////////////////////////////////////////
23 #include <TDatabasePDG.h>
24 #include <TParticle.h>
25 #include <TClonesArray.h>
26 #include <TLorentzVector.h>
28 #include "EvtGenBase/EvtStdHep.hh"
29 #include "EvtGenBase/EvtRandomEngine.hh"
30 #include "EvtGen/EvtGen.hh"
31 #include "EvtGenBase/EvtParticle.hh"
32 #include "EvtGenBase/EvtPDL.hh"
33 #include "EvtGenBase/EvtParticleFactory.hh"
34 #include "AliDecayerEvtGen.h"
37 ClassImp(AliDecayerEvtGen)
38 //____________________________________________________________
39 AliDecayerEvtGen::AliDecayerEvtGen():
44 fParticleTablePath(0x0),
47 // Default constructor
48 fEvtstdhep = new EvtStdHep();
49 fDecayTablePath = gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DECAY.DEC"); //default decay table
50 fParticleTablePath = gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/evt.pdl"); //particle table
52 //_________________________________________________________________
53 AliDecayerEvtGen::AliDecayerEvtGen(const AliDecayerEvtGen &decayer):
55 fRandomEngine(decayer.fRandomEngine),
56 fGenerator(decayer.fGenerator),
57 fEvtstdhep(decayer.fEvtstdhep),
58 fDecayTablePath(decayer.fDecayTablePath),
59 fParticleTablePath(decayer.fParticleTablePath),
60 fDecay(decayer.fDecay)
65 //____________________________________________________________
66 AliDecayerEvtGen::~AliDecayerEvtGen()
69 if(fRandomEngine) {delete fRandomEngine;}
71 if(fGenerator) {delete fGenerator;}
73 if(fEvtstdhep) {delete fEvtstdhep;}
75 if(fDecayTablePath) {delete fDecayTablePath;}
77 if(fParticleTablePath) {delete fParticleTablePath;}
78 fParticleTablePath = 0;
81 //___________________________________________________________
82 void AliDecayerEvtGen::Init()
84 //Standard AliDecayerEvtGen initializer:
85 //initialize EvtGen with default decay table (DECAY.DEC), particle table (evt.pdl)
86 //and fRandomEngine for generation of random numbers
89 AliWarning(" AliDecayerEvtGen already initialized!!!!\n");
92 fRandomEngine=new EvtNUMRandomEngine();
93 fGenerator=new EvtGen(fDecayTablePath,fParticleTablePath,fRandomEngine);
95 //____________________________________________________________
96 void AliDecayerEvtGen::Decay(Int_t ipart, TLorentzVector *p)
100 //input: pdg code and momentum of the particle to be decayed
101 //all informations about decay products are stored in fEvtstdhep
103 EvtId IPART=EvtPDL::evtIdFromStdHep(ipart);
104 EvtVector4R p_init=EvtVector4R::EvtVector4R(p->E(),p->Px(),p->Py(),p->Pz());
105 EvtParticle *froot_part=EvtParticleFactory::particleFactory(IPART,p_init);
106 fGenerator->generateDecay(froot_part);
108 froot_part->makeStdHep(*fEvtstdhep);
109 //froot_part->printTree(); //to print the decay chain
110 froot_part->deleteTree();
113 //____________________________________________________________
114 Int_t AliDecayerEvtGen::ImportParticles(TClonesArray *particles)
117 //Input: pointer to a TClonesArray - Output(Int_t): number of decay products
118 //Put all the informations about the decay products in the
119 //TClonesArray particles
121 if (particles == 0) return 0;
122 TClonesArray &clonesParticles = *particles;
123 clonesParticles.Clear();
132 Int_t npart=fEvtstdhep->getNPart();
133 for(int i=0;i<fEvtstdhep->getNPart();i++){
135 int jmotherfirst=fEvtstdhep->getFirstMother(i)+1;
136 int jmotherlast=fEvtstdhep->getLastMother(i)+1;
137 int jdaugfirst=fEvtstdhep->getFirstDaughter(i)+1;
138 int jdauglast=fEvtstdhep->getLastDaughter(i)+1;
140 partnum=fEvtstdhep->getStdHepID(i);
142 //verify if all particles of decay chain are in the TDatabasePDG
143 TParticlePDG *partPDG = TDatabasePDG::Instance()->GetParticle(partnum);
146 AliWarning("Particle code non known in TDatabasePDG - set pdg = 89");
147 partnum=89; //internal use for unspecified resonance data
150 istat=fEvtstdhep->getIStat(i);
152 if(istat!=1 && istat!=2) Info("ImportParticles","Attention: unknown status code!");
153 if(istat == 2) istat = 11; //status decayed
155 p4=fEvtstdhep->getP4(i);
156 x4=fEvtstdhep->getX4(i);
167 AliDebug(1,Form("partnum = %d istat = %d primaMadre = %d ultimaMadre = %d primaF = %d ultimaF=%d x=%f y=%f z=%f t=%f e=%f px=%f \n",partnum,istat,jmotherfirst,jmotherlast,jdaugfirst,jdauglast,x,y,z,t,e,px));
169 new(clonesParticles[i]) TParticle(partnum,istat,jmotherfirst,-1,jdaugfirst,jdauglast,px,py,pz,e,x,y,z,t);
171 //set polarization!!!
178 void AliDecayerEvtGen::Copy(TObject &) const
181 // Copy *this onto AliDecayerEvtGen -- not implemented
183 Fatal("Copy","Not implemented!\n");
186 void AliDecayerEvtGen::ForceDecay()
189 // Intupt: none - Output: none
190 // Set the decay mode to decay particles: for each case is read a
191 // different decay table. case kAll read the default decay table only
193 Decay_t decay = fDecay;
198 case kBJpsiDiElectron:
199 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOJPSITOELE.DEC"));
202 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOJPSI.DEC"));
205 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOJPSITOMU.DEC"));
207 case kBSemiElectronic:
208 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOELE.DEC"));
211 case kChiToJpsiGammaToMuonMuon:
212 case kChiToJpsiGammaToElectronElectron:
216 case kSemiElectronic:
218 case kBPsiPrimeDiMuon:
224 case kWToCharmToMuon:
228 case kHadronicDWithout4Bodies:
235 case kBPsiPrimeDiElectron:
236 AliWarning(Form("Warning: case %s not implemented for this class!",(Char_t)decay));
242 Float_t AliDecayerEvtGen::GetPartialBranchingRatio(Int_t)
244 // This method is dummy
248 Float_t AliDecayerEvtGen::GetLifetime(Int_t kf)
251 //Input: pdg code of a particle
252 //return lifetime in sec for a particle with particle code kf
254 EvtId IdPart=EvtPDL::evtIdFromStdHep(kf);
255 Double_t lifetime = EvtPDL::getctau(IdPart); //c*tau (mm)
256 AliDebug(1,Form("lifetime is %f (mum) , particle id= %d",lifetime*1000,kf));
257 return lifetime*kconv; //tau (sec)
260 void AliDecayerEvtGen::ReadDecayTable()
262 //Input none - Output none
263 //Read the decay table that correspond to the path
266 TString temp = fDecayTablePath;
267 if(!temp.EndsWith("DECAY.DEC"))
268 fGenerator->readUDecay(fDecayTablePath);
270 ////////////////////////////////////////////////////////////
271 Bool_t AliDecayerEvtGen::SetDecayTablePath(Char_t *path)
274 //Set the path of the decay table read to force particle decays
276 if(gSystem->AccessPathName(path))
278 AliWarning("Attention: This path not exist!\n");
281 fDecayTablePath = path;