]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/PartCorrBase/AliCaloTrackAODReader.cxx
Added possibility to recalibrate CaloClusters during the analysis
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCaloTrackAODReader.cxx
index 9d0d95ff9dd549f134e34f4ce2f058f9f537fc36..9347e4a71f4243a82927683b3e459a420addfc26 100755 (executable)
@@ -31,7 +31,6 @@
 
 //---- ANALYSIS system ----
 #include "AliCaloTrackAODReader.h" 
-#include "AliAODEvent.h"
 #include "AliAODCaloCluster.h"
 #include "AliAODTrack.h"
 #include "AliESDtrack.h"
@@ -78,7 +77,7 @@ AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & aodr)
 //____________________________________________________________________________
 void AliCaloTrackAODReader::FillInputCTS() {
   //Return array with Central Tracking System (CTS) tracks
-
+  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputCTS()\n");
   Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
   Int_t naod = 0;
   Double_t p[3];
@@ -142,7 +141,8 @@ void AliCaloTrackAODReader::FillInputCTS() {
 //____________________________________________________________________________
 void AliCaloTrackAODReader::FillInputEMCAL() {
   //Return array with EMCAL clusters in aod format
-  
+  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputEMCAL()\n");
+       
   //Get vertex for momentum calculation  
   Double_t v[3] ; //vertex ;
   GetVertex(v);
@@ -154,6 +154,11 @@ void AliCaloTrackAODReader::FillInputEMCAL() {
     AliAODCaloCluster * clus = 0;
     if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
       if (clus->IsEMCALCluster()){
+                 
+       //Check if the cluster contains any bad channel and if close to calorimeter borders
+       if(GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) continue;
+       if(!GetCaloUtils()->CheckCellFiducialRegion(clus,((AliAODEvent*)fInputEvent)->GetEMCALCells())) continue;
+
        TLorentzVector momentum ;
        clus->GetMomentum(momentum, v);      
        
@@ -162,6 +167,12 @@ void AliCaloTrackAODReader::FillInputEMCAL() {
          if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
                                                     momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
          
+         //Recalibrate the cluster energy 
+         if(GetCaloUtils()->IsRecalibrationOn()) {
+                 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetEMCALCells());
+                 clus->SetE(energy);
+         }
+               
          if(fWriteOutputStdAOD){
                AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus);
                fAODEMCAL->Add(newclus);        
@@ -209,7 +220,8 @@ void AliCaloTrackAODReader::FillInputEMCAL() {
 //____________________________________________________________________________
 void AliCaloTrackAODReader::FillInputPHOS() {
   //Return array with PHOS clusters in aod format
-  
+  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputPHOS()\n");
+       
   //Get vertex for momentum calculation  
   Double_t v[3] ; //vertex ;
   GetVertex(v);
@@ -221,6 +233,11 @@ void AliCaloTrackAODReader::FillInputPHOS() {
     AliAODCaloCluster * clus = 0;
     if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
       if (clus->IsPHOSCluster()){
+                 
+       //Check if the cluster contains any bad channel and if close to calorimeter borders
+       if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) continue;
+       if(!GetCaloUtils()->CheckCellFiducialRegion(clus, ((AliAODEvent*)fInputEvent)->GetPHOSCells())) continue;
+
        TLorentzVector momentum ;
        clus->GetMomentum(momentum, v);      
        
@@ -228,7 +245,13 @@ void AliCaloTrackAODReader::FillInputPHOS() {
          
          if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
                                                     momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-
+               
+               //Recalibrate the cluster energy 
+               if(GetCaloUtils()->IsRecalibrationOn()) {
+                       Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
+                       clus->SetE(energy);
+               }
+               
                if(fWriteOutputStdAOD){
                        AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus);
                        fAODPHOS->Add(newclus);