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 "EvtGenBase/EvtStdlibRandomEngine.hh"
31 #include "EvtGen/EvtGen.hh"
32 #include "EvtGenBase/EvtParticle.hh"
33 #include "EvtGenBase/EvtPDL.hh"
34 #include "EvtGenBase/EvtParticleFactory.hh"
35 #include "AliDecayerEvtGen.h"
36 #include "EvtGenExternal/EvtExternalGenList.hh"
37 #include "EvtGenBase/EvtAbsRadCorr.hh"
40 ClassImp(AliDecayerEvtGen)
41 //____________________________________________________________
42 AliDecayerEvtGen::AliDecayerEvtGen():
48 fParticleTablePath(0x0),
51 // Default constructor
52 fEvtstdhep = new EvtStdHep();
53 fDecayTablePath = gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DECAY.DEC"); //default decay table
54 fParticleTablePath = gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/evt.pdl"); //particle table
56 //_________________________________________________________________
57 AliDecayerEvtGen::AliDecayerEvtGen(const AliDecayerEvtGen &decayer):
59 fRandomEngine(decayer.fRandomEngine),
60 fGenerator(decayer.fGenerator),
61 fEvtstdhep(decayer.fEvtstdhep),
62 fDecayTablePath(decayer.fDecayTablePath),
63 fParticleTablePath(decayer.fParticleTablePath),
64 fDecay(decayer.fDecay)
69 //____________________________________________________________
70 AliDecayerEvtGen::~AliDecayerEvtGen()
73 if(fRandomEngine) {delete fRandomEngine;}
75 if(fRadCorrEngine) {delete fRadCorrEngine;}
77 if(fGenerator) {delete fGenerator;}
79 if(fEvtstdhep) {delete fEvtstdhep;}
81 if(fDecayTablePath) {delete fDecayTablePath;}
83 if(fParticleTablePath) {delete fParticleTablePath;}
84 fParticleTablePath = 0;
87 //___________________________________________________________
88 void AliDecayerEvtGen::Init()
90 //Standard AliDecayerEvtGen initializer:
91 //initialize EvtGen with default decay table (DECAY.DEC), particle table (evt.pdl)
92 //and fRandomEngine for generation of random numbers
95 AliWarning(" AliDecayerEvtGen already initialized!!!!\n");
98 fRandomEngine = new EvtStdlibRandomEngine();
99 std::list<EvtDecayBase*> extraModels;
101 EvtExternalGenList genList;
102 fRadCorrEngine = genList.getPhotosModel();
103 extraModels = genList.getListOfModels();
105 fGenerator=new EvtGen(fDecayTablePath,fParticleTablePath,fRandomEngine,fRadCorrEngine,&extraModels);
107 //____________________________________________________________
108 void AliDecayerEvtGen::Decay(Int_t ipart, TLorentzVector *p)
112 //input: pdg code and momentum of the particle to be decayed
113 //all informations about decay products are stored in fEvtstdhep
115 EvtId IPART=EvtPDL::evtIdFromStdHep(ipart);
116 EvtVector4R p_init(p->E(),p->Px(),p->Py(),p->Pz());
117 EvtParticle *froot_part=EvtParticleFactory::particleFactory(IPART,p_init);
118 fGenerator->generateDecay(froot_part);
120 froot_part->makeStdHep(*fEvtstdhep);
121 froot_part->printTree(); //to print the decay chain
122 froot_part->deleteTree();
125 //____________________________________________________________
126 Int_t AliDecayerEvtGen::ImportParticles(TClonesArray *particles)
129 //Input: pointer to a TClonesArray - Output(Int_t): number of decay products
130 //Put all the informations about the decay products in the
131 //TClonesArray particles
133 if (particles == 0) return 0;
134 TClonesArray &clonesParticles = *particles;
135 clonesParticles.Clear();
144 Int_t npart=fEvtstdhep->getNPart();
145 for(int i=0;i<fEvtstdhep->getNPart();i++){
147 int jmotherfirst=fEvtstdhep->getFirstMother(i)+1;
148 int jmotherlast=fEvtstdhep->getLastMother(i)+1;
149 int jdaugfirst=fEvtstdhep->getFirstDaughter(i)+1;
150 int jdauglast=fEvtstdhep->getLastDaughter(i)+1;
152 partnum=fEvtstdhep->getStdHepID(i);
154 //verify if all particles of decay chain are in the TDatabasePDG
155 TParticlePDG *partPDG = TDatabasePDG::Instance()->GetParticle(partnum);
158 AliWarning("Particle code non known in TDatabasePDG - set pdg = 89");
159 partnum=89; //internal use for unspecified resonance data
162 istat=fEvtstdhep->getIStat(i);
164 if(istat!=1 && istat!=2) Info("ImportParticles","Attention: unknown status code!");
165 if(istat == 2) istat = 11; //status decayed
167 p4=fEvtstdhep->getP4(i);
168 x4=fEvtstdhep->getX4(i);
173 const Float_t kconvT=0.001/2.999792458e8; // mm/c to seconds conversion
174 const Float_t kconvL=1./10; // mm to cm conversion
175 x=x4.get(1)*kconvL;//[cm]
176 y=x4.get(2)*kconvL;//[cm]
177 z=x4.get(3)*kconvL;//[cm]
178 t=x4.get(0)*kconvT;//[s]
180 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));
182 new(clonesParticles[i]) TParticle(partnum,istat,jmotherfirst,-1,jdaugfirst,jdauglast,px,py,pz,e,x,y,z,t);
184 //set polarization!!!
191 void AliDecayerEvtGen::Copy(TObject &) const
194 // Copy *this onto AliDecayerEvtGen -- not implemented
196 Fatal("Copy","Not implemented!\n");
199 void AliDecayerEvtGen::ForceDecay()
202 // Intupt: none - Output: none
203 // Set the decay mode to decay particles: for each case is read a
204 // different decay table. case kAll read the default decay table only
206 Decay_t decay = fDecay;
209 case kAll: // particles decayed "naturally" according to $ALICE_ROOT/TEvtGen/EvtGen/DECAY.DEC
211 case kBJpsiDiElectron:
212 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOJPSITOELE.DEC"));
215 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOJPSI.DEC"));
218 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOJPSITOMU.DEC"));
220 case kBSemiElectronic:
221 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOELE.DEC"));
224 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/HADRONICD.DEC"));
226 case kHadronicDWithout4Bodies:
227 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/HADRONICDWITHOUT4BODIES.DEC"));
229 case kChiToJpsiGammaToElectronElectron:
230 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/CHICTOJPSITOELE.DEC"));
232 case kChiToJpsiGammaToMuonMuon:
233 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/CHICTOJPSITOMUON.DEC"));
235 case kSemiElectronic:
236 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BANDCTOELE.DEC"));
239 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOMU.DEC"));
242 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BANDCTOMU.DEC"));
245 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/DIELECTRON.DEC"));
248 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/DIMUON.DEC"));
250 case kBPsiPrimeDiMuon:
251 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOPSIPRIMETODIMUON.DEC"));
253 case kBPsiPrimeDiElectron:
254 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BTOPSIPRIMETODIELECTRON.DEC"));
257 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/JPSIDIMUON.DEC"));
259 case kPsiPrimeJpsiDiElectron:
260 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/PSIPRIMETOJPSITOMU.DEC"));
263 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/PHITOK.DEC"));
266 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/OMEGATOLAMBDAK.DEC"));
269 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/LAMBDATOPROTPI.DEC"));
272 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/HARDMUONS.DEC"));
275 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/ELECTRONEM.DEC"));
278 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/DIELECTRONEM.DEC"));
281 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/GAMMAEM.DEC"));
284 SetDecayTablePath(gSystem->ExpandPathName("$ALICE_ROOT/TEvtGen/EvtGen/DecayTable/BEAUTYUPGRADE.DEC"));
291 case kWToCharmToMuon:
297 case kBJpsiUndecayed:
299 AliWarning(Form("Warning: case %d not implemented for this class!",(int)decay));
305 Float_t AliDecayerEvtGen::GetPartialBranchingRatio(Int_t)
307 // This method is dummy
311 Float_t AliDecayerEvtGen::GetLifetime(Int_t kf)
314 //Input: pdg code of a particle
315 //return lifetime in sec for a particle with particle code kf
317 EvtId IdPart=EvtPDL::evtIdFromStdHep(kf);
318 Double_t lifetime = EvtPDL::getctau(IdPart); //c*tau (mm)
319 AliDebug(1,Form("lifetime is %f (mum) , particle id= %d",lifetime*1000,kf));
320 return lifetime*kconv; //tau (sec)
323 void AliDecayerEvtGen::ReadDecayTable()
325 //Input none - Output none
326 //Read the decay table that correspond to the path
329 TString temp = fDecayTablePath;
330 if(!temp.EndsWith("DECAY.DEC"))
331 fGenerator->readUDecay(fDecayTablePath);
333 ////////////////////////////////////////////////////////////
334 Bool_t AliDecayerEvtGen::SetDecayTablePath(Char_t *path)
337 //Set the path of the decay table read to force particle decays
339 if(gSystem->AccessPathName(path))
341 AliWarning("Attention: This path not exist!\n");
344 fDecayTablePath = path;