]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTrackParam.cxx
New digitizer, not deriving from MUONDigitizer and doing decalibration of
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackParam.cxx
index bc91e6dcb947e245c2848cbf049860cfb8353693..1b0a0bfe4d7b7b5a3fa72b472e75f899d2f7e3af 100644 (file)
@@ -28,7 +28,7 @@
 //#include <Riostream.h>
 #include "AliMUON.h"
 #include "AliMUONTrackParam.h" 
-//#include "AliMUONChamber.h"
+#include "AliMUONConstants.h"
 #include "AliRun.h" 
 #include "AliMagF.h" 
 #include "AliLog.h" 
@@ -120,24 +120,28 @@ void AliMUONTrackParam::ExtrapToZ(Double_t Z)
   // Interpolation back to exact Z (2nd order)
   // should be in function ???? using TArray ????
   Double_t dZ12 = vGeant3New[2] - vGeant3[2]; // 1->2
-  Double_t dZ1i = Z - vGeant3[2]; // 1-i
-  Double_t dZi2 = vGeant3New[2] - Z; // i->2
-  Double_t xPrime = (vGeant3New[0] - vGeant3[0]) / dZ12;
-  Double_t xSecond =
-    ((vGeant3New[3] / vGeant3New[5]) - (vGeant3[3] / vGeant3[5])) / dZ12;
-  Double_t yPrime = (vGeant3New[1] - vGeant3[1]) / dZ12;
-  Double_t ySecond =
-    ((vGeant3New[4] / vGeant3New[5]) - (vGeant3[4] / vGeant3[5])) / dZ12;
-  vGeant3[0] = vGeant3[0] + xPrime * dZ1i - 0.5 * xSecond * dZ1i * dZi2; // X
-  vGeant3[1] = vGeant3[1] + yPrime * dZ1i - 0.5 * ySecond * dZ1i * dZi2; // Y
-  vGeant3[2] = Z; // Z
-  Double_t xPrimeI = xPrime - 0.5 * xSecond * (dZi2 - dZ1i);
-  Double_t yPrimeI = yPrime - 0.5 * ySecond * (dZi2 - dZ1i);
-  // (PX, PY, PZ)/PTOT assuming forward motion
-  vGeant3[5] =
-    1.0 / TMath::Sqrt(1.0 + xPrimeI * xPrimeI + yPrimeI * yPrimeI); // PZ/PTOT
-  vGeant3[3] = xPrimeI * vGeant3[5]; // PX/PTOT
-  vGeant3[4] = yPrimeI * vGeant3[5]; // PY/PTOT
+  if (TMath::Abs(dZ12) > 0) {
+    Double_t dZ1i = Z - vGeant3[2]; // 1-i
+    Double_t dZi2 = vGeant3New[2] - Z; // i->2
+    Double_t xPrime = (vGeant3New[0] - vGeant3[0]) / dZ12;
+    Double_t xSecond =
+      ((vGeant3New[3] / vGeant3New[5]) - (vGeant3[3] / vGeant3[5])) / dZ12;
+    Double_t yPrime = (vGeant3New[1] - vGeant3[1]) / dZ12;
+    Double_t ySecond =
+      ((vGeant3New[4] / vGeant3New[5]) - (vGeant3[4] / vGeant3[5])) / dZ12;
+    vGeant3[0] = vGeant3[0] + xPrime * dZ1i - 0.5 * xSecond * dZ1i * dZi2; // X
+    vGeant3[1] = vGeant3[1] + yPrime * dZ1i - 0.5 * ySecond * dZ1i * dZi2; // Y
+    vGeant3[2] = Z; // Z
+    Double_t xPrimeI = xPrime - 0.5 * xSecond * (dZi2 - dZ1i);
+    Double_t yPrimeI = yPrime - 0.5 * ySecond * (dZi2 - dZ1i);
+    // (PX, PY, PZ)/PTOT assuming forward motion
+    vGeant3[5] =
+      1.0 / TMath::Sqrt(1.0 + xPrimeI * xPrimeI + yPrimeI * yPrimeI); // PZ/PTOT
+    vGeant3[3] = xPrimeI * vGeant3[5]; // PX/PTOT
+    vGeant3[4] = yPrimeI * vGeant3[5]; // PY/PTOT
+  } else {
+    AliWarning(Form("Extrap. to Z not reached, Z = %f",Z));    
+  }
   // Track parameters from Geant3 parameters,
   // with charge back for forward motion
   GetFromGeant3Parameters(vGeant3, chargeExtrap * forwardBackward);
@@ -189,10 +193,9 @@ void AliMUONTrackParam::ExtrapToStation(Int_t Station, AliMUONTrackParam *TrackP
   // pointed to by "TrackParam" (index 0 and 1 for first and second chambers).
   Double_t extZ[2], z1, z2;
   Int_t i1 = -1, i2 = -1; // = -1 to avoid compilation warnings
-  AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
   // range of Station to be checked ????
-  z1 = (&(pMUON->Chamber(2 * Station)))->Z(); // Z of first chamber
-  z2 = (&(pMUON->Chamber(2 * Station + 1)))->Z(); // Z of second chamber
+  z1 = AliMUONConstants::DefaultChamberZ(2 * Station);
+  z2 = AliMUONConstants::DefaultChamberZ(2 * Station + 1);
   // First and second Z to extrapolate at
   if ((z1 > this->fZ) && (z2 > this->fZ)) {i1 = 0; i2 = 1;}
   else if ((z1 < this->fZ) && (z2 < this->fZ)) {i1 = 1; i2 = 0;}
@@ -542,7 +545,7 @@ Double_t AliMUONTrackParam::P()
 }
  //__________________________________________________________________________
 void AliMUONTrackParam::ExtrapOneStepHelix(Double_t charge, Double_t step, 
-                                        Double_t *vect, Double_t *vout) 
+                                        Double_t *vect, Double_t *vout) const
 {
 //    ******************************************************************
 //    *                                                                *
@@ -661,7 +664,7 @@ void AliMUONTrackParam::ExtrapOneStepHelix(Double_t charge, Double_t step,
 
  //__________________________________________________________________________
 void AliMUONTrackParam::ExtrapOneStepHelix3(Double_t field, Double_t step, 
-                                              Double_t *vect, Double_t *vout)
+                                              Double_t *vect, Double_t *vout) const
 {
 // 
 //     ******************************************************************
@@ -739,7 +742,7 @@ void AliMUONTrackParam::ExtrapOneStepHelix3(Double_t field, Double_t step,
 }
  //__________________________________________________________________________
 void AliMUONTrackParam::ExtrapOneStepRungekutta(Double_t charge, Double_t step, 
-                                                    Double_t* vect, Double_t* vout)
+                                                    Double_t* vect, Double_t* vout) const
 {
 // 
 //     ******************************************************************
@@ -984,7 +987,7 @@ void AliMUONTrackParam::ExtrapOneStepRungekutta(Double_t charge, Double_t step,
     return;
 }
 //___________________________________________________________
- void  AliMUONTrackParam::GetField(Double_t *Position, Double_t *Field) 
+ void  AliMUONTrackParam::GetField(Double_t *Position, Double_t *Field) const
 {
     // interface to "gAlice->Field()->Field" for arguments in double precision