]>
Commit | Line | Data |
---|---|---|
4bda3bc1 | 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$ | |
b9d0a01d | 18 | Revision 1.2.6.1 2002/06/10 14:57:41 hristov |
19 | Merged with v3-08-02 | |
20 | ||
21 | Revision 1.2 2002/05/15 13:29:11 morsch | |
22 | Use fOsigma[2] for vertex smearing. Default is 2000 cm. | |
23 | ||
508eeb68 | 24 | Revision 1.1 2002/05/15 08:59:36 morsch |
25 | First commit. | |
4bda3bc1 | 26 | |
508eeb68 | 27 | */ |
4bda3bc1 | 28 | |
508eeb68 | 29 | // |
30 | // Generator to simulate beam gas interactions. | |
31 | // At present single interactions are read from an external file. | |
32 | // Several interactions are combined in one event. | |
4bda3bc1 | 33 | |
34 | ||
35 | #include "AliGenBeamGas.h" | |
36 | #include "AliRun.h" | |
37 | ||
38 | #include <TParticle.h> | |
39 | #include <TFile.h> | |
40 | #include <TTree.h> | |
41 | ||
42 | ||
43 | ClassImp(AliGenBeamGas) | |
44 | ||
45 | AliGenBeamGas::AliGenBeamGas() | |
46 | :AliGenExtFile() | |
47 | { | |
48 | // Constructor | |
49 | // | |
50 | fInteractions = 1; | |
508eeb68 | 51 | fOsigma[0] = 0.; |
52 | fOsigma[1] = 0.; | |
53 | fOsigma[2] = 2000.; | |
4bda3bc1 | 54 | } |
55 | ||
56 | AliGenBeamGas::AliGenBeamGas(const AliGenBeamGas & ExtFile) | |
57 | { | |
58 | // copy constructor | |
59 | } | |
60 | //____________________________________________________________ | |
61 | ||
62 | AliGenBeamGas::~AliGenBeamGas() | |
63 | { | |
64 | // Destructor | |
65 | delete fReader; | |
66 | } | |
67 | ||
68 | //___________________________________________________________ | |
69 | void AliGenBeamGas::Init() | |
70 | { | |
71 | // Initialize | |
72 | AliGenExtFile::Init(); | |
73 | } | |
74 | ||
75 | ||
76 | void AliGenBeamGas::Generate() | |
77 | { | |
78 | // Generate particles | |
79 | ||
80 | Float_t polar[3] = {0,0,0}; | |
81 | Float_t origin[3] = {0,0,0}; | |
82 | Float_t p[3]; | |
83 | Float_t random[2]; | |
84 | Int_t i, nt; | |
85 | Int_t nInt = 0; | |
86 | ||
87 | while(nInt < fInteractions) { | |
88 | // | |
89 | Rndm(random,2); | |
90 | // | |
91 | // Interaction vertex | |
92 | // | |
508eeb68 | 93 | origin[2] = 2. * fOsigma[2] * random[0] - fOsigma[2]; |
4bda3bc1 | 94 | // |
95 | // beam 1 or 2 | |
96 | // | |
97 | Float_t ibeam = (random[1] < 0.5) ? -1. : 1.; | |
98 | ||
99 | // | |
100 | // Read next event | |
101 | // | |
102 | Int_t nTracks = fReader->NextEvent(); | |
103 | if (nTracks == 0) { | |
104 | // printf("\n No more events !!! !\n"); | |
105 | Warning("AliGenBeamGas::Generate", | |
106 | "\nNo more events in external file!!!\n Last event may be empty or incomplete.\n"); | |
107 | return; | |
108 | } | |
109 | ||
110 | // | |
111 | // Stack filling loop | |
112 | // | |
113 | for (i = 0; i < nTracks; i++) { | |
114 | TParticle* iparticle = fReader->NextParticle(); | |
115 | p[0] = iparticle->Px(); | |
116 | p[1] = iparticle->Py(); | |
117 | p[2] = iparticle->Pz() * ibeam; | |
118 | ||
119 | Int_t idpart = iparticle->GetPdgCode(); | |
120 | Int_t decayed = iparticle->GetFirstDaughter(); | |
121 | Int_t doTracking = fTrackIt && (decayed < 0) && (TMath::Abs(idpart) > 10); | |
122 | SetTrack(doTracking,-1,idpart,p,origin,polar,0,kPPrimary,nt); | |
123 | KeepTrack(nt); | |
124 | } // track loop | |
125 | nInt++; | |
126 | } // event loop | |
127 | // | |
128 | SetHighWaterMark(nt); | |
129 | // | |
130 | CdEventFile(); | |
131 | } | |
132 | ||
133 | ||
134 | //AliGenBeamGas& AliGenBeamGas::operator=(const AliGenBeamGas& rhs) | |
135 | //{ | |
136 | // Assignment operator | |
137 | // return *this; | |
138 | //} | |
139 | ||
140 | ||
141 | ||
142 | ||
143 | ||
144 | ||
145 | ||
146 |