1 #include "AliGenHalo.h"
2 #include "AliGenMUONlib.h"
6 #include <TDirectory.h>
7 #include <TDatabasePDG.h>
12 AliGenHalo::AliGenHalo()
16 fTitle="Halo from LHC Tunnel";
17 // Set the default file
18 fFileName="~/marsip/marsip5.mu";
25 AliGenHalo::AliGenHalo(Int_t npart)
29 fTitle="Halo from LHC Tunnel";
30 // Set the default file
31 fFileName="~/marsip/marsip5.mu";
38 //____________________________________________________________
39 AliGenHalo::~AliGenHalo()
43 //____________________________________________________________
44 void AliGenHalo::Init()
47 //____________________________________________________________
48 void AliGenHalo::Generate()
50 FILE *fp = fopen(fFileName,"r");
52 printf("\n File %s opened for reading ! \n ", fFileName);
54 printf("\n Opening of file %s failed ! \n ", fFileName);
57 // MARS particle codes
58 // const Int_t imars[12]={0,14, 13, 8, 9, 11, 12, 5, 6, 1, 3, 2};
59 const Int_t imars[12]={0,kProton,kNeutron,kPiPlus,kPiMinus,kKPlus,kKMinus,
60 kMuonPlus,kMuonMinus,kGamma,kElectron,kPositron};
62 Float_t polar[3]= {0,0,0};
65 Float_t ekin, wgt, tx, ty, tz, txy;
68 Int_t ipart, ncols, nt;
74 ncols = fscanf(fp,"%i %f %f %f %f %f %f",
76 &origin[0], &origin[1],
80 if (fNpart !=-1 && nread > fNpart) break;
82 amass = TDatabasePDG::Instance()->GetParticle(ipart)->Mass();
83 p0=sqrt(ekin*ekin + 2.*amass);
85 txy=TMath::Sqrt(tx*tx+ty*ty);
89 tz=-TMath::Sqrt(1.-txy);
95 gAlice->SetTrack(1,-1,ipart,p,origin,polar,0,"Halo+",nt,fParentWeight);
98 gAlice->SetTrack(1,-1,ipart,p,origin,polar,0,"Halo-",nt,fParentWeight);