]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSv1.cxx
Removed a two places a multiplication of constants in the step manager and moved...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv1.cxx
index 8acacf130effda73cc9e99798eb08b38ead525f5..00521ce600418e16af11d1c194285b523c1a41de 100644 (file)
@@ -75,7 +75,9 @@ AliPHOSv0()
   fLightYieldAttenuation  = 0. ;  
   fRecalibrationFactor    = 0. ;    
   fElectronsPerGeV        = 0. ;
-  fAPDGain                = 0. ;    
+  fAPDGain                = 0. ;  
+  fLightFactor            = 0. ; 
+  fAPDFactor              = 0. ; 
 
 }
 
@@ -116,10 +118,13 @@ AliPHOSv1::AliPHOSv1(const char *name, const char *title):
   // The APD Gain is 300
   fLightYieldMean = 47000;
   fIntrinsicPINEfficiency = 0.02655 ; //APD= 0.1875/0.1271 * 0.018 (PIN)
-  fLightYieldAttenuation = 0.0045 ; 
-  fRecalibrationFactor = 13.418/ fLightYieldMean ;
-  fElectronsPerGeV = 2.77e+8 ;
-  fAPDGain= 300. ;
+  fLightYieldAttenuation  = 0.0045 ; 
+  fRecalibrationFactor    = 13.418/ fLightYieldMean ;
+  fElectronsPerGeV        = 2.77e+8 ;
+  fAPDGain                = 300. ;
+  fLightFactor            = fLightYieldMean * fIntrinsicPINEfficiency ; 
+  fAPDFactor              = (fRecalibrationFactor/100.) * fAPDGain ; 
+
 
   Int_t nb   = GetGeometry()->GetNModules() ; 
   
@@ -286,8 +291,8 @@ void AliPHOSv1::StepManager(void)
     
     Float_t        xyd[3]={0,0,0}   ;   //local posiiton of the entering
     xyd[0]  = xyzd[0];
-    xyd[1]  =-xyzd[2];
-    xyd[2]  =-xyzd[1];
+    xyd[1]  =-xyzd[1];
+    xyd[2]  =-xyzd[2];
   
     // Current momentum of the hit's track in the local ref. system
     TLorentzVector pmom     ;        //momentum of the particle initiated hit
@@ -298,8 +303,8 @@ void AliPHOSv1::StepManager(void)
 
     gMC -> Gmtod (pm, pd, 2);        // transform 3-momentum from master to daughter system
     pmom[0] = pd[0];
-    pmom[1] =-pd[2];
-    pmom[2] =-pd[1];
+    pmom[1] =-pd[1];
+    pmom[2] =-pd[2];
       
     // Digitize the current CPV hit:
     
@@ -361,7 +366,11 @@ void AliPHOSv1::StepManager(void)
        qsum  += cpvDigit->GetQpad();
       }
     }
-    delete cpvDigits;
+    if (cpvDigits) {
+      cpvDigits->Delete();
+      delete cpvDigits;
+      cpvDigits=0;
+    }
   }
 
  
@@ -384,10 +393,6 @@ void AliPHOSv1::StepManager(void)
 
       gMC->CurrentVolOffID(10, moduleNumber) ; // get the PHOS module number ;
       
-      // fill the relevant QA Checkables
-      fQATotEner->Update( xyze[4] ) ;                                             // total energy in PHOS
-      (static_cast<AliPHOSQAFloatCheckable*>((*fQATotEnerB)[moduleNumber-1]))->Update( xyze[4] ) ; // energy in this block  
-
       Int_t strip ;
       gMC->CurrentVolOffID(3, strip);
       Int_t cell ;
@@ -403,18 +408,20 @@ void AliPHOSv1::StepManager(void)
       
       //Calculates the light yield, the number of photns produced in the
       //crystal 
-      Float_t lightYield = gRandom->Poisson(fLightYieldMean * lostenergy *
-                                           fIntrinsicPINEfficiency * 
+      Float_t lightYield = gRandom->Poisson(fLightFactor * lostenergy *
                                            exp(-fLightYieldAttenuation *
                                                (local[1]+GetGeometry()->GetCrystalSize(1)/2.0 ))
                                            ) ;
       //Calculates de energy deposited in the crystal  
-      xyze[4] = (fRecalibrationFactor/100.) * fAPDGain * lightYield  ;
+      xyze[4] = fAPDFactor * lightYield  ;
       
       // add current hit to the hit list
       AddHit(fIshunt, primary,tracknumber, absid, xyze);
       
-      
+      // fill the relevant QA Checkables
+      fQATotEner->Update( xyze[4] ) ;                                             // total energy in PHOS
+      (static_cast<AliPHOSQAFloatCheckable*>((*fQATotEnerB)[moduleNumber-1]))->Update( xyze[4] ) ; // energy in this block  
+
     } // there is deposited energy
   } // we are inside a PHOS Xtal