]>
Commit | Line | Data |
---|---|---|
4c039060 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | /* | |
17 | $Log$ | |
65fb704d | 18 | Revision 1.8 2000/10/02 15:20:40 morsch |
19 | Direct reference to default input file removed. | |
20 | ||
3459d6b6 | 21 | Revision 1.7 2000/06/30 12:19:07 morsch |
22 | Type of fFileName changed to TString, fp has been !-ed. | |
23 | ||
bd1cece1 | 24 | Revision 1.6 2000/06/09 20:36:01 morsch |
25 | All coding rule violations except RS3 corrected | |
26 | ||
f87cfe57 | 27 | Revision 1.5 1999/11/03 17:43:20 fca |
28 | New version from G.Martinez & A.Morsch | |
29 | ||
886b6f73 | 30 | Revision 1.4 1999/09/29 09:24:14 fca |
31 | Introduction of the Copyright and cvs Log | |
32 | ||
4c039060 | 33 | */ |
34 | ||
fe4da5cc | 35 | #include "AliGenHalo.h" |
fe4da5cc | 36 | #include "AliRun.h" |
c5970876 | 37 | #include "AliPDG.h" |
38 | ||
1578254f | 39 | #include <TDatabasePDG.h> |
fe4da5cc | 40 | #include <stdlib.h> |
f87cfe57 | 41 | |
fe4da5cc | 42 | ClassImp(AliGenHalo) |
43 | AliGenHalo::AliGenHalo() | |
44 | :AliGenerator(-1) | |
45 | { | |
f87cfe57 | 46 | // Constructor |
fe4da5cc | 47 | fName="Halo"; |
48 | fTitle="Halo from LHC Tunnel"; | |
fe4da5cc | 49 | // |
50 | // Read all particles | |
51 | fNpart=-1; | |
52 | fp=0; | |
53 | } | |
54 | ||
55 | AliGenHalo::AliGenHalo(Int_t npart) | |
56 | :AliGenerator(npart) | |
57 | { | |
f87cfe57 | 58 | // Constructor |
fe4da5cc | 59 | fName="Halo"; |
60 | fTitle="Halo from LHC Tunnel"; | |
fe4da5cc | 61 | // |
62 | // Read all particles | |
63 | fNpart=-1; | |
64 | fp=0; | |
65 | } | |
66 | ||
f87cfe57 | 67 | AliGenHalo::AliGenHalo(const AliGenHalo & Halo) |
68 | { | |
69 | // copy constructor | |
70 | } | |
71 | ||
72 | ||
fe4da5cc | 73 | //____________________________________________________________ |
74 | AliGenHalo::~AliGenHalo() | |
75 | { | |
f87cfe57 | 76 | // Destructor |
fe4da5cc | 77 | } |
78 | ||
79 | //____________________________________________________________ | |
80 | void AliGenHalo::Init() | |
f87cfe57 | 81 | { |
82 | // Initialisation | |
83 | } | |
fe4da5cc | 84 | |
85 | //____________________________________________________________ | |
86 | void AliGenHalo::Generate() | |
87 | { | |
f87cfe57 | 88 | // Generate from input file |
fe4da5cc | 89 | FILE *fp = fopen(fFileName,"r"); |
90 | if (fp) { | |
bd1cece1 | 91 | printf("\n File %s opened for reading ! \n ", (char*) &fFileName); |
fe4da5cc | 92 | } else { |
bd1cece1 | 93 | printf("\n Opening of file %s failed ! \n ", (char*) &fFileName); |
fe4da5cc | 94 | } |
95 | // | |
96 | // MARS particle codes | |
f87cfe57 | 97 | const Int_t kmars[12]={0,kProton,kNeutron,kPiPlus,kPiMinus,kKPlus,kKMinus, |
1578254f | 98 | kMuonPlus,kMuonMinus,kGamma,kElectron,kPositron}; |
fe4da5cc | 99 | |
100 | Float_t polar[3]= {0,0,0}; | |
101 | Float_t origin[3]; | |
102 | Float_t p[3], p0; | |
103 | Float_t ekin, wgt, tx, ty, tz, txy; | |
1578254f | 104 | Float_t amass; |
fe4da5cc | 105 | // |
1578254f | 106 | Int_t ipart, ncols, nt; |
fe4da5cc | 107 | |
108 | Int_t nread=0; | |
109 | origin[2]=2650; | |
110 | ||
111 | while(1) { | |
112 | ncols = fscanf(fp,"%i %f %f %f %f %f %f", | |
113 | &ipart, &ekin, &wgt, | |
114 | &origin[0], &origin[1], | |
115 | &tx, &ty); | |
116 | if (ncols < 0) break; | |
117 | nread++; | |
118 | if (fNpart !=-1 && nread > fNpart) break; | |
f87cfe57 | 119 | ipart = kmars[ipart]; |
1578254f | 120 | amass = TDatabasePDG::Instance()->GetParticle(ipart)->Mass(); |
fe4da5cc | 121 | p0=sqrt(ekin*ekin + 2.*amass); |
122 | ||
123 | txy=TMath::Sqrt(tx*tx+ty*ty); | |
124 | if (txy == 1.) { | |
125 | tz=0; | |
126 | } else { | |
127 | tz=-TMath::Sqrt(1.-txy); | |
128 | } | |
129 | p[0]=p0*tx; | |
130 | p[1]=p0*ty; | |
131 | p[2]=p0*tz; | |
132 | fParentWeight=wgt; | |
65fb704d | 133 | gAlice->SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,kPNoProcess,nt,fParentWeight); |
134 | // gAlice->SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo+",nt,fParentWeight); | |
fe4da5cc | 135 | origin[2]=-origin[2]; |
136 | p[2]=-p[2]; | |
65fb704d | 137 | gAlice->SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,kPNoProcess,nt,fParentWeight); |
138 | // gAlice->SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo-",nt,fParentWeight); | |
fe4da5cc | 139 | origin[2]=-origin[2]; |
140 | p[2]=-p[2]; | |
141 | } | |
142 | } | |
143 | ||
144 | ||
f87cfe57 | 145 | AliGenHalo& AliGenHalo::operator=(const AliGenHalo& rhs) |
146 | { | |
147 | // Assignment operator | |
148 | return *this; | |
149 | } | |
150 | ||
fe4da5cc | 151 | |
152 | ||
153 | ||
154 | ||
155 | ||
156 | ||
157 |