]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDltuParam.cxx
- fix coding rule violations
[u/mrichter/AliRoot.git] / TRD / AliTRDltuParam.cxx
index bfa14cbdc7a48f9b6fbfadf83b5b97ff0074d793..14194b518e9df0efc1e0a23c7eadc5f9096cf97b 100644 (file)
@@ -28,7 +28,7 @@ Float_t AliTRDltuParam::fgLengthOuterPadC1[6] =
 Float_t AliTRDltuParam::fgLengthInnerPadC0 = 9.0;
 Float_t AliTRDltuParam::fgLengthOuterPadC0 = 8.0;
 Float_t AliTRDltuParam::fgScalePad = 256. * 32.;
-Float_t AliTRDltuParam::fgDriftLength = 3.e-2;
+Float_t AliTRDltuParam::fgDriftLength = 3.;
 
 AliTRDltuParam::AliTRDltuParam() :
   TObject(),
@@ -39,14 +39,15 @@ AliTRDltuParam::AliTRDltuParam() :
   fScaleQ0(0),
   fScaleQ1(0),
   fPidTracklengthCorr(kFALSE),
-  fTiltCorr(kFALSE)
+  fTiltCorr(kFALSE),
+  fPidGainCorr(kFALSE)
 {
-
+  // default constructor
 }
 
 AliTRDltuParam::~AliTRDltuParam()
 {
-
+  // destructor
 }
 
 Int_t AliTRDltuParam::GetDyCorrection(Int_t det, Int_t rob, Int_t mcm) const
@@ -56,7 +57,7 @@ Int_t AliTRDltuParam::GetDyCorrection(Int_t det, Int_t rob, Int_t mcm) const
 
   Int_t layer = det % 6;
 
-  Float_t dyTilt = ( fgDriftLength * TMath::Tan(fgTiltingAngle[layer]) *
+  Float_t dyTilt = ( fgDriftLength * TMath::Tan(fgTiltingAngle[layer] * TMath::Pi()/180.) *
                     GetLocalZ(det, rob, mcm) / fgX[layer] );
 
   // calculate Lorentz correction
@@ -76,7 +77,7 @@ void AliTRDltuParam::GetDyRange(Int_t det, Int_t rob, Int_t mcm, Int_t ch,
   dyMinInt = fgDyMin;
   dyMaxInt = fgDyMax;
 
-  if (fMagField < 0.1)
+  if (TMath::Abs(fMagField) < 0.1)
     return;
 
   Float_t e = 0.30;
@@ -110,6 +111,9 @@ void AliTRDltuParam::GetDyRange(Int_t det, Int_t rob, Int_t mcm, Int_t ch,
 
 Float_t AliTRDltuParam::GetElongation(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
 {
+  // calculate the ratio of the distance to the primary vertex and the
+  // distance in x-direction for the given ADC channel
+
   Int_t layer = det % 6;
 
   Float_t elongation = TMath::Abs(GetDist(det, rob, mcm, ch) / fgX[layer]);
@@ -122,39 +126,52 @@ Float_t AliTRDltuParam::GetElongation(Int_t det, Int_t rob, Int_t mcm, Int_t ch)
 }
 
 void AliTRDltuParam::GetCorrectionFactors(Int_t det, Int_t rob, Int_t mcm, Int_t ch,
-                                         UInt_t &cor0, UInt_t &cor1) const
+                                         UInt_t &cor0, UInt_t &cor1, Float_t gain) const
 {
+  // calculate the gain correction factors for the given ADC channel
+
+  if (fPidGainCorr==kFALSE)
+    gain=1;
+
   if (fPidTracklengthCorr == kTRUE ) {
-    cor0 = Int_t ((1.0*fScaleQ0* (1./GetElongation(det, rob, mcm, ch)) ));
-    cor1 = Int_t ((1.0*fScaleQ1* (1./GetElongation(det, rob, mcm, ch)) ));
+    cor0 = UInt_t ((1.0*fScaleQ0* (1./GetElongation(det, rob, mcm, ch))) / gain );
+    cor1 = UInt_t ((1.0*fScaleQ1* (1./GetElongation(det, rob, mcm, ch))) / gain );
   }
   else {
-    cor0 = fScaleQ0;
-    cor1 = fScaleQ1;
+    cor0 = UInt_t (fScaleQ0 / gain);
+    cor1 = UInt_t ( fScaleQ1 / gain);
   }
 }
 
 Int_t AliTRDltuParam::GetNtimebins() const
 {
+  // return the number of timebins used
+
   return fNtimebins;
 }
 
 Float_t AliTRDltuParam::GetX(Int_t det, Int_t /* rob */, Int_t /* mcm */) const
 {
+  // return the distance to the beam axis in x-direction
+
   Int_t layer = det%6;
   return fgX[layer];
 }
 
 Float_t AliTRDltuParam::GetLocalY(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
 {
+  // get local y-position (r-phi) w.r.t. the chamber centre
+
   Int_t layer = det%6;
   // calculate the pad position as in the TRAP
-  Float_t ypos = (-4 + (rob&0x1) * 4 + (mcm&0x3)) * 18 - ch - 0.5; // y position in bins of pad widths
+  Float_t ypos = (-4 + 1 + (rob&0x1) * 4 + (mcm&0x3)) * 18 - ch - 0.5; // y position in bins of pad widths
   return ypos*fgWidthPad[layer];
 }
 
 Float_t AliTRDltuParam::GetLocalZ(Int_t det, Int_t rob, Int_t mcm) const
 {
+  // get local z-position w.r.t. to the chamber boundary
+
   Int_t stack = (det%30) / 6;
   Int_t layer = det % 6;
   Int_t row   = (rob/2) * 4 + mcm/4;
@@ -179,17 +196,23 @@ Float_t AliTRDltuParam::GetLocalZ(Int_t det, Int_t rob, Int_t mcm) const
 
 Float_t AliTRDltuParam::GetPerp(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
 {
+  // get transverse distance to the beam axis
+
   return TMath::Sqrt(GetLocalY(det, rob, mcm, ch)*GetLocalY(det, rob, mcm, ch) +
                     GetX(det, rob, mcm)*GetX(det, rob, mcm) );
 }
 
 Float_t AliTRDltuParam::GetPhi(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
 {
+  // calculate the azimuthal angle for the given ADC channel
+
   return TMath::ATan2(GetLocalY(det, rob, mcm, ch), GetX(det, rob, mcm));
 }
 
 Float_t AliTRDltuParam::GetDist(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
 {
+  // calculate the distance from the origin for the given ADC channel
+
   return TMath::Sqrt(GetLocalY(det, rob, mcm, ch)*GetLocalY(det, rob, mcm, ch) +
                     GetX(det, rob, mcm)*GetX(det, rob, mcm) +
                     GetLocalZ(det, rob, mcm)*GetLocalZ(det, rob, mcm) );