change the setting of the selected calorimeter, set not only a string but an int...
authorgconesab <gustavo.conesa.balbastre@cern.ch>
Sat, 18 Oct 2014 18:05:12 +0000 (20:05 +0200)
committergconesab <gustavo.conesa.balbastre@cern.ch>
Sun, 19 Oct 2014 20:47:24 +0000 (22:47 +0200)
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrBaseClass.cxx
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrBaseClass.h

index f4e4156..ad383ba 100755 (executable)
@@ -47,7 +47,7 @@ ClassImp(AliAnaCaloTrackCorrBaseClass)
 AliAnaCaloTrackCorrBaseClass::AliAnaCaloTrackCorrBaseClass() : 
 TObject(), 
 fDataMC(0),                   fDebug(0),
-fCalorimeter(""),
+fCalorimeter(-1),             fCalorimeterString(""),
 fCheckFidCut(0),              fCheckRealCaloAcc(0),
 fCheckCaloPID(0),             fRecalculateCaloPID(0), 
 fMinPt(0),                    fMaxPt(0),
@@ -93,26 +93,28 @@ void AliAnaCaloTrackCorrBaseClass::AddAODParticle(AliAODPWG4Particle pc)
 {
   //Put AOD calo cluster in the AODParticleCorrelation array
   
-  if(fOutputAODBranch){
-    
-    Int_t i = fOutputAODBranch->GetEntriesFast();
-    //new((*fOutputAODBranch)[i])  AliAODPWG4Particle(pc);
-    if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4Particle")==0)
-      new((*fOutputAODBranch)[i])  AliAODPWG4Particle(pc);
-    else   if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4ParticleCorrelation")==0)
-      new((*fOutputAODBranch)[i])  AliAODPWG4ParticleCorrelation(pc);
-    else {
-      printf("AliAnaCaloTrackCorrBaseClass::AddAODParticle() - Cannot add an object of type < %s >, to the AOD TClonesArray \n",  
-             fOutputAODBranch->GetClass()->GetName());
-      abort();    
-    }
+  if(!fOutputAODBranch)
+  {
+    AliFatal("No AOD branch available!!!\n");
+    return; // coverity
+  }
+  
+  Int_t i = fOutputAODBranch->GetEntriesFast();
+  //new((*fOutputAODBranch)[i])  AliAODPWG4Particle(pc);
+  if     (strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4Particle")==0)
+  {
+    new((*fOutputAODBranch)[i])  AliAODPWG4Particle(pc);
   }
-  else {
-    printf(" AliAnaCaloTrackCorrBaseClass::AddAODParticle() - No AOD branch available!!!\n");
-    abort();
+  else if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4ParticleCorrelation")==0)
+  {
+    new((*fOutputAODBranch)[i])  AliAODPWG4ParticleCorrelation(pc);
+  }
+  else
+  {
+    AliFatal(Form("Cannot add an object of type < %s >, to the AOD TClonesArray \n", fOutputAODBranch->GetClass()->GetName()));
   }
   
-}      
+}
 
 //__________________________________________________________________________________________
 Int_t AliAnaCaloTrackCorrBaseClass::CheckMixedEventVertex(Int_t caloLabel, Int_t trackLabel)
@@ -568,7 +570,8 @@ void AliAnaCaloTrackCorrBaseClass::InitParameters()
   fNZvertBin           = 1;
   fNrpBin              = 1;
   
-  fCalorimeter         = "EMCAL";
+  fCalorimeterString   = "EMCAL";
+  fCalorimeter         = kEMCAL ;
   
   fTrackMultBins[0] =  0;  fTrackMultBins[1] =  5;  fTrackMultBins[2] = 10;
   fTrackMultBins[3] = 15;  fTrackMultBins[4] = 20;  fTrackMultBins[5] = 30;
@@ -616,5 +619,36 @@ void AliAnaCaloTrackCorrBaseClass::Print(const Option_t * opt) const
   
 } 
 
+//_______________________________________________________________
+void AliAnaCaloTrackCorrBaseClass::SetCalorimeter(TString & calo)
+{
+  // Set the calorimeter for the analysis
+  
+  fCalorimeterString = calo;
+  
+  if     (calo=="EMCAL") fCalorimeter = kEMCAL;
+  else if(calo=="PHOS" ) fCalorimeter = kPHOS;
+  else if(calo=="CTS")   fCalorimeter = kCTS;
+  else if(calo=="DCAL")  fCalorimeter = kDCAL;
+  else if(calo.Contains("DCAL") && calo.Contains("PHOS")) fCalorimeter = kDCALPHOS;
+  else AliFatal(Form("Detector < %s > not known!", calo.Data()));
+
+}
+
+//___________________________________________________________
+void AliAnaCaloTrackCorrBaseClass::SetCalorimeter(Int_t calo)
+{
+  // Set the calorimeter for the analysis
+  
+  fCalorimeter = calo;
+  
+  if     (calo==kEMCAL)    fCalorimeterString = "EMCAL";
+  else if(calo==kPHOS )    fCalorimeterString = "PHOS";
+  else if(calo==kCTS)      fCalorimeterString = "CTS";
+  else if(calo==kDCAL)     fCalorimeterString = "DCAL";
+  else if(calo==kDCALPHOS) fCalorimeterString = "DCAL_PHOS";
+  else AliFatal(Form("Detector < %d > not known!", calo));
+
+}
 
 
index 7fb8adb..f890e26 100755 (executable)
@@ -135,8 +135,14 @@ public:
 
   // Common analysis switchs 
   
-  virtual TString        GetCalorimeter()                 const  { return fCalorimeter           ; }
-  virtual void           SetCalorimeter(TString & calo)          { fCalorimeter = calo           ; }
+  enum detector { kEMCAL = AliFiducialCut::kEMCAL, kPHOS = AliFiducialCut::kPHOS,
+                  kCTS   = AliFiducialCut::kCTS  , kDCAL = AliFiducialCut::kDCAL,
+                  kDCALPHOS = AliFiducialCut::kDCALPHOS } ;
+
+  virtual Int_t          GetCalorimeter()                 const  { return fCalorimeter          ; }
+  virtual TString        GetCalorimeterString()           const  { return fCalorimeterString    ; }
+  virtual void           SetCalorimeter(TString & calo);
+  virtual void           SetCalorimeter(Int_t calo) ;
 
   virtual Bool_t         IsDataMC()                        const { return fDataMC                ; }
   virtual void           SwitchOnDataMC()                        { fDataMC = kTRUE ;
@@ -304,7 +310,8 @@ private:
   
   Bool_t                     fDataMC ;             // Flag to access MC data when using ESD or AOD     
   Int_t                      fDebug ;              // Debug level
-  TString                    fCalorimeter ;        // Calorimeter selection
+  Int_t                      fCalorimeter ;        // Calorimeter selection
+  TString                    fCalorimeterString ;  // Calorimeter selection
   Bool_t                     fCheckFidCut ;        // Do analysis for clusters in defined region
   Bool_t                     fCheckRealCaloAcc ;   // When analysis of MC particle kinematics, check their hit in Calorimeter in Real Geometry or use FidCut
   Bool_t                     fCheckCaloPID ;       // Do analysis for calorimeters