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