]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALRawUtils.cxx
In order to use the new TPC dEdx information within the common pid classes the new...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRawUtils.cxx
index 1710d51322a1082fdc73ebd0086022aee7a74f0d..92cc806248e142bc8d7eefed50bce0f85b735ab8 100644 (file)
@@ -107,6 +107,8 @@ AliEMCALRawUtils::AliEMCALRawUtils( Algo::fitAlgorithm fitAlgo) : fNoiseThreshol
 AliEMCALRawUtils::~AliEMCALRawUtils() 
 {
   //dtor
+  delete fRawAnalyzer;
+  delete fTriggerRawDigitMaker;
 }
 
 
@@ -295,6 +297,12 @@ void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr,
   Int_t lowGain  = 0;
   Int_t caloFlag = 0; // low, high gain, or TRU, or LED ref.
   
+  Float_t bcTimePhaseCorr = 0; // for BC-based L1 phase correction
+  Int_t bcMod4 = (reader->GetBCID() % 4); // LHC uses 40 MHz, EMCal uses 10 MHz clock
+  if (bcMod4==0 || bcMod4==1) { 
+    bcTimePhaseCorr = -1e-7; // subtract 100 ns for certain BC values
+  } 
+
   while (in.NextDDL()) 
     {
       while (in.NextChannel()) 
@@ -319,7 +327,7 @@ void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr,
              AliCaloFitResults res =  fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());  
              if(res.GetAmp() >= fNoiseThreshold )
                {
-                 AddDigit(digitsArr, id, lowGain, res.GetAmp(),  res.GetTime(), res.GetChi2(),  res.GetNdf() ); 
+                 AddDigit(digitsArr, id, lowGain, res.GetAmp(),  res.GetTime()+bcTimePhaseCorr, res.GetChi2(),  res.GetNdf() ); 
                }
            }//ALTRO
          else if(fUseFALTRO)
@@ -365,6 +373,7 @@ void AliEMCALRawUtils::TrimDigits(TClonesArray *digitsArr)
 
 void AliEMCALRawUtils::SetFittingAlgorithm(Int_t fitAlgo)              
 {
+  delete fRawAnalyzer; // delete doesn't do anything if the pointer is 0x0
   fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer( fitAlgo );
   fRawAnalyzer->SetNsampleCut(5); // requirement for fits to be done, for the new methods
   fRawAnalyzer->SetOverflowCut ( OVERFLOWCUT );