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)
34 AliGenHaloProtvino::AliGenHaloProtvino()
39 fName = "HaloProtvino";
40 fTitle = "Halo from LHC Tunnel";
52 AliGenHaloProtvino::AliGenHaloProtvino(Int_t npart)
57 fTitle= "Halo from LHC Tunnel";
68 AliGenHaloProtvino::AliGenHaloProtvino(const AliGenHaloProtvino & HaloProtvino)
74 //____________________________________________________________
75 AliGenHaloProtvino::~AliGenHaloProtvino()
80 //____________________________________________________________
81 void AliGenHaloProtvino::Init()
84 fFile = fopen(fFileName,"r");
86 printf("\n File %s opened for reading, %p ! \n ", fFileName.Data(), fFile);
88 printf("\n Opening of file %s failed, %p ! \n ", fFileName.Data(), fFile);
93 // Read file with gas pressure values
96 name = gSystem->ExpandPathName("$(ALICE_ROOT)/LHC/gasPressure.dat" );
97 FILE* file = fopen(name, "r");
104 for (i = 0; i < 21; i++)
106 fscanf(file, "%f %f %f %f %f %f", &z,
107 &fG1[i][0], &fG1[i][1], &fG1[i][2], &fG1[i][3], &fG1[i][4]);
109 fZ1[i] = fZ1[i-1] + z;
117 for (i = 0; i < 21; i++)
119 fscanf(file, "%f %f %f %f %f %f", &z,
120 &fG2[i][0], &fG2[i][1], &fG2[i][2], &fG2[i][3], &fG2[i][4]);
122 fZ2[i] = fZ2[i-1] + z;
128 // Transform into interaction rates
130 const Float_t crossSection = 0.094e-28; // m^2
131 Float_t pFlux[5] = {0.2, 0.2, 0.3, 0.3, 1.0};
133 for (j = 0; j < 5; j++) {
134 pFlux[j] *= 1.e11/25.e-9;
135 for (i = 0; i < 21; i++)
137 fG1[i][j] = fG1[i][j] * crossSection * pFlux[j]; // 1/m/s
138 fG2[i][j] = fG2[i][j] * crossSection * pFlux[j]; // 1/m/s
146 for (Int_t i = 0; i < 300; i++) {
147 Float_t z = 20.+i*1.;
149 Float_t wgt1 = GassPressureWeight(z);
150 Float_t wgt2 = GassPressureWeight(-z);
151 // printf("weight: %f %f %f %f %f \n", z, wgt1, wgt2, fZ1[20], fZ2[20]);
157 printf("\n %f %f \n \n", sum1, sum2);
160 //____________________________________________________________
161 void AliGenHaloProtvino::Generate()
163 // Generate from input file
165 Float_t polar[3]= {0,0,0};
175 Float_t* zPrimary = new Float_t [fNpart];
176 Int_t * inuc = new Int_t [fNpart];
177 Int_t * ipart = new Int_t [fNpart];
178 Float_t* wgt = new Float_t [fNpart];
179 Float_t* ekin = new Float_t [fNpart];
180 Float_t* vx = new Float_t [fNpart];
181 Float_t* vy = new Float_t [fNpart];
182 Float_t* tx = new Float_t [fNpart];
183 Float_t* ty = new Float_t [fNpart];
185 Float_t zVertexOld = -1.e10;
186 Int_t nInt = 0; // Counts number of interactions
190 // Load event into array
192 ncols = fscanf(fFile,"%f %d %d %f %f %f %f %f %f",
193 &zPrimary[nread], &inuc[nread], &ipart[nread], &wgt[nread],
194 &ekin[nread], &vx[nread], &vy[nread],
195 &tx[nread], &ty[nread]);
197 if (ncols < 0) break;
198 // Skip fNskip events
200 if (fNpart !=-1 && nskip <= fNskip) continue;
201 // Count interactions
202 if (zPrimary[nread] != zVertexOld) {
204 zVertexOld = zPrimary[nread];
208 if (fNpart !=-1 && nread > fNpart) break;
211 // Mean time between interactions
213 Float_t dT = fTimePerEvent/nInt; // sec
214 Float_t t = 0; // sec
217 // Loop over primaries
222 for (Int_t nprim = 0; nprim < fNpart; nprim++)
224 amass = TDatabasePDG::Instance()->GetParticle(ipart[nprim])->Mass();
229 p0=sqrt(ekin[nprim]*ekin[nprim] + 2.*amass*ekin[nprim]);
231 txy=TMath::Sqrt(tx[nprim]*tx[nprim]+ty[nprim]*ty[nprim]);
235 tz=-TMath::Sqrt(1.-txy);
242 origin[0] = vx[nprim];
243 origin[1] = vy[nprim];
250 Float_t originP[3] = {0., 0., 0.};
251 originP[2] = zPrimary[nprim];
253 Float_t pP[3] = {0., 0., 0.};
257 originP[2] = -zPrimary[nprim];
258 origin[2] = -origin[2];
265 if (zPrimary[nprim] != zVertexOld) {
266 while(arg==0.) arg = gRandom->Rndm();
267 t -= dT*TMath::Log(arg); // (sec)
268 zVertexOld = zPrimary[nprim];
271 // Get statistical weight according to local gas-pressure
273 fParentWeight=wgt[nprim]*GassPressureWeight(zPrimary[nprim]);
275 if (!fAnalog || gRandom->Rndm() < fParentWeight) {
276 // Pass parent particle
278 SetTrack(0,-1,kProton,pP,originP,polar,t,kPNoProcess,ntP, fParentWeight);
280 SetTrack(fTrackIt,ntP,ipart[nprim],p,origin,polar,t,kPNoProcess,nt,fParentWeight);
284 // Both sides are considered
288 fParentWeight=wgt[nprim]*GassPressureWeight(-zPrimary[nprim]);
289 if (!fAnalog || gRandom->Rndm() < fParentWeight) {
290 origin[2] = -origin[2];
291 originP[2] = -originP[2];
293 SetTrack(0,-1,kProton,pP,originP,polar,t,kPNoProcess,ntP, fParentWeight);
295 SetTrack(fTrackIt,ntP,ipart[nprim],p,origin,polar,t,kPNoProcess,nt,fParentWeight);
298 SetHighWaterMark(nt);
312 AliGenHaloProtvino& AliGenHaloProtvino::operator=(const AliGenHaloProtvino& rhs)
314 // Assignment operator
320 Float_t AliGenHaloProtvino::GassPressureWeight(Float_t zPrimary)
323 // Return z-dependent gasspressure weight = interaction rate [1/m/s].
327 Float_t zAbs = TMath::Abs(zPrimary);
330 if (zAbs > fZ1[20]) {
333 for (Int_t i = 1; i < 21; i++) {
335 weight = fG1[i][fRunPeriod];
341 if (zAbs > fZ2[20]) {
344 for (Int_t i = 1; i < 21; i++) {
346 weight = fG2[i][fRunPeriod];
356 # Title: README file for the sources of IR8 machine induced background
357 # Author: Vadim Talanov <Vadim.Talanov@cern.ch>
358 # Modified: 12-12-2000
362 There are three files, named ring.one.beta.[01,10,50].m, which
363 contain the lists of background particles, induced by proton losses
364 upstream of IP8 in the LHC ring one, for the beta* values of 1, 10
365 and 50 m, respectively.
369 Each line in the files contains the coordinates of particle track
370 crossing with the infinite plane, positioned at z=-1m, together with
371 the physical properties of corresponding particle, namely:
373 S - S coordinate of the primary interaction vertex, cm;
374 N - type of the gas nuclei at interaction, 1 is H, 2 - C and 3 - O;
375 I - particle ID in PDG particle numbering scheme;
377 E - particle kinetic energy, GeV;
378 X - x coordinate of the crossing point, cm;
379 Y - y coordinate of the crossing point, cm;
380 Dx - x direction cosine;
381 Dy - y direction cosine.
385 Each file is given per unity of linear density of proton inelastic
386 interactions with the gas nuclei, [1 inelastic interaction/m].
388 # ~/vtalanov/public/README.mib: the end.