]>
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 | ||
a713db22 | 179 | if (fSegmentationType == 1) { |
002920d1 | 180 | AliFatal("Old Segmentation no more supported"); |
a9e2aefa | 181 | } |
a713db22 | 182 | |
183 | if (fSegmentationType == 2) { | |
8109731a | 184 | fFactory = new AliMUONFactoryV2("New MUON Factory"); |
5a0e88a7 | 185 | AliInfo("New Segmentation"); |
a713db22 | 186 | } |
187 | ||
8109731a | 188 | fFactory->Build(this, "default"); |
a713db22 | 189 | |
190 | // | |
191 | // Initialize segmentation | |
192 | // | |
193 | if (!fSegmentationType) { | |
194 | AliFatal("No Segmentation Type defined."); | |
195 | return; | |
196 | } | |
197 | ||
a713db22 | 198 | for (i=0; i<AliMUONConstants::NCh(); i++) |
002920d1 | 199 | ( (AliMUONChamber*) (*fChambers)[i])->Init(fSegmentationType);// new segmentation |
200 | ||
a713db22 | 201 | |
331dcacd | 202 | // trigger circuit |
203 | // cp | |
204 | for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) | |
205 | ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i); | |
206 | ||
207 | ||
a713db22 | 208 | |
209 | ||
210 | ||
a9e2aefa | 211 | } |
1391e633 | 212 | |
d4bb94a1 | 213 | //__________________________________________________________________ |
214 | Int_t AliMUONv1::GetChamberId(Int_t volId) const | |
215 | { | |
216 | // Check if the volume with specified volId is a sensitive volume (gas) | |
217 | // of some chamber and returns the chamber number; | |
218 | // if not sensitive volume - return 0. | |
219 | // --- | |
220 | ||
221 | /* | |
222 | for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) | |
223 | if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i; | |
224 | */ | |
225 | for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) | |
226 | if ( ((AliMUONChamber*)(*fChambers)[i-1])->IsSensId(volId) ) return i; | |
227 | ||
228 | return 0; | |
229 | } | |
333f7cda | 230 | |
231 | //_______________________________________________________________________________ | |
232 | TString AliMUONv1::CurrentVolumePath() const | |
233 | { | |
234 | // Returns current volume path | |
235 | // (Could be removed when this function is available via gMC) | |
236 | // --- | |
237 | ||
238 | TString path = ""; | |
239 | TString name; | |
240 | Int_t copyNo; | |
241 | Int_t imother = 0; | |
242 | do { | |
243 | name = gMC->CurrentVolOffName(imother); | |
244 | gMC->CurrentVolOffID(imother++, copyNo); | |
245 | TString add = "/"; | |
246 | add += name; | |
247 | add += "."; | |
248 | add += copyNo; | |
249 | path.Insert(0,add); | |
250 | } | |
251 | while ( name != TString("ALIC") ); | |
252 | ||
253 | return path; | |
254 | } | |
255 | ||
1391e633 | 256 | //_______________________________________________________________________________ |
c33d9661 | 257 | void AliMUONv1::StepManager() |
258 | { | |
d7c4fbc4 | 259 | // Stepmanager for the chambers |
d59b2ec3 | 260 | // TBR |
261 | ||
262 | if (fStepManagerVersionDE) { | |
263 | StepManager2(); | |
264 | return; | |
265 | } | |
d7c4fbc4 | 266 | |
c33d9661 | 267 | |
268 | // Only charged tracks | |
d59b2ec3 | 269 | if( !(gMC->TrackCharge()) ) return; |
1391e633 | 270 | // Only charged tracks |
271 | ||
c33d9661 | 272 | // Only gas gap inside chamber |
273 | // Tag chambers and record hits when track enters | |
acc838fd | 274 | static Int_t idvol=-1; |
1391e633 | 275 | Int_t iChamber=0; |
276 | Int_t id=0; | |
277 | Int_t copy; | |
278 | const Float_t kBig = 1.e10; | |
279 | ||
acc838fd | 280 | |
281 | // | |
282 | // Only gas gap inside chamber | |
283 | // Tag chambers and record hits when track enters | |
c33d9661 | 284 | id=gMC->CurrentVolID(copy); |
acc838fd | 285 | iChamber = GetChamberId(id); |
286 | idvol = iChamber -1; | |
287 | ||
288 | if (idvol == -1) return; | |
abaf7c9d | 289 | |
967a2a25 | 290 | // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers |
291 | if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) ) | |
292 | AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); | |
293 | ||
1391e633 | 294 | if( gMC->IsTrackEntering() ) { |
295 | Float_t theta = fTrackMomentum.Theta(); | |
4ac9d21e | 296 | if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative |
297 | } | |
abaf7c9d | 298 | |
5a0e88a7 | 299 | // AliDebug(1, |
300 | // Form("Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, | |
301 | // ( (AliMUONChamber*)(*fChambers)[idvol])->Z())); | |
302 | // Particule id and mass, | |
1391e633 | 303 | Int_t ipart = gMC->TrackPid(); |
304 | Float_t mass = gMC->TrackMass(); | |
305 | ||
306 | fDestepSum[idvol]+=gMC->Edep(); | |
307 | // Get current particle id (ipart), track position (pos) and momentum (mom) | |
308 | if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum); | |
309 | fStepSum[idvol]+=gMC->TrackStep(); | |
abaf7c9d | 310 | |
5a0e88a7 | 311 | // if(AliDebugLevel()) { |
312 | // AliDebug(1, | |
313 | // Form("iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g", | |
314 | // iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, | |
315 | // mass, fStepSum[idvol], gMC->Edep())); | |
316 | // AliDebug(1, | |
317 | // Form("Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), | |
318 | // fTrackMomentum.Z())); | |
319 | // gMC->TrackPosition(fTrackPosition); | |
320 | // AliDebug(1, | |
321 | // Form("Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(), | |
322 | // fTrackPosition.Z())) ; | |
323 | // } | |
1391e633 | 324 | |
325 | // Track left chamber or StepSum larger than fStepMaxInActiveGas | |
326 | if ( gMC->IsTrackExiting() || | |
327 | gMC->IsTrackStop() || | |
328 | gMC->IsTrackDisappeared()|| | |
329 | (fStepSum[idvol]>fStepMaxInActiveGas) ) { | |
330 | ||
331 | if ( gMC->IsTrackExiting() || | |
acc838fd | 332 | gMC->IsTrackStop() || |
333 | gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig); | |
1391e633 | 334 | |
335 | gMC->TrackPosition(fTrackPosition); | |
336 | Float_t theta = fTrackMomentum.Theta(); | |
337 | Float_t phi = fTrackMomentum.Phi(); | |
338 | ||
d7c4fbc4 | 339 | TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi), |
acc838fd | 340 | fStepSum[idvol]/2.*sin(theta)*sin(phi), |
341 | fStepSum[idvol]/2.*cos(theta),0.0 ); | |
5a0e88a7 | 342 | // AliDebug(1,Form("Exit: Track Position %f %f %f",fTrackPosition.X(), |
343 | // fTrackPosition.Y(),fTrackPosition.Z())) ; | |
344 | // AliDebug(1,Form("Exit: Track backToWire %f %f %f",backToWire.X(), | |
345 | // backToWire.Y(),backToWire.Z()) ; | |
d7c4fbc4 | 346 | fTrackPosition-=backToWire; |
1391e633 | 347 | |
348 | //-------------- Angle effect | |
349 | // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass) | |
350 | ||
30178c30 | 351 | Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2 |
d7c4fbc4 | 352 | Float_t sigmaEffect10degrees; |
353 | Float_t sigmaEffectThetadegrees; | |
354 | Float_t eLossParticleELossMip; | |
355 | Float_t yAngleEffect=0.; | |
356 | Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative | |
357 | ||
374ebd7d | 358 | |
359 | if (fAngleEffect){ | |
30178c30 | 360 | if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) { |
361 | betaxGamma=TMath::Log(betaxGamma); | |
362 | eLossParticleELossMip = fElossRatio->Eval(betaxGamma); | |
1391e633 | 363 | // 10 degrees is a reference for a model (arbitrary) |
d7c4fbc4 | 364 | sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers |
1391e633 | 365 | // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. |
d7c4fbc4 | 366 | sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap |
1391e633 | 367 | if ( (iChamber==1) || (iChamber==2) ) |
acc838fd | 368 | sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm) |
d7c4fbc4 | 369 | yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm |
1391e633 | 370 | } |
374ebd7d | 371 | } |
1391e633 | 372 | |
333f7cda | 373 | // Detection elements ids |
e118b27e | 374 | AliMUONGeometryModule* geometry |
375 | = Chamber(iChamber-1).GetGeometry(); | |
376 | ||
377 | AliMUONGeometryDetElement* detElement | |
378 | = geometry->FindBySensitiveVolume(CurrentVolumePath()); | |
379 | ||
333f7cda | 380 | Int_t detElemId = 0; |
e118b27e | 381 | if (detElement) detElemId = detElement->GetUniqueID(); |
333f7cda | 382 | |
383 | if (!detElemId) { | |
384 | cerr << "Chamber id: " | |
385 | << setw(3) << iChamber << " " | |
386 | << "Current SV: " | |
387 | << CurrentVolumePath() | |
388 | << " detElemId: " | |
389 | << setw(5) << detElemId | |
390 | << endl; | |
391 | Double_t x, y, z; | |
392 | gMC->TrackPosition(x, y, z); | |
393 | cerr << " global position: " | |
394 | << x << ", " << y << ", " << z | |
395 | << endl; | |
8c343c7c | 396 | AliWarning("DetElemId not identified."); |
333f7cda | 397 | } |
398 | ||
1391e633 | 399 | // One hit per chamber |
47464038 | 400 | GetMUONData()->AddHit(fIshunt, |
401 | gAlice->GetMCApp()->GetCurrentTrackNumber(), | |
402 | iChamber, ipart, | |
403 | fTrackPosition.X(), | |
404 | fTrackPosition.Y()+yAngleEffect, | |
405 | fTrackPosition.Z(), | |
406 | gMC->TrackTime(), | |
407 | fTrackMomentum.P(), | |
408 | theta, | |
409 | phi, | |
410 | fStepSum[idvol], | |
411 | fDestepSum[idvol], | |
412 | fTrackPosition.X(), | |
413 | fTrackPosition.Y(), | |
414 | fTrackPosition.Z()); | |
415 | ||
5a0e88a7 | 416 | // if (AliDebugLevel()){ |
417 | // AliDebug(1,Form("Exit: Particle exiting from chamber %d",iChamber)); | |
418 | // AliDebug(1,Form("Exit: StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol])); | |
419 | // AliDebug(1,Form("Exit: Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z())) ; | |
1391e633 | 420 | // } |
421 | fStepSum[idvol] =0; // Reset for the next event | |
422 | fDestepSum[idvol]=0; // Reset for the next event | |
423 | } | |
abaf7c9d | 424 | } |
5f91c9e8 | 425 | |
d59b2ec3 | 426 | //_______________________________________________________________________________ |
427 | void AliMUONv1::StepManager2() | |
428 | { | |
429 | // Stepmanager for the chambers | |
430 | ||
d59b2ec3 | 431 | // Only charged tracks |
432 | if( !(gMC->TrackCharge()) ) return; | |
433 | // Only charged tracks | |
434 | ||
435 | // Only gas gap inside chamber | |
436 | // Tag chambers and record hits when track enters | |
437 | static Int_t idvol=-1; | |
438 | Int_t iChamber=0; | |
439 | Int_t id=0; | |
440 | Int_t copy; | |
441 | const Float_t kBig = 1.e10; | |
442 | ||
443 | ||
444 | // | |
445 | // Only gas gap inside chamber | |
446 | // Tag chambers and record hits when track enters | |
447 | id=gMC->CurrentVolID(copy); | |
448 | iChamber = GetChamberId(id); | |
449 | idvol = iChamber -1; | |
450 | ||
451 | if (idvol == -1) return; | |
452 | ||
453 | // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers | |
454 | if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) ) | |
455 | AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); | |
456 | ||
457 | if( gMC->IsTrackEntering() ) { | |
458 | Float_t theta = fTrackMomentum.Theta(); | |
459 | if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative | |
460 | } | |
461 | ||
5a0e88a7 | 462 | // AliDebug(1, |
463 | // Form("Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, | |
464 | // ( (AliMUONChamber*)(*fChambers)[idvol])->Z())) ; | |
d59b2ec3 | 465 | // Particule id and mass, |
466 | Int_t ipart = gMC->TrackPid(); | |
467 | Float_t mass = gMC->TrackMass(); | |
468 | ||
469 | fDestepSum[idvol]+=gMC->Edep(); | |
470 | // Get current particle id (ipart), track position (pos) and momentum (mom) | |
471 | if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum); | |
472 | fStepSum[idvol]+=gMC->TrackStep(); | |
473 | ||
5a0e88a7 | 474 | // if (AliDebugLevel()) { |
475 | // AliDebug(1,Form("Step, iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g", | |
476 | // iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, | |
477 | // mass, fStepSum[idvol], gMC->Edep())); | |
478 | // AliDebug(1,Form("Step:Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), | |
479 | // fTrackMomentum.Z())); | |
480 | // gMC->TrackPosition(fTrackPosition); | |
481 | // AliDebug(1,Form("Step: Track Position %f %f %f",fTrackPosition.X(), | |
482 | // fTrackPosition.Y(),fTrackPosition.Z())) ; | |
483 | //} | |
d59b2ec3 | 484 | |
485 | // Track left chamber or StepSum larger than fStepMaxInActiveGas | |
486 | if ( gMC->IsTrackExiting() || | |
487 | gMC->IsTrackStop() || | |
488 | gMC->IsTrackDisappeared()|| | |
489 | (fStepSum[idvol]>fStepMaxInActiveGas) ) { | |
490 | ||
491 | if ( gMC->IsTrackExiting() || | |
492 | gMC->IsTrackStop() || | |
493 | gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig); | |
494 | ||
495 | gMC->TrackPosition(fTrackPosition); | |
496 | Float_t theta = fTrackMomentum.Theta(); | |
497 | Float_t phi = fTrackMomentum.Phi(); | |
498 | ||
499 | TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi), | |
500 | fStepSum[idvol]/2.*sin(theta)*sin(phi), | |
501 | fStepSum[idvol]/2.*cos(theta),0.0 ); | |
5a0e88a7 | 502 | // AliDebug(1, |
503 | // Form("Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z())); | |
504 | // AliDebug(1, | |
505 | // Form("Exit: Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z())) ; | |
d59b2ec3 | 506 | fTrackPosition-=backToWire; |
507 | ||
508 | //-------------- Angle effect | |
509 | // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass) | |
510 | ||
511 | Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2 | |
512 | Float_t sigmaEffect10degrees; | |
513 | Float_t sigmaEffectThetadegrees; | |
514 | Float_t eLossParticleELossMip; | |
515 | Float_t yAngleEffect=0.; | |
516 | Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative | |
517 | ||
518 | ||
519 | if (fAngleEffect){ | |
520 | if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) { | |
521 | betaxGamma=TMath::Log(betaxGamma); | |
522 | eLossParticleELossMip = fElossRatio->Eval(betaxGamma); | |
523 | // 10 degrees is a reference for a model (arbitrary) | |
524 | sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers | |
525 | // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. | |
526 | sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap | |
527 | if ( (iChamber==1) || (iChamber==2) ) | |
528 | sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm) | |
529 | yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm | |
530 | } | |
531 | } | |
532 | ||
533 | // Detection elements ids | |
534 | AliMUONGeometryModule* geometry | |
535 | = Chamber(iChamber-1).GetGeometry(); | |
536 | ||
537 | AliMUONGeometryDetElement* detElement | |
538 | = geometry->FindBySensitiveVolume(CurrentVolumePath()); | |
539 | ||
540 | Int_t detElemId = 0; | |
541 | if (detElement) detElemId = detElement->GetUniqueID(); | |
542 | ||
543 | if (!detElemId) { | |
544 | cerr << "Chamber id: " | |
545 | << setw(3) << iChamber << " " | |
546 | << "Current SV: " | |
547 | << CurrentVolumePath() | |
548 | << " detElemId: " | |
549 | << setw(5) << detElemId | |
550 | << endl; | |
551 | Double_t x, y, z; | |
552 | gMC->TrackPosition(x, y, z); | |
553 | cerr << " global position: " | |
554 | << x << ", " << y << ", " << z | |
555 | << endl; | |
556 | AliError("DetElemId not identified."); | |
557 | } | |
558 | ||
559 | // One hit per chamber | |
8690a0a6 | 560 | GetMUONData()->AddHit2(fIshunt, |
d59b2ec3 | 561 | gAlice->GetMCApp()->GetCurrentTrackNumber(), |
562 | detElemId, ipart, | |
563 | fTrackPosition.X(), | |
564 | fTrackPosition.Y()+yAngleEffect, | |
565 | fTrackPosition.Z(), | |
566 | gMC->TrackTime(), | |
567 | fTrackMomentum.P(), | |
568 | theta, | |
569 | phi, | |
570 | fStepSum[idvol], | |
571 | fDestepSum[idvol], | |
572 | fTrackPosition.X(), | |
573 | fTrackPosition.Y(), | |
574 | fTrackPosition.Z()); | |
575 | ||
5a0e88a7 | 576 | // AliDebug(1,Form("Exit: Particle exiting from chamber %d",iChamber)); |
577 | // AliDebug(1,Form("Exit: StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol])); | |
578 | // AliDebug(1,Form("Exit: Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ; | |
579 | ||
d59b2ec3 | 580 | fStepSum[idvol] =0; // Reset for the next event |
581 | fDestepSum[idvol]=0; // Reset for the next event | |
582 | } | |
583 | } |