]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALReconstructor.cxx
Digit header added
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALReconstructor.cxx
index ba2044277dce9d12fea1409167415cfcdb9d489a..9340c820b83af8e3775a0080787ddf0fd5512685 100644 (file)
@@ -49,7 +49,6 @@
 #include "AliRawReader.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
-#include "AliEMCALRecParam.h"
 #include "AliEMCALGeometry.h"
 #include "AliEMCAL.h"
 #include "AliEMCALHistoUtilities.h"
@@ -60,7 +59,7 @@
 
 ClassImp(AliEMCALReconstructor) 
 
-AliEMCALRecParam* AliEMCALReconstructor::fgkRecParam = 0;  // EMCAL rec. parameters
+const AliEMCALRecParam* AliEMCALReconstructor::fgkRecParam = 0;  // EMCAL rec. parameters
 AliEMCALRawUtils* AliEMCALReconstructor::fgRawUtils = 0;   // EMCAL raw utilities class
 AliEMCALClusterizer* AliEMCALReconstructor::fgClusterizer = 0;   // EMCAL clusterizer class
 TClonesArray*     AliEMCALReconstructor::fgDigitsArr = 0;  // shoud read just once at event
@@ -69,14 +68,13 @@ AliEMCALReconstructor::AliEMCALReconstructor()
   : fDebug(kFALSE), fList(0), fGeom(0) 
 {
   // ctor
-  InitRecParam();
 
   fgRawUtils = new AliEMCALRawUtils;
   fgClusterizer = new AliEMCALClusterizerv1;
 
   //To make sure we match with the geometry in a simulation file,
   //let's try to get it first.  If not, take the default geometry
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliRunLoader *rl = AliRunLoader::Instance();
   if (rl->GetAliRun() && rl->GetAliRun()->GetDetector("EMCAL")) {
     fGeom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
   } else {
@@ -113,24 +111,6 @@ void AliEMCALReconstructor::Init()
   fList = AliEMCALHistoUtilities::GetTriggersListOfHists(kTRUE);
 }
 
-//____________________________________________________________________________
-void AliEMCALReconstructor::InitRecParam() const
-{
-  // Check if the instance of AliEMCALRecParam exists, 
-  // if not, get it from OCDB if available, otherwise create a default one
-
- if (!fgkRecParam  && (AliCDBManager::Instance()->IsDefaultStorageSet())) {
-    AliCDBEntry *entry = (AliCDBEntry*) 
-      AliCDBManager::Instance()->Get("EMCAL/Config/RecParam");
-    if (entry) fgkRecParam =  (AliEMCALRecParam*) entry->GetObject();
-  }
-  
-  if(!fgkRecParam){
-    AliWarning("The Reconstruction parameters for EMCAL nonitialized - Used default one");
-    fgkRecParam = new AliEMCALRecParam;
-  }
-}
-
 //____________________________________________________________________________
 void AliEMCALReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
 {
@@ -143,7 +123,7 @@ void AliEMCALReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree)
   AliCodeTimerAuto("")
 
   ReadDigitsArrayFromTree(digitsTree);
-
+  fgClusterizer->InitParameters();
   fgClusterizer->SetOutput(clustersTree);
 
   if(fgDigitsArr && fgDigitsArr->GetEntries()) {
@@ -171,18 +151,18 @@ void AliEMCALReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digits
 
   rawReader->Reset() ; 
 
-  TClonesArray *digitsArr = new TClonesArray("AliEMCALDigit",100);
+  TClonesArray *digitsArr = new TClonesArray("AliEMCALDigit",200);
   Int_t bufsize = 32000;
   digitsTree->Branch("EMCAL", &digitsArr, bufsize);
 
   //must be done here because, in constructor, option is not yet known
   fgRawUtils->SetOption(GetOption());
 
-  fgRawUtils->SetRawFormatHighLowGainFactor(fgkRecParam->GetHighLowGainFactor());
-  fgRawUtils->SetRawFormatOrder(fgkRecParam->GetOrderParameter());
-  fgRawUtils->SetRawFormatTau(fgkRecParam->GetTau());
-  fgRawUtils->SetNoiseThreshold(fgkRecParam->GetNoiseThreshold());
-  fgRawUtils->SetNPedSamples(fgkRecParam->GetNPedSamples());
+  fgRawUtils->SetRawFormatHighLowGainFactor(GetRecParam()->GetHighLowGainFactor());
+  fgRawUtils->SetRawFormatOrder(GetRecParam()->GetOrderParameter());
+  fgRawUtils->SetRawFormatTau(GetRecParam()->GetTau());
+  fgRawUtils->SetNoiseThreshold(GetRecParam()->GetNoiseThreshold());
+  fgRawUtils->SetNPedSamples(GetRecParam()->GetNPedSamples());
 
   fgRawUtils->Raw2Digits(rawReader,digitsArr);
 
@@ -368,22 +348,24 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
     Float_t *amplFloat = clust->GetEnergiesList();
     Int_t   *digitInts = clust->GetAbsId();
     TArrayS absIdList(cellMult);
-    //Uncomment when unfolding is done
-    //TArrayD fracList(cellMult);
+    TArrayD fracList(cellMult);
 
     Int_t newCellMult = 0;
     for (Int_t iCell=0; iCell<cellMult; iCell++) {
       if (amplFloat[iCell] > 0) {
       absIdList[newCellMult] = (UShort_t)(digitInts[iCell]);
-    //Uncomment when unfolding is done
-    //fracList[newCellMult] = amplFloat[iCell]/emcCells.GetCellAmplitude(digitInts[iCell]);
+      //Uncomment when unfolding is done
+      //if(emcCells.GetCellAmplitude(digitInts[iCell])>0)
+      //fracList[newCellMult] = amplFloat[iCell]/(emcCells.GetCellAmplitude(digitInts[iCell])*calibration);//get cell calibration value 
+      //else
+      fracList[newCellMult] = 0; 
       newCellMult++;
       }
     }
-    absIdList.Set(newCellMult);
-    //Uncomment when unfolding is done
-    //fracList.Set(newCellMult);
 
+    absIdList.Set(newCellMult);
+    fracList.Set(newCellMult);
+    
     if(newCellMult > 0) { // accept cluster if it has some digit
       nClustersNew++;
       //Primaries
@@ -397,16 +379,13 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
       ec->SetNCells(newCellMult);
       //Change type of list from short to ushort
       UShort_t *newAbsIdList  = new UShort_t[newCellMult];
-      //Uncomment when unfolding is done
-      //Double_t *newFracList  = new Double_t[newCellMult];
+      Double_t *newFracList  = new Double_t[newCellMult];
       for(Int_t i = 0; i < newCellMult ; i++) {
         newAbsIdList[i]=absIdList[i];
-      //Uncomment when unfolding is done
-      //newFracList[i]=fracList[i];
+        newFracList[i]=fracList[i];
       }
       ec->SetCellsAbsId(newAbsIdList);
-      //Uncomment when unfolding is done
-      //ec->SetCellsAmplitudeFraction(newFracList);
+      ec->SetCellsAmplitudeFraction(newFracList);
       ec->SetClusterDisp(clust->GetDispersion());
       ec->SetClusterChi2(-1); //not yet implemented
       ec->SetM02(elipAxis[0]*elipAxis[0]) ;
@@ -421,10 +400,10 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
       ec->AddLabels(arrayParents);
 
       // add the cluster to the esd object
-     esd->AddCaloCluster(ec);
+      esd->AddCaloCluster(ec);
       delete ec;
       delete [] newAbsIdList ;
-      //delete [] newFracList ;
+      delete [] newFracList ;
    }
  } // cycle on clusters
 
@@ -440,10 +419,10 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   pid->SetReconstructor(kTRUE);
   pid->RunPID(esd);
   delete pid;
-
+  
   delete digits;
   delete clusters;
-
+  
   // printf(" ## AliEMCALReconstructor::FillESD() is ended : ncl %i -> %i ### \n ",nClusters, nClustersNew); 
 }