1 | // $Id: ParentPhoton.cc 2835 2009-07-16 03:22:42Z biktem $ |
---|
2 | // M. Pallavicini created Jul, 3 2002 |
---|
3 | |
---|
4 | /***************************************************************************** |
---|
5 | * ESAF: Euso Simulation and Analysis Framework * |
---|
6 | * * |
---|
7 | * Id: ParentPhoton * |
---|
8 | * Package: RadiativeTransfer * |
---|
9 | * Coordinator: Sylvain.Moreggia * |
---|
10 | * * |
---|
11 | *****************************************************************************/ |
---|
12 | |
---|
13 | //_____________________________________________________________________________ |
---|
14 | // |
---|
15 | // ParentPhoton |
---|
16 | // |
---|
17 | // Note on reference frame: |
---|
18 | // Z axis is axis of Euso and also zenith-nadir direction |
---|
19 | // Z positive in Zenith |
---|
20 | // X and Y not important so far. |
---|
21 | |
---|
22 | #include "Photon.hh" |
---|
23 | #include "ParentPhoton.hh" |
---|
24 | #include "SinglePhoton.hh" |
---|
25 | #include "EPhoton.hh" |
---|
26 | #include "Config.hh" |
---|
27 | #include "EsafRandom.hh" |
---|
28 | |
---|
29 | ClassImp(ParentPhoton) |
---|
30 | |
---|
31 | //______________________________________________________________________________ |
---|
32 | ParentPhoton::ParentPhoton() { |
---|
33 | // |
---|
34 | // empty ctor |
---|
35 | // |
---|
36 | Double_t pos[3] = {0,0,0}; |
---|
37 | Double_t spos[3] = {0,0,0}; |
---|
38 | Build(-1, spos, pos, 0., 0., 0., 0, Fluorescence); |
---|
39 | } |
---|
40 | |
---|
41 | //______________________________________________________________________________ |
---|
42 | ParentPhoton::ParentPhoton(Int_t i, Double_t* x, Double_t* y, Double_t th, |
---|
43 | Double_t ph, Double_t w, Double_t t, ParentPhotonType typ) { |
---|
44 | // |
---|
45 | // Constructor |
---|
46 | // |
---|
47 | // i: photon number (from 1 to number of photons in this event) |
---|
48 | // x: 3 dim. array with position in the shower |
---|
49 | // y: 3 dim. array with position on the pupil (mm) |
---|
50 | // th: theta direction of the photon (rad, theta=0 enter along axis) |
---|
51 | // ph: phi direction of the photon (rad) |
---|
52 | // w: wavelength in nm |
---|
53 | // t: entrance fTime in ns |
---|
54 | // typ: type |
---|
55 | // |
---|
56 | |
---|
57 | Build(i,x,y,th,ph,w,t,typ); |
---|
58 | } |
---|
59 | |
---|
60 | //______________________________________________________________________________ |
---|
61 | ParentPhoton::ParentPhoton(Int_t i, Double_t* x, Double_t* y, Double_t* d, |
---|
62 | Double_t w, Double_t t, ParentPhotonType typ) { |
---|
63 | // |
---|
64 | // Constructor |
---|
65 | // |
---|
66 | // i: photon number (from 1 to number of photons in this event) |
---|
67 | // x: 3 dim. array with position in the shower |
---|
68 | // y: 3 dim. array with position on the pupil (mm) |
---|
69 | // d: direction of the photon |
---|
70 | // w: wavelength in nm |
---|
71 | // t: entrance fTime in ns |
---|
72 | // typ: type |
---|
73 | // |
---|
74 | |
---|
75 | Build(i,x,y,d,w,t,typ); |
---|
76 | } |
---|
77 | |
---|
78 | //______________________________________________________________________________ |
---|
79 | ParentPhoton::ParentPhoton(Int_t i, const TVector3 spos, const TVector3 pos, |
---|
80 | Double_t th, Double_t ph, Double_t w, Double_t t, ParentPhotonType typ) { |
---|
81 | // |
---|
82 | // Constructor |
---|
83 | // |
---|
84 | // i: photon number (from 1 to number of photons in this event) |
---|
85 | // spos: emission position in the shower |
---|
86 | // ppos: position of the photon |
---|
87 | // th: theta direction of the photon (rad, theta=0 enter along axis) |
---|
88 | // ph: phi direction of the photon (rad) |
---|
89 | // w: wavelength in nm |
---|
90 | // t: entrance fTime in ns |
---|
91 | // typ: type |
---|
92 | // |
---|
93 | |
---|
94 | Build(i,spos,pos,th,ph,w,t,typ); |
---|
95 | } |
---|
96 | |
---|
97 | //______________________________________________________________________________ |
---|
98 | ParentPhoton::ParentPhoton(Int_t i, const TVector3 spos, const TVector3 pos, |
---|
99 | const TVector3 dir, Double_t w, Double_t t, ParentPhotonType typ) { |
---|
100 | // |
---|
101 | // Constructor |
---|
102 | // |
---|
103 | // i: photon number (from 1 to number of photons in this event) |
---|
104 | // spos: emission position in the shower |
---|
105 | // ppos: position of the photon |
---|
106 | // dir: direction of the photon |
---|
107 | // w: wavelength in nm |
---|
108 | // t: entrance fTime in ns |
---|
109 | // typ: type |
---|
110 | // |
---|
111 | |
---|
112 | Build(i,spos,pos,dir,w,t,typ); |
---|
113 | } |
---|
114 | |
---|
115 | //______________________________________________________________________________ |
---|
116 | ParentPhoton::ParentPhoton( const SinglePhoton& p, const TVector3& pos, const TVector3& local_dir) { |
---|
117 | // |
---|
118 | // convert a SinglePhoton to a ParentPhoton |
---|
119 | // |
---|
120 | static Int_t i = 0; |
---|
121 | fId = i++; |
---|
122 | fTime = p.Date() + p.Tof(); |
---|
123 | fWl = p.Wl(); |
---|
124 | fAtmoHistory = p.Status(); |
---|
125 | fCloudAbsorbed = p.IsCloudAbsorbed(); |
---|
126 | fAtmoNbinter = p.NbOfInteractions(); |
---|
127 | fShowerPos = p.PosInAtmo(); |
---|
128 | fShowerAge = p.ShowerAge(); |
---|
129 | fDir = local_dir; |
---|
130 | fTheta = p.Dir().Theta(); |
---|
131 | fPhi = p.Dir().Phi(); |
---|
132 | fPupilPos.SetXYZ(pos.X(),pos.Y(),pos.Z()); |
---|
133 | |
---|
134 | if (p.Type() == Fluo) |
---|
135 | fType = Fluorescence; |
---|
136 | else if(p.Type() == Cerenkov) { |
---|
137 | switch(p.Status()) { |
---|
138 | case Reflected: fType = CerenkovReflected; |
---|
139 | break; |
---|
140 | case RaylScat : fType = CerenkovScattered; |
---|
141 | break; |
---|
142 | case CloudScat: fType = CerenkovScattered; |
---|
143 | break; |
---|
144 | case AeroScat : fType = CerenkovScattered; |
---|
145 | break; |
---|
146 | case Direct : fType = CerenkovScattered; |
---|
147 | break; |
---|
148 | |
---|
149 | default : Msg(EsafMsg::Warning) << "Wrong SinglePhoton status given to ParentPhoton" << MsgDispatch; |
---|
150 | } |
---|
151 | } |
---|
152 | CreatePhoton(); |
---|
153 | } |
---|
154 | |
---|
155 | //______________________________________________________________________________ |
---|
156 | void ParentPhoton::Build(Int_t i, Double_t* x, Double_t* y, Double_t th, |
---|
157 | Double_t ph, Double_t w, Double_t t, ParentPhotonType typ) { |
---|
158 | // |
---|
159 | // Set all parameters of the ParentPhoton |
---|
160 | // |
---|
161 | // i: photon number (from 1 to number of photons in this event) |
---|
162 | // x: 3 dim. array with position in the shower |
---|
163 | // y: 3 dim. array with position on the pupil (mm) |
---|
164 | // th: theta direction of the photon (rad, theta=0 enter along axis) |
---|
165 | // ph: phi direction of the photon (rad) |
---|
166 | // w: wavelength in nm |
---|
167 | // t: entrance fTime in ns |
---|
168 | // typ: type |
---|
169 | // |
---|
170 | |
---|
171 | fId = i; |
---|
172 | fShowerPos[0] = x[0]; // position in shower |
---|
173 | fShowerPos[1] = x[1]; |
---|
174 | fShowerPos[2] = x[2]; |
---|
175 | fPupilPos[0] = y[0]; // position in pupil |
---|
176 | fPupilPos[1] = y[1]; |
---|
177 | fPupilPos[2] = y[2]; |
---|
178 | fShowerAge = -1; |
---|
179 | fDir.SetMagThetaPhi(1,th,ph); // direction in global frame |
---|
180 | fWl = w; |
---|
181 | fTime = t; |
---|
182 | fTheta = th; |
---|
183 | fPhi = ph; |
---|
184 | fType = typ; |
---|
185 | fAtmoHistory = -1; |
---|
186 | fAtmoNbinter = -1; |
---|
187 | fCloudAbsorbed = false; |
---|
188 | |
---|
189 | CreatePhoton(); |
---|
190 | } |
---|
191 | |
---|
192 | //______________________________________________________________________________ |
---|
193 | void ParentPhoton::Build(Int_t i, Double_t* x, Double_t* y, Double_t* d, |
---|
194 | Double_t w, Double_t t, ParentPhotonType typ) { |
---|
195 | // |
---|
196 | // Set all parameters of the ParentPhoton |
---|
197 | // |
---|
198 | // i: photon number (from 1 to number of photons in this event) |
---|
199 | // x: 3 dim. array with position in the shower |
---|
200 | // y: 3 dim. array with position on the pupil (mm) |
---|
201 | // th: theta direction of the photon (rad, theta=0 enter along axis) |
---|
202 | // ph: phi direction of the photon (rad) |
---|
203 | // w: wavelength in nm |
---|
204 | // t: entrance fTime in ns |
---|
205 | // typ: type |
---|
206 | // |
---|
207 | |
---|
208 | fId = i; |
---|
209 | fShowerPos[0] = x[0]; // position in shower |
---|
210 | fShowerPos[1] = x[1]; |
---|
211 | fShowerPos[2] = x[2]; |
---|
212 | fPupilPos[0] = y[0]; // position in pupil |
---|
213 | fPupilPos[1] = y[1]; |
---|
214 | fPupilPos[2] = y[2]; |
---|
215 | fDir[0] = d[0]; // direction in global frame |
---|
216 | fDir[1] = d[1]; |
---|
217 | fDir[2] = d[2]; |
---|
218 | fShowerAge = -1; |
---|
219 | fWl = w; |
---|
220 | fTime = t; |
---|
221 | fTheta = fDir.Theta(); |
---|
222 | fPhi = fDir.Phi(); |
---|
223 | fType = typ; |
---|
224 | fCloudAbsorbed = false; |
---|
225 | |
---|
226 | CreatePhoton(); |
---|
227 | } |
---|
228 | |
---|
229 | //______________________________________________________________________________ |
---|
230 | void ParentPhoton::Build(Int_t i, const TVector3 spos, const TVector3 pos, Double_t th, |
---|
231 | Double_t ph, Double_t w, Double_t t, ParentPhotonType typ) { |
---|
232 | // |
---|
233 | // Set all parameters of the ParentPhoton |
---|
234 | // |
---|
235 | // i: photon number (from 1 to number of photons in this event) |
---|
236 | // spos: emission position in the shower |
---|
237 | // ppos: position of the photon |
---|
238 | // th: theta direction of the photon (rad, theta=0 enter along axis) |
---|
239 | // ph: phi direction of the photon (rad) |
---|
240 | // w: wavelength in nm |
---|
241 | // t: entrance fTime in ns |
---|
242 | // typ: type |
---|
243 | // |
---|
244 | |
---|
245 | Double_t x[3], y[3]; |
---|
246 | spos.GetXYZ(x); |
---|
247 | pos.GetXYZ(y); |
---|
248 | |
---|
249 | Build(i,x,y,th,ph,w,t,typ); |
---|
250 | |
---|
251 | } |
---|
252 | |
---|
253 | //______________________________________________________________________________ |
---|
254 | void ParentPhoton::Build(Int_t i, const TVector3 spos, const TVector3 pos, |
---|
255 | const TVector3 dir, Double_t w, Double_t t, ParentPhotonType typ) { |
---|
256 | // |
---|
257 | // Set all parameters of the ParentPhoton |
---|
258 | // |
---|
259 | // i: photon number (from 1 to number of photons in this event) |
---|
260 | // spos: emission position in the shower |
---|
261 | // ppos: position of the photon |
---|
262 | // th: theta direction of the photon (rad, theta=0 enter along axis) |
---|
263 | // ph: phi direction of the photon (rad) |
---|
264 | // w: wavelength in nm |
---|
265 | // t: entrance fTime in ns |
---|
266 | // typ: type |
---|
267 | // |
---|
268 | |
---|
269 | Double_t x[3], y[3], d[3]; |
---|
270 | spos.GetXYZ(x); |
---|
271 | pos.GetXYZ(y); |
---|
272 | dir.GetXYZ(d); |
---|
273 | |
---|
274 | Build(i,x,y,d,w,t,typ); |
---|
275 | |
---|
276 | } |
---|
277 | |
---|
278 | //______________________________________________________________________________ |
---|
279 | ParentPhoton::~ParentPhoton() { |
---|
280 | // |
---|
281 | // Destructor |
---|
282 | // |
---|
283 | } |
---|
284 | |
---|
285 | //______________________________________________________________________________ |
---|
286 | void ParentPhoton::CreatePhoton() { |
---|
287 | // |
---|
288 | // create a photon object from this parent photon |
---|
289 | // |
---|
290 | fChild.time = fTime; |
---|
291 | fChild.wl = fWl; |
---|
292 | fChild.pos = fPupilPos; |
---|
293 | fChild.dir = fDir; |
---|
294 | fChild.iterations = 0; |
---|
295 | fChild.hit = false; |
---|
296 | fChild.hitIfs = false; |
---|
297 | fChild.MChit = false; |
---|
298 | fChild.madeSignal = false; |
---|
299 | fChild.pixelUid = -1; |
---|
300 | fChild.fate = 0; |
---|
301 | fChild.parent = this; |
---|
302 | fChild.history=0; |
---|
303 | } |
---|