]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOS.cxx
revome redundant variables
[u/mrichter/AliRoot.git] / PHOS / AliPHOS.cxx
index b2d817052fead9a4e1c12f8d86d2e400415c18cb..dde85f477cbc734e0f4ee69a2fb6f3ab69e08979 100644 (file)
@@ -94,15 +94,16 @@ class TFile;
 #include "AliPHOSPulseGenerator.h"
 #include "AliDAQ.h"
 #include "AliPHOSRawDecoder.h"
+#include "AliPHOSCalibData.h"
 #include "AliPHOSRawDigiProducer.h"
 #include "AliPHOSQAChecker.h"
-#include "AliPHOSRecoParamEmc.h"
+#include "AliPHOSRecoParam.h"
 #include "AliPHOSSimParam.h"
 
 ClassImp(AliPHOS)
 
 //____________________________________________________________________________
-  AliPHOS:: AliPHOS() : AliDetector()
+  AliPHOS:: AliPHOS() : AliDetector(),fgCalibData(0)
 {
   // Default ctor
   fName   = "PHOS" ;
@@ -110,7 +111,8 @@ ClassImp(AliPHOS)
 }
 
 //____________________________________________________________________________
-AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title)
+AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title),
+fgCalibData(0)
 {
   //   ctor : title is used to identify the layout
 }
@@ -118,6 +120,7 @@ AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title)
 //____________________________________________________________________________
 AliPHOS::~AliPHOS() 
 {  
+  if(fgCalibData) delete fgCalibData ;
 }
 
 //____________________________________________________________________________
@@ -441,15 +444,18 @@ void AliPHOS::Digits2Raw()
   }
 
   // get mapping from OCDB
-  const TObjArray* maps = AliPHOSRecoParamEmc::GetMappings();
+  const TObjArray* maps = AliPHOSRecoParam::GetMappings();
   if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
 
   // some digitization constants
-  const Float_t    kThreshold = 0.001; // skip digits below 1 MeV
+  const Float_t    kThreshold = 1.; // skip digits below 1 ADC channel
   const Int_t      kAdcThreshold = 1;  // Lower ADC threshold to write to raw data
 
   Int_t prevDDL = -1;
 
+  if(fgCalibData==0)
+    fgCalibData= new AliPHOSCalibData(-1) ;
+
   // Create a shaper pulse object
   AliPHOSPulseGenerator *pulse = new AliPHOSPulseGenerator();
   
@@ -475,8 +481,11 @@ void AliPHOS::Digits2Raw()
   // loop over digits (assume ordered digits)
   for (Int_t iDigit = 0; iDigit < digits->GetEntries(); iDigit++) {
     AliPHOSDigit* digit = dynamic_cast<AliPHOSDigit *>(digits->At(iDigit)) ;
+
+    // Skip small energy below treshold
     if (digit->GetEnergy() < kThreshold) 
       continue;
+
     Int_t relId[4];
     geom->AbsToRelNumbering(digit->GetId(), relId);
     Int_t module = relId[0];
@@ -531,7 +540,7 @@ void AliPHOS::Digits2Raw()
                    relId[0]-1,relId[3]-1,relId[2]-1));
     // if a signal is out of time range, write only trailer
     if (digit->GetTimeR() > pulse->GetRawFormatTimeMax()*0.5 ) {
-      AliInfo("Signal is out of time range.\n");
+      AliDebug(2,"Signal is out of time range.\n");
       buffer[iDDL]->FillBuffer(0);
       buffer[iDDL]->FillBuffer(pulse->GetRawFormatTimeBins() );  // time bin
       buffer[iDDL]->FillBuffer(3);                               // bunch length
@@ -550,6 +559,8 @@ void AliPHOS::Digits2Raw()
       }
       pulse->SetAmplitude(energy);
       pulse->SetTZero(digit->GetTimeR());
+      Double_t r =fgCalibData->GetHighLowRatioEmc(relId[0],relId[3],relId[2]) ;
+      pulse->SetHG2LGRatio(r) ;
       pulse->MakeSamples();
       pulse->GetSamples(adcValuesHigh, adcValuesLow) ; 
       buffer[iDDL]->WriteChannel(relId[3]-1, relId[2]-1, 0, 
@@ -605,7 +616,7 @@ void AliPHOS::SetTreeAddress()
   char branchname[20];
   sprintf(branchname,"%s",GetName());
   // Branch address for hit tree
-    TTree *treeH = TreeH();
+    TTree *treeH = fLoader->TreeH();
   if (treeH) {
     branch = treeH->GetBranch(branchname);
     if (branch)