Changing sparse histos from doubles to floats and adding switch to turn sparse histos...
authorcnattras <cnattras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Nov 2011 21:44:55 +0000 (21:44 +0000)
committercnattras <cnattras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Nov 2011 21:44:55 +0000 (21:44 +0000)
PWG4/totEt/AliAnalysisEt.cxx
PWG4/totEt/AliAnalysisEt.h
PWG4/totEt/AliAnalysisTaskTotEt.cxx
PWG4/totEt/AliAnalysisTaskTotEt.h

index 1aa6d45..cd75f53 100644 (file)
@@ -128,6 +128,7 @@ AliAnalysisEt::AliAnalysisEt() : AliAnalysisEtCommon()
                               ,fTreeDeposit(0)
                               ,fCentrality(0)
                               ,fDetector(0)
+                              ,fMakeSparse(kFALSE)
                               ,fSparseHistTracks(0)
                               ,fSparseHistClusters(0)
                               ,fSparseHistEt(0)
@@ -237,10 +238,11 @@ void AliAnalysisEt::FillOutputList(TList *list)
       }
     }
     
-   list->Add(fSparseHistTracks);
-   list->Add(fSparseHistClusters);
-   list->Add(fSparseHistEt);
-    
+    if(fMakeSparse){
+      list->Add(fSparseHistTracks);
+      list->Add(fSparseHistClusters);
+      list->Add(fSparseHistEt);
+    }
 
 }
 
@@ -389,59 +391,60 @@ void AliAnalysisEt::CreateHistograms()
     histname = "fHistTMDxDz" + fHistogramNameSuffix;
     fHistTMDxDz = new TH2F(histname.Data(), "#Delta x vs #Delta z for calorimeter clusters", 800, -200, 200, 800, -200, 200);
     
-    histname = "fSparseHistTracks" + fHistogramNameSuffix;
-    const Int_t stsize = 7;
-    Int_t binsHist[stsize]   = {  1001,    7, 200000, 10000, 10000, 100,   11};
-    Double_t minHist[stsize] = {-500.5, -3.5,    0.0,   0.0,   0.0, -1.5, -0.5};
-    Double_t maxHist[stsize] = { 499.5,  3.5,  200.0, 100.0, 100.0,  1.5, 10.5};
-    fSparseTracks = new Double_t[stsize];
-    fSparseHistTracks = new THnSparseD(histname.Data(), "pid:charge:mass:et:pt:rap:cent", stsize, binsHist, minHist, maxHist);
+    if(fMakeSparse){
+      histname = "fSparseHistTracks" + fHistogramNameSuffix;
+      const Int_t stsize = 7;
+      Int_t binsHist[stsize]   = {  1001,    7, 200000, 10000, 10000, 100,   11};
+      Double_t minHist[stsize] = {-500.5, -3.5,    0.0,   0.0,   0.0, -1.5, -0.5};
+      Double_t maxHist[stsize] = { 499.5,  3.5,  200.0, 100.0, 100.0,  1.5, 10.5};
+      fSparseTracks = new Double_t[stsize];
+      fSparseHistTracks = new THnSparseF(histname.Data(), "pid:charge:mass:et:pt:rap:cent", stsize, binsHist, minHist, maxHist);
     
-    fSparseHistTracks->GetAxis(0)->SetTitle("pid");
-    fSparseHistTracks->GetAxis(1)->SetTitle("charge");
-    fSparseHistTracks->GetAxis(2)->SetTitle("mass");
-    fSparseHistTracks->GetAxis(3)->SetTitle("et");
-    fSparseHistTracks->GetAxis(4)->SetTitle("pt");
-    fSparseHistTracks->GetAxis(5)->SetTitle("rap");
-    fSparseHistTracks->GetAxis(6)->SetTitle("cent");
-
-    histname = "fSparseHistClusters" + fHistogramNameSuffix;
-    const Int_t scsize = 11;
-    //                            pid     ch    mass     et     pt   eta   et_t   pt_t  eta_t  cent   dist
-    Int_t scbinsHist[scsize]   = {  1001,    7, 200000, 10000, 10000,  100, 10000, 10000,  100,   11,   4000};
-    Double_t scminHist[scsize] = {-500.5, -3.5,    0.0,   0.0,   0.0, -1.5,   0.0,   0.0, -1.5, -0.5, -200.0};
-    Double_t scmaxHist[scsize] = { 499.5,  3.5,  200.0, 100.0, 100.0,  1.5, 100.0, 100.0,  1.5, 10.5,  200.0};
-    fSparseClusters = new Double_t[scsize];
-    fSparseHistClusters = new THnSparseD(histname.Data(), "pid:charge:mass:et:pt:rap:et_track:pt_track:eta_track:cent:dist_matched", scsize, scbinsHist, scminHist, scmaxHist);
+      fSparseHistTracks->GetAxis(0)->SetTitle("pid");
+      fSparseHistTracks->GetAxis(1)->SetTitle("charge");
+      fSparseHistTracks->GetAxis(2)->SetTitle("mass");
+      fSparseHistTracks->GetAxis(3)->SetTitle("et");
+      fSparseHistTracks->GetAxis(4)->SetTitle("pt");
+      fSparseHistTracks->GetAxis(5)->SetTitle("rap");
+      fSparseHistTracks->GetAxis(6)->SetTitle("cent");
+
+      histname = "fSparseHistClusters" + fHistogramNameSuffix;
+      const Int_t scsize = 11;
+      //                            pid     ch    mass     et     pt   eta   et_t   pt_t  eta_t  cent   dist
+      Int_t scbinsHist[scsize]   = {  1001,    7, 200000, 10000, 10000,  100, 10000, 10000,  100,   11,   4000};
+      Double_t scminHist[scsize] = {-500.5, -3.5,    0.0,   0.0,   0.0, -1.5,   0.0,   0.0, -1.5, -0.5, -200.0};
+      Double_t scmaxHist[scsize] = { 499.5,  3.5,  200.0, 100.0, 100.0,  1.5, 100.0, 100.0,  1.5, 10.5,  200.0};
+      fSparseClusters = new Double_t[scsize];
+      fSparseHistClusters = new THnSparseF(histname.Data(), "pid:charge:mass:et:pt:rap:et_track:pt_track:eta_track:cent:dist_matched", scsize, scbinsHist, scminHist, scmaxHist);
     
-    fSparseHistClusters->GetAxis(0)->SetTitle("pid");
-    fSparseHistClusters->GetAxis(1)->SetTitle("charge");
-    fSparseHistClusters->GetAxis(2)->SetTitle("mass");
-    fSparseHistClusters->GetAxis(3)->SetTitle("et");
-    fSparseHistClusters->GetAxis(4)->SetTitle("pt");
-    fSparseHistClusters->GetAxis(5)->SetTitle("rap");
-    fSparseHistClusters->GetAxis(6)->SetTitle("et_track");
-    fSparseHistClusters->GetAxis(7)->SetTitle("pt_track");
-    fSparseHistClusters->GetAxis(8)->SetTitle("rap_track");
-    fSparseHistClusters->GetAxis(9)->SetTitle("cent");
-    fSparseHistClusters->GetAxis(10)->SetTitle("dist_matched");
-
-    histname = "fSparseHistEt" + fHistogramNameSuffix;
-    const Int_t etsize = 7;
-    Int_t etbinsHist[etsize]   = { 10000, 10000,  10000,   3000,   500,   30000,   11};
-    Double_t etminHist[etsize] = {   0.0,   0.0,    0.0,   -0.5,  -0.5,    -0.5, -0.5};
-    Double_t etmaxHist[etsize] = { 200.0, 200.0,  200.0, 2999.5, 499.5,  2999.5, 10.5};
-    fSparseEt = new Double_t[etsize];
-    fSparseHistEt = new THnSparseD(histname.Data(), "tot_et:neutral_et:charged_et:tot_mult:neutral_mult:charged_mult:cent", etsize, etbinsHist, etminHist, etmaxHist);
+      fSparseHistClusters->GetAxis(0)->SetTitle("pid");
+      fSparseHistClusters->GetAxis(1)->SetTitle("charge");
+      fSparseHistClusters->GetAxis(2)->SetTitle("mass");
+      fSparseHistClusters->GetAxis(3)->SetTitle("et");
+      fSparseHistClusters->GetAxis(4)->SetTitle("pt");
+      fSparseHistClusters->GetAxis(5)->SetTitle("rap");
+      fSparseHistClusters->GetAxis(6)->SetTitle("et_track");
+      fSparseHistClusters->GetAxis(7)->SetTitle("pt_track");
+      fSparseHistClusters->GetAxis(8)->SetTitle("rap_track");
+      fSparseHistClusters->GetAxis(9)->SetTitle("cent");
+      fSparseHistClusters->GetAxis(10)->SetTitle("dist_matched");
+
+      histname = "fSparseHistEt" + fHistogramNameSuffix;
+      const Int_t etsize = 7;
+      Int_t etbinsHist[etsize]   = { 10000, 10000,  10000,   3000,   500,   30000,   11};
+      Double_t etminHist[etsize] = {   0.0,   0.0,    0.0,   -0.5,  -0.5,    -0.5, -0.5};
+      Double_t etmaxHist[etsize] = { 200.0, 200.0,  200.0, 2999.5, 499.5,  2999.5, 10.5};
+      fSparseEt = new Double_t[etsize];
+      fSparseHistEt = new THnSparseF(histname.Data(), "tot_et:neutral_et:charged_et:tot_mult:neutral_mult:charged_mult:cent", etsize, etbinsHist, etminHist, etmaxHist);
     
-    fSparseHistEt->GetAxis(0)->SetTitle("tot_et");
-    fSparseHistEt->GetAxis(1)->SetTitle("neutral_et");
-    fSparseHistEt->GetAxis(2)->SetTitle("charged_et");
-    fSparseHistEt->GetAxis(3)->SetTitle("tot_mult");
-    fSparseHistEt->GetAxis(4)->SetTitle("netral_mult");
-    fSparseHistEt->GetAxis(5)->SetTitle("charged_mult");
-    fSparseHistEt->GetAxis(6)->SetTitle("cent");
-  
+      fSparseHistEt->GetAxis(0)->SetTitle("tot_et");
+      fSparseHistEt->GetAxis(1)->SetTitle("neutral_et");
+      fSparseHistEt->GetAxis(2)->SetTitle("charged_et");
+      fSparseHistEt->GetAxis(3)->SetTitle("tot_mult");
+      fSparseHistEt->GetAxis(4)->SetTitle("netral_mult");
+      fSparseHistEt->GetAxis(5)->SetTitle("charged_mult");
+      fSparseHistEt->GetAxis(6)->SetTitle("cent");
+    }
 }
 
 TH2F* AliAnalysisEt::CreateEtaEHisto2D(TString name, TString title, TString ztitle)
@@ -511,7 +514,7 @@ TH2F* AliAnalysisEt::CreateResPtHisto2D(TString name, TString title, TString zti
        return histo; 
 }
 
-THnSparseD* AliAnalysisEt::CreateClusterHistoSparse(TString name, TString title)
+THnSparseF* AliAnalysisEt::CreateClusterHistoSparse(TString name, TString title)
 {     //creates a 2D sparse histogram
        TString histoname   = name + fHistogramNameSuffix;
        
@@ -519,7 +522,7 @@ THnSparseD* AliAnalysisEt::CreateClusterHistoSparse(TString name, TString title)
        Double_t min[4] = {0.,-1.,70.,0.5};
        Double_t max[4] = {50.,1.,190,20.5};
        
-       THnSparseD *histo = new THnSparseD(histoname.Data(),title.Data(),4,nBins,min, max);
+       THnSparseF *histo = new THnSparseF(histoname.Data(),title.Data(),4,nBins,min, max);
     histo->GetAxis(0)->SetTitle("E");
     histo->GetAxis(1)->SetTitle("#eta_{cluster}");
     histo->GetAxis(2)->SetTitle("#phi_{cluster}");
@@ -529,7 +532,7 @@ THnSparseD* AliAnalysisEt::CreateClusterHistoSparse(TString name, TString title)
        return histo; 
 }
 
-THnSparseD* AliAnalysisEt::CreateNeutralPartHistoSparse(TString name, TString title)
+THnSparseF* AliAnalysisEt::CreateNeutralPartHistoSparse(TString name, TString title)
 {     //creates a sparse neutral particle histogram
        TString histoname   = name + fHistogramNameSuffix;
        
@@ -537,7 +540,7 @@ THnSparseD* AliAnalysisEt::CreateNeutralPartHistoSparse(TString name, TString ti
        Double_t min[6] = {-1.,0.,0.,-1.,70.,0.5};
        Double_t max[6] = {1.,50.,50.,1.,190,20.5};
        
-       THnSparseD *histo = new THnSparseD(histoname.Data(),title.Data(),6,nBins,min, max);
+       THnSparseF *histo = new THnSparseF(histoname.Data(),title.Data(),6,nBins,min, max);
     histo->GetAxis(0)->SetTitle("#eta");
     histo->GetAxis(1)->SetTitle("p_{T}");
     histo->GetAxis(2)->SetTitle("E");
@@ -549,7 +552,7 @@ THnSparseD* AliAnalysisEt::CreateNeutralPartHistoSparse(TString name, TString ti
        return histo; 
 }
 
-THnSparseD* AliAnalysisEt::CreateChargedPartHistoSparse(TString name, TString title)
+THnSparseF* AliAnalysisEt::CreateChargedPartHistoSparse(TString name, TString title)
 {     //creates a sparse charged particle histogram
        TString histoname   = name + fHistogramNameSuffix;
        
@@ -557,7 +560,7 @@ THnSparseD* AliAnalysisEt::CreateChargedPartHistoSparse(TString name, TString ti
        Double_t min[7] = {-1.,0.,0.,-1.,70.,0.5,0.};
        Double_t max[7] = {1.,50.,50.,1.,190,20.5,0.1};
        
-       THnSparseD *histo = new THnSparseD(histoname.Data(),title.Data(),7,nBins,min, max);
+       THnSparseF *histo = new THnSparseF(histoname.Data(),title.Data(),7,nBins,min, max);
     histo->GetAxis(0)->SetTitle("#eta");
     histo->GetAxis(1)->SetTitle("p_{T}");
     histo->GetAxis(2)->SetTitle("E");
index 5fb5a85..81efbc5 100644 (file)
@@ -55,9 +55,9 @@ public:
        TH2F* CreateEtaEtHisto2D(TString name, TString title, TString ztitle);
        TH2F* CreateResEHisto2D(TString name, TString title, TString ztitle);
        TH2F* CreateResPtHisto2D(TString name, TString title, TString ztitle);
-    THnSparseD* CreateClusterHistoSparse(TString name, TString title);
-    THnSparseD* CreateNeutralPartHistoSparse(TString name, TString title);
-    THnSparseD* CreateChargedPartHistoSparse(TString name, TString title);
+    THnSparseF* CreateClusterHistoSparse(TString name, TString title);
+    THnSparseF* CreateNeutralPartHistoSparse(TString name, TString title);
+    THnSparseF* CreateChargedPartHistoSparse(TString name, TString title);
        
     /** Fills the histograms, must be overloaded if you want to add your own */
     virtual void FillHistograms();
@@ -97,6 +97,8 @@ public:
     /** Get contribution from removed gammas */
     virtual Double_t GetGammaContribution(Int_t /*clusterMultiplicity*/) {return 0;}
 
+    void MakeSparseHistograms(){fMakeSparse=kTRUE;}
+
 protected:
 
     //AliAnalysisEtCuts *fCuts; // keeper of basic cuts
@@ -244,13 +246,15 @@ protected:
     AliCentrality *fCentrality; //Centrality object
     
     Short_t fDetector;     /** Which detector? (-1 -> PHOS, 1 -> EMCAL)*/
+
+    Bool_t fMakeSparse;//Boolean for whether or not to make sparse histograms
     
-    THnSparseD *fSparseHistTracks;     /** THnSparse histograms */
+    THnSparseF *fSparseHistTracks;     /** THnSparse histograms */
     
-    THnSparseD *fSparseHistClusters;     /** THnSparse histograms */
+    THnSparseF *fSparseHistClusters;     /** THnSparse histograms */
     
     /** ET sparse valuses */
-    THnSparseD *fSparseHistEt; //!
+    THnSparseF *fSparseHistEt; //!
        
     /** Values for sparse hists */
     Double_t *fSparseTracks; //!
index 250dd64..5908840 100644 (file)
@@ -41,11 +41,10 @@ ClassImp(AliAnalysisTaskTotEt)
     AliAnalysisTaskTransverseEnergy(name, isMc)
     ,fRecAnalysis(0)
     ,fMCAnalysis(0)
-    ,fSparseHistRecVsMc(0)
-    ,fSparseRecVsMc(0)
+                                           // ,fSparseHistRecVsMc(0)
+                                           //,fSparseRecVsMc(0)
 {
   // Constructor
-       
   // select if we should use EMCal or PHOS class
   // PHOS by default, EMCal if name string contains EMC
   TString t(name);
@@ -104,8 +103,8 @@ AliAnalysisTaskTotEt::~AliAnalysisTaskTotEt() {//Destructor
   //    fOutputList->Clear();
   delete fRecAnalysis;
   delete fMCAnalysis;
-  delete fSparseHistRecVsMc;
-  delete fSparseRecVsMc;
+  //delete fSparseHistRecVsMc;
+  //delete fSparseRecVsMc;
 }
 
 //________________________________________________________________________
@@ -176,7 +175,7 @@ void AliAnalysisTaskTotEt::UserCreateOutputObjects()
   else {
     Printf("Error: no track cuts!");
   }
-       
+
 }
 
 //________________________________________________________________________
index 456c0d4..64aab39 100644 (file)
@@ -36,8 +36,8 @@ private:
   AliAnalysisEtReconstructed *fRecAnalysis; // Rec \r
   AliAnalysisEtMonteCarlo *fMCAnalysis; // MC\r
   \r
-  THnSparseD *fSparseHistRecVsMc; // Hist Rec vs Mc\r
-  Double_t *fSparseRecVsMc; // Rec vs Mc\r
+  //THnSparseD *fSparseHistRecVsMc; // Hist Rec vs Mc\r
+  //Double_t *fSparseRecVsMc; // Rec vs Mc\r
   \r
   ClassDef(AliAnalysisTaskTotEt, 2) \r
 };\r