]>
Commit | Line | Data |
---|---|---|
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> |
333f7cda | 27 | #include <TGeoMatrix.h> |
a9e2aefa | 28 | |
30178c30 | 29 | #include "AliMUONv1.h" |
a9e2aefa | 30 | #include "AliConst.h" |
31 | #include "AliMUONChamber.h" | |
88cb7938 | 32 | #include "AliMUONConstants.h" |
a713db22 | 33 | #include "AliMUONFactoryV2.h" |
a9e2aefa | 34 | #include "AliMUONHit.h" |
8c449e83 | 35 | #include "AliMUONTriggerCircuit.h" |
d4bb94a1 | 36 | #include "AliMUONGeometryBuilder.h" |
e118b27e | 37 | #include "AliMUONGeometryModule.h" |
333f7cda | 38 | #include "AliMUONGeometrySVMap.h" |
e118b27e | 39 | #include "AliMUONGeometryDetElement.h" |
88cb7938 | 40 | #include "AliMagF.h" |
41 | #include "AliRun.h" | |
5d12ce38 | 42 | #include "AliMC.h" |
8c343c7c | 43 | #include "AliLog.h" |
a9e2aefa | 44 | |
45 | ClassImp(AliMUONv1) | |
46 | ||
47 | //___________________________________________ | |
30178c30 | 48 | AliMUONv1::AliMUONv1() |
49 | : AliMUON(), | |
d4bb94a1 | 50 | fStepManagerVersionOld(kFALSE), |
d59b2ec3 | 51 | fStepManagerVersionDE(kFALSE), |
d4bb94a1 | 52 | fAngleEffect(kTRUE), |
53 | fStepMaxInActiveGas(0.6), | |
54 | fStepSum(0x0), | |
55 | fDestepSum(0x0), | |
56 | fTrackMomentum(), | |
57 | fTrackPosition(), | |
58 | fElossRatio(0x0), | |
59 | fAngleEffect10(0x0), | |
60 | fAngleEffectNorma(0x0) | |
a9e2aefa | 61 | { |
d4bb94a1 | 62 | // Default constructor |
1391e633 | 63 | } |
d4bb94a1 | 64 | |
a9e2aefa | 65 | //___________________________________________ |
66 | AliMUONv1::AliMUONv1(const char *name, const char *title) | |
d4bb94a1 | 67 | : AliMUON(name,title), |
68 | fStepManagerVersionOld(kFALSE), | |
d59b2ec3 | 69 | fStepManagerVersionDE(kFALSE), |
d4bb94a1 | 70 | fAngleEffect(kTRUE), |
71 | fStepMaxInActiveGas(0.6), | |
72 | fStepSum(0x0), | |
73 | fDestepSum(0x0), | |
74 | fTrackMomentum(), | |
75 | fTrackPosition(), | |
76 | fElossRatio(0x0), | |
77 | fAngleEffect10(0x0), | |
78 | fAngleEffectNorma(0x0) | |
a9e2aefa | 79 | { |
d4bb94a1 | 80 | // Standard onstructor |
81 | ||
ba030c0e | 82 | // By default include all stations |
c33d9661 | 83 | |
1391e633 | 84 | fStepSum = new Float_t [AliMUONConstants::NCh()]; |
85 | fDestepSum = new Float_t [AliMUONConstants::NCh()]; | |
86 | for (Int_t i=0; i<AliMUONConstants::NCh(); i++) { | |
87 | fStepSum[i] =0.0; | |
88 | fDestepSum[i]=0.0; | |
89 | } | |
90 | // Ratio of particle mean eloss with respect MIP's Khalil Boudjemline, sep 2003, PhD.Thesis and Particle Data Book | |
91 | fElossRatio = new TF1("ElossRatio","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.); | |
92 | fElossRatio->SetParameter(0,1.02138); | |
93 | fElossRatio->SetParameter(1,-9.54149e-02); | |
94 | fElossRatio->SetParameter(2,+7.83433e-02); | |
95 | fElossRatio->SetParameter(3,-9.98208e-03); | |
96 | fElossRatio->SetParameter(4,+3.83279e-04); | |
97 | ||
98 | // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers) | |
99 | fAngleEffect10 = new TF1("AngleEffect10","[0]+[1]*x+[2]*x*x",0.5,3.0); | |
100 | fAngleEffect10->SetParameter(0, 1.90691e+02); | |
101 | fAngleEffect10->SetParameter(1,-6.62258e+01); | |
102 | fAngleEffect10->SetParameter(2,+1.28247e+01); | |
103 | // Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) | |
104 | // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. | |
105 | fAngleEffectNorma = new TF1("AngleEffectNorma","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0); | |
106 | fAngleEffectNorma->SetParameter(0,4.148); | |
107 | fAngleEffectNorma->SetParameter(1,-6.809e-01); | |
108 | fAngleEffectNorma->SetParameter(2,5.151e-02); | |
109 | fAngleEffectNorma->SetParameter(3,-1.490e-03); | |
a9e2aefa | 110 | } |
111 | ||
fb1bf5c0 | 112 | //_____________________________________________________________________________ |
113 | AliMUONv1::AliMUONv1(const AliMUONv1& right) | |
114 | : AliMUON(right) | |
115 | { | |
116 | // copy constructor (not implemented) | |
117 | ||
8c343c7c | 118 | AliFatal("Copy constructor not provided."); |
fb1bf5c0 | 119 | } |
120 | ||
a9e2aefa | 121 | //___________________________________________ |
acc838fd | 122 | AliMUONv1::~AliMUONv1() |
a9e2aefa | 123 | { |
acc838fd | 124 | // Destructor |
a9e2aefa | 125 | |
d4bb94a1 | 126 | delete [] fStepSum; |
127 | delete [] fDestepSum; | |
128 | delete fElossRatio; | |
129 | delete fAngleEffect10; | |
8109731a | 130 | delete fAngleEffectNorma; |
acc838fd | 131 | } |
b17c0c87 | 132 | |
fb1bf5c0 | 133 | //_____________________________________________________________________________ |
134 | AliMUONv1& AliMUONv1::operator=(const AliMUONv1& right) | |
135 | { | |
136 | // assignement operator (not implemented) | |
137 | ||
138 | // check assignement to self | |
139 | if (this == &right) return *this; | |
140 | ||
8c343c7c | 141 | AliFatal("Assignement operator not provided."); |
fb1bf5c0 | 142 | |
143 | return *this; | |
144 | } | |
145 | ||
acc838fd | 146 | //__________________________________________________ |
147 | void AliMUONv1::CreateGeometry() | |
148 | { | |
b17c0c87 | 149 | // |
d4bb94a1 | 150 | // Construct geometry using geometry builder |
a9e2aefa | 151 | // |
a9e2aefa | 152 | |
d4bb94a1 | 153 | fGeometryBuilder->CreateGeometry(); |
acc838fd | 154 | } |
a9e2aefa | 155 | |
acc838fd | 156 | //________________________________________________________________ |
a9e2aefa | 157 | void AliMUONv1::CreateMaterials() |
158 | { | |
a9e2aefa | 159 | // |
d4bb94a1 | 160 | // Construct materials using geometry builder |
161 | // | |
acc838fd | 162 | |
d4bb94a1 | 163 | fGeometryBuilder->CreateMaterials(); |
a9e2aefa | 164 | } |
165 | ||
acc838fd | 166 | //___________________________________________ |
a9e2aefa | 167 | void AliMUONv1::Init() |
a713db22 | 168 | { |
8c343c7c | 169 | AliDebug(1,"Start Init for version 1 - CPC chamber type"); |
e17592e9 | 170 | Int_t i; |
a713db22 | 171 | |
172 | ||
331dcacd | 173 | // |
d4bb94a1 | 174 | // Initialize geometry |
a9e2aefa | 175 | // |
d4bb94a1 | 176 | fGeometryBuilder->InitGeometry(); |
a713db22 | 177 | AliDebug(1,"Finished Init for version 1 - CPC chamber type"); |
178 | ||
7fe0032c | 179 | fFactory = new AliMUONFactoryV2("New MUON Factory"); |
180 | AliInfo("New Segmentation"); | |
a713db22 | 181 | |
a713db22 | 182 | |
8109731a | 183 | fFactory->Build(this, "default"); |
a713db22 | 184 | |
185 | // | |
186 | // Initialize segmentation | |
187 | // | |
a713db22 | 188 | |
a713db22 | 189 | for (i=0; i<AliMUONConstants::NCh(); i++) |
7fe0032c | 190 | ( (AliMUONChamber*) (*fChambers)[i])->Init(2);// new segmentation |
002920d1 | 191 | |
a713db22 | 192 | |
331dcacd | 193 | // trigger circuit |
194 | // cp | |
195 | for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) | |
196 | ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i); | |
197 | ||
198 | ||
a713db22 | 199 | |
200 | ||
201 | ||
a9e2aefa | 202 | } |
1391e633 | 203 | |
d4bb94a1 | 204 | //__________________________________________________________________ |
205 | Int_t AliMUONv1::GetChamberId(Int_t volId) const | |
206 | { | |
207 | // Check if the volume with specified volId is a sensitive volume (gas) | |
208 | // of some chamber and returns the chamber number; | |
209 | // if not sensitive volume - return 0. | |
210 | // --- | |
211 | ||
212 | /* | |
213 | for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) | |
214 | if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i; | |
215 | */ | |
216 | for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) | |
217 | if ( ((AliMUONChamber*)(*fChambers)[i-1])->IsSensId(volId) ) return i; | |
218 | ||
219 | return 0; | |
220 | } | |
333f7cda | 221 | |
222 | //_______________________________________________________________________________ | |
223 | TString AliMUONv1::CurrentVolumePath() const | |
224 | { | |
225 | // Returns current volume path | |
226 | // (Could be removed when this function is available via gMC) | |
227 | // --- | |
228 | ||
229 | TString path = ""; | |
230 | TString name; | |
231 | Int_t copyNo; | |
232 | Int_t imother = 0; | |
233 | do { | |
234 | name = gMC->CurrentVolOffName(imother); | |
235 | gMC->CurrentVolOffID(imother++, copyNo); | |
236 | TString add = "/"; | |
237 | add += name; | |
238 | add += "."; | |
239 | add += copyNo; | |
240 | path.Insert(0,add); | |
241 | } | |
242 | while ( name != TString("ALIC") ); | |
243 | ||
244 | return path; | |
245 | } | |
246 | ||
1391e633 | 247 | //_______________________________________________________________________________ |
c33d9661 | 248 | void AliMUONv1::StepManager() |
249 | { | |
d7c4fbc4 | 250 | // Stepmanager for the chambers |
d59b2ec3 | 251 | // TBR |
252 | ||
253 | if (fStepManagerVersionDE) { | |
254 | StepManager2(); | |
255 | return; | |
256 | } | |
d7c4fbc4 | 257 | |
c33d9661 | 258 | |
259 | // Only charged tracks | |
d59b2ec3 | 260 | if( !(gMC->TrackCharge()) ) return; |
1391e633 | 261 | // Only charged tracks |
262 | ||
c33d9661 | 263 | // Only gas gap inside chamber |
264 | // Tag chambers and record hits when track enters | |
acc838fd | 265 | static Int_t idvol=-1; |
1391e633 | 266 | Int_t iChamber=0; |
267 | Int_t id=0; | |
268 | Int_t copy; | |
269 | const Float_t kBig = 1.e10; | |
270 | ||
acc838fd | 271 | |
272 | // | |
273 | // Only gas gap inside chamber | |
274 | // Tag chambers and record hits when track enters | |
c33d9661 | 275 | id=gMC->CurrentVolID(copy); |
acc838fd | 276 | iChamber = GetChamberId(id); |
277 | idvol = iChamber -1; | |
278 | ||
279 | if (idvol == -1) return; | |
abaf7c9d | 280 | |
967a2a25 | 281 | // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers |
282 | if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) ) | |
283 | AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); | |
284 | ||
1391e633 | 285 | if( gMC->IsTrackEntering() ) { |
286 | Float_t theta = fTrackMomentum.Theta(); | |
4ac9d21e | 287 | if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative |
288 | } | |
abaf7c9d | 289 | |
5a0e88a7 | 290 | // AliDebug(1, |
291 | // Form("Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, | |
292 | // ( (AliMUONChamber*)(*fChambers)[idvol])->Z())); | |
293 | // Particule id and mass, | |
1391e633 | 294 | Int_t ipart = gMC->TrackPid(); |
295 | Float_t mass = gMC->TrackMass(); | |
296 | ||
297 | fDestepSum[idvol]+=gMC->Edep(); | |
298 | // Get current particle id (ipart), track position (pos) and momentum (mom) | |
299 | if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum); | |
300 | fStepSum[idvol]+=gMC->TrackStep(); | |
abaf7c9d | 301 | |
5a0e88a7 | 302 | // if(AliDebugLevel()) { |
303 | // AliDebug(1, | |
304 | // Form("iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g", | |
305 | // iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, | |
306 | // mass, fStepSum[idvol], gMC->Edep())); | |
307 | // AliDebug(1, | |
308 | // Form("Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), | |
309 | // fTrackMomentum.Z())); | |
310 | // gMC->TrackPosition(fTrackPosition); | |
311 | // AliDebug(1, | |
312 | // Form("Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(), | |
313 | // fTrackPosition.Z())) ; | |
314 | // } | |
1391e633 | 315 | |
316 | // Track left chamber or StepSum larger than fStepMaxInActiveGas | |
317 | if ( gMC->IsTrackExiting() || | |
318 | gMC->IsTrackStop() || | |
319 | gMC->IsTrackDisappeared()|| | |
320 | (fStepSum[idvol]>fStepMaxInActiveGas) ) { | |
321 | ||
322 | if ( gMC->IsTrackExiting() || | |
acc838fd | 323 | gMC->IsTrackStop() || |
324 | gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig); | |
1391e633 | 325 | |
326 | gMC->TrackPosition(fTrackPosition); | |
327 | Float_t theta = fTrackMomentum.Theta(); | |
328 | Float_t phi = fTrackMomentum.Phi(); | |
329 | ||
d7c4fbc4 | 330 | TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi), |
acc838fd | 331 | fStepSum[idvol]/2.*sin(theta)*sin(phi), |
332 | fStepSum[idvol]/2.*cos(theta),0.0 ); | |
5a0e88a7 | 333 | // AliDebug(1,Form("Exit: Track Position %f %f %f",fTrackPosition.X(), |
334 | // fTrackPosition.Y(),fTrackPosition.Z())) ; | |
335 | // AliDebug(1,Form("Exit: Track backToWire %f %f %f",backToWire.X(), | |
336 | // backToWire.Y(),backToWire.Z()) ; | |
d7c4fbc4 | 337 | fTrackPosition-=backToWire; |
1391e633 | 338 | |
339 | //-------------- Angle effect | |
340 | // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass) | |
341 | ||
30178c30 | 342 | Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2 |
d7c4fbc4 | 343 | Float_t sigmaEffect10degrees; |
344 | Float_t sigmaEffectThetadegrees; | |
345 | Float_t eLossParticleELossMip; | |
346 | Float_t yAngleEffect=0.; | |
347 | Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative | |
348 | ||
374ebd7d | 349 | |
350 | if (fAngleEffect){ | |
30178c30 | 351 | if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) { |
352 | betaxGamma=TMath::Log(betaxGamma); | |
353 | eLossParticleELossMip = fElossRatio->Eval(betaxGamma); | |
1391e633 | 354 | // 10 degrees is a reference for a model (arbitrary) |
d7c4fbc4 | 355 | sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers |
1391e633 | 356 | // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. |
d7c4fbc4 | 357 | sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap |
1391e633 | 358 | if ( (iChamber==1) || (iChamber==2) ) |
acc838fd | 359 | sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm) |
d7c4fbc4 | 360 | yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm |
1391e633 | 361 | } |
374ebd7d | 362 | } |
1391e633 | 363 | |
333f7cda | 364 | // Detection elements ids |
e118b27e | 365 | AliMUONGeometryModule* geometry |
366 | = Chamber(iChamber-1).GetGeometry(); | |
367 | ||
368 | AliMUONGeometryDetElement* detElement | |
369 | = geometry->FindBySensitiveVolume(CurrentVolumePath()); | |
370 | ||
333f7cda | 371 | Int_t detElemId = 0; |
e118b27e | 372 | if (detElement) detElemId = detElement->GetUniqueID(); |
333f7cda | 373 | |
374 | if (!detElemId) { | |
375 | cerr << "Chamber id: " | |
376 | << setw(3) << iChamber << " " | |
377 | << "Current SV: " | |
378 | << CurrentVolumePath() | |
379 | << " detElemId: " | |
380 | << setw(5) << detElemId | |
381 | << endl; | |
382 | Double_t x, y, z; | |
383 | gMC->TrackPosition(x, y, z); | |
384 | cerr << " global position: " | |
385 | << x << ", " << y << ", " << z | |
386 | << endl; | |
8c343c7c | 387 | AliWarning("DetElemId not identified."); |
333f7cda | 388 | } |
389 | ||
1391e633 | 390 | // One hit per chamber |
47464038 | 391 | GetMUONData()->AddHit(fIshunt, |
392 | gAlice->GetMCApp()->GetCurrentTrackNumber(), | |
393 | iChamber, ipart, | |
394 | fTrackPosition.X(), | |
395 | fTrackPosition.Y()+yAngleEffect, | |
396 | fTrackPosition.Z(), | |
397 | gMC->TrackTime(), | |
398 | fTrackMomentum.P(), | |
399 | theta, | |
400 | phi, | |
401 | fStepSum[idvol], | |
402 | fDestepSum[idvol], | |
403 | fTrackPosition.X(), | |
404 | fTrackPosition.Y(), | |
405 | fTrackPosition.Z()); | |
406 | ||
5a0e88a7 | 407 | // if (AliDebugLevel()){ |
408 | // AliDebug(1,Form("Exit: Particle exiting from chamber %d",iChamber)); | |
409 | // AliDebug(1,Form("Exit: StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol])); | |
410 | // AliDebug(1,Form("Exit: Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z())) ; | |
1391e633 | 411 | // } |
412 | fStepSum[idvol] =0; // Reset for the next event | |
413 | fDestepSum[idvol]=0; // Reset for the next event | |
414 | } | |
abaf7c9d | 415 | } |
5f91c9e8 | 416 | |
d59b2ec3 | 417 | //_______________________________________________________________________________ |
418 | void AliMUONv1::StepManager2() | |
419 | { | |
420 | // Stepmanager for the chambers | |
421 | ||
d59b2ec3 | 422 | // Only charged tracks |
423 | if( !(gMC->TrackCharge()) ) return; | |
424 | // Only charged tracks | |
425 | ||
426 | // Only gas gap inside chamber | |
427 | // Tag chambers and record hits when track enters | |
428 | static Int_t idvol=-1; | |
429 | Int_t iChamber=0; | |
430 | Int_t id=0; | |
431 | Int_t copy; | |
432 | const Float_t kBig = 1.e10; | |
433 | ||
434 | ||
435 | // | |
436 | // Only gas gap inside chamber | |
437 | // Tag chambers and record hits when track enters | |
438 | id=gMC->CurrentVolID(copy); | |
439 | iChamber = GetChamberId(id); | |
440 | idvol = iChamber -1; | |
441 | ||
442 | if (idvol == -1) return; | |
443 | ||
444 | // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers | |
445 | if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) ) | |
446 | AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); | |
447 | ||
448 | if( gMC->IsTrackEntering() ) { | |
449 | Float_t theta = fTrackMomentum.Theta(); | |
450 | if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative | |
451 | } | |
452 | ||
5a0e88a7 | 453 | // AliDebug(1, |
454 | // Form("Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, | |
455 | // ( (AliMUONChamber*)(*fChambers)[idvol])->Z())) ; | |
d59b2ec3 | 456 | // Particule id and mass, |
457 | Int_t ipart = gMC->TrackPid(); | |
458 | Float_t mass = gMC->TrackMass(); | |
459 | ||
460 | fDestepSum[idvol]+=gMC->Edep(); | |
461 | // Get current particle id (ipart), track position (pos) and momentum (mom) | |
462 | if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum); | |
463 | fStepSum[idvol]+=gMC->TrackStep(); | |
464 | ||
5a0e88a7 | 465 | // if (AliDebugLevel()) { |
466 | // AliDebug(1,Form("Step, iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g", | |
467 | // iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, | |
468 | // mass, fStepSum[idvol], gMC->Edep())); | |
469 | // AliDebug(1,Form("Step:Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), | |
470 | // fTrackMomentum.Z())); | |
471 | // gMC->TrackPosition(fTrackPosition); | |
472 | // AliDebug(1,Form("Step: Track Position %f %f %f",fTrackPosition.X(), | |
473 | // fTrackPosition.Y(),fTrackPosition.Z())) ; | |
474 | //} | |
d59b2ec3 | 475 | |
476 | // Track left chamber or StepSum larger than fStepMaxInActiveGas | |
477 | if ( gMC->IsTrackExiting() || | |
478 | gMC->IsTrackStop() || | |
479 | gMC->IsTrackDisappeared()|| | |
480 | (fStepSum[idvol]>fStepMaxInActiveGas) ) { | |
481 | ||
482 | if ( gMC->IsTrackExiting() || | |
483 | gMC->IsTrackStop() || | |
484 | gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig); | |
485 | ||
486 | gMC->TrackPosition(fTrackPosition); | |
487 | Float_t theta = fTrackMomentum.Theta(); | |
488 | Float_t phi = fTrackMomentum.Phi(); | |
489 | ||
490 | TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi), | |
491 | fStepSum[idvol]/2.*sin(theta)*sin(phi), | |
492 | fStepSum[idvol]/2.*cos(theta),0.0 ); | |
5a0e88a7 | 493 | // AliDebug(1, |
494 | // Form("Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z())); | |
495 | // AliDebug(1, | |
496 | // Form("Exit: Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z())) ; | |
d59b2ec3 | 497 | fTrackPosition-=backToWire; |
498 | ||
499 | //-------------- Angle effect | |
500 | // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass) | |
501 | ||
502 | Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2 | |
503 | Float_t sigmaEffect10degrees; | |
504 | Float_t sigmaEffectThetadegrees; | |
505 | Float_t eLossParticleELossMip; | |
506 | Float_t yAngleEffect=0.; | |
507 | Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative | |
508 | ||
509 | ||
510 | if (fAngleEffect){ | |
511 | if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) { | |
512 | betaxGamma=TMath::Log(betaxGamma); | |
513 | eLossParticleELossMip = fElossRatio->Eval(betaxGamma); | |
514 | // 10 degrees is a reference for a model (arbitrary) | |
515 | sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers | |
516 | // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. | |
517 | sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap | |
518 | if ( (iChamber==1) || (iChamber==2) ) | |
519 | sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm) | |
520 | yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm | |
521 | } | |
522 | } | |
523 | ||
524 | // Detection elements ids | |
525 | AliMUONGeometryModule* geometry | |
526 | = Chamber(iChamber-1).GetGeometry(); | |
527 | ||
528 | AliMUONGeometryDetElement* detElement | |
529 | = geometry->FindBySensitiveVolume(CurrentVolumePath()); | |
530 | ||
531 | Int_t detElemId = 0; | |
532 | if (detElement) detElemId = detElement->GetUniqueID(); | |
533 | ||
534 | if (!detElemId) { | |
535 | cerr << "Chamber id: " | |
536 | << setw(3) << iChamber << " " | |
537 | << "Current SV: " | |
538 | << CurrentVolumePath() | |
539 | << " detElemId: " | |
540 | << setw(5) << detElemId | |
541 | << endl; | |
542 | Double_t x, y, z; | |
543 | gMC->TrackPosition(x, y, z); | |
544 | cerr << " global position: " | |
545 | << x << ", " << y << ", " << z | |
546 | << endl; | |
547 | AliError("DetElemId not identified."); | |
548 | } | |
549 | ||
550 | // One hit per chamber | |
8690a0a6 | 551 | GetMUONData()->AddHit2(fIshunt, |
d59b2ec3 | 552 | gAlice->GetMCApp()->GetCurrentTrackNumber(), |
553 | detElemId, ipart, | |
554 | fTrackPosition.X(), | |
555 | fTrackPosition.Y()+yAngleEffect, | |
556 | fTrackPosition.Z(), | |
557 | gMC->TrackTime(), | |
558 | fTrackMomentum.P(), | |
559 | theta, | |
560 | phi, | |
561 | fStepSum[idvol], | |
562 | fDestepSum[idvol], | |
563 | fTrackPosition.X(), | |
564 | fTrackPosition.Y(), | |
565 | fTrackPosition.Z()); | |
566 | ||
5a0e88a7 | 567 | // AliDebug(1,Form("Exit: Particle exiting from chamber %d",iChamber)); |
568 | // AliDebug(1,Form("Exit: StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol])); | |
569 | // AliDebug(1,Form("Exit: Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ; | |
570 | ||
d59b2ec3 | 571 | fStepSum[idvol] =0; // Reset for the next event |
572 | fDestepSum[idvol]=0; // Reset for the next event | |
573 | } | |
574 | } |