]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Calibrate time of cells with parameters stored in OCDB
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 23 Jul 2011 17:15:24 +0000 (17:15 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 23 Jul 2011 17:15:24 +0000 (17:15 +0000)
Add possibility to use v2 clusterizer in reconstruction

EMCAL/AliEMCALClusterizer.cxx
EMCAL/AliEMCALClusterizer.h
EMCAL/AliEMCALClusterizerNxN.cxx
EMCAL/AliEMCALClusterizerv1.cxx
EMCAL/AliEMCALClusterizerv2.cxx
EMCAL/AliEMCALRecPoint.cxx
EMCAL/AliEMCALRecPoint.h
EMCAL/AliEMCALReconstructor.cxx

index bff14426149855a454a89f4e3e46125b691d5163..c15ebe1b9f7b314cd99eca560c1aff4f1058da2d 100644 (file)
@@ -69,7 +69,7 @@ AliEMCALClusterizer::AliEMCALClusterizer():
   fGeom(NULL),
   fCalibData(NULL), 
   fCaloPed(NULL),
-  fADCchannelECA(0.),fADCpedestalECA(0.),
+  fADCchannelECA(0.),fADCpedestalECA(0.), fTimeECA(1.),
   fTimeMin(-1.),fTimeMax(1.),fTimeCut(1.),
   fDefaultInit(kFALSE),fToUnfold(kFALSE),
   fNumberOfECAClusters(0), fECAClusteringThreshold(0.),
@@ -91,7 +91,7 @@ AliEMCALClusterizer::AliEMCALClusterizer(AliEMCALGeometry* geometry):
   fGeom(geometry),
   fCalibData(NULL), 
   fCaloPed(NULL),
-  fADCchannelECA(0.),fADCpedestalECA(0.),
+  fADCchannelECA(0.),fADCpedestalECA(0.), fTimeECA(1.),
   fTimeMin(-1.),fTimeMax(1.),fTimeCut(1.),
   fDefaultInit(kFALSE),fToUnfold(kFALSE),
   fNumberOfECAClusters(0), fECAClusteringThreshold(0.),
@@ -130,7 +130,7 @@ AliEMCALClusterizer::AliEMCALClusterizer(AliEMCALGeometry *geometry,
   fGeom(geometry),
   fCalibData(calib),
   fCaloPed(caloped),
-  fADCchannelECA(0.),fADCpedestalECA(0.),
+  fADCchannelECA(0.),fADCpedestalECA(0.), fTimeECA(1.),
   fTimeMin(-1.),fTimeMax(1.),fTimeCut(1.),
   fDefaultInit(kFALSE),fToUnfold(kFALSE),
   fNumberOfECAClusters(0), fECAClusteringThreshold(0.),
@@ -177,21 +177,24 @@ void AliEMCALClusterizer::DeleteRecPoints()
 }
 
 //____________________________________________________________________________
-Float_t AliEMCALClusterizer::Calibrate(const Float_t amp, const Float_t time, const Int_t absId) 
+void AliEMCALClusterizer::Calibrate(Float_t & amp, Float_t & time, const Int_t absId) 
 {
-  // Convert digitized amplitude into energy.
-  // Calibration parameters are taken from calibration data base for raw data,
-  // or from digitizer parameters for simulated data.
+  // Convert digitized amplitude into energy, calibrate time
+  // Calibration parameters are taken from OCDB : OCDB/EMCAL/Calib/Data
 
   //Return energy with default parameters if calibration is not available
   if (!fCalibData&&!fCaloPed) {
     if (fIsInputCalibrated == kTRUE)
     {
       AliDebug(10, Form("Input already calibrated!"));
-      return amp;
+      return ;
     }    
     
-    return -fADCpedestalECA + amp * fADCchannelECA ; 
+    time *= fTimeECA ;
+    amp   = amp * fADCchannelECA - fADCpedestalECA ; 
+    
+    return;
+    
   }
   
   if (fGeom==0)
@@ -211,7 +214,9 @@ Float_t AliEMCALClusterizer::Calibrate(const Float_t amp, const Float_t time, co
     //assert(0); // GCB: This aborts reconstruction of raw simulations 
     //where simulation had more SM than default geometry, 
     //change to return 0, to avoid aborting good generations.
-    return 0;
+    amp  = 0;
+    time = 0;
+    return ;
   }
     
   fGeom->GetCellPhiEtaIndexInSModule(iSupMod,nModule,nIphi, nIeta,iphi,ieta);
@@ -224,22 +229,31 @@ Float_t AliEMCALClusterizer::Calibrate(const Float_t amp, const Float_t time, co
     Int_t channelStatus = (Int_t)(fCaloPed->GetDeadMap(iSupMod))->GetBinContent(ieta,iphi);
     if(channelStatus == AliCaloCalibPedestal::kHot || channelStatus == AliCaloCalibPedestal::kDead) {
       AliDebug(2,Form("Tower from SM %d, ieta %d, iphi %d is BAD : status %d !!!",iSupMod,ieta,iphi, channelStatus));
-      return 0;
+      amp  = 0 ;
+      time = 0 ;
+      return ;
     }
   }
   //Check if time is too large or too small, indication of a noisy channel, remove in this case
-  if(time > fTimeMax || time < fTimeMin) return 0;
+  if(time > fTimeMax || time < fTimeMin) {
+    amp  = 0 ;
+    time = 0 ;
+    return ;
+  }
     
   if (fIsInputCalibrated||!fCalibData)
   {
     AliDebug(10, Form("Input already calibrated!"));
-    return amp;
+    return ;
   }
          
   fADCchannelECA  = fCalibData->GetADCchannel (iSupMod,ieta,iphi);
   fADCpedestalECA = fCalibData->GetADCpedestal(iSupMod,ieta,iphi);
-      
-  return -fADCpedestalECA + amp * fADCchannelECA ;        
+  fTimeECA        = fCalibData->GetTimeChannel(iSupMod,ieta,iphi);
+  
+  time -= fTimeECA ;
+  amp   = amp * fADCchannelECA - fADCpedestalECA ;  
+  
 }
 
 //____________________________________________________________________________
index 9cbc0555a7fcb864d61bbe469e000cae562a6823..053c1fb0f1e42bc9789da03ecd49d7c1c3c80145 100644 (file)
@@ -36,7 +36,7 @@ public:
 
   virtual void    Digits2Clusters(Option_t *option) = 0;
 
-  virtual Float_t Calibrate(const Float_t amp, const Float_t time, const Int_t cellId);
+  virtual void    Calibrate(Float_t & amp, Float_t & time, const Int_t cellId);
   virtual void    Init();
   virtual void    InitParameters();
   virtual void    InitParameters(const AliEMCALRecParam* recParam);
@@ -106,7 +106,8 @@ protected:
   
   Float_t fADCchannelECA;           // width of one ADC channel for EC section (GeV)
   Float_t fADCpedestalECA;          // pedestal of ADC for EC section (GeV) 
-
+  Float_t fTimeECA;                 // calibration parameter for channels time
+  
   Float_t fTimeMin;                 // minimum time of physical signal in a cell/digit
   Float_t fTimeMax;                 // maximum time of physical signal in a cell/digit
   Float_t fTimeCut;                 // maximum time difference between the digits inside EMC cluster
@@ -129,6 +130,6 @@ protected:
   AliEMCALClusterizer(const AliEMCALClusterizer &);
   AliEMCALClusterizer & operator = (const AliEMCALClusterizer &);
   
-  ClassDef(AliEMCALClusterizer,6)  // Clusterization algorithm class 
+  ClassDef(AliEMCALClusterizer,7)  // Clusterization algorithm class 
 };
 #endif // AliEMCALCLUSTERIZER_H
index a47c2008e3297c39d7173e95c640e410d0cdad64..5d0be0dca87f73f83db68e510af8789066b1a426 100644 (file)
@@ -233,13 +233,16 @@ void AliEMCALClusterizerNxN::MakeClusters()
   fNumberOfECAClusters = 0;
   fRecPoints->Delete();
   
-  // Set up TObjArray with pointers to digits to work on 
+  // Set up TObjArray with pointers to digits to work on, calibrate digits 
   TObjArray digitsC;
   TIter nextdigit(fDigitsArr);
   AliEMCALDigit *digit = 0;
   while ( (digit = static_cast<AliEMCALDigit*>(nextdigit())) ) {
-    Float_t dEnergyCalibrated = Calibrate(digit->GetAmplitude(), digit->GetTime(),digit->GetId());
+    Float_t dEnergyCalibrated = digit->GetAmplitude();
+    Float_t time              = digit->GetTime();
+    Calibrate(dEnergyCalibrated,time ,digit->GetId());
     digit->SetCalibAmp(dEnergyCalibrated);
+    digit->SetTime(time);    
     digitsC.AddLast(digit);
   }
   
@@ -326,10 +329,9 @@ void AliEMCALClusterizerNxN::MakeClusters()
         for (Int_t idig = 0; idig < clusterDigitList.GetEntries(); idig++)
         {
           digit = (AliEMCALDigit*)clusterDigitList.At(idig);
-          Float_t dEnergyCalibrated = digit->GetCalibAmp();
           AliDebug(5, Form(" Adding digit %d", digit->GetId()));
           // note: this way the sharing info is lost!
-          recPoint->AddDigit(*digit, dEnergyCalibrated, kFALSE); //Time or TimeR?
+          recPoint->AddDigit(*digit, digit->GetCalibAmp(), kFALSE); //Time or TimeR?
           digitsC.Remove(digit);                 
         }
       }// recpoint
index 0b3f7b0a1af4f47b4ea9075a96388423cf1bea34..22d3ba1ad0243f32bdc784f348166ad7ad55440d 100644 (file)
@@ -216,32 +216,37 @@ void AliEMCALClusterizerv1::MakeClusters()
   
   fRecPoints->Delete();
   
-  // Set up TObjArray with pointers to digits to work on 
+  // Set up TObjArray with pointers to digits to work on calibrated digits 
   TObjArray *digitsC = new TObjArray();
-  TIter nextdigit(fDigitsArr);
   AliEMCALDigit *digit;
-  while ( (digit = dynamic_cast<AliEMCALDigit*>(nextdigit())) ) {
-    digitsC->AddLast(digit);
-  }
-  
-  double e = 0.0, ehs = 0.0;
-  TIter nextdigitC(digitsC);
-  while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigitC())) ) { // clean up digits
-    e = Calibrate(digit->GetAmplitude(), digit->GetTime(),digit->GetId());//Time or TimeR?
-    if ( e < fMinECut) //|| digit->GetTimeR() > fTimeCut ) // time window of cell checked in calibrate
-      digitsC->Remove(digit);
-    else    
-      ehs += e;
+  Float_t dEnergyCalibrated = 0.0, ehs = 0.0, time = 0.0;
+  TIter nextdigit(fDigitsArr);
+  while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigit())) ) { // calibrate and clean up digits
+    dEnergyCalibrated =  digit->GetAmplitude();
+    time              =  digit->GetTime();
+    Calibrate(dEnergyCalibrated,time,digit->GetId());
+    digit->SetCalibAmp(dEnergyCalibrated);
+    digit->SetTime(time);
+    if ( dEnergyCalibrated < fMinECut){
+      continue;
+    }
+    else if (!fGeom->CheckAbsCellId(digit->GetId()))
+      continue;
+    else{
+      ehs += dEnergyCalibrated;
+      digitsC->AddLast(digit);
+    }
   } 
+  
   AliDebug(1,Form("MakeClusters: Number of digits %d  -> (e %f), ehs %f\n",
                   fDigitsArr->GetEntries(),fMinECut,ehs));
   
-  nextdigitC.Reset();
-  
+  TIter nextdigitC(digitsC);
   while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigitC())) ) { // scan over the list of digitsC
     TArrayI clusterECAdigitslist(fDigitsArr->GetEntries());
-    
-    if(fGeom->CheckAbsCellId(digit->GetId()) && (Calibrate(digit->GetAmplitude(), digit->GetTime(),digit->GetId()) > fECAClusteringThreshold  ) ){
+    dEnergyCalibrated = digit->GetCalibAmp();
+    time              = digit->GetTime();
+    if(fGeom->CheckAbsCellId(digit->GetId()) && ( dEnergyCalibrated > fECAClusteringThreshold  ) ){
       // start a new Tower RecPoint
       if(fNumberOfECAClusters >= fRecPoints->GetSize()) fRecPoints->Expand(2*fNumberOfECAClusters+1);
       
@@ -252,27 +257,25 @@ void AliEMCALClusterizerv1::MakeClusters()
         fNumberOfECAClusters++; 
         
         recPoint->SetClusterType(AliVCluster::kEMCALClusterv1);
-        
-        recPoint->AddDigit(*digit, Calibrate(digit->GetAmplitude(), digit->GetTime(),digit->GetId()),kFALSE); //Time or TimeR?
+        recPoint->AddDigit(*digit, digit->GetCalibAmp(), kFALSE); //Time or TimeR?
         TObjArray clusterDigits;
         clusterDigits.AddLast(digit);  
         digitsC->Remove(digit); 
         
-        AliDebug(1,Form("MakeClusters: OK id = %d, ene = %f , cell.th. = %f \n", digit->GetId(),
-                        Calibrate(digit->GetAmplitude(),digit->GetTime(),digit->GetId()), fECAClusteringThreshold));  //Time or TimeR?
-        Float_t time = digit->GetTime();//Time or TimeR?
+        AliDebug(1,Form("MakeClusters: OK id = %d, ene = %f , cell.th. = %f \n", digit->GetId(), dEnergyCalibrated, fECAClusteringThreshold));  //Time or TimeR?
+      
         // Grow cluster by finding neighbours
         TIter nextClusterDigit(&clusterDigits);
+        
         while ( (digit = dynamic_cast<AliEMCALDigit*>(nextClusterDigit())) ) { // scan over digits in cluster 
           TIter nextdigitN(digitsC); 
           AliEMCALDigit *digitN = 0; // digi neighbor
           while ( (digitN = (AliEMCALDigit *)nextdigitN()) ) { // scan over all digits to look for neighbours
-            
             //Do not add digits with too different time 
             Bool_t shared = kFALSE;//cluster shared by 2 SuperModules?
             if(TMath::Abs(time - digitN->GetTime()) > fTimeCut ) continue; //Time or TimeR?
             if (AreNeighbours(digit, digitN, shared)==1) {      // call (digit,digitN) in THAT order !!!!! 
-              recPoint->AddDigit(*digitN, Calibrate(digitN->GetAmplitude(), digitN->GetTime(), digitN->GetId()),shared); //Time or TimeR?
+              recPoint->AddDigit(*digitN, digitN->GetCalibAmp(), shared); 
               clusterDigits.AddLast(digitN); 
               digitsC->Remove(digitN); 
             } // if(ineb==1)
index 09541758c9eeac8e80203a7b47c70eabd28c85ab..882e731c41458323193004690f38d4308d91f78b 100644 (file)
@@ -110,14 +110,17 @@ void AliEMCALClusterizerv2::MakeClusters()
   
   fRecPoints->Delete();
 
-  // set up TObjArray with pointers to digits to work on 
+  // set up TObjArray with pointers to digits to work on, calibrate digits 
   TObjArray digitsC;
   Double_t ehs = 0.0;
   AliEMCALDigit *digit = 0;
   TIter nextdigit(fDigitsArr);
   while ( (digit = static_cast<AliEMCALDigit*>(nextdigit())) ) {
-    Float_t dEnergyCalibrated = Calibrate(digit->GetAmplitude(), digit->GetTime(),digit->GetId());
+    Float_t dEnergyCalibrated = digit->GetAmplitude();
+    Float_t time              = digit->GetTime();
+    Calibrate(dEnergyCalibrated, time ,digit->GetId());
     digit->SetCalibAmp(dEnergyCalibrated);
+    digit->SetTime(time);
     if (dEnergyCalibrated < fMinECut) 
       continue;
     if (!fGeom->CheckAbsCellId(digit->GetId()))
@@ -137,7 +140,7 @@ void AliEMCALClusterizerv2::MakeClusters()
     nextdigitC.Reset();
     while ( (digit = static_cast<AliEMCALDigit *>(nextdigitC())) ) { 
       Float_t dEnergyCalibrated = digit->GetCalibAmp();
-      if (dEnergyCalibrated>fECAClusteringThreshold &&  dEnergyCalibrated>dMaxEnergyDigit) {
+      if (dEnergyCalibrated>fECAClusteringThreshold && dEnergyCalibrated>dMaxEnergyDigit) {
         dMaxEnergyDigit = dEnergyCalibrated;
         iMaxEnergyDigit = digit->GetId();
         pMaxEnergyDigit = digit;
@@ -152,7 +155,7 @@ void AliEMCALClusterizerv2::MakeClusters()
 
     AliEMCALRecPoint *recPoint = new  AliEMCALRecPoint(""); 
     recPoint->SetClusterType(AliVCluster::kEMCALClusterv1);
-    recPoint->AddDigit(*pMaxEnergyDigit, dMaxEnergyDigit, kFALSE);
+    recPoint->AddDigit(*pMaxEnergyDigit, pMaxEnergyDigit->GetCalibAmp(), kFALSE);
     fRecPoints->AddAt(recPoint, fNumberOfECAClusters++);
     digitsC.Remove(pMaxEnergyDigit); 
     TObjArray clusterDigits;
index 20e9c4f9ae9cfd2f9289fba187de1c525c5a88b2..38fa5f3a182d4725058560d5220c5e57dd7f3f06 100644 (file)
@@ -207,7 +207,7 @@ AliEMCALRecPoint& AliEMCALRecPoint::operator= (const AliEMCALRecPoint &rp)
 }
 
 //____________________________________________________________________________
-void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, Float_t energy, Bool_t shared)
+void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, const Float_t energy, const Bool_t shared)
 {
   // Adds a digit to the RecPoint
   // and accumulates the total amplitude and the multiplicity 
@@ -215,24 +215,24 @@ void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, Float_t energy, Bool_t sh
   if(fEnergyList == 0)
     fEnergyList =  new Float_t[fMaxDigit]; 
   if(fTimeList == 0)
-    fTimeList =  new Float_t[fMaxDigit]; 
+    fTimeList   =  new Float_t[fMaxDigit]; 
   if(fAbsIdList == 0) {
-    fAbsIdList =  new Int_t[fMaxDigit];
+    fAbsIdList  =  new Int_t  [fMaxDigit];
   }
 
   if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists 
     fMaxDigit*=2 ; 
-    Int_t   * tempo   = new Int_t[fMaxDigit]; 
+    Int_t   * tempo   = new Int_t  [fMaxDigit]; 
     Float_t * tempoE  = new Float_t[fMaxDigit];
     Float_t * tempoT  = new Float_t[fMaxDigit];
-    Int_t   * tempoId = new Int_t[fMaxDigit]; 
+    Int_t   * tempoId = new Int_t  [fMaxDigit]; 
 
     Int_t index ;     
     for ( index = 0 ; index < fMulDigit ; index++ ){
-      tempo[index]   = fDigitsList[index] ;
-      tempoE[index]  = fEnergyList[index] ; 
-      tempoT[index]  = fTimeList[index] ; 
-      tempoId[index] = fAbsIdList[index] ; 
+      tempo  [index] = fDigitsList[index] ;
+      tempoE [index] = fEnergyList[index] ; 
+      tempoT [index] = fTimeList  [index] ; 
+      tempoId[index] = fAbsIdList [index] ; 
     }
     
     delete [] fDigitsList ;
@@ -248,8 +248,8 @@ void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, Float_t energy, Bool_t sh
   
   fDigitsList[fMulDigit]   = digit.GetIndexInList()  ; 
   fEnergyList[fMulDigit]   = energy ;
-  fTimeList[fMulDigit]     = digit.GetTimeR() ;
-  fAbsIdList[fMulDigit]    = digit.GetId();
+  fTimeList  [fMulDigit]   = digit.GetTime();
+  fAbsIdList [fMulDigit]   = digit.GetId();
   fMulDigit++ ; 
   fAmp += energy ; 
        
index 26e61b82cff6b0a00b14b8d7e21f1ac850e3465b..6380473f0b8e0c5da19dfd97f8d7b9b077455e4e 100644 (file)
@@ -44,144 +44,133 @@ class AliEMCALRecPoint : public AliCluster {
 
   virtual ~AliEMCALRecPoint();
 
-  virtual void    AddDigit(AliDigitNew &) const { 
-    Fatal("AddDigit", "use AddDigit(AliEMCALDigit & digit, Float_t Energy )") ; 
-  }
-  virtual void    AddDigit(AliEMCALDigit & digit, Float_t Energy, Bool_t shared); 
+  virtual void    AddDigit(AliEMCALDigit & digit, const Float_t energy, const Bool_t shared); 
   virtual Int_t   Compare(const TObject * obj) const;  
-  //virtual Int_t   DistancetoPrimitive(Int_t px, Int_t py);//Not used, remove?
   virtual void    Draw(Option_t * option="") ;
-  //virtual void    ExecuteEvent(Int_t event, Int_t, Int_t) ;//Not used, remove?
 
-  virtual void    SetClusterType(Int_t ver) { fClusterType = ver; }
-  virtual Int_t   GetClusterType() const { return fClusterType; }
+  virtual void    SetClusterType(Int_t ver) { fClusterType = ver ; }
+  virtual Int_t   GetClusterType()    const { return fClusterType; }
 
-  virtual void    EvalAll(Float_t logWeight, TClonesArray * digits, const Bool_t justClusters);
+  virtual void    EvalAll           (Float_t logWeight, TClonesArray * digits, const Bool_t justClusters);
   virtual void    EvalLocalPosition (Float_t logWeight, TClonesArray * digits);
   virtual void    EvalGlobalPosition(Float_t logWeight, TClonesArray * digits);
 
   virtual void    EvalPrimaries(TClonesArray * digits) ;
-  virtual void    EvalParents(TClonesArray * digits) ;
+  virtual void    EvalParents  (TClonesArray * digits) ;
 
-  virtual int *   GetDigitsList(void) const { return fDigitsList ; }
-  virtual Float_t GetEnergy() const {return fAmp; }
-
-  void   EvalLocal2TrackingCSTransform();
-  void   EvalLocalPositionFit(Double_t deff, Double_t w0, Double_t phiSlope,TClonesArray * digits);
-  Bool_t EvalLocalPosition2(TClonesArray *digits, TArrayD &ed);
-
-  Bool_t EvalLocalPositionFromDigits(const Double_t esum, const Double_t deff, const Double_t w0, 
+  void            EvalLocal2TrackingCSTransform();
+  void            EvalLocalPositionFit(Double_t deff, Double_t w0, Double_t phiSlope,TClonesArray * digits);
+  Bool_t          EvalLocalPosition2(TClonesArray *digits, TArrayD &ed);
+  Bool_t          EvalLocalPositionFromDigits(const Double_t esum, const Double_t deff, const Double_t w0, 
                                               TClonesArray *digits, TArrayD &ed, TVector3 &locPos);
-  Bool_t EvalLocalPositionFromDigits(TClonesArray *digits, TArrayD &ed, TVector3 &locPos);
+  Bool_t          EvalLocalPositionFromDigits(TClonesArray *digits, TArrayD &ed, TVector3 &locPos);
   static  void    GetDeffW0(const Double_t esum, Double_t &deff,  Double_t &w0);
 
-  //virtual void    GetGlobalPosition(TVector3 & gpos, TMatrixF & gmat) const; // return global position (x, y, z) in ALICE
   virtual void    GetGlobalPosition(TVector3 & gpos) const; // return global position (x, y, z) in ALICE
-  virtual void    GetLocalPosition(TVector3 & lpos)  const;  // return local position  (x, y, z) in EMCAL SM
-  virtual Int_t * GetPrimaries(Int_t & number) const {number = fMulTrack ; 
-                                                      return fTracksList ; }
-  virtual Int_t * GetParents(Int_t & number)   const {number = fMulParent ; 
-                                                      return fParentsList ; }
+  virtual void    GetLocalPosition (TVector3 & lpos) const; // return local position  (x, y, z) in EMCAL SM
+  
+  virtual Int_t * GetPrimaries(Int_t & number)       const { number = fMulTrack  ; 
+                                                             return fTracksList  ; }
+  virtual Int_t * GetParents  (Int_t & number)       const { number = fMulParent ; 
+                                                             return fParentsList ; }
 
-  virtual Int_t   GetDigitsMultiplicity(void)  const { return fMulDigit ; }
+  virtual Int_t   GetDigitsMultiplicity(void)  const { return fMulDigit    ; }
   Int_t           GetIndexInList()             const { return fIndexInList ; }
-
-  Float_t         GetCoreEnergy()const {return fCoreEnergy ;}
-  virtual Float_t GetDispersion()const {return fDispersion ;}
-  virtual void    GetElipsAxis(Float_t * lambda)const {lambda[0] = fLambda[0]; lambda[1] = fLambda[1];};
-  
-  Float_t *   GetEnergiesList() const {return fEnergyList ;}       // gets the list of energies making this recpoint
-  Double_t    GetPointEnergy() const;                              // gets point energy (sum of energy list)
-  Float_t *   GetTimeList() const {return fTimeList ;}             // gets the list of digit times in this recpoint
-  Float_t     GetMaximalEnergy(void) const ;                       // get the highest energy in the cluster
-  Int_t       GetMaximalEnergyIndex(void) const ;                  // get the index of highest energy digit
-  Int_t       GetMaximumMultiplicity() const {return fMaxDigit ;}  // gets the maximum number of digits allowed
-  Int_t       GetMultiplicity(void) const { return fMulDigit ; }   // gets the number of digits making this recpoint
-  Int_t       GetMultiplicityAtLevel(Float_t level) const ;        // computes multiplicity of digits with 
-  Int_t *     GetAbsId() const {return fAbsIdList;}
-  Int_t       GetAbsId(Int_t i) const {if(i>=0 && i<fMulDigit)return fAbsIdList[i]; else return -1;}
-  Int_t       GetAbsIdMaxDigit() const {return GetAbsId(fDigitIndMax);}
-  Int_t       GetIndMaxDigit() const {return fDigitIndMax;}
-  void        SetIndMaxDigit(const Int_t ind) {fDigitIndMax = ind;}
-  void        SetIndexInList(Int_t val) { fIndexInList = val ; }
-
-  virtual Int_t GetSuperModuleNumber(void) const { return fSuperModuleNumber;}
+  virtual int *   GetDigitsList(void)          const { return fDigitsList  ; }
+  virtual Float_t GetEnergy()                  const { return fAmp         ; }
+  Float_t         GetCoreEnergy()              const { return fCoreEnergy  ; }
+  virtual Float_t GetDispersion()              const { return fDispersion  ; }
+  virtual void    GetElipsAxis(Float_t * lambda) const {lambda[0] = fLambda[0]; lambda[1] = fLambda[1];};
+  Float_t *       GetEnergiesList()            const { return fEnergyList  ; } // gets the list of energies making this recpoint
+  Double_t        GetPointEnergy()             const;                          // gets point energy (sum of energy list)
+  Float_t *       GetTimeList()                const { return fTimeList    ; } // gets the list of digit times in this recpoint
+  Float_t         GetMaximalEnergy(void)       const ;                         // get the highest energy in the cluster
+  Int_t           GetMaximalEnergyIndex(void)  const ;                         // get the index of highest energy digit
+  Int_t           GetMaximumMultiplicity()     const { return fMaxDigit    ; } // gets the maximum number of digits allowed
+  Int_t           GetMultiplicity(void)        const { return fMulDigit    ; } // gets the number of digits making this recpoint
+  Int_t           GetMultiplicityAtLevel(Float_t level) const ;                // computes multiplicity of digits with 
+  Int_t *         GetAbsId()                   const { return fAbsIdList   ; }
+  Int_t           GetAbsId(Int_t i)            const { if(i>=0 && i<fMulDigit)
+                                                        return fAbsIdList[i]; 
+                                                        else return -1     ; }
+  Int_t           GetAbsIdMaxDigit()           const { return GetAbsId(fDigitIndMax) ; }
+  Int_t           GetIndMaxDigit()             const { return fDigitIndMax ; }
+  void            SetIndMaxDigit(const Int_t ind)    { fDigitIndMax = ind  ; }
+  void            SetIndexInList(Int_t val)          { fIndexInList = val  ; }
+
+  virtual Int_t   GetSuperModuleNumber(void)   const { return fSuperModuleNumber;}
 
   // energy above relative level
-  virtual Int_t GetNumberOfLocalMax(AliEMCALDigit **  maxAt, Float_t * maxAtEnergy,
-                                    Float_t locMaxCut,TClonesArray * digits ) const ; 
+  virtual Int_t   GetNumberOfLocalMax(AliEMCALDigit **  maxAt, Float_t * maxAtEnergy,
+                                      Float_t locMaxCut,TClonesArray * digits ) const ; 
                                                                    // searches for the local maxima 
   // Number of local maxima found in cluster in unfolding:
   // 0: no unfolding
   //-1: unfolding failed
-  Short_t     GetNExMax(void)     const { return fNExMax ;}  // Number of maxima found in cluster in unfolding
-  void        SetNExMax(Int_t nmax=1)   {fNExMax = static_cast<Short_t>(nmax) ;}
+  Short_t         GetNExMax(void)              const { return fNExMax       ; }  // Number of maxima found in cluster in unfolding
+  void            SetNExMax(Int_t nmax=1)            { fNExMax = static_cast<Short_t>(nmax) ;}
        
-  Int_t       GetPrimaryIndex()   const  ;
+  Int_t           GetPrimaryIndex()            const  ;
        
-  Float_t     GetTime(void)       const { return  fTime ; }
+  Float_t         GetTime(void)                const { return  fTime        ; }
        
-  Bool_t      SharedCluster(void) const { return  fSharedCluster ; }
-  void        SetSharedCluster(Bool_t s){ fSharedCluster = s ; }
+  Bool_t          SharedCluster(void)          const { return  fSharedCluster ; }
+  void            SetSharedCluster(Bool_t s)         { fSharedCluster = s     ; }
        
-  virtual Bool_t  IsEmc(void)     const { return kTRUE ;  }
-  virtual Bool_t  IsSortable()    const { 
-    // tells that this is a sortable object
-    return kTRUE ; 
-  }  
+  virtual Bool_t  IsEmc(void)                  const { return kTRUE         ; }
+  virtual Bool_t  IsSortable()                 const { return kTRUE         ; }  
   virtual void    Paint(Option_t * option="");
   virtual void    Print(Option_t * option="") const ; 
   
-  Double_t TmaxInCm(const Double_t e=0.0, const Int_t key=0);
+  Double_t        TmaxInCm(const Double_t e=0.0, const Int_t key=0);
 
-  Float_t     GetDistanceToBadTower() const {return fDistToBadTower;}
-  void        EvalDistanceToBadChannels(AliCaloCalibPedestal* caloped);
+  Float_t         GetDistanceToBadTower() const {return fDistToBadTower;}
+  void            EvalDistanceToBadChannels(AliCaloCalibPedestal* caloped);
 
 protected:
-         void  EvalCoreEnergy(Float_t logWeight,TClonesArray * digits) ;             
-         virtual void  EvalDispersion(Float_t logWeight,TClonesArray * digits) ;   // computes the dispersion of the shower
-         virtual void  EvalElipsAxis(Float_t logWeight, TClonesArray * digits );   // computes the axis of shower ellipsoide
-         void  EvalTime( TClonesArray * digits );
+         void           EvalCoreEnergy(Float_t logWeight, TClonesArray * digits) ;             
+         virtual void   EvalDispersion(Float_t logWeight, TClonesArray * digits) ;  // computes the dispersion of the shower
+         virtual void   EvalElipsAxis (Float_t logWeight, TClonesArray * digits );  // computes the axis of shower ellipsoide
+         void           EvalTime( TClonesArray * digits );
          virtual Bool_t AreNeighbours(AliEMCALDigit * digit1, AliEMCALDigit * digit2 ) const;
-         Float_t ThetaToEta(Float_t arg) const;  //Converts Theta (Radians) to Eta(Radians)
-         Float_t EtaToTheta(Float_t arg) const;  //Converts Eta (Radians) to Theta(Radians)
+         Float_t        ThetaToEta(Float_t arg) const;  //Converts Theta (Radians) to Eta(Radians)
+         Float_t        EtaToTheta(Float_t arg) const;  //Converts Eta (Radians) to Theta(Radians)
 
 private:
 
-  //JLK do we need this?
          AliEMCALGeometry* fGeomPtr;  //! Pointer to geometry for utilities
 
-         Float_t fAmp ;            // summed amplitude of digits   
-         Int_t   fIndexInList ;    // the index of this RecPoint in the
-                                   // list stored in TreeR (to be set by analysis)
-         TVector3    fGlobPos ;    // global position
-         TVector3    fLocPos ;     // local  position in the sub-detector coordinate
-         Int_t       fMaxDigit ;   //! max initial size of digits array (not saved)
-         Int_t       fMulDigit ;   // total multiplicity of digits       
-         Int_t       fMaxTrack ;   //! max initial size of tracks array (not saved)
-         Int_t       fMulTrack ;   // total multiplicity of tracks
-         Int_t *     fDigitsList ; //[fMulDigit] list of digit's indexes from which the point was reconstructed
-         Int_t *     fTracksList ; //[fMulTrack] list of tracks to which the point was assigned
-
-         Int_t   fClusterType;       // type of cluster stored: v1
-         Float_t fCoreEnergy ;       // energy in a shower core 
-         Float_t fLambda[2] ;        // shower ellipse axes
-         Float_t fDispersion ;       // shower dispersion
-         Float_t *fEnergyList ;      //[fMulDigit] energy of digits
-         Float_t *fTimeList ;        //[fMulDigit] time of digits
-         Int_t   *fAbsIdList;        //[fMulDigit] absId  of digits
-         Float_t fTime ;             // Time of the digit with maximal energy deposition
-         Short_t fNExMax ;           // number of (Ex-)maxima before unfolding
-         Float_t fCoreRadius;        // The radius in which the core energy is evaluated
-         Float_t *fDETracksList ;    //[fMulTrack] list of tracks to which the point was assigned
-         Int_t fMulParent;           // Multiplicity of the parents
-         Int_t fMaxParent;           // Maximum number of parents allowed
-         Int_t fParentsList;       // [fMulParent] list of the parents of the digits
-         Float_t * fDEParentsList;   // [fMulParent] list of the parents of the digits
-         Int_t   fSuperModuleNumber; // number identifying supermodule containing recpoint, reference is cell with maximum energy.
-         Int_t   fDigitIndMax;       // Index of digit with max energy in array fAbsIdList
-         Float_t fDistToBadTower;    // Distance to nearest bad tower
-         Bool_t  fSharedCluster;     // States if cluster is shared by 2 SuperModules in same phi rack (0,1), (2,3) ... (10,11).
+         Float_t  fAmp ;              // summed amplitude of digits   
+         Int_t    fIndexInList ;      // the index of this RecPoint in the
+                                 // list stored in TreeR (to be set by analysis)
+         TVector3 fGlobPos ;          // global position
+         TVector3 fLocPos ;           // local  position in the sub-detector coordinate
+         Int_t    fMaxDigit ;         //! max initial size of digits array (not saved)
+         Int_t    fMulDigit ;         // total multiplicity of digits       
+         Int_t    fMaxTrack ;         //! max initial size of tracks array (not saved)
+         Int_t    fMulTrack ;         // total multiplicity of tracks
+         Int_t   *fDigitsList ;       //[fMulDigit] list of digit's indexes from which the point was reconstructed
+         Int_t   *fTracksList ;       //[fMulTrack] list of tracks to which the point was assigned
+
+         Int_t    fClusterType;       // type of cluster stored: v1
+         Float_t  fCoreEnergy ;       // energy in a shower core 
+         Float_t  fLambda[2] ;        // shower ellipse axes
+         Float_t  fDispersion ;       // shower dispersion
+         Float_t *fEnergyList ;       //[fMulDigit] energy of digits
+         Float_t *fTimeList ;         //[fMulDigit] time of digits
+         Int_t   *fAbsIdList;         //[fMulDigit] absId  of digits
+         Float_t  fTime ;             // Time of the digit with maximal energy deposition
+         Short_t  fNExMax ;           // number of (Ex-)maxima before unfolding
+         Float_t  fCoreRadius;        // The radius in which the core energy is evaluated
+         Float_t *fDETracksList ;     //[fMulTrack] list of tracks to which the point was assigned
+         Int_t    fMulParent;         // Multiplicity of the parents
+         Int_t    fMaxParent;         // Maximum number of parents allowed
+         Int_t   *fParentsList;       // [fMulParent] list of the parents of the digits
+         Float_t *fDEParentsList;     // [fMulParent] list of the parents of the digits
+         Int_t    fSuperModuleNumber; // number identifying supermodule containing recpoint, reference is cell with maximum energy.
+         Int_t    fDigitIndMax;       // Index of digit with max energy in array fAbsIdList
+         Float_t  fDistToBadTower;    // Distance to nearest bad tower
+         Bool_t   fSharedCluster;     // States if cluster is shared by 2 SuperModules in same phi rack (0,1), (2,3) ... (10,11).
        
   ClassDef(AliEMCALRecPoint,12) // RecPoint for EMCAL (Base Class)
  
index 364636f6bc99e307decbba0c7c9d0bedfce131fc..6e73418215e4549841f20e1060283e1099052ec1 100644 (file)
@@ -44,6 +44,7 @@
 #include "AliEMCALRawUtils.h"
 #include "AliEMCALDigit.h"
 #include "AliEMCALClusterizerv1.h"
+#include "AliEMCALClusterizerv2.h"
 #include "AliEMCALClusterizerNxN.h"
 #include "AliEMCALRecPoint.h"
 #include "AliEMCALPID.h"
@@ -204,24 +205,34 @@ void AliEMCALReconstructor::InitClusterizer() const
       //printf("ReCreate clusterizer? Clusterizer set <%d>, Clusterizer in use <%s>\n",
       //     clusterizerType, fgClusterizer->Version());
       
-      if     (clusterizerType == AliEMCALRecParam::kClusterizerv1 && !strcmp(fgClusterizer->Version(),"clu-v1")) return;
+      if     (clusterizerType == AliEMCALRecParam::kClusterizerv1  && !strcmp(fgClusterizer->Version(),"clu-v1"))  return;
       
       else if(clusterizerType == AliEMCALRecParam::kClusterizerNxN && !strcmp(fgClusterizer->Version(),"clu-NxN")) return;
       
+      else if(clusterizerType == AliEMCALRecParam::kClusterizerv2  && !strcmp(fgClusterizer->Version(),"clu-v2"))  return;
+      
       //Need to create new clusterizer, the one set previously is not the correct one     
       delete fgClusterizer;
     }
     else return;
   }
   
-  if (clusterizerType  == AliEMCALRecParam::kClusterizerv1)
+  if      (clusterizerType  == AliEMCALRecParam::kClusterizerv1)
     {
-      fgClusterizer = new AliEMCALClusterizerv1(fGeom, fCalibData,fPedestalData);
+      fgClusterizer = new AliEMCALClusterizerv1 (fGeom, fCalibData,fPedestalData);
     }
-  else
+  else if (clusterizerType  == AliEMCALRecParam::kClusterizerNxN)
     {
       fgClusterizer = new AliEMCALClusterizerNxN(fGeom, fCalibData,fPedestalData);
     }
+  else if (clusterizerType  == AliEMCALRecParam::kClusterizerv2)
+  {
+    fgClusterizer = new AliEMCALClusterizerv2   (fGeom, fCalibData,fPedestalData);
+  }
+  else 
+  {
+    AliFatal(Form("Unknown clusterizer %d ", clusterizerType));
+  }
 }
 
 //____________________________________________________________________________
@@ -426,17 +437,19 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   
   Int_t nDigits = fgDigitsArr->GetEntries(), idignew = 0 ;
   AliDebug(1,Form("%d digits",nDigits));
-  
   AliESDCaloCells &emcCells = *(esd->GetEMCALCells());
   emcCells.CreateContainer(nDigits);
   emcCells.SetType(AliVCaloCells::kEMCALCell);
   Float_t energy = 0;
+  Float_t time   = 0;
   for (Int_t idig = 0 ; idig < nDigits ; idig++) {
     const AliEMCALDigit * dig = (const AliEMCALDigit*)fgDigitsArr->At(idig);
-    if(dig->GetAmplitude() > 0 ){
-      energy = fgClusterizer->Calibrate(dig->GetAmplitude(),dig->GetTime(),dig->GetId()); //TimeR or Time?
-      if(energy > 0){ //Digits tagged as bad (dead, hot, not alive) are set to 0 in calibrate, remove them     
-        emcCells.SetCell(idignew,dig->GetId(),energy, dig->GetTime());   
+    time   = dig->GetTime();      // Time already calibrated in clusterizer
+    energy = dig->GetAmplitude(); // energy calibrated in clusterizer
+    if(energy > 0 ){
+      fgClusterizer->Calibrate(energy,time,dig->GetId()); //Digits already calibrated in clusterizers
+      if(energy > 0){ //Digits tagged as bad (dead, hot, not alive) are set to 0 in calibrate, remove them
+        emcCells.SetCell(idignew,dig->GetId(),energy, time);   
         idignew++;
       }
     }