]>
Commit | Line | Data |
---|---|---|
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 | /* $Id$ */ | |
17 | ||
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 | |
21 | // for this purpose. | |
22 | // Author: andreas.morsch@cern.ch | |
23 | ||
24 | #include <stdlib.h> | |
25 | ||
26 | #include <TDatabasePDG.h> | |
27 | #include <TPDGCode.h> | |
28 | ||
29 | #include "AliGenHalo.h" | |
30 | #include "AliRun.h" | |
31 | ||
32 | ClassImp(AliGenHalo) | |
33 | AliGenHalo::AliGenHalo() | |
34 | :AliGenerator(-1) | |
35 | { | |
36 | // Constructor | |
37 | fName="Halo"; | |
38 | fTitle="Halo from LHC Tunnel"; | |
39 | // | |
40 | // Read all particles | |
41 | fNpart=-1; | |
42 | fp=0; | |
43 | } | |
44 | ||
45 | AliGenHalo::AliGenHalo(Int_t npart) | |
46 | :AliGenerator(npart) | |
47 | { | |
48 | // Constructor | |
49 | fName="Halo"; | |
50 | fTitle="Halo from LHC Tunnel"; | |
51 | // | |
52 | // Read all particles | |
53 | fNpart=-1; | |
54 | fp=0; | |
55 | } | |
56 | ||
57 | AliGenHalo::AliGenHalo(const AliGenHalo & Halo) | |
58 | { | |
59 | // copy constructor | |
60 | } | |
61 | ||
62 | ||
63 | //____________________________________________________________ | |
64 | AliGenHalo::~AliGenHalo() | |
65 | { | |
66 | // Destructor | |
67 | } | |
68 | ||
69 | //____________________________________________________________ | |
70 | void AliGenHalo::Init() | |
71 | { | |
72 | // Initialisation | |
73 | } | |
74 | ||
75 | //____________________________________________________________ | |
76 | void AliGenHalo::Generate() | |
77 | { | |
78 | // Generate from input file | |
79 | FILE *fp = fopen(fFileName,"r"); | |
80 | if (fp) { | |
81 | printf("\n File %s opened for reading ! \n ", (char*) &fFileName); | |
82 | } else { | |
83 | printf("\n Opening of file %s failed ! \n ", (char*) &fFileName); | |
84 | } | |
85 | // | |
86 | // MARS particle codes | |
87 | const Int_t kmars[12]={0,kProton,kNeutron,kPiPlus,kPiMinus,kKPlus,kKMinus, | |
88 | kMuonPlus,kMuonMinus,kGamma,kElectron,kPositron}; | |
89 | ||
90 | Float_t polar[3]= {0,0,0}; | |
91 | Float_t origin[3]; | |
92 | Float_t p[3], p0; | |
93 | Float_t ekin, wgt, tx, ty, tz, txy; | |
94 | Float_t amass; | |
95 | // | |
96 | Int_t ipart, ncols, nt; | |
97 | ||
98 | Int_t nread=0; | |
99 | origin[2]=2650; | |
100 | ||
101 | while(1) { | |
102 | ncols = fscanf(fp,"%i %f %f %f %f %f %f", | |
103 | &ipart, &ekin, &wgt, | |
104 | &origin[0], &origin[1], | |
105 | &tx, &ty); | |
106 | if (ncols < 0) break; | |
107 | nread++; | |
108 | if (fNpart !=-1 && nread > fNpart) break; | |
109 | ipart = kmars[ipart]; | |
110 | amass = TDatabasePDG::Instance()->GetParticle(ipart)->Mass(); | |
111 | p0=sqrt(ekin*ekin + 2.*amass); | |
112 | ||
113 | txy=TMath::Sqrt(tx*tx+ty*ty); | |
114 | if (txy == 1.) { | |
115 | tz=0; | |
116 | } else { | |
117 | tz=-TMath::Sqrt(1.-txy); | |
118 | } | |
119 | p[0]=p0*tx; | |
120 | p[1]=p0*ty; | |
121 | p[2]=p0*tz; | |
122 | fParentWeight=wgt; | |
123 | PushTrack(fTrackIt,-1,ipart,p,origin,polar,0,kPNoProcess,nt,fParentWeight); | |
124 | // PushTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo+",nt,fParentWeight); | |
125 | origin[2]=-origin[2]; | |
126 | p[2]=-p[2]; | |
127 | PushTrack(fTrackIt,-1,ipart,p,origin,polar,0,kPNoProcess,nt,fParentWeight); | |
128 | // PushTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo-",nt,fParentWeight); | |
129 | origin[2]=-origin[2]; | |
130 | p[2]=-p[2]; | |
131 | } | |
132 | } | |
133 | ||
134 | ||
135 | AliGenHalo& AliGenHalo::operator=(const AliGenHalo& rhs) | |
136 | { | |
137 | // Assignment operator | |
138 | return *this; | |
139 | } | |
140 | ||
141 | ||
142 | ||
143 | ||
144 | ||
145 | ||
146 | ||
147 |