a9e2aefa |
1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
d7c4fbc4 |
3 | * SigmaEffect_thetadegrees * |
a9e2aefa |
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 * |
2c799aa2 |
12 | * about the suitability of this software for any purpeateose. It is * |
a9e2aefa |
13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ |
15 | |
88cb7938 |
16 | /* $Id$ */ |
a9e2aefa |
17 | |
18 | ///////////////////////////////////////////////////////// |
acc838fd |
19 | // Manager and hits classes for set:MUON version 1 // |
a9e2aefa |
20 | ///////////////////////////////////////////////////////// |
acc838fd |
21 | |
abaf7c9d |
22 | #include <TRandom.h> |
23 | #include <TF1.h> |
116cbefd |
24 | #include <TClonesArray.h> |
acc838fd |
25 | #include <TRandom.h> |
88cb7938 |
26 | #include <TVirtualMC.h> |
a9e2aefa |
27 | |
30178c30 |
28 | #include "AliMUONv1.h" |
a9e2aefa |
29 | #include "AliConst.h" |
30 | #include "AliMUONChamber.h" |
88cb7938 |
31 | #include "AliMUONConstants.h" |
32 | #include "AliMUONFactory.h" |
a9e2aefa |
33 | #include "AliMUONHit.h" |
8c449e83 |
34 | #include "AliMUONTriggerCircuit.h" |
d4bb94a1 |
35 | #include "AliMUONGeometryBuilder.h" |
88cb7938 |
36 | #include "AliMagF.h" |
37 | #include "AliRun.h" |
5d12ce38 |
38 | #include "AliMC.h" |
a9e2aefa |
39 | |
40 | ClassImp(AliMUONv1) |
41 | |
42 | //___________________________________________ |
30178c30 |
43 | AliMUONv1::AliMUONv1() |
44 | : AliMUON(), |
d4bb94a1 |
45 | fStepManagerVersionOld(kFALSE), |
46 | fAngleEffect(kTRUE), |
47 | fStepMaxInActiveGas(0.6), |
48 | fStepSum(0x0), |
49 | fDestepSum(0x0), |
50 | fTrackMomentum(), |
51 | fTrackPosition(), |
52 | fElossRatio(0x0), |
53 | fAngleEffect10(0x0), |
54 | fAngleEffectNorma(0x0) |
a9e2aefa |
55 | { |
d4bb94a1 |
56 | // Default constructor |
1391e633 |
57 | } |
d4bb94a1 |
58 | |
a9e2aefa |
59 | //___________________________________________ |
60 | AliMUONv1::AliMUONv1(const char *name, const char *title) |
d4bb94a1 |
61 | : AliMUON(name,title), |
62 | fStepManagerVersionOld(kFALSE), |
63 | fAngleEffect(kTRUE), |
64 | fStepMaxInActiveGas(0.6), |
65 | fStepSum(0x0), |
66 | fDestepSum(0x0), |
67 | fTrackMomentum(), |
68 | fTrackPosition(), |
69 | fElossRatio(0x0), |
70 | fAngleEffect10(0x0), |
71 | fAngleEffectNorma(0x0) |
a9e2aefa |
72 | { |
d4bb94a1 |
73 | // Standard onstructor |
74 | |
ba030c0e |
75 | // By default include all stations |
ba030c0e |
76 | AliMUONFactory factory; |
77 | factory.Build(this, title); |
c33d9661 |
78 | |
1391e633 |
79 | fStepSum = new Float_t [AliMUONConstants::NCh()]; |
80 | fDestepSum = new Float_t [AliMUONConstants::NCh()]; |
81 | for (Int_t i=0; i<AliMUONConstants::NCh(); i++) { |
82 | fStepSum[i] =0.0; |
83 | fDestepSum[i]=0.0; |
84 | } |
85 | // Ratio of particle mean eloss with respect MIP's Khalil Boudjemline, sep 2003, PhD.Thesis and Particle Data Book |
86 | fElossRatio = new TF1("ElossRatio","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.); |
87 | fElossRatio->SetParameter(0,1.02138); |
88 | fElossRatio->SetParameter(1,-9.54149e-02); |
89 | fElossRatio->SetParameter(2,+7.83433e-02); |
90 | fElossRatio->SetParameter(3,-9.98208e-03); |
91 | fElossRatio->SetParameter(4,+3.83279e-04); |
92 | |
93 | // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers) |
94 | fAngleEffect10 = new TF1("AngleEffect10","[0]+[1]*x+[2]*x*x",0.5,3.0); |
95 | fAngleEffect10->SetParameter(0, 1.90691e+02); |
96 | fAngleEffect10->SetParameter(1,-6.62258e+01); |
97 | fAngleEffect10->SetParameter(2,+1.28247e+01); |
98 | // Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) |
99 | // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. |
100 | fAngleEffectNorma = new TF1("AngleEffectNorma","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0); |
101 | fAngleEffectNorma->SetParameter(0,4.148); |
102 | fAngleEffectNorma->SetParameter(1,-6.809e-01); |
103 | fAngleEffectNorma->SetParameter(2,5.151e-02); |
104 | fAngleEffectNorma->SetParameter(3,-1.490e-03); |
a9e2aefa |
105 | } |
106 | |
fb1bf5c0 |
107 | //_____________________________________________________________________________ |
108 | AliMUONv1::AliMUONv1(const AliMUONv1& right) |
109 | : AliMUON(right) |
110 | { |
111 | // copy constructor (not implemented) |
112 | |
113 | Fatal("AliMUONv1", "Copy constructor not provided."); |
114 | } |
115 | |
a9e2aefa |
116 | //___________________________________________ |
acc838fd |
117 | AliMUONv1::~AliMUONv1() |
a9e2aefa |
118 | { |
acc838fd |
119 | // Destructor |
a9e2aefa |
120 | |
d4bb94a1 |
121 | delete [] fStepSum; |
122 | delete [] fDestepSum; |
123 | delete fElossRatio; |
124 | delete fAngleEffect10; |
125 | delete fAngleEffectNorma; |
acc838fd |
126 | } |
b17c0c87 |
127 | |
fb1bf5c0 |
128 | //_____________________________________________________________________________ |
129 | AliMUONv1& AliMUONv1::operator=(const AliMUONv1& right) |
130 | { |
131 | // assignement operator (not implemented) |
132 | |
133 | // check assignement to self |
134 | if (this == &right) return *this; |
135 | |
136 | Fatal("operator =", "Assignement operator not provided."); |
137 | |
138 | return *this; |
139 | } |
140 | |
acc838fd |
141 | //__________________________________________________ |
142 | void AliMUONv1::CreateGeometry() |
143 | { |
b17c0c87 |
144 | // |
d4bb94a1 |
145 | // Construct geometry using geometry builder |
a9e2aefa |
146 | // |
a9e2aefa |
147 | |
d4bb94a1 |
148 | fGeometryBuilder->CreateGeometry(); |
acc838fd |
149 | } |
a9e2aefa |
150 | |
acc838fd |
151 | //________________________________________________________________ |
a9e2aefa |
152 | void AliMUONv1::CreateMaterials() |
153 | { |
a9e2aefa |
154 | // |
d4bb94a1 |
155 | // Construct materials using geometry builder |
156 | // |
acc838fd |
157 | |
d4bb94a1 |
158 | fGeometryBuilder->CreateMaterials(); |
a9e2aefa |
159 | } |
160 | |
acc838fd |
161 | //___________________________________________ |
a9e2aefa |
162 | void AliMUONv1::Init() |
163 | { |
164 | // |
165 | // Initialize Tracking Chambers |
166 | // |
167 | |
9e1a0ddb |
168 | if(fDebug) printf("\n%s: Start Init for version 1 - CPC chamber type\n\n",ClassName()); |
e17592e9 |
169 | Int_t i; |
f665c1ea |
170 | for (i=0; i<AliMUONConstants::NCh(); i++) { |
a9e2aefa |
171 | ( (AliMUONChamber*) (*fChambers)[i])->Init(); |
172 | } |
173 | |
acc838fd |
174 | // |
d4bb94a1 |
175 | // Initialize geometry |
a9e2aefa |
176 | // |
d4bb94a1 |
177 | fGeometryBuilder->InitGeometry(); |
9e1a0ddb |
178 | if(fDebug) printf("\n%s: Finished Init for version 1 - CPC chamber type\n",ClassName()); |
a9e2aefa |
179 | |
180 | //cp |
9e1a0ddb |
181 | if(fDebug) printf("\n%s: Start Init for Trigger Circuits\n",ClassName()); |
f665c1ea |
182 | for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) { |
a9e2aefa |
183 | ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i); |
184 | } |
9e1a0ddb |
185 | if(fDebug) printf("%s: Finished Init for Trigger Circuits\n",ClassName()); |
a9e2aefa |
186 | //cp |
a9e2aefa |
187 | } |
1391e633 |
188 | |
d4bb94a1 |
189 | //__________________________________________________________________ |
190 | Int_t AliMUONv1::GetChamberId(Int_t volId) const |
191 | { |
192 | // Check if the volume with specified volId is a sensitive volume (gas) |
193 | // of some chamber and returns the chamber number; |
194 | // if not sensitive volume - return 0. |
195 | // --- |
196 | |
197 | /* |
198 | for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) |
199 | if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i; |
200 | */ |
201 | for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) |
202 | if ( ((AliMUONChamber*)(*fChambers)[i-1])->IsSensId(volId) ) return i; |
203 | |
204 | return 0; |
205 | } |
1391e633 |
206 | //_______________________________________________________________________________ |
c33d9661 |
207 | void AliMUONv1::StepManager() |
208 | { |
d7c4fbc4 |
209 | // Stepmanager for the chambers |
210 | |
1391e633 |
211 | if (fStepManagerVersionOld) { |
c33d9661 |
212 | StepManagerOld(); |
213 | return; |
214 | } |
c33d9661 |
215 | |
216 | // Only charged tracks |
217 | if( !(gMC->TrackCharge()) ) return; |
1391e633 |
218 | // Only charged tracks |
219 | |
c33d9661 |
220 | // Only gas gap inside chamber |
221 | // Tag chambers and record hits when track enters |
acc838fd |
222 | static Int_t idvol=-1; |
1391e633 |
223 | Int_t iChamber=0; |
224 | Int_t id=0; |
225 | Int_t copy; |
226 | const Float_t kBig = 1.e10; |
227 | |
acc838fd |
228 | |
229 | // |
230 | // Only gas gap inside chamber |
231 | // Tag chambers and record hits when track enters |
c33d9661 |
232 | id=gMC->CurrentVolID(copy); |
acc838fd |
233 | iChamber = GetChamberId(id); |
234 | idvol = iChamber -1; |
235 | |
236 | if (idvol == -1) return; |
abaf7c9d |
237 | |
967a2a25 |
238 | // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers |
239 | if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) ) |
240 | AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); |
241 | |
1391e633 |
242 | if( gMC->IsTrackEntering() ) { |
243 | Float_t theta = fTrackMomentum.Theta(); |
4ac9d21e |
244 | if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative |
245 | } |
abaf7c9d |
246 | |
1391e633 |
247 | // if (GetDebug()) { |
248 | // Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ; |
249 | // Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z); |
250 | // } |
251 | // Particule id and mass, |
252 | Int_t ipart = gMC->TrackPid(); |
253 | Float_t mass = gMC->TrackMass(); |
254 | |
255 | fDestepSum[idvol]+=gMC->Edep(); |
256 | // Get current particle id (ipart), track position (pos) and momentum (mom) |
257 | if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum); |
258 | fStepSum[idvol]+=gMC->TrackStep(); |
abaf7c9d |
259 | |
1391e633 |
260 | // if (GetDebug()) { |
261 | // Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g", |
acc838fd |
262 | // iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep()); |
1391e633 |
263 | // Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ; |
264 | // gMC->TrackPosition(fTrackPosition); |
265 | // Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ; |
d08aff2d |
266 | // } |
1391e633 |
267 | |
268 | // Track left chamber or StepSum larger than fStepMaxInActiveGas |
269 | if ( gMC->IsTrackExiting() || |
270 | gMC->IsTrackStop() || |
271 | gMC->IsTrackDisappeared()|| |
272 | (fStepSum[idvol]>fStepMaxInActiveGas) ) { |
273 | |
274 | if ( gMC->IsTrackExiting() || |
acc838fd |
275 | gMC->IsTrackStop() || |
276 | gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig); |
1391e633 |
277 | |
278 | gMC->TrackPosition(fTrackPosition); |
279 | Float_t theta = fTrackMomentum.Theta(); |
280 | Float_t phi = fTrackMomentum.Phi(); |
281 | |
d7c4fbc4 |
282 | TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi), |
acc838fd |
283 | fStepSum[idvol]/2.*sin(theta)*sin(phi), |
284 | fStepSum[idvol]/2.*cos(theta),0.0 ); |
1391e633 |
285 | // if (GetDebug()) |
286 | // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ; |
287 | // if (GetDebug()) |
d7c4fbc4 |
288 | // Info("StepManager Exit ","Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z()) ; |
289 | fTrackPosition-=backToWire; |
1391e633 |
290 | |
291 | //-------------- Angle effect |
292 | // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass) |
293 | |
30178c30 |
294 | Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2 |
d7c4fbc4 |
295 | Float_t sigmaEffect10degrees; |
296 | Float_t sigmaEffectThetadegrees; |
297 | Float_t eLossParticleELossMip; |
298 | Float_t yAngleEffect=0.; |
299 | Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative |
300 | |
374ebd7d |
301 | |
302 | if (fAngleEffect){ |
30178c30 |
303 | if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) { |
304 | betaxGamma=TMath::Log(betaxGamma); |
305 | eLossParticleELossMip = fElossRatio->Eval(betaxGamma); |
1391e633 |
306 | // 10 degrees is a reference for a model (arbitrary) |
d7c4fbc4 |
307 | sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers |
1391e633 |
308 | // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. |
d7c4fbc4 |
309 | sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap |
1391e633 |
310 | if ( (iChamber==1) || (iChamber==2) ) |
acc838fd |
311 | sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm) |
d7c4fbc4 |
312 | yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm |
1391e633 |
313 | } |
374ebd7d |
314 | } |
1391e633 |
315 | |
316 | // One hit per chamber |
47464038 |
317 | GetMUONData()->AddHit(fIshunt, |
318 | gAlice->GetMCApp()->GetCurrentTrackNumber(), |
319 | iChamber, ipart, |
320 | fTrackPosition.X(), |
321 | fTrackPosition.Y()+yAngleEffect, |
322 | fTrackPosition.Z(), |
323 | gMC->TrackTime(), |
324 | fTrackMomentum.P(), |
325 | theta, |
326 | phi, |
327 | fStepSum[idvol], |
328 | fDestepSum[idvol], |
329 | fTrackPosition.X(), |
330 | fTrackPosition.Y(), |
331 | fTrackPosition.Z()); |
332 | |
1391e633 |
333 | // if (GetDebug()){ |
334 | // Info("StepManager Exit","Particle exiting from chamber %d",iChamber); |
335 | // Info("StepManager Exit","StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol]); |
336 | // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ; |
337 | // } |
338 | fStepSum[idvol] =0; // Reset for the next event |
339 | fDestepSum[idvol]=0; // Reset for the next event |
340 | } |
abaf7c9d |
341 | } |
5f91c9e8 |
342 | |
4ac9d21e |
343 | //__________________________________________ |
c33d9661 |
344 | void AliMUONv1::StepManagerOld() |
a9e2aefa |
345 | { |
d7c4fbc4 |
346 | // Old Stepmanager for the chambers |
a9e2aefa |
347 | Int_t copy, id; |
acc838fd |
348 | static Int_t idvol =-1; |
a9e2aefa |
349 | static Int_t vol[2]; |
350 | Int_t ipart; |
351 | TLorentzVector pos; |
352 | TLorentzVector mom; |
353 | Float_t theta,phi; |
354 | Float_t destep, step; |
abaf7c9d |
355 | |
d7c4fbc4 |
356 | static Float_t sstep; |
1e8fff9c |
357 | static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength; |
2eb55fab |
358 | const Float_t kBig = 1.e10; |
a9e2aefa |
359 | static Float_t hits[15]; |
360 | |
361 | TClonesArray &lhits = *fHits; |
362 | |
363 | // |
a9e2aefa |
364 | // |
365 | // Only charged tracks |
366 | if( !(gMC->TrackCharge()) ) return; |
367 | // |
368 | // Only gas gap inside chamber |
369 | // Tag chambers and record hits when track enters |
a9e2aefa |
370 | id=gMC->CurrentVolID(copy); |
5f91c9e8 |
371 | vol[0] = GetChamberId(id); |
372 | idvol = vol[0] -1; |
373 | |
374 | if (idvol == -1) return; |
375 | |
a9e2aefa |
376 | // |
377 | // Get current particle id (ipart), track position (pos) and momentum (mom) |
378 | gMC->TrackPosition(pos); |
379 | gMC->TrackMomentum(mom); |
380 | |
381 | ipart = gMC->TrackPid(); |
a9e2aefa |
382 | |
383 | // |
384 | // momentum loss and steplength in last step |
385 | destep = gMC->Edep(); |
386 | step = gMC->TrackStep(); |
abaf7c9d |
387 | // cout<<"------------"<<step<<endl; |
a9e2aefa |
388 | // |
389 | // record hits when track enters ... |
390 | if( gMC->IsTrackEntering()) { |
abaf7c9d |
391 | |
a9e2aefa |
392 | gMC->SetMaxStep(fMaxStepGas); |
393 | Double_t tc = mom[0]*mom[0]+mom[1]*mom[1]; |
394 | Double_t rt = TMath::Sqrt(tc); |
395 | Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]); |
2eb55fab |
396 | Double_t tx = mom[0]/pmom; |
397 | Double_t ty = mom[1]/pmom; |
398 | Double_t tz = mom[2]/pmom; |
399 | Double_t s = ((AliMUONChamber*)(*fChambers)[idvol]) |
acc838fd |
400 | ->ResponseModel() |
401 | ->Pitch()/tz; |
a9e2aefa |
402 | theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg; |
403 | phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg; |
404 | hits[0] = Float_t(ipart); // Geant3 particle type |
2eb55fab |
405 | hits[1] = pos[0]+s*tx; // X-position for hit |
406 | hits[2] = pos[1]+s*ty; // Y-position for hit |
407 | hits[3] = pos[2]+s*tz; // Z-position for hit |
a9e2aefa |
408 | hits[4] = theta; // theta angle of incidence |
409 | hits[5] = phi; // phi angle of incidence |
ce3f5e87 |
410 | hits[8] = 0;//PadHits does not exist anymore (Float_t) fNPadHits; // first padhit |
a9e2aefa |
411 | hits[9] = -1; // last pad hit |
2eb55fab |
412 | hits[10] = mom[3]; // hit momentum P |
413 | hits[11] = mom[0]; // Px |
414 | hits[12] = mom[1]; // Py |
415 | hits[13] = mom[2]; // Pz |
a9e2aefa |
416 | tof=gMC->TrackTime(); |
2eb55fab |
417 | hits[14] = tof; // Time of flight |
418 | tlength = 0; |
419 | eloss = 0; |
420 | eloss2 = 0; |
d7c4fbc4 |
421 | sstep=0; |
2eb55fab |
422 | xhit = pos[0]; |
423 | yhit = pos[1]; |
424 | zhit = pos[2]; |
681d067b |
425 | Chamber(idvol).ChargeCorrelationInit(); |
a9e2aefa |
426 | // Only if not trigger chamber |
1e8fff9c |
427 | |
abaf7c9d |
428 | // printf("---------------------------\n"); |
429 | // printf(">>>> Y = %f \n",hits[2]); |
430 | // printf("---------------------------\n"); |
431 | |
1e8fff9c |
432 | |
433 | |
abaf7c9d |
434 | // if(idvol < AliMUONConstants::NTrackingCh()) { |
acc838fd |
435 | // // |
436 | // // Initialize hit position (cursor) in the segmentation model |
437 | // ((AliMUONChamber*) (*fChambers)[idvol]) |
438 | // ->SigGenInit(pos[0], pos[1], pos[2]); |
abaf7c9d |
439 | // } else { |
acc838fd |
440 | // //geant3->Gpcxyz(); |
441 | // //printf("In the Trigger Chamber #%d\n",idvol-9); |
abaf7c9d |
442 | // } |
a9e2aefa |
443 | } |
444 | eloss2+=destep; |
d7c4fbc4 |
445 | sstep+=step; |
abaf7c9d |
446 | |
d7c4fbc4 |
447 | // cout<<sstep<<endl; |
abaf7c9d |
448 | |
a9e2aefa |
449 | // |
450 | // Calculate the charge induced on a pad (disintegration) in case |
451 | // |
452 | // Mip left chamber ... |
453 | if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){ |
454 | gMC->SetMaxStep(kBig); |
455 | eloss += destep; |
456 | tlength += step; |
457 | |
802a864d |
458 | Float_t x0,y0,z0; |
459 | Float_t localPos[3]; |
460 | Float_t globalPos[3] = {pos[0], pos[1], pos[2]}; |
802a864d |
461 | gMC->Gmtod(globalPos,localPos,1); |
462 | |
2eb55fab |
463 | if(idvol < AliMUONConstants::NTrackingCh()) { |
a9e2aefa |
464 | // tracking chambers |
acc838fd |
465 | x0 = 0.5*(xhit+pos[0]); |
466 | y0 = 0.5*(yhit+pos[1]); |
467 | z0 = 0.5*(zhit+pos[2]); |
a9e2aefa |
468 | } else { |
469 | // trigger chambers |
acc838fd |
470 | x0 = xhit; |
471 | y0 = yhit; |
472 | z0 = 0.; |
a9e2aefa |
473 | } |
474 | |
1e8fff9c |
475 | |
ce3f5e87 |
476 | // if (eloss >0) MakePadHits(x0,y0,z0,eloss,tof,idvol); |
a9e2aefa |
477 | |
acc838fd |
478 | |
2eb55fab |
479 | hits[6] = tlength; // track length |
480 | hits[7] = eloss2; // de/dx energy loss |
481 | |
abaf7c9d |
482 | |
ce3f5e87 |
483 | // if (fNPadHits > (Int_t)hits[8]) { |
acc838fd |
484 | // hits[8] = hits[8]+1; |
485 | // hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits; |
ce3f5e87 |
486 | //} |
2eb55fab |
487 | // |
488 | // new hit |
489 | |
a9e2aefa |
490 | new(lhits[fNhits++]) |
acc838fd |
491 | AliMUONHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); |
a9e2aefa |
492 | eloss = 0; |
493 | // |
494 | // Check additional signal generation conditions |
495 | // defined by the segmentation |
a75f073c |
496 | // model (boundary crossing conditions) |
497 | // only for tracking chambers |
a9e2aefa |
498 | } else if |
a75f073c |
499 | ((idvol < AliMUONConstants::NTrackingCh()) && |
500 | ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2])) |
a9e2aefa |
501 | { |
502 | ((AliMUONChamber*) (*fChambers)[idvol]) |
acc838fd |
503 | ->SigGenInit(pos[0], pos[1], pos[2]); |
802a864d |
504 | |
505 | Float_t localPos[3]; |
506 | Float_t globalPos[3] = {pos[0], pos[1], pos[2]}; |
507 | gMC->Gmtod(globalPos,localPos,1); |
508 | |
e0f71fb7 |
509 | eloss += destep; |
802a864d |
510 | |
ce3f5e87 |
511 | // if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh()) |
acc838fd |
512 | // MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol); |
a9e2aefa |
513 | xhit = pos[0]; |
514 | yhit = pos[1]; |
e0f71fb7 |
515 | zhit = pos[2]; |
516 | eloss = 0; |
a9e2aefa |
517 | tlength += step ; |
518 | // |
519 | // nothing special happened, add up energy loss |
520 | } else { |
521 | eloss += destep; |
522 | tlength += step ; |
523 | } |
524 | } |