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 **************************************************************************/
18 Revision 1.5 1999/11/03 17:43:20 fca
19 New version from G.Martinez & A.Morsch
21 Revision 1.4 1999/09/29 09:24:14 fca
22 Introduction of the Copyright and cvs Log
26 #include "AliGenHalo.h"
30 #include <TDatabasePDG.h>
34 AliGenHalo::AliGenHalo()
39 fTitle="Halo from LHC Tunnel";
40 // Set the default file
41 fFileName="~/marsip/marsip5.mu";
48 AliGenHalo::AliGenHalo(Int_t npart)
53 fTitle="Halo from LHC Tunnel";
54 // Set the default file
55 fFileName="~/marsip/marsip5.mu";
62 AliGenHalo::AliGenHalo(const AliGenHalo & Halo)
68 //____________________________________________________________
69 AliGenHalo::~AliGenHalo()
74 //____________________________________________________________
75 void AliGenHalo::Init()
80 //____________________________________________________________
81 void AliGenHalo::Generate()
83 // Generate from input file
84 FILE *fp = fopen(fFileName,"r");
86 printf("\n File %s opened for reading ! \n ", fFileName);
88 printf("\n Opening of file %s failed ! \n ", fFileName);
91 // MARS particle codes
92 const Int_t kmars[12]={0,kProton,kNeutron,kPiPlus,kPiMinus,kKPlus,kKMinus,
93 kMuonPlus,kMuonMinus,kGamma,kElectron,kPositron};
95 Float_t polar[3]= {0,0,0};
98 Float_t ekin, wgt, tx, ty, tz, txy;
101 Int_t ipart, ncols, nt;
107 ncols = fscanf(fp,"%i %f %f %f %f %f %f",
109 &origin[0], &origin[1],
111 if (ncols < 0) break;
113 if (fNpart !=-1 && nread > fNpart) break;
114 ipart = kmars[ipart];
115 amass = TDatabasePDG::Instance()->GetParticle(ipart)->Mass();
116 p0=sqrt(ekin*ekin + 2.*amass);
118 txy=TMath::Sqrt(tx*tx+ty*ty);
122 tz=-TMath::Sqrt(1.-txy);
128 gAlice->SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo+",nt,fParentWeight);
129 origin[2]=-origin[2];
131 gAlice->SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo-",nt,fParentWeight);
132 origin[2]=-origin[2];
138 AliGenHalo& AliGenHalo::operator=(const AliGenHalo& rhs)
140 // Assignment operator