]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONv1.cxx
Logging of Debug, Info and Error Messages follwing AliRoot Standard http://aliweb...
[u/mrichter/AliRoot.git] / MUON / AliMUONv1.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *      SigmaEffect_thetadegrees                                                                  *
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     *
12  * about the suitability of this software for any purpeateose. It is      *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 /////////////////////////////////////////////////////////
19 //  Manager and hits classes for set:MUON version 1    //
20 /////////////////////////////////////////////////////////
21
22 #include <TRandom.h>
23 #include <TF1.h>
24 #include <TClonesArray.h>
25 #include <TRandom.h> 
26 #include <TVirtualMC.h>
27 #include <TGeoMatrix.h>
28
29 #include "AliMUONv1.h"
30 #include "AliConst.h" 
31 #include "AliMUONChamber.h"
32 #include "AliMUONConstants.h"
33 #include "AliMUONFactory.h"
34 #include "AliMUONHit.h"
35 #include "AliMUONTriggerCircuit.h"
36 #include "AliMUONGeometryBuilder.h"     
37 #include "AliMUONGeometrySVMap.h"       
38 #include "AliMagF.h"
39 #include "AliRun.h"
40 #include "AliMC.h"
41 #include "AliLog.h"
42
43 ClassImp(AliMUONv1)
44  
45 //___________________________________________
46 AliMUONv1::AliMUONv1() 
47   : AliMUON(),
48     fStepManagerVersionOld(kFALSE),
49     fAngleEffect(kTRUE),
50     fStepMaxInActiveGas(0.6),
51     fStepSum(0x0),
52     fDestepSum(0x0),
53     fTrackMomentum(), 
54     fTrackPosition(),
55     fElossRatio(0x0),
56     fAngleEffect10(0x0),
57     fAngleEffectNorma(0x0)
58 {
59 // Default constructor
60
61
62 //___________________________________________
63 AliMUONv1::AliMUONv1(const char *name, const char *title)
64   : AliMUON(name,title), 
65     fStepManagerVersionOld(kFALSE),
66     fAngleEffect(kTRUE),
67     fStepMaxInActiveGas(0.6),
68     fStepSum(0x0),
69     fDestepSum(0x0),
70     fTrackMomentum(), 
71     fTrackPosition(),
72     fElossRatio(0x0),
73     fAngleEffect10(0x0),
74     fAngleEffectNorma(0x0)
75 {
76 // Standard onstructor
77
78     // By default include all stations
79     AliMUONFactory factory;
80     factory.Build(this, title);
81
82     fStepSum   = new Float_t [AliMUONConstants::NCh()];
83     fDestepSum = new Float_t [AliMUONConstants::NCh()];
84     for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
85       fStepSum[i] =0.0;
86       fDestepSum[i]=0.0;
87     }
88     // Ratio of particle mean eloss with respect MIP's Khalil Boudjemline, sep 2003, PhD.Thesis and Particle Data Book
89     fElossRatio = new TF1("ElossRatio","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.); 
90     fElossRatio->SetParameter(0,1.02138);
91     fElossRatio->SetParameter(1,-9.54149e-02);
92     fElossRatio->SetParameter(2,+7.83433e-02); 
93     fElossRatio->SetParameter(3,-9.98208e-03);
94     fElossRatio->SetParameter(4,+3.83279e-04);
95
96     // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers)
97     fAngleEffect10 = new TF1("AngleEffect10","[0]+[1]*x+[2]*x*x",0.5,3.0);
98     fAngleEffect10->SetParameter(0, 1.90691e+02);
99     fAngleEffect10->SetParameter(1,-6.62258e+01);
100     fAngleEffect10->SetParameter(2,+1.28247e+01);
101     // Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis)  
102     // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
103     fAngleEffectNorma = new TF1("AngleEffectNorma","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0);
104     fAngleEffectNorma->SetParameter(0,4.148);
105     fAngleEffectNorma->SetParameter(1,-6.809e-01);
106     fAngleEffectNorma->SetParameter(2,5.151e-02);
107     fAngleEffectNorma->SetParameter(3,-1.490e-03);
108 }
109
110 //_____________________________________________________________________________
111 AliMUONv1::AliMUONv1(const AliMUONv1& right) 
112   : AliMUON(right) 
113 {  
114   // copy constructor (not implemented)
115
116   AliFatal("Copy constructor not provided.");
117 }
118
119 //___________________________________________
120 AliMUONv1::~AliMUONv1()
121 {
122 // Destructor
123
124   delete [] fStepSum;
125   delete [] fDestepSum;
126   delete fElossRatio;
127   delete fAngleEffect10;
128   delete fAngleEffectNorma;  
129 }
130
131 //_____________________________________________________________________________
132 AliMUONv1& AliMUONv1::operator=(const AliMUONv1& right)
133 {
134   // assignement operator (not implemented)
135
136   // check assignement to self
137   if (this == &right) return *this;
138
139   AliFatal("Assignement operator not provided.");
140     
141   return *this;  
142 }    
143
144 //__________________________________________________
145 void AliMUONv1::CreateGeometry()
146 {
147 //
148 // Construct geometry using geometry builder
149 //
150
151   fGeometryBuilder->CreateGeometry();
152 }
153
154 //________________________________________________________________
155 void AliMUONv1::CreateMaterials()
156 {
157 //
158 // Construct materials using geometry builder
159 //
160
161   fGeometryBuilder->CreateMaterials();
162 }
163
164 #include "AliMUONChamberGeometry.h"     
165 #include "AliMUONGeometryTransformStore.h"      
166 //___________________________________________
167 void AliMUONv1::Init()
168 {
169    // 
170    // Initialize Tracking Chambers
171    //
172    AliDebug(1,"Start Init for version 1 - CPC chamber type");
173    Int_t i;
174    for (i=0; i<AliMUONConstants::NCh(); i++) {
175        ( (AliMUONChamber*) (*fChambers)[i])->Init();
176    }
177    
178    //
179    // Initialize geometry
180    //
181    fGeometryBuilder->InitGeometry();
182    AliDebug(1,"Finished Init for version 1 - CPC chamber type");
183
184    //cp 
185    AliDebug(1,"Start Init for Trigger Circuits");
186    for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) {
187      ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i);
188    }
189    AliDebug(1,"Finished Init for Trigger Circuits");
190    //cp
191
192    //
193    // Debug info
194    //
195    if (GetDebug() >1) {
196      // Print transformations and SV map
197      for (i=0; i<AliMUONConstants::NCh(); i++) {
198  
199        cout << "Chamber: " << i+1 << endl;
200        cout << "===================" << endl; 
201      
202        Chamber(i).GetGeometry()
203            ->GetTransformStore()->Print("");
204  
205        Chamber(i).GetGeometry()
206            ->GetSVMap()->Print("");
207      }
208      cout << endl;
209    }  
210 }
211
212 //__________________________________________________________________
213 Int_t  AliMUONv1::GetChamberId(Int_t volId) const
214 {
215 // Check if the volume with specified  volId is a sensitive volume (gas) 
216 // of some chamber and returns the chamber number;
217 // if not sensitive volume - return 0.
218 // ---
219
220 /*
221   for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++)
222     if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i;
223 */
224   for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++)
225     if ( ((AliMUONChamber*)(*fChambers)[i-1])->IsSensId(volId) ) return i;
226
227   return 0;
228 }
229
230 //_______________________________________________________________________________
231 TString  AliMUONv1::CurrentVolumePath() const
232 {
233 // Returns current volume path
234 // (Could be removed when this function is available via gMC)
235 // ---       
236
237   TString path = "";
238   TString name;
239   Int_t copyNo;
240   Int_t imother = 0;
241   do {
242     name = gMC->CurrentVolOffName(imother);
243     gMC->CurrentVolOffID(imother++, copyNo);
244     TString add = "/";
245     add += name;
246     add += ".";
247     add += copyNo;
248     path.Insert(0,add); 
249   }
250   while ( name != TString("ALIC") );
251   
252   return path;  
253 }
254
255 //_______________________________________________________________________________
256 void AliMUONv1::StepManager()
257 {
258   // Stepmanager for the chambers
259
260  if (fStepManagerVersionOld) {
261     StepManagerOld();
262     return;
263   }
264
265   // Only charged tracks
266   if( !(gMC->TrackCharge()) && !(gMC->TrackPid()==0) ) return; 
267   // Only charged tracks
268   
269   // Only gas gap inside chamber
270   // Tag chambers and record hits when track enters 
271   static Int_t   idvol=-1;
272   Int_t   iChamber=0;
273   Int_t   id=0;
274   Int_t   copy;
275   const  Float_t kBig = 1.e10;
276
277
278   //
279   // Only gas gap inside chamber
280   // Tag chambers and record hits when track enters 
281   id=gMC->CurrentVolID(copy);
282   iChamber = GetChamberId(id);
283   idvol = iChamber -1;
284
285   if (idvol == -1) return;
286   
287   if (GetDebug() > 1) {
288     // Fill the global position of detection elements
289     // Only for verification 
290     AliMUONGeometrySVMap* svMap
291       =  Chamber(iChamber-1).GetGeometry()->GetSVMap();
292     Double_t x, y, z;
293     gMC->TrackPosition(x, y, z);           
294     svMap->AddPosition(CurrentVolumePath(), TGeoTranslation(x, y, z));
295   }   
296   
297   if (gMC->TrackPid()==0) return;
298
299   // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers
300   if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) )     
301     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
302   
303    if( gMC->IsTrackEntering() ) {
304      Float_t theta = fTrackMomentum.Theta();
305      if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative
306   }
307
308 //  if (GetDebug()) {
309 //     Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ;
310 //      Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z);
311 //   }  
312   // Particule id and mass, 
313   Int_t     ipart = gMC->TrackPid();
314   Float_t   mass  = gMC->TrackMass();
315
316   fDestepSum[idvol]+=gMC->Edep();
317   // Get current particle id (ipart), track position (pos)  and momentum (mom)
318   if ( fStepSum[idvol]==0.0 )  gMC->TrackMomentum(fTrackMomentum);
319   fStepSum[idvol]+=gMC->TrackStep();
320   
321 //   if (GetDebug()) {
322 //     Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
323 //       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()) ;
324 //     gMC->TrackPosition(fTrackPosition);
325 //     Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
326 //   }
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() || 
335            gMC->IsTrackStop() || 
336            gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig);
337
338     gMC->TrackPosition(fTrackPosition);
339     Float_t theta = fTrackMomentum.Theta();
340     Float_t phi   = fTrackMomentum.Phi();
341     
342     TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi),
343                                fStepSum[idvol]/2.*sin(theta)*sin(phi),
344                                fStepSum[idvol]/2.*cos(theta),0.0       );
345     //     if (GetDebug()) 
346     //       Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
347     //     if (GetDebug()) 
348     //        Info("StepManager Exit ","Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z()) ;
349     fTrackPosition-=backToWire;
350     
351     //-------------- Angle effect 
352     // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass)
353     
354     Float_t betaxGamma    = fTrackMomentum.P()/mass;//  pc/mc2
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
361
362     if (fAngleEffect){
363     if ( (betaxGamma >3.2)   &&  (thetawires*kRaddeg<=15.) ) {
364       betaxGamma=TMath::Log(betaxGamma);
365       eLossParticleELossMip = fElossRatio->Eval(betaxGamma);
366       // 10 degrees is a reference for a model (arbitrary)
367       sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers
368       // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
369       sigmaEffectThetadegrees =  sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg);  // For 5mm gap  
370       if ( (iChamber==1)  ||  (iChamber==2) )  
371         sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm)
372       yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm
373     }
374     }
375     
376     // Detection elements ids
377     AliMUONGeometryTransformStore* transforms
378       =  Chamber(iChamber-1).GetGeometry()->GetTransformStore();
379     const TGeoCombiTrans* kTransform
380       = transforms->FindBySensitiveVolume(CurrentVolumePath());
381       
382     Int_t detElemId = 0;
383     if (kTransform) detElemId = kTransform->GetUniqueID(); 
384  
385     if (!detElemId) {
386       cerr << "Chamber id: "
387            << setw(3) << iChamber << "  "
388            << "Current SV: " 
389            <<  CurrentVolumePath() 
390            << "  detElemId: "
391            << setw(5) << detElemId 
392            << endl;
393       Double_t x, y, z;
394       gMC->TrackPosition(x, y, z);         
395       cerr << "   global position: "
396            << x << ", " << y << ", " << z
397            << endl;
398       AliWarning("DetElemId not identified.");
399     }  
400     
401     // One hit per chamber
402     GetMUONData()->AddHit(fIshunt, 
403                           gAlice->GetMCApp()->GetCurrentTrackNumber(), 
404                           iChamber, ipart,
405                           fTrackPosition.X(), 
406                           fTrackPosition.Y()+yAngleEffect, 
407                           fTrackPosition.Z(), 
408                           gMC->TrackTime(),
409                           fTrackMomentum.P(),
410                           theta, 
411                           phi, 
412                           fStepSum[idvol], 
413                           fDestepSum[idvol],                        
414                           fTrackPosition.X(),
415                           fTrackPosition.Y(),
416                           fTrackPosition.Z());
417
418 //     if (GetDebug()){
419 //       Info("StepManager Exit","Particle exiting from chamber %d",iChamber);
420 //       Info("StepManager Exit","StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol]);
421 //       Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
422 //     }
423     fStepSum[idvol]  =0; // Reset for the next event
424     fDestepSum[idvol]=0; // Reset for the next event
425   }
426 }
427
428 //__________________________________________
429 void AliMUONv1::StepManagerOld()
430 {
431   // Old Stepmanager for the chambers
432   Int_t          copy, id;
433   static Int_t   idvol =-1;
434   static Int_t   vol[2];
435   Int_t          ipart;
436   TLorentzVector pos;
437   TLorentzVector mom;
438   Float_t        theta,phi;
439   Float_t        destep, step;
440   
441   static Float_t sstep;
442   static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
443   const  Float_t kBig = 1.e10;
444   static Float_t hits[15];
445
446   TClonesArray &lhits = *fHits;
447
448   //
449   //
450   // Only charged tracks
451   if( !(gMC->TrackCharge()) ) return; 
452   //
453   // Only gas gap inside chamber
454   // Tag chambers and record hits when track enters 
455   id=gMC->CurrentVolID(copy);
456   vol[0] = GetChamberId(id);
457   idvol = vol[0] -1;
458
459   if (idvol == -1) return;
460
461   //
462   // Get current particle id (ipart), track position (pos)  and momentum (mom) 
463   gMC->TrackPosition(pos);
464   gMC->TrackMomentum(mom);
465
466   ipart  = gMC->TrackPid();
467
468   //
469   // momentum loss and steplength in last step
470   destep = gMC->Edep();
471   step   = gMC->TrackStep();
472   // cout<<"------------"<<step<<endl;
473   //
474   // record hits when track enters ...
475   if( gMC->IsTrackEntering()) {
476
477       gMC->SetMaxStep(fMaxStepGas);
478       Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
479       Double_t rt = TMath::Sqrt(tc);
480       Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
481       Double_t tx = mom[0]/pmom;
482       Double_t ty = mom[1]/pmom;
483       Double_t tz = mom[2]/pmom;
484       Double_t s  = ((AliMUONChamber*)(*fChambers)[idvol])
485           ->ResponseModel()
486           ->Pitch()/tz;
487       theta   = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
488       phi     = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
489       hits[0] = Float_t(ipart);         // Geant3 particle type
490       hits[1] = pos[0]+s*tx;            // X-position for hit
491       hits[2] = pos[1]+s*ty;            // Y-position for hit
492       hits[3] = pos[2]+s*tz;            // Z-position for hit
493       hits[4] = theta;                  // theta angle of incidence
494       hits[5] = phi;                    // phi angle of incidence 
495       hits[8] = 0;//PadHits does not exist anymore  (Float_t) fNPadHits;    // first padhit
496       hits[9] = -1;                     // last pad hit
497       hits[10] = mom[3];                // hit momentum P
498       hits[11] = mom[0];                // Px
499       hits[12] = mom[1];                // Py
500       hits[13] = mom[2];                // Pz
501       tof=gMC->TrackTime();
502       hits[14] = tof;                   // Time of flight
503       tlength  = 0;
504       eloss    = 0;
505       eloss2   = 0;
506       sstep=0;
507       xhit     = pos[0];
508       yhit     = pos[1];      
509       zhit     = pos[2];      
510       Chamber(idvol).ChargeCorrelationInit();
511       // Only if not trigger chamber
512
513 //       printf("---------------------------\n");
514 //       printf(">>>> Y =  %f \n",hits[2]);
515 //       printf("---------------------------\n");
516     
517       
518
519      //  if(idvol < AliMUONConstants::NTrackingCh()) {
520 //        //
521 //        //  Initialize hit position (cursor) in the segmentation model 
522 //        ((AliMUONChamber*) (*fChambers)[idvol])
523 //            ->SigGenInit(pos[0], pos[1], pos[2]);
524 //       } else {
525 //        //geant3->Gpcxyz();
526 //        //printf("In the Trigger Chamber #%d\n",idvol-9);
527 //       }
528   }
529   eloss2+=destep;
530   sstep+=step;
531
532   // cout<<sstep<<endl;
533
534   // 
535   // Calculate the charge induced on a pad (disintegration) in case 
536   //
537   // Mip left chamber ...
538   if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
539       gMC->SetMaxStep(kBig);
540       eloss   += destep;
541       tlength += step;
542       
543       Float_t x0,y0,z0;
544       Float_t localPos[3];
545       Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
546       gMC->Gmtod(globalPos,localPos,1); 
547
548       if(idvol < AliMUONConstants::NTrackingCh()) {
549 // tracking chambers
550           x0 = 0.5*(xhit+pos[0]);
551           y0 = 0.5*(yhit+pos[1]);
552           z0 = 0.5*(zhit+pos[2]);
553       } else {
554 // trigger chambers
555           x0 = xhit;
556           y0 = yhit;
557           z0 = 0.;
558       }
559       
560
561       //      if (eloss >0)  MakePadHits(x0,y0,z0,eloss,tof,idvol);
562       
563           
564       hits[6] = tlength;   // track length
565       hits[7] = eloss2;    // de/dx energy loss
566
567
568       //      if (fNPadHits > (Int_t)hits[8]) {
569       //          hits[8] = hits[8]+1;
570       //          hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
571       //}
572 //
573 //    new hit 
574       
575       new(lhits[fNhits++]) 
576           AliMUONHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
577       eloss = 0; 
578       //
579       // Check additional signal generation conditions 
580       // defined by the segmentation
581       // model (boundary crossing conditions)
582       // only for tracking chambers
583   } else if 
584       ((idvol < AliMUONConstants::NTrackingCh()) &&
585        ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2]))
586   {
587       ((AliMUONChamber*) (*fChambers)[idvol])
588           ->SigGenInit(pos[0], pos[1], pos[2]);
589       
590       Float_t localPos[3];
591       Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
592       gMC->Gmtod(globalPos,localPos,1); 
593
594       eloss    += destep;
595
596       // if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh())
597       //        MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol);
598       xhit     = pos[0];
599       yhit     = pos[1]; 
600       zhit     = pos[2];
601       eloss = 0;
602       tlength += step ;
603       //
604       // nothing special  happened, add up energy loss
605   } else {        
606       eloss   += destep;
607       tlength += step ;
608   }
609 }
610
611 //______________________________________________________________________________
612 void   AliMUONv1::FinishRun()
613 {
614 // Print debug info 
615 // ---
616
617   if (GetDebug() <= 1) return;
618
619   // Print the global positions of detection elements
620   for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
621
622     cout << "Chamber: " << i+1 << endl;
623     cout << "===================" << endl; 
624      
625     AliMUONGeometrySVMap* svMap
626       = Chamber(i).GetGeometry()->GetSVMap();
627       
628     svMap->SortPositions();
629     svMap->PrintPositions();
630     svMap->ClearPositions();
631   }
632   cout << endl;    
633 }