Remove hard-coded number of centrality bins
authorsaiola <salvatore.aiola@cern.ch>
Sat, 9 Aug 2014 08:15:52 +0000 (10:15 +0200)
committersaiola <salvatore.aiola@cern.ch>
Tue, 12 Aug 2014 19:17:44 +0000 (21:17 +0200)
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskSAJF.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskSAJF.h

index 1c4d114..00e685b 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$
 //
 // Jet analysis task.
 //
@@ -25,34 +24,29 @@ ClassImp(AliAnalysisTaskSAJF)
 AliAnalysisTaskSAJF::AliAnalysisTaskSAJF() : 
   AliAnalysisTaskEmcalJet("AliAnalysisTaskSAJF", kTRUE),
   fHistoType(1),
-  fHistJetObservables(0)
-
+  fHistTracksJetPt(0),
+  fHistClustersJetPt(0),
+  fHistTracksPtDist(0),
+  fHistClustersPtDist(0),
+  fHistJetObservables(0),
+  fHistJetPtEtaPhi(0),
+  fHistJetPtArea(0),
+  fHistJetPtEP(0),
+  fHistJetPtNEF(0),
+  fHistJetPtZ(0),
+  fHistJetPtLeadingPartPt(0),
+  fHistJetCorrPtEtaPhi(0),
+  fHistJetCorrPtArea(0),
+  fHistJetCorrPtEP(0),
+  fHistJetCorrPtNEF(0),
+  fHistJetCorrPtZ(0),
+  fHistJetCorrPtLeadingPartPt(0),
+  fHistJetPtCorrPt(0),
+  fHistJetPtMCPt(0),
+  fHistJetMCPtCorrPt(0)
 {
   // Default constructor.
 
-  for (Int_t i = 0; i < 4; i++) {
-    fHistTracksJetPt[i] = 0;
-    fHistClustersJetPt[i] = 0;
-    fHistTracksPtDist[i] = 0;
-    fHistClustersPtDist[i] = 0;
-
-    fHistJetPtEtaPhi[i] = 0;
-    fHistJetPtArea[i] = 0;
-    fHistJetPtEP[i] = 0;
-    fHistJetPtNEF[i] = 0;
-    fHistJetPtZ[i] = 0;
-    fHistJetPtLeadingPartPt[i] = 0;
-    fHistJetCorrPtEtaPhi[i] = 0;
-    fHistJetCorrPtArea[i] = 0;
-    fHistJetCorrPtEP[i] = 0;
-    fHistJetCorrPtNEF[i] = 0;
-    fHistJetCorrPtZ[i] = 0;
-    fHistJetCorrPtLeadingPartPt[i] = 0;
-    fHistJetPtCorrPt[i] = 0;
-    fHistJetPtMCPt[i] = 0;
-    fHistJetMCPtCorrPt[i] = 0;
-  }
-
   SetMakeGeneralHistograms(kTRUE);
 }
 
@@ -60,33 +54,29 @@ AliAnalysisTaskSAJF::AliAnalysisTaskSAJF() :
 AliAnalysisTaskSAJF::AliAnalysisTaskSAJF(const char *name) : 
   AliAnalysisTaskEmcalJet(name, kTRUE),
   fHistoType(1),
-  fHistJetObservables(0)
+  fHistTracksJetPt(0),
+  fHistClustersJetPt(0),
+  fHistTracksPtDist(0),
+  fHistClustersPtDist(0),
+  fHistJetObservables(0),
+  fHistJetPtEtaPhi(0),
+  fHistJetPtArea(0),
+  fHistJetPtEP(0),
+  fHistJetPtNEF(0),
+  fHistJetPtZ(0),
+  fHistJetPtLeadingPartPt(0),
+  fHistJetCorrPtEtaPhi(0),
+  fHistJetCorrPtArea(0),
+  fHistJetCorrPtEP(0),
+  fHistJetCorrPtNEF(0),
+  fHistJetCorrPtZ(0),
+  fHistJetCorrPtLeadingPartPt(0),
+  fHistJetPtCorrPt(0),
+  fHistJetPtMCPt(0),
+  fHistJetMCPtCorrPt(0)
 {
   // Standard constructor.
 
-  for (Int_t i = 0; i < 4; i++) {
-    fHistTracksJetPt[i] = 0;
-    fHistClustersJetPt[i] = 0;
-    fHistTracksPtDist[i] = 0;
-    fHistClustersPtDist[i] = 0;
-
-    fHistJetPtEtaPhi[i] = 0;
-    fHistJetPtArea[i] = 0;
-    fHistJetPtEP[i] = 0;
-    fHistJetPtNEF[i] = 0;
-    fHistJetPtZ[i] = 0;
-    fHistJetPtLeadingPartPt[i] = 0;
-    fHistJetCorrPtEtaPhi[i] = 0;
-    fHistJetCorrPtArea[i] = 0;
-    fHistJetCorrPtEP[i] = 0;
-    fHistJetCorrPtNEF[i] = 0;
-    fHistJetCorrPtZ[i] = 0;
-    fHistJetCorrPtLeadingPartPt[i] = 0;
-    fHistJetPtCorrPt[i] = 0;
-    fHistJetPtMCPt[i] = 0;
-    fHistJetMCPtCorrPt[i] = 0;
-  }
-
   SetMakeGeneralHistograms(kTRUE);
 }
 
@@ -186,7 +176,23 @@ void AliAnalysisTaskSAJF::AllocateTHnSparse()
 //________________________________________________________________________
 void AliAnalysisTaskSAJF::AllocateTHX()
 {
-  for (Int_t i = 0; i < 4; i++) {
+  fHistJetPtEtaPhi = new TH3*[fNcentBins];
+  fHistJetPtArea = new TH2*[fNcentBins];
+  fHistJetPtEP = new TH2*[fNcentBins];
+  fHistJetPtNEF = new TH2*[fNcentBins];
+  fHistJetPtZ = new TH2*[fNcentBins];
+  fHistJetPtLeadingPartPt = new TH2*[fNcentBins];
+  fHistJetCorrPtEtaPhi = new TH3*[fNcentBins];
+  fHistJetCorrPtArea = new TH2*[fNcentBins];
+  fHistJetCorrPtEP = new TH2*[fNcentBins];
+  fHistJetCorrPtNEF = new TH2*[fNcentBins];
+  fHistJetCorrPtZ = new TH2*[fNcentBins];
+  fHistJetCorrPtLeadingPartPt = new TH2*[fNcentBins];
+  fHistJetPtCorrPt = new TH2*[fNcentBins];
+  fHistJetPtMCPt = new TH2*[fNcentBins];
+  fHistJetMCPtCorrPt = new TH2*[fNcentBins];
+
+  for (Int_t i = 0; i < fNcentBins; i++) {
     TString histname;
 
     histname = "fHistJetPtEtaPhi_";
@@ -324,15 +330,20 @@ void AliAnalysisTaskSAJF::UserCreateOutputObjects()
 
   AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
 
-  if (fHistoType == 0)
+  if (fHistoType == 0) 
     AllocateTHX();
   else
     AllocateTHnSparse();
 
-  for (Int_t i = 0; i < 4; i++) {
+  fHistTracksJetPt = new TH2*[fNcentBins];
+  fHistClustersJetPt = new TH2*[fNcentBins];
+  fHistTracksPtDist = new TH2*[fNcentBins];
+  fHistClustersPtDist = new TH2*[fNcentBins];
+
+  for (Int_t i = 0; i < fNcentBins; i++) {
     TString histname;
 
-    if (fParticleCollArray.GetEntriesFast()>0) {
+    if (fParticleCollArray.GetEntriesFast() > 0) {
       histname = "fHistTracksJetPt_";
       histname += i;
       fHistTracksJetPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2, fNbins, fMinBinPt, fMaxBinPt);
@@ -350,7 +361,7 @@ void AliAnalysisTaskSAJF::UserCreateOutputObjects()
       fOutput->Add(fHistTracksPtDist[i]);
     }
 
-    if (fClusterCollArray.GetEntriesFast()>0) {
+    if (fClusterCollArray.GetEntriesFast() > 0) {
       histname = "fHistClustersJetPt_";
       histname += i;
       fHistClustersJetPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2, fNbins, fMinBinPt, fMaxBinPt);
index 2dbcddc..eb6a18f 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef ALIANALYSISTASKSAJF_H
 #define ALIANALYSISTASKSAJF_H
 
-// $Id$
-
 class TH2;
 class THnSparse;
 
@@ -31,30 +29,30 @@ class AliAnalysisTaskSAJF : public AliAnalysisTaskEmcalJet {
 
   Int_t                       fHistoType;                      // histogram type (0=TH2, 1=THnSparse)
 
+  TH2                       **fHistTracksJetPt;             //!Track pt vs. jet pt
+  TH2                       **fHistClustersJetPt;           //!Cluster pt vs. jet pt
+  TH2                       **fHistTracksPtDist;            //!Track pt vs. distance form jet axis
+  TH2                       **fHistClustersPtDist;          //!Cluster pt vs. distance form jet axis
+
   // Inclusive jets histograms
-  THnSparse                  *fHistJetObservables;             //!Jet-wise observables
+  THnSparse                  *fHistJetObservables;          //!Jet observables
 
   // TH2/TH3 versions
-  TH3                        *fHistJetPtEtaPhi[4];             //!Jet Pt vs. Eta vs. Phi
-  TH2                        *fHistJetPtArea[4];               //!Jet Pt vs. Area
-  TH2                        *fHistJetPtEP[4];                 //!Jet Pt vs. event plane
-  TH2                        *fHistJetPtNEF[4];                //!Jet Pt vs. neutral energy fraction
-  TH2                        *fHistJetPtZ[4];                  //!Jet Pt vs. z
-  TH2                        *fHistJetPtLeadingPartPt[4];      //!Jet Pt vs. leading particle pt
-  TH3                        *fHistJetCorrPtEtaPhi[4];         //!Jet corrPt vs. Eta vs. Phi
-  TH2                        *fHistJetCorrPtArea[4];           //!Jet corrPt vs. Area
-  TH2                        *fHistJetCorrPtEP[4];             //!Jet corrPt vs. event plane
-  TH2                        *fHistJetCorrPtNEF[4];            //!Jet corrPt vs. neutral energy fraction
-  TH2                        *fHistJetCorrPtZ[4];              //!Jet corrPt vs. z
-  TH2                        *fHistJetCorrPtLeadingPartPt[4];  //!Jet corrPt vs. leading particle pt
-  TH2                        *fHistJetPtCorrPt[4];             //!Jet Pt vs. corrPt
-  TH2                        *fHistJetPtMCPt[4];               //!Jet Pt vs. MCPt
-  TH2                        *fHistJetMCPtCorrPt[4];           //!Jet MCPt vs. corrPt
-
-  TH2                        *fHistTracksJetPt[4];             //!Track pt vs. jet pt
-  TH2                        *fHistClustersJetPt[4];           //!Cluster pt vs. jet pt
-  TH2                        *fHistTracksPtDist[4];            //!Track pt vs. distance form jet axis
-  TH2                        *fHistClustersPtDist[4];          //!Cluster pt vs. distance form jet axis
+  TH3                       **fHistJetPtEtaPhi;             //!Jet Pt vs. Eta vs. Phi
+  TH2                       **fHistJetPtArea;               //!Jet Pt vs. Area
+  TH2                       **fHistJetPtEP;                 //!Jet Pt vs. event plane
+  TH2                       **fHistJetPtNEF;                //!Jet Pt vs. neutral energy fraction
+  TH2                       **fHistJetPtZ;                  //!Jet Pt vs. z
+  TH2                       **fHistJetPtLeadingPartPt;      //!Jet Pt vs. leading particle pt
+  TH3                       **fHistJetCorrPtEtaPhi;         //!Jet corrPt vs. Eta vs. Phi
+  TH2                       **fHistJetCorrPtArea;           //!Jet corrPt vs. Area
+  TH2                       **fHistJetCorrPtEP;             //!Jet corrPt vs. event plane
+  TH2                       **fHistJetCorrPtNEF;            //!Jet corrPt vs. neutral energy fraction
+  TH2                       **fHistJetCorrPtZ;              //!Jet corrPt vs. z
+  TH2                       **fHistJetCorrPtLeadingPartPt;  //!Jet corrPt vs. leading particle pt
+  TH2                       **fHistJetPtCorrPt;             //!Jet Pt vs. corrPt
+  TH2                       **fHistJetPtMCPt;               //!Jet Pt vs. MCPt
+  TH2                       **fHistJetMCPtCorrPt;           //!Jet MCPt vs. corrPt
 
  private:
   AliAnalysisTaskSAJF(const AliAnalysisTaskSAJF&);            // not implemented