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 // Read background particles from a boundary source
19 // Very specialized generator to simulate background from beam halo.
20 // The input file is a text file specially prepared
22 // Author: andreas.morsch@cern.ch
26 #include <TDatabasePDG.h>
30 #include "AliGenHaloProtvino.h"
33 ClassImp(AliGenHaloProtvino)
35 AliGenHaloProtvino::AliGenHaloProtvino()
40 fName = "HaloProtvino";
41 fTitle = "Halo from LHC Tunnel";
53 AliGenHaloProtvino::AliGenHaloProtvino(Int_t npart)
58 fTitle= "Halo from LHC Tunnel";
69 AliGenHaloProtvino::AliGenHaloProtvino(const AliGenHaloProtvino & HaloProtvino):
70 AliGenerator(HaloProtvino)
73 HaloProtvino.Copy(*this);
77 //____________________________________________________________
78 AliGenHaloProtvino::~AliGenHaloProtvino()
83 //____________________________________________________________
84 void AliGenHaloProtvino::Init()
87 fFile = fopen(fFileName,"r");
89 printf("\n File %s opened for reading, %p ! \n ", fFileName.Data(), fFile);
91 printf("\n Opening of file %s failed, %p ! \n ", fFileName.Data(), fFile);
96 // Read file with gas pressure values
99 name = gSystem->ExpandPathName("$(ALICE_ROOT)/LHC/gasPressure.dat" );
100 FILE* file = fopen(name, "r");
107 for (i = 0; i < 21; i++)
109 fscanf(file, "%f %f %f %f %f %f", &z,
110 &fG1[i][0], &fG1[i][1], &fG1[i][2], &fG1[i][3], &fG1[i][4]);
112 fZ1[i] = fZ1[i-1] + z;
120 for (i = 0; i < 21; i++)
122 fscanf(file, "%f %f %f %f %f %f", &z,
123 &fG2[i][0], &fG2[i][1], &fG2[i][2], &fG2[i][3], &fG2[i][4]);
125 fZ2[i] = fZ2[i-1] + z;
131 // Transform into interaction rates
133 const Float_t kCrossSection = 0.094e-28; // m^2
134 Float_t pFlux[5] = {0.2, 0.2, 0.3, 0.3, 1.0};
136 for (j = 0; j < 5; j++) {
137 pFlux[j] *= 1.e11/25.e-9;
138 for (i = 0; i < 21; i++)
140 fG1[i][j] = fG1[i][j] * kCrossSection * pFlux[j]; // 1/m/s
141 fG2[i][j] = fG2[i][j] * kCrossSection * pFlux[j]; // 1/m/s
149 for (Int_t i = 0; i < 300; i++) {
150 Float_t z = 20.+i*1.;
152 Float_t wgt1 = GassPressureWeight(z);
153 Float_t wgt2 = GassPressureWeight(-z);
154 // printf("weight: %f %f %f %f %f \n", z, wgt1, wgt2, fZ1[20], fZ2[20]);
160 printf("\n %f %f \n \n", sum1, sum2);
163 //____________________________________________________________
164 void AliGenHaloProtvino::Generate()
166 // Generate from input file
168 Float_t polar[3]= {0,0,0};
178 Float_t* zPrimary = new Float_t [fNpart];
179 Int_t * inuc = new Int_t [fNpart];
180 Int_t * ipart = new Int_t [fNpart];
181 Float_t* wgt = new Float_t [fNpart];
182 Float_t* ekin = new Float_t [fNpart];
183 Float_t* vx = new Float_t [fNpart];
184 Float_t* vy = new Float_t [fNpart];
185 Float_t* tx = new Float_t [fNpart];
186 Float_t* ty = new Float_t [fNpart];
188 Float_t zVertexOld = -1.e10;
189 Int_t nInt = 0; // Counts number of interactions
193 // Load event into array
195 ncols = fscanf(fFile,"%f %d %d %f %f %f %f %f %f",
196 &zPrimary[nread], &inuc[nread], &ipart[nread], &wgt[nread],
197 &ekin[nread], &vx[nread], &vy[nread],
198 &tx[nread], &ty[nread]);
200 if (ncols < 0) break;
201 // Skip fNskip events
203 if (fNpart !=-1 && nskip <= fNskip) continue;
204 // Count interactions
205 if (zPrimary[nread] != zVertexOld) {
207 zVertexOld = zPrimary[nread];
211 if (fNpart !=-1 && nread > fNpart) break;
214 // Mean time between interactions
216 Float_t dT = fTimePerEvent/nInt; // sec
217 Float_t t = 0; // sec
220 // Loop over primaries
225 for (Int_t nprim = 0; nprim < fNpart; nprim++)
227 amass = TDatabasePDG::Instance()->GetParticle(ipart[nprim])->Mass();
232 p0=sqrt(ekin[nprim]*ekin[nprim] + 2.*amass*ekin[nprim]);
234 txy=TMath::Sqrt(tx[nprim]*tx[nprim]+ty[nprim]*ty[nprim]);
238 tz=-TMath::Sqrt(1.-txy);
245 origin[0] = vx[nprim];
246 origin[1] = vy[nprim];
253 Float_t originP[3] = {0., 0., 0.};
254 originP[2] = zPrimary[nprim];
256 Float_t pP[3] = {0., 0., 0.};
260 originP[2] = -zPrimary[nprim];
261 origin[2] = -origin[2];
268 if (zPrimary[nprim] != zVertexOld) {
269 while(arg==0.) arg = gRandom->Rndm();
270 t -= dT*TMath::Log(arg); // (sec)
271 zVertexOld = zPrimary[nprim];
274 // Get statistical weight according to local gas-pressure
276 fParentWeight=wgt[nprim]*GassPressureWeight(zPrimary[nprim]);
278 if (!fAnalog || gRandom->Rndm() < fParentWeight) {
279 // Pass parent particle
281 PushTrack(0,-1,kProton,pP,originP,polar,t,kPNoProcess,ntP, fParentWeight);
283 PushTrack(fTrackIt,ntP,ipart[nprim],p,origin,polar,t,kPNoProcess,nt,fParentWeight);
287 // Both sides are considered
291 fParentWeight=wgt[nprim]*GassPressureWeight(-zPrimary[nprim]);
292 if (!fAnalog || gRandom->Rndm() < fParentWeight) {
293 origin[2] = -origin[2];
294 originP[2] = -originP[2];
296 PushTrack(0,-1,kProton,pP,originP,polar,t,kPNoProcess,ntP, fParentWeight);
298 PushTrack(fTrackIt,ntP,ipart[nprim],p,origin,polar,t,kPNoProcess,nt,fParentWeight);
301 SetHighWaterMark(nt);
315 AliGenHaloProtvino& AliGenHaloProtvino::operator=(const AliGenHaloProtvino& rhs)
317 // Assignment operator
324 Float_t AliGenHaloProtvino::GassPressureWeight(Float_t zPrimary)
327 // Return z-dependent gasspressure weight = interaction rate [1/m/s].
331 Float_t zAbs = TMath::Abs(zPrimary);
334 if (zAbs > fZ1[20]) {
337 for (Int_t i = 1; i < 21; i++) {
339 weight = fG1[i][fRunPeriod];
345 if (zAbs > fZ2[20]) {
348 for (Int_t i = 1; i < 21; i++) {
350 weight = fG2[i][fRunPeriod];
359 void AliGenHaloProtvino::Copy(TObject&) const
364 Fatal("Copy","Not implemented!\n");
369 # Title: README file for the sources of IR8 machine induced background
370 # Author: Vadim Talanov <Vadim.Talanov@cern.ch>
371 # Modified: 12-12-2000
375 There are three files, named ring.one.beta.[01,10,50].m, which
376 contain the lists of background particles, induced by proton losses
377 upstream of IP8 in the LHC ring one, for the beta* values of 1, 10
378 and 50 m, respectively.
382 Each line in the files contains the coordinates of particle track
383 crossing with the infinite plane, positioned at z=-1m, together with
384 the physical properties of corresponding particle, namely:
386 S - S coordinate of the primary interaction vertex, cm;
387 N - type of the gas nuclei at interaction, 1 is H, 2 - C and 3 - O;
388 I - particle ID in PDG particle numbering scheme;
390 E - particle kinetic energy, GeV;
391 X - x coordinate of the crossing point, cm;
392 Y - y coordinate of the crossing point, cm;
393 Dx - x direction cosine;
394 Dy - y direction cosine.
398 Each file is given per unity of linear density of proton inelastic
399 interactions with the gas nuclei, [1 inelastic interaction/m].
401 # ~/vtalanov/public/README.mib: the end.