14ab5373 |
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$ |
05df024b |
18 | Revision 1.3 2001/07/27 17:09:36 morsch |
19 | Use local SetTrack, KeepTrack and SetHighWaterMark methods |
20 | to delegate either to local stack or to stack owned by AliRun. |
21 | (Piotr Skowronski, A.M.) |
22 | |
a99cf51f |
23 | Revision 1.2 2001/06/14 12:15:27 morsch |
24 | Bugs corrected. SetSide() method added. |
25 | |
154d524b |
26 | Revision 1.1 2001/01/23 15:04:33 morsch |
27 | Generator to read beam halo file from Protvino group. |
28 | |
14ab5373 |
29 | */ |
30 | |
31 | // Read background particles from a boundary source |
32 | // Very specialized generator to simulate background from beam halo. |
33 | // The input file is a text file specially prepared |
34 | // for this purpose. |
35 | // Author: andreas.morsch@cern.ch |
36 | |
37 | #include "AliGenHaloProtvino.h" |
38 | #include "AliRun.h" |
39 | #include "AliMC.h" |
40 | #include "AliPDG.h" |
41 | |
42 | #include <TDatabasePDG.h> |
43 | #include <stdlib.h> |
44 | |
45 | ClassImp(AliGenHaloProtvino) |
46 | AliGenHaloProtvino::AliGenHaloProtvino() |
47 | :AliGenerator(-1) |
48 | { |
49 | // Constructor |
154d524b |
50 | printf("\n Calling Default Constructor"); |
51 | |
52 | fName = "HaloProtvino"; |
53 | fTitle = "Halo from LHC Tunnel"; |
14ab5373 |
54 | // |
55 | // Read all particles |
154d524b |
56 | fNpart = -1; |
57 | fFile = 0; |
58 | fSide = 1; |
14ab5373 |
59 | } |
60 | |
61 | AliGenHaloProtvino::AliGenHaloProtvino(Int_t npart) |
62 | :AliGenerator(npart) |
63 | { |
64 | // Constructor |
154d524b |
65 | printf("\n Calling Constructor"); |
66 | fName = "Halo"; |
67 | fTitle= "Halo from LHC Tunnel"; |
14ab5373 |
68 | // |
154d524b |
69 | fNpart = npart; |
70 | fFile = 0; |
71 | fSide = 1; |
14ab5373 |
72 | } |
73 | |
74 | AliGenHaloProtvino::AliGenHaloProtvino(const AliGenHaloProtvino & HaloProtvino) |
75 | { |
76 | // copy constructor |
77 | } |
78 | |
79 | |
80 | //____________________________________________________________ |
81 | AliGenHaloProtvino::~AliGenHaloProtvino() |
82 | { |
83 | // Destructor |
84 | } |
85 | |
86 | //____________________________________________________________ |
87 | void AliGenHaloProtvino::Init() |
88 | { |
89 | // Initialisation |
154d524b |
90 | fFile = fopen(fFileName,"r"); |
91 | if (fFile) { |
92 | printf("\n File %s opened for reading, %p ! \n ", fFileName.Data(), fFile); |
93 | } else { |
94 | printf("\n Opening of file %s failed, %p ! \n ", fFileName.Data(), fFile); |
95 | } |
14ab5373 |
96 | } |
97 | |
98 | //____________________________________________________________ |
99 | void AliGenHaloProtvino::Generate() |
100 | { |
101 | // Generate from input file |
14ab5373 |
102 | |
103 | Float_t polar[3]= {0,0,0}; |
104 | Float_t origin[3]; |
105 | Float_t p[3], p0; |
106 | Float_t ekin, wgt, tx, ty, tz, txy; |
107 | Float_t zPrimary; |
108 | Float_t amass; |
109 | Int_t inuc; |
110 | // |
111 | Int_t ipart, ncols, nt; |
05df024b |
112 | Int_t nskip = 0; |
154d524b |
113 | Int_t nread = 0; |
14ab5373 |
114 | while(1) { |
154d524b |
115 | ncols = fscanf(fFile,"%f %d %d %f %f %f %f %f %f", |
14ab5373 |
116 | &zPrimary, &inuc, &ipart, &wgt, |
117 | &ekin, &origin[0], &origin[1], |
118 | &tx, &ty); |
154d524b |
119 | /* |
14ab5373 |
120 | printf(" \n %f %d %d %f %f %f %f %f %f", |
05df024b |
121 | zPrimary, inuc, ipart, wgt, |
122 | ekin, origin[0], origin[1], |
123 | tx, ty); |
154d524b |
124 | */ |
05df024b |
125 | |
14ab5373 |
126 | if (ncols < 0) break; |
154d524b |
127 | |
05df024b |
128 | nskip++; |
129 | if (fNpart !=-1 && nskip <= fNskip) continue; |
130 | |
131 | nread++; |
14ab5373 |
132 | if (fNpart !=-1 && nread > fNpart) break; |
133 | |
14ab5373 |
134 | amass = TDatabasePDG::Instance()->GetParticle(ipart)->Mass(); |
135 | |
136 | // |
137 | // Momentum vector |
138 | // |
05df024b |
139 | p0=sqrt(ekin*ekin + 2.*amass*ekin); |
14ab5373 |
140 | |
141 | txy=TMath::Sqrt(tx*tx+ty*ty); |
142 | if (txy == 1.) { |
143 | tz=0; |
144 | } else { |
145 | tz=-TMath::Sqrt(1.-txy); |
146 | } |
147 | |
148 | p[0]=p0*tx; |
149 | p[1]=p0*ty; |
154d524b |
150 | p[2]=-p0*tz; |
05df024b |
151 | |
152 | origin[2] = -2196.5; |
14ab5373 |
153 | |
154 | // |
155 | // |
156 | // Particle weight |
157 | |
154d524b |
158 | Float_t originP[3] = {0., 0., 0.}; |
159 | originP[2] = zPrimary; |
160 | |
161 | Float_t pP[3] = {0., 0., 0.}; |
162 | Int_t ntP; |
163 | |
164 | if (fSide == -1) { |
165 | originP[2] = -zPrimary; |
166 | origin[2] = -origin[2]; |
167 | p[2] = -p[2]; |
168 | } |
05df024b |
169 | |
a99cf51f |
170 | SetTrack(0,-1,kProton,pP,originP,polar,0,kPNoProcess,ntP); |
171 | KeepTrack(ntP); |
14ab5373 |
172 | fParentWeight=wgt*GassPressureWeight(zPrimary); |
a99cf51f |
173 | SetTrack(fTrackIt,ntP,ipart,p,origin,polar,0,kPNoProcess,nt,fParentWeight); |
174 | SetHighWaterMark(nt); |
154d524b |
175 | |
14ab5373 |
176 | // |
177 | // Assume particles come from two directions with same probability |
154d524b |
178 | |
05df024b |
179 | // Both Side are considered |
180 | if (fSide > 1) { |
181 | origin[2]=-origin[2]; |
182 | p[2]=-p[2]; |
183 | fParentWeight=wgt*GassPressureWeight(-zPrimary); |
184 | SetTrack(fTrackIt,ntP,ipart,p,origin,polar,0,kPNoProcess,nt,fParentWeight); |
185 | } |
186 | |
14ab5373 |
187 | } |
188 | } |
189 | |
190 | |
191 | AliGenHaloProtvino& AliGenHaloProtvino::operator=(const AliGenHaloProtvino& rhs) |
192 | { |
193 | // Assignment operator |
194 | return *this; |
195 | } |
196 | |
197 | |
198 | Float_t AliGenHaloProtvino::GassPressureWeight(Float_t zPrimary) |
199 | { |
200 | // Return z-dependent gasspressure weight |
201 | // |
154d524b |
202 | Float_t weight = 500.; |
203 | |
204 | if (zPrimary > 45000.) weight = 2.e4; |
205 | |
206 | return weight; |
14ab5373 |
207 | } |
208 | |
209 | /* |
210 | # Title: README file for the sources of IR8 machine induced background |
211 | # Author: Vadim Talanov <Vadim.Talanov@cern.ch> |
212 | # Modified: 12-12-2000 |
213 | |
214 | 0. Overview |
215 | |
216 | There are three files, named ring.one.beta.[01,10,50].m, which |
217 | contain the lists of background particles, induced by proton losses |
218 | upstream of IP8 in the LHC ring one, for the beta* values of 1, 10 |
219 | and 50 m, respectively. |
220 | |
221 | 1. File contents |
222 | |
223 | Each line in the files contains the coordinates of particle track |
224 | crossing with the infinite plane, positioned at z=-1m, together with |
225 | the physical properties of corresponding particle, namely: |
226 | |
227 | S - S coordinate of the primary interaction vertex, cm; |
228 | N - type of the gas nuclei at interaction, 1 is H, 2 - C and 3 - O; |
229 | I - particle ID in PDG particle numbering scheme; |
230 | W - particle weight; |
231 | E - particle kinetic energy, GeV; |
232 | X - x coordinate of the crossing point, cm; |
233 | Y - y coordinate of the crossing point, cm; |
234 | Dx - x direction cosine; |
235 | Dy - y direction cosine. |
236 | |
237 | 2. Normalisation |
238 | |
239 | Each file is given per unity of linear density of proton inelastic |
240 | interactions with the gas nuclei, [1 inelastic interaction/m]. |
241 | |
242 | # ~/vtalanov/public/README.mib: the end. |
243 | |
244 | */ |
245 | |
246 | |
247 | |
248 | |