]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONv1.cxx
Obsolete file (Ivana)
[u/mrichter/AliRoot.git] / MUON / AliMUONv1.cxx
CommitLineData
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
45ClassImp(AliMUONv1)
46
47//___________________________________________
30178c30 48AliMUONv1::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//___________________________________________
66AliMUONv1::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//_____________________________________________________________________________
113AliMUONv1::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 122AliMUONv1::~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//_____________________________________________________________________________
134AliMUONv1& 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//__________________________________________________
147void 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 157void 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 167void 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");
f1501d74 185 printf("\n New Segmentation \n\n");
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//__________________________________________________________________
214Int_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//_______________________________________________________________________________
232TString 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 257void 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
1391e633 299// if (GetDebug()) {
300// Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ;
301// Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z);
302// }
303 // Particule id and mass,
304 Int_t ipart = gMC->TrackPid();
305 Float_t mass = gMC->TrackMass();
306
307 fDestepSum[idvol]+=gMC->Edep();
308 // Get current particle id (ipart), track position (pos) and momentum (mom)
309 if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum);
310 fStepSum[idvol]+=gMC->TrackStep();
abaf7c9d 311
1391e633 312// if (GetDebug()) {
313// Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
333f7cda 314// iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
1391e633 315// gMC->TrackPosition(fTrackPosition);
316// Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
d08aff2d 317// }
1391e633 318
319 // Track left chamber or StepSum larger than fStepMaxInActiveGas
320 if ( gMC->IsTrackExiting() ||
321 gMC->IsTrackStop() ||
322 gMC->IsTrackDisappeared()||
323 (fStepSum[idvol]>fStepMaxInActiveGas) ) {
324
325 if ( gMC->IsTrackExiting() ||
acc838fd 326 gMC->IsTrackStop() ||
327 gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig);
1391e633 328
329 gMC->TrackPosition(fTrackPosition);
330 Float_t theta = fTrackMomentum.Theta();
331 Float_t phi = fTrackMomentum.Phi();
332
d7c4fbc4 333 TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi),
acc838fd 334 fStepSum[idvol]/2.*sin(theta)*sin(phi),
335 fStepSum[idvol]/2.*cos(theta),0.0 );
1391e633 336 // if (GetDebug())
337 // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
338 // if (GetDebug())
d7c4fbc4 339 // Info("StepManager Exit ","Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z()) ;
340 fTrackPosition-=backToWire;
1391e633 341
342 //-------------- Angle effect
343 // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass)
344
30178c30 345 Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2
d7c4fbc4 346 Float_t sigmaEffect10degrees;
347 Float_t sigmaEffectThetadegrees;
348 Float_t eLossParticleELossMip;
349 Float_t yAngleEffect=0.;
350 Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative
351
374ebd7d 352
353 if (fAngleEffect){
30178c30 354 if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) {
355 betaxGamma=TMath::Log(betaxGamma);
356 eLossParticleELossMip = fElossRatio->Eval(betaxGamma);
1391e633 357 // 10 degrees is a reference for a model (arbitrary)
d7c4fbc4 358 sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers
1391e633 359 // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
d7c4fbc4 360 sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap
1391e633 361 if ( (iChamber==1) || (iChamber==2) )
acc838fd 362 sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm)
d7c4fbc4 363 yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm
1391e633 364 }
374ebd7d 365 }
1391e633 366
333f7cda 367 // Detection elements ids
e118b27e 368 AliMUONGeometryModule* geometry
369 = Chamber(iChamber-1).GetGeometry();
370
371 AliMUONGeometryDetElement* detElement
372 = geometry->FindBySensitiveVolume(CurrentVolumePath());
373
333f7cda 374 Int_t detElemId = 0;
e118b27e 375 if (detElement) detElemId = detElement->GetUniqueID();
333f7cda 376
377 if (!detElemId) {
378 cerr << "Chamber id: "
379 << setw(3) << iChamber << " "
380 << "Current SV: "
381 << CurrentVolumePath()
382 << " detElemId: "
383 << setw(5) << detElemId
384 << endl;
385 Double_t x, y, z;
386 gMC->TrackPosition(x, y, z);
387 cerr << " global position: "
388 << x << ", " << y << ", " << z
389 << endl;
8c343c7c 390 AliWarning("DetElemId not identified.");
333f7cda 391 }
392
1391e633 393 // One hit per chamber
47464038 394 GetMUONData()->AddHit(fIshunt,
395 gAlice->GetMCApp()->GetCurrentTrackNumber(),
396 iChamber, ipart,
397 fTrackPosition.X(),
398 fTrackPosition.Y()+yAngleEffect,
399 fTrackPosition.Z(),
400 gMC->TrackTime(),
401 fTrackMomentum.P(),
402 theta,
403 phi,
404 fStepSum[idvol],
405 fDestepSum[idvol],
406 fTrackPosition.X(),
407 fTrackPosition.Y(),
408 fTrackPosition.Z());
409
1391e633 410// if (GetDebug()){
411// Info("StepManager Exit","Particle exiting from chamber %d",iChamber);
412// Info("StepManager Exit","StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol]);
413// Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
414// }
415 fStepSum[idvol] =0; // Reset for the next event
416 fDestepSum[idvol]=0; // Reset for the next event
417 }
abaf7c9d 418}
5f91c9e8 419
d59b2ec3 420//_______________________________________________________________________________
421void AliMUONv1::StepManager2()
422{
423 // Stepmanager for the chambers
424
d59b2ec3 425 // Only charged tracks
426 if( !(gMC->TrackCharge()) ) return;
427 // Only charged tracks
428
429 // Only gas gap inside chamber
430 // Tag chambers and record hits when track enters
431 static Int_t idvol=-1;
432 Int_t iChamber=0;
433 Int_t id=0;
434 Int_t copy;
435 const Float_t kBig = 1.e10;
436
437
438 //
439 // Only gas gap inside chamber
440 // Tag chambers and record hits when track enters
441 id=gMC->CurrentVolID(copy);
442 iChamber = GetChamberId(id);
443 idvol = iChamber -1;
444
445 if (idvol == -1) return;
446
447 // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers
448 if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) )
449 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
450
451 if( gMC->IsTrackEntering() ) {
452 Float_t theta = fTrackMomentum.Theta();
453 if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative
454 }
455
456// if (GetDebug()) {
457// Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ;
458// Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z);
459// }
460 // Particule id and mass,
461 Int_t ipart = gMC->TrackPid();
462 Float_t mass = gMC->TrackMass();
463
464 fDestepSum[idvol]+=gMC->Edep();
465 // Get current particle id (ipart), track position (pos) and momentum (mom)
466 if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum);
467 fStepSum[idvol]+=gMC->TrackStep();
468
469// if (GetDebug()) {
470// Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
471// iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
472// gMC->TrackPosition(fTrackPosition);
473// Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
474// }
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 );
493 // if (GetDebug())
494 // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
495 // if (GetDebug())
496 // Info("StepManager Exit ","Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z()) ;
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
567// if (GetDebug()){
568// Info("StepManager Exit","Particle exiting from chamber %d",iChamber);
569// Info("StepManager Exit","StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol]);
570// Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
571// }
572 fStepSum[idvol] =0; // Reset for the next event
573 fDestepSum[idvol]=0; // Reset for the next event
574 }
575}