Adding draw and Print function to AliESDtrackCuts
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Mar 2007 08:49:05 +0000 (08:49 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Mar 2007 08:49:05 +0000 (08:49 +0000)
Allowing analysis of tracks that have positive, negative charge; pos, neg z; primary, secondary in the selector

PWG0/esdTrackCuts/AliESDtrackCuts.cxx
PWG0/esdTrackCuts/AliESDtrackCuts.h
PWG0/esdTrackCuts/AliTestESDtrackCutsSelector.cxx
PWG0/esdTrackCuts/AliTestESDtrackCutsSelector.h
PWG0/esdTrackCuts/testESDtrackCuts.C

index b76fcba..b9f8f64 100644 (file)
@@ -21,7 +21,9 @@
 #include <AliESDtrack.h>
 #include <AliESD.h>
 #include <AliLog.h>
+
 #include <TTree.h>
+#include <TCanvas.h>
 #include <TDirectory.h>
 
 //____________________________________________________________________
@@ -236,13 +238,13 @@ AliESDtrackCuts::~AliESDtrackCuts()
     if (fhDXYNormalized[i])
       delete fhDXYNormalized[i];           
     if (fhDZNormalized[i])
-      delete fhDZNormalized[i];            
+      delete fhDZNormalized[i];
     if (fhDXYvsDZNormalized[i])
       delete fhDXYvsDZNormalized[i];       
     if (fhNSigmaToVertex[i])
       delete fhNSigmaToVertex[i];
   }
-  
+
   if (ffDTheoretical)
     delete ffDTheoretical;
 
@@ -460,7 +462,7 @@ Long64_t AliESDtrackCuts::Merge(TCollection* list) {
       fhDXYvsDZ[i]           ->Add(entry->fhDXYvsDZ[i]          ); 
                                                                    
       fhDXYNormalized[i]     ->Add(entry->fhDXYNormalized[i]    ); 
-      fhDZNormalized[i]      ->Add(entry->fhDZNormalized[i]     ); 
+      fhDZNormalized[i]      ->Add(entry->fhDZNormalized[i]     );
       fhDXYvsDZNormalized[i] ->Add(entry->fhDXYvsDZNormalized[i]); 
       fhNSigmaToVertex[i]    ->Add(entry->fhNSigmaToVertex[i]); 
 
@@ -812,7 +814,10 @@ AliESDtrackCuts::CountAcceptedTracks(AliESD* esd)
    // 
 
    fHistogramsOn=kTRUE;
-
+   
+   Bool_t oldStatus = TH1::AddDirectoryStatus();
+   TH1::AddDirectory(kFALSE);
+   
    //###################################################################################
    // defining histograms
 
@@ -839,48 +844,48 @@ AliESDtrackCuts::CountAcceptedTracks(AliESD* esd)
     if (i==0) sprintf(str," ");
     else sprintf(str,"_cut");
 
-    fhNClustersITS[i]        = new TH1F(Form("nClustersITS%s",str),"",8,-0.5,7.5);
-    fhNClustersTPC[i]        = new TH1F(Form("nClustersTPC%s",str),"",165,-0.5,164.5);
+    fhNClustersITS[i]        = new TH1F(Form("nClustersITS%s",str)     ,"",8,-0.5,7.5);
+    fhNClustersTPC[i]        = new TH1F(Form("nClustersTPC%s",str)     ,"",165,-0.5,164.5);
     fhChi2PerClusterITS[i]   = new TH1F(Form("chi2PerClusterITS%s",str),"",500,0,10);
     fhChi2PerClusterTPC[i]   = new TH1F(Form("chi2PerClusterTPC%s",str),"",500,0,10);
 
-    fhC11[i]                 = new TH1F(Form("covMatrixDiagonal11%s",str),"",2000,0,20);
+    fhC11[i]                 = new  TH1F(Form("covMatrixDiagonal11%s",str),"",2000,0,20);
     fhC22[i]                 = new  TH1F(Form("covMatrixDiagonal22%s",str),"",2000,0,20);
     fhC33[i]                 = new  TH1F(Form("covMatrixDiagonal33%s",str),"",1000,0,1);
     fhC44[i]                 = new  TH1F(Form("covMatrixDiagonal44%s",str),"",1000,0,5);
     fhC55[i]                 = new  TH1F(Form("covMatrixDiagonal55%s",str),"",1000,0,5);
 
-    fhDXY[i]                 = new  TH1F(Form("dXY%s",str),"",500,-10,10);
-    fhDZ[i]                  = new  TH1F(Form("dZ%s",str),"",500,-10,10);
+    fhDXY[i]                 = new  TH1F(Form("dXY%s",str)    ,"",500,-10,10);
+    fhDZ[i]                  = new  TH1F(Form("dZ%s",str)     ,"",500,-10,10);
     fhDXYvsDZ[i]             = new  TH2F(Form("dXYvsDZ%s",str),"",200,-10,10,200,-10,10);
 
-    fhDXYNormalized[i]       = new  TH1F(Form("dXYNormalized%s",str),"",500,-10,10);
-    fhDZNormalized[i]        = new  TH1F(Form("dZNormalized%s",str),"",500,-10,10);
+    fhDXYNormalized[i]       = new  TH1F(Form("dXYNormalized%s",str)    ,"",500,-10,10);
+    fhDZNormalized[i]        = new  TH1F(Form("dZNormalized%s",str)     ,"",500,-10,10);
     fhDXYvsDZNormalized[i]   = new  TH2F(Form("dXYvsDZNormalized%s",str),"",200,-10,10,200,-10,10);
 
     fhNSigmaToVertex[i]         = new  TH1F(Form("nSigmaToVertex%s",str),"",500,0,50);
 
-    fhNClustersITS[i]->SetXTitle("n ITS clusters");
-    fhNClustersTPC[i]->SetXTitle("n TPC clusters");
-    fhChi2PerClusterITS[i]->SetXTitle("#Chi^{2} per ITS cluster");
-    fhChi2PerClusterTPC[i]->SetXTitle("#Chi^{2} per TPC cluster");
+    fhNClustersITS[i]->SetTitle("n ITS clusters");
+    fhNClustersTPC[i]->SetTitle("n TPC clusters");
+    fhChi2PerClusterITS[i]->SetTitle("#Chi^{2} per ITS cluster");
+    fhChi2PerClusterTPC[i]->SetTitle("#Chi^{2} per TPC cluster");
 
-    fhC11[i]->SetXTitle("cov 11 : #sigma_{y}^{2} [cm^{2}]");
-    fhC22[i]->SetXTitle("cov 22 : #sigma_{z}^{2} [cm^{2}]");
-    fhC33[i]->SetXTitle("cov 33 : #sigma_{sin(#phi)}^{2}");
-    fhC44[i]->SetXTitle("cov 44 : #sigma_{tan(#theta_{dip})}^{2}");
-    fhC55[i]->SetXTitle("cov 55 : #sigma_{1/p_{T}}^{2} [(c/GeV)^2]");
+    fhC11[i]->SetTitle("cov 11 : #sigma_{y}^{2} [cm^{2}]");
+    fhC22[i]->SetTitle("cov 22 : #sigma_{z}^{2} [cm^{2}]");
+    fhC33[i]->SetTitle("cov 33 : #sigma_{sin(#phi)}^{2}");
+    fhC44[i]->SetTitle("cov 44 : #sigma_{tan(#theta_{dip})}^{2}");
+    fhC55[i]->SetTitle("cov 55 : #sigma_{1/p_{T}}^{2} [(c/GeV)^2]");
 
-    fhDXY[i]->SetXTitle("transverse impact parameter");
-    fhDZ[i]->SetXTitle("longitudinal impact parameter");
-    fhDXYvsDZ[i]->SetXTitle("longitudinal impact parameter");
+    fhDXY[i]->SetTitle("transverse impact parameter");
+    fhDZ[i]->SetTitle("longitudinal impact parameter");
+    fhDXYvsDZ[i]->SetTitle("longitudinal impact parameter");
     fhDXYvsDZ[i]->SetYTitle("transverse impact parameter");
 
-    fhDXYNormalized[i]->SetXTitle("normalized trans impact par");
-    fhDZNormalized[i]->SetXTitle("normalized long impact par");
-    fhDXYvsDZNormalized[i]->SetXTitle("normalized long impact par"); 
+    fhDXYNormalized[i]->SetTitle("normalized trans impact par");
+    fhDZNormalized[i]->SetTitle("normalized long impact par");
+    fhDXYvsDZNormalized[i]->SetTitle("normalized long impact par");
     fhDXYvsDZNormalized[i]->SetYTitle("normalized trans impact par");
-    fhNSigmaToVertex[i]->SetXTitle("n #sigma to vertex");
+    fhNSigmaToVertex[i]->SetTitle("n #sigma to vertex");
 
     fhNClustersITS[i]->SetLineColor(color);   fhNClustersITS[i]->SetLineWidth(2);
     fhNClustersTPC[i]->SetLineColor(color);   fhNClustersTPC[i]->SetLineWidth(2);
@@ -904,33 +909,108 @@ AliESDtrackCuts::CountAcceptedTracks(AliESD* esd)
   // The number of sigmas to the vertex is per definition gaussian
   ffDTheoretical = new TF1("nSigmaToVertexTheoretical","([0]/2.506628274)*exp(-(x**2)/2)",0,50);
   ffDTheoretical->SetParameter(0,1);
+  
+  TH1::AddDirectory(oldStatus);
 }
 
-
-
 //____________________________________________________________________
-void 
-AliESDtrackCuts::Print(const Option_t*) const {
+Bool_t AliESDtrackCuts::LoadHistograms(const Char_t* dir)
+{
   //
-  // print method - still to be implemented
+  // loads the histograms from a file
+  // if dir is empty a directory with the name of this object is taken (like in SaveHistogram)
   //
 
-  AliInfo("AliESDtrackCuts...");
-}
+  if (!dir)
+    dir = GetName();
+
+  if (!gDirectory->cd(dir))
+    return kFALSE;
+
+  ffDTheoretical = dynamic_cast<TF1*> (gDirectory->Get("nSigmaToVertexTheory"));
+
+  fhCutStatistics = dynamic_cast<TH1F*> (gDirectory->Get("cut_statistics"));
+  fhCutCorrelation = dynamic_cast<TH2F*> (gDirectory->Get("cut_correlation"));
+
+  Char_t str[5];
+  for (Int_t i=0; i<2; i++) {
+    if (i==0)
+    {
+      gDirectory->cd("before_cuts");
+      str[0] = 0;
+    }
+    else
+    {
+      gDirectory->cd("after_cuts");
+      sprintf(str,"_cut");
+    }
+
+    fhNClustersITS[i]      = dynamic_cast<TH1F*> (gDirectory->Get(Form("nClustersITS%s",str)     ));
+    fhNClustersTPC[i]      = dynamic_cast<TH1F*> (gDirectory->Get(Form("nClustersTPC%s",str)     ));
+    fhChi2PerClusterITS[i] = dynamic_cast<TH1F*> (gDirectory->Get(Form("chi2PerClusterITS%s",str)));
+    fhChi2PerClusterTPC[i] = dynamic_cast<TH1F*> (gDirectory->Get(Form("chi2PerClusterTPC%s",str)));
+
+    fhC11[i] = dynamic_cast<TH1F*> (gDirectory->Get(Form("covMatrixDiagonal11%s",str)));
+    fhC22[i] = dynamic_cast<TH1F*> (gDirectory->Get(Form("covMatrixDiagonal22%s",str)));
+    fhC33[i] = dynamic_cast<TH1F*> (gDirectory->Get(Form("covMatrixDiagonal33%s",str)));
+    fhC44[i] = dynamic_cast<TH1F*> (gDirectory->Get(Form("covMatrixDiagonal44%s",str)));
+    fhC55[i] = dynamic_cast<TH1F*> (gDirectory->Get(Form("covMatrixDiagonal55%s",str)));
+
+    fhDXY[i] =     dynamic_cast<TH1F*> (gDirectory->Get(Form("dXY%s",str)    ));
+    fhDZ[i] =      dynamic_cast<TH1F*> (gDirectory->Get(Form("dZ%s",str)     ));
+    fhDXYvsDZ[i] = dynamic_cast<TH2F*> (gDirectory->Get(Form("dXYvsDZ%s",str)));
+
+    fhDXYNormalized[i] =     dynamic_cast<TH1F*> (gDirectory->Get(Form("dXYNormalized%s",str)    ));
+    fhDZNormalized[i] =      dynamic_cast<TH1F*> (gDirectory->Get(Form("dZNormalized%s",str)     ));
+    fhDXYvsDZNormalized[i] = dynamic_cast<TH2F*> (gDirectory->Get(Form("dXYvsDZNormalized%s",str)));
+
+    fhNSigmaToVertex[i] = dynamic_cast<TH1F*> (gDirectory->Get(Form("nSigmaToVertex%s",str)));
+
+    // TODO only temporary
+    /*fhNClustersITS[i]->SetTitle("n ITS clusters");
+    fhNClustersTPC[i]->SetTitle("n TPC clusters");
+    fhChi2PerClusterITS[i]->SetTitle("#Chi^{2} per ITS cluster");
+    fhChi2PerClusterTPC[i]->SetTitle("#Chi^{2} per TPC cluster");
+
+    fhC11[i]->SetTitle("cov 11 : #sigma_{y}^{2} [cm^{2}]");
+    fhC22[i]->SetTitle("cov 22 : #sigma_{z}^{2} [cm^{2}]");
+    fhC33[i]->SetTitle("cov 33 : #sigma_{sin(#phi)}^{2}");
+    fhC44[i]->SetTitle("cov 44 : #sigma_{tan(#theta_{dip})}^{2}");
+    fhC55[i]->SetTitle("cov 55 : #sigma_{1/p_{T}}^{2} [(c/GeV)^2]");
+
+    fhDXY[i]->SetTitle("transverse impact parameter");
+    fhDZ[i]->SetTitle("longitudinal impact parameter");
+    fhDXYvsDZ[i]->SetTitle("longitudinal impact parameter");
+    fhDXYvsDZ[i]->SetYTitle("transverse impact parameter");
 
+    fhDXYNormalized[i]->SetTitle("normalized trans impact par");
+    fhDZNormalized[i]->SetTitle("normalized long impact par");
+    fhDXYvsDZNormalized[i]->SetTitle("normalized long impact par");
+    fhDXYvsDZNormalized[i]->SetYTitle("normalized trans impact par");
+    fhNSigmaToVertex[i]->SetTitle("n #sigma to vertex");*/
+
+    gDirectory->cd("../");
+  }
+
+  gDirectory->cd("..");
+
+  return kTRUE;
+}
 
 //____________________________________________________________________
-void AliESDtrackCuts::SaveHistograms(Char_t* dir) {
-  // 
+void AliESDtrackCuts::SaveHistograms(const Char_t* dir) {
+  //
   // saves the histograms in a directory (dir)
-  // 
+  //
 
-  
   if (!fHistogramsOn) {
     AliDebug(0, "Histograms not on - cannot save histograms!!!");
     return;
   }
 
+  if (!dir)
+    dir = GetName();
+
   gDirectory->mkdir(dir);
   gDirectory->cd(dir);
 
@@ -949,12 +1029,12 @@ void AliESDtrackCuts::SaveHistograms(Char_t* dir) {
       gDirectory->cd("before_cuts");
     else
       gDirectory->cd("after_cuts");
-    
+
     fhNClustersITS[i]        ->Write();
     fhNClustersTPC[i]        ->Write();
     fhChi2PerClusterITS[i]   ->Write();
     fhChi2PerClusterTPC[i]   ->Write();
-    
+
     fhC11[i]                 ->Write();
     fhC22[i]                 ->Write();
     fhC33[i]                 ->Write();
@@ -964,7 +1044,7 @@ void AliESDtrackCuts::SaveHistograms(Char_t* dir) {
     fhDXY[i]                 ->Write();
     fhDZ[i]                  ->Write();
     fhDXYvsDZ[i]             ->Write();
-    
+
     fhDXYNormalized[i]       ->Write();
     fhDZNormalized[i]        ->Write();
     fhDXYvsDZNormalized[i]   ->Write();
@@ -976,5 +1056,132 @@ void AliESDtrackCuts::SaveHistograms(Char_t* dir) {
   gDirectory->cd("../");
 }
 
-
+//____________________________________________________________________
+void AliESDtrackCuts::DrawHistograms()
+{
+  // draws some histograms
+
+  TCanvas* canvas1 = new TCanvas(Form("%s_1", GetName()), "Track Quality Results1", 800, 800);
+  canvas1->Divide(2, 2);
+
+  canvas1->cd(1);
+  fhNClustersTPC[0]->SetStats(kFALSE);
+  fhNClustersTPC[0]->Draw();
+
+  canvas1->cd(2);
+  fhChi2PerClusterTPC[0]->SetStats(kFALSE);
+  fhChi2PerClusterTPC[0]->Draw();
+
+  canvas1->cd(3);
+  fhNSigmaToVertex[0]->SetStats(kFALSE);
+  fhNSigmaToVertex[0]->GetXaxis()->SetRangeUser(0, 10);
+  fhNSigmaToVertex[0]->Draw();
+
+  canvas1->SaveAs(Form("%s_%s.gif", GetName(), canvas1->GetName()));
+
+  TCanvas* canvas2 = new TCanvas(Form("%s_2", GetName()), "Track Quality Results2", 1200, 800);
+  canvas2->Divide(3, 2);
+
+  canvas2->cd(1);
+  fhC11[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhC11[0]->Draw();
+
+  canvas2->cd(2);
+  fhC22[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhC22[0]->Draw();
+
+  canvas2->cd(3);
+  fhC33[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhC33[0]->Draw();
+
+  canvas2->cd(4);
+  fhC44[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhC44[0]->Draw();
+
+  canvas2->cd(5);
+  fhC55[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhC55[0]->Draw();
+
+  canvas2->SaveAs(Form("%s_%s.gif", GetName(), canvas2->GetName()));
+
+  TCanvas* canvas3 = new TCanvas(Form("%s_3", GetName()), "Track Quality Results3", 1200, 800);
+  canvas3->Divide(3, 2);
+
+  canvas3->cd(1);
+  fhDXY[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhDXY[0]->Draw();
+
+  canvas3->cd(2);
+  fhDZ[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhDZ[0]->Draw();
+
+  canvas3->cd(3);
+  fhDXYvsDZ[0]->SetStats(kFALSE);
+  gPad->SetLogz();
+  gPad->SetRightMargin(0.15);
+  fhDXYvsDZ[0]->Draw("COLZ");
+
+  canvas3->cd(4);
+  fhDXYNormalized[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhDXYNormalized[0]->Draw();
+
+  canvas3->cd(5);
+  fhDZNormalized[0]->SetStats(kFALSE);
+  gPad->SetLogy();
+  fhDZNormalized[0]->Draw();
+
+  canvas3->cd(6);
+  fhDXYvsDZNormalized[0]->SetStats(kFALSE);
+  gPad->SetLogz();
+  gPad->SetRightMargin(0.15);
+  fhDXYvsDZNormalized[0]->Draw("COLZ");
+
+  canvas3->SaveAs(Form("%s_%s.gif", GetName(), canvas3->GetName()));
+
+  TCanvas* canvas4 = new TCanvas(Form("%s_4", GetName()), "Track Quality Results4", 800, 500);
+  canvas4->Divide(2, 1);
+
+  canvas4->cd(1);
+  fhCutStatistics->SetStats(kFALSE);
+  fhCutStatistics->LabelsOption("v");
+  gPad->SetBottomMargin(0.3);
+  fhCutStatistics->Draw();
+
+  canvas4->cd(2);
+  fhCutCorrelation->SetStats(kFALSE);
+  fhCutCorrelation->LabelsOption("v");
+  gPad->SetBottomMargin(0.3);
+  gPad->SetLeftMargin(0.3);
+  fhCutCorrelation->Draw("COLZ");
+
+  canvas4->SaveAs(Form("%s_%s.gif", GetName(), canvas4->GetName()));
+
+  /*canvas->cd(1);
+  fhDXYvsDZNormalized[0]->SetStats(kFALSE);
+  fhDXYvsDZNormalized[0]->DrawCopy("COLZ");
+
+  canvas->cd(2);
+  fhNClustersTPC[0]->SetStats(kFALSE);
+  fhNClustersTPC[0]->DrawCopy();
+
+  canvas->cd(3);
+  fhChi2PerClusterITS[0]->SetStats(kFALSE);
+  fhChi2PerClusterITS[0]->DrawCopy();
+  fhChi2PerClusterITS[1]->SetLineColor(2);
+  fhChi2PerClusterITS[1]->DrawCopy("SAME");
+
+  canvas->cd(4);
+  fhChi2PerClusterTPC[0]->SetStats(kFALSE);
+  fhChi2PerClusterTPC[0]->DrawCopy();
+  fhChi2PerClusterTPC[1]->SetLineColor(2);
+  fhChi2PerClusterTPC[1]->DrawCopy("SAME");*/
+}
 
index 5415400..991e8d9 100644 (file)
@@ -79,17 +79,19 @@ public:
   //######################################################
   void SetHistogramsOn(Bool_t b=kFALSE) {fHistogramsOn = b;}
   void DefineHistograms(Int_t color=1);
-  void SaveHistograms(Char_t* dir="track_selection");
+  virtual Bool_t LoadHistograms(const Char_t* dir = 0);
+  void SaveHistograms(const Char_t* dir = 0);
+  void DrawHistograms();
 
   Float_t GetSigmaToVertex(AliESDtrack* esdTrack);
   
-  virtual void Print(const Option_t* = "") const;
-
   static void EnableNeededBranches(TTree* tree);
 
   // void SaveQualityCuts(Char_t* file)
   // void LoadQualityCuts(Char_t* file)
 
+       TH1* GetDZNormalized(Int_t i) const { return fhDZNormalized[i]; }
+
 protected:
   void Init(); // sets everything to 0
 
@@ -100,7 +102,7 @@ protected:
   static const Char_t* fgkCutNames[kNCuts]; //! names of cuts (for internal use)
 
   Int_t   fCutMinNClusterTPC;         // min number of tpc clusters
-  Int_t   fCutMinNClusterITS;         // min number of its clusters  
+  Int_t   fCutMinNClusterITS;         // min number of its clusters
 
   Float_t fCutMaxChi2PerClusterTPC;   // max tpc fit chi2 per tpc cluster
   Float_t fCutMaxChi2PerClusterITS;   // max its fit chi2 per its cluster
@@ -114,7 +116,7 @@ protected:
   Bool_t  fCutAcceptKinkDaughters;    // accepting kink daughters?
   Bool_t  fCutRequireTPCRefit;        // require TPC refit
   Bool_t  fCutRequireITSRefit;        // require ITS refit
-  
+
   // track to vertex cut
   Float_t fCutNsigmaToVertex;         // max number of estimated sigma from track-to-vertex
   Bool_t  fCutSigmaToVertexRequired;  // cut track if sigma from track-to-vertex could not be calculated
@@ -151,7 +153,7 @@ protected:
   TH1F* fhDXYNormalized[2];           //->
   TH1F* fhDZNormalized[2];            //->
   TH2F* fhDXYvsDZNormalized[2];       //->
-  TH1F* fhNSigmaToVertex[2];          //->  
+  TH1F* fhNSigmaToVertex[2];          //->
 
   TF1*  ffDTheoretical;               //-> theoretical distance to vertex normalized (2d gauss)
 
index 211a872..5fae6de 100644 (file)
@@ -30,7 +30,11 @@ AliTestESDtrackCutsSelector::AliTestESDtrackCutsSelector() :
   AliSelectorRL(),
   fEsdTrackCutsAll(0),
   fEsdTrackCutsPri(0),
-  fEsdTrackCutsSec(0)
+  fEsdTrackCutsSec(0),
+  fEsdTrackCutsPlusZ(0),
+  fEsdTrackCutsMinusZ(0),
+  fEsdTrackCutsPos(0),
+  fEsdTrackCutsNeg(0)
 {
   //
   // Constructor. Initialization of pointers
@@ -60,22 +64,25 @@ void AliTestESDtrackCutsSelector::ReadUserObjects(TTree* tree)
 {
   // read the user objects, called from slavebegin and begin
 
+  // only do it once
+  if (fEsdTrackCutsAll)
+    return;
+
   if (!fEsdTrackCutsAll && fInput)
     fEsdTrackCutsAll = dynamic_cast<AliESDtrackCuts*> (fInput->FindObject("esdTrackCutsAll")->Clone());
-  if (!fEsdTrackCutsPri && fInput)
-    fEsdTrackCutsPri = dynamic_cast<AliESDtrackCuts*> (fInput->FindObject("esdTrackCutsPri")->Clone());
-  if (!fEsdTrackCutsSec && fInput)
-    fEsdTrackCutsSec = dynamic_cast<AliESDtrackCuts*> (fInput->FindObject("esdTrackCutsSec")->Clone());
 
   if (!fEsdTrackCutsAll && tree)
     fEsdTrackCutsAll = dynamic_cast<AliESDtrackCuts*> (tree->GetUserInfo()->FindObject("esdTrackCutsAll"));
-  if (!fEsdTrackCutsPri && tree)
-    fEsdTrackCutsPri = dynamic_cast<AliESDtrackCuts*> (tree->GetUserInfo()->FindObject("esdTrackCutsPri"));
-  if (!fEsdTrackCutsSec && tree)
-    fEsdTrackCutsSec = dynamic_cast<AliESDtrackCuts*> (tree->GetUserInfo()->FindObject("esdTrackCutsSec"));
 
-  if (!fEsdTrackCutsAll || !fEsdTrackCutsPri || !fEsdTrackCutsSec)
-     AliDebug(AliLog::kError, "ERROR: Could not read esdTrackCutsXXX from input list.");
+  if (!fEsdTrackCutsAll)
+     AliDebug(AliLog::kError, "ERROR: Could not read fEsdTrackCutsAll from input list.");
+
+  fEsdTrackCutsPri =    dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsPri"));
+  fEsdTrackCutsSec =    dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsSec"));
+  fEsdTrackCutsPlusZ =  dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsPlusZ"));
+  fEsdTrackCutsMinusZ = dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsMinusZ"));
+  fEsdTrackCutsPos =    dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsPos"));
+  fEsdTrackCutsNeg =    dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsNeg"));
 }
 
 void AliTestESDtrackCutsSelector::SlaveBegin(TTree* tree)
@@ -89,6 +96,24 @@ void AliTestESDtrackCutsSelector::SlaveBegin(TTree* tree)
   ReadUserObjects(tree);
 }
 
+void AliTestESDtrackCutsSelector::Init(TTree* tree)
+{
+  // read the user objects
+
+  AliSelectorRL::Init(tree);
+
+  // Enable only the needed branches
+  if (tree)
+  {
+    tree->SetBranchStatus("*", 0);
+    tree->SetBranchStatus("fTriggerMask", 1);
+    tree->SetBranchStatus("fSPDVertex*", 1);
+    tree->SetBranchStatus("fTracks.fLabel", 1);
+
+    AliESDtrackCuts::EnableNeededBranches(tree);
+  }
+}
+
 Bool_t AliTestESDtrackCutsSelector::Process(Long64_t entry)
 {
   // The Process() function is called for each entry in the tree (or possibly
@@ -116,7 +141,7 @@ Bool_t AliTestESDtrackCutsSelector::Process(Long64_t entry)
   if (!fESD) {
     AliDebug(AliLog::kError, "ESD branch not available");
     return kFALSE;
-  }  
+  }
 
   if (!AliPWG0Helper::IsVertexReconstructed(fESD)) {
     AliDebug(AliLog::kDebug+5, "Vertex is not reconstructed");
@@ -124,7 +149,7 @@ Bool_t AliTestESDtrackCutsSelector::Process(Long64_t entry)
   }
 
   // check if the esd track cut objects are there
-  if (!fEsdTrackCutsAll || !fEsdTrackCutsPri || !fEsdTrackCutsSec) {
+  if (!fEsdTrackCutsAll || !fEsdTrackCutsPri || !fEsdTrackCutsSec || !fEsdTrackCutsPlusZ || !fEsdTrackCutsMinusZ || !fEsdTrackCutsPos || !fEsdTrackCutsNeg) {
     AliDebug(AliLog::kError, "fEsdTrackCutsXXX not available");
     return kFALSE;
   }
@@ -165,6 +190,20 @@ Bool_t AliTestESDtrackCutsSelector::Process(Long64_t entry)
       fEsdTrackCutsPri->AcceptTrack(esdTrack);
     else
       fEsdTrackCutsSec->AcceptTrack(esdTrack);
+
+    TParticlePDG* pdgPart = particle->GetPDG();
+    if (pdgPart)
+    {
+      if (pdgPart->Charge() > 0)
+        fEsdTrackCutsPos->AcceptTrack(esdTrack);
+      else if (pdgPart->Charge() < 0)
+        fEsdTrackCutsNeg->AcceptTrack(esdTrack);
+    }
+
+    if (particle->Eta() < 0)
+      fEsdTrackCutsPlusZ->AcceptTrack(esdTrack);
+    else
+      fEsdTrackCutsMinusZ->AcceptTrack(esdTrack);
   }
   
   return kTRUE;
@@ -188,6 +227,10 @@ void AliTestESDtrackCutsSelector::SlaveTerminate()
   fOutput->Add(fEsdTrackCutsAll);
   fOutput->Add(fEsdTrackCutsPri);
   fOutput->Add(fEsdTrackCutsSec);
+  fOutput->Add(fEsdTrackCutsPlusZ);
+  fOutput->Add(fEsdTrackCutsMinusZ);
+  fOutput->Add(fEsdTrackCutsPos);
+  fOutput->Add(fEsdTrackCutsNeg);
 }
 
 void AliTestESDtrackCutsSelector::Terminate()
@@ -198,23 +241,31 @@ void AliTestESDtrackCutsSelector::Terminate()
 
   AliSelectorRL::Terminate();
 
-  if (fOutput)
-    fOutput->Print();
-
   fEsdTrackCutsAll = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("esdTrackCutsAll"));
-  fEsdTrackCutsPri = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("esdTrackCutsPri"));
-  fEsdTrackCutsSec = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("esdTrackCutsSec"));
+  fEsdTrackCutsPri = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCutsPri"));
+  fEsdTrackCutsSec = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCutsSec"));
+  fEsdTrackCutsPlusZ = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCutsPlusZ"));
+  fEsdTrackCutsMinusZ = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCutsMinusZ"));
+  fEsdTrackCutsPos = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCutsPos"));
+  fEsdTrackCutsNeg = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCutsNeg"));
 
   // check if the esd track cut objects are there
-  if (!fEsdTrackCutsAll || !fEsdTrackCutsPri || !fEsdTrackCutsSec) {
-    AliDebug(AliLog::kError, Form("fEsdTrackCutsXXX not available %p %p %p", fEsdTrackCutsAll, fEsdTrackCutsPri, fEsdTrackCutsSec));
+  if (!fEsdTrackCutsAll || !fEsdTrackCutsPri || !fEsdTrackCutsSec || !fEsdTrackCutsPlusZ || !fEsdTrackCutsMinusZ || !fEsdTrackCutsPos || !fEsdTrackCutsNeg) {
+    AliDebug(AliLog::kError, Form("fEsdTrackCutsXXX not available %p %p %p %p %p %p %p", fEsdTrackCutsAll, fEsdTrackCutsPri, fEsdTrackCutsSec, fEsdTrackCutsPlusZ, fEsdTrackCutsMinusZ, fEsdTrackCutsPos, fEsdTrackCutsNeg));
     return;
   }
 
   TFile* file = TFile::Open("trackCuts.root", "RECREATE");
-  fEsdTrackCutsAll->SaveHistograms("esdTrackCutsAll");
-  fEsdTrackCutsPri->SaveHistograms("esdTrackCutsPri");
-  fEsdTrackCutsSec->SaveHistograms("esdTrackCutsSec");
+
+  fEsdTrackCutsAll->SaveHistograms();
+  fEsdTrackCutsPri->SaveHistograms();
+  fEsdTrackCutsSec->SaveHistograms();
+  fEsdTrackCutsPlusZ->SaveHistograms();
+  fEsdTrackCutsMinusZ->SaveHistograms();
+  fEsdTrackCutsPos->SaveHistograms();
+  fEsdTrackCutsNeg->SaveHistograms();
 
   file->Close();
+
+       fEsdTrackCutsAll->DrawHistograms();
 }
index 230a7c0..6aa71c6 100644 (file)
@@ -14,6 +14,7 @@ class AliTestESDtrackCutsSelector : public AliSelectorRL {
 
     virtual void    Begin(TTree* tree);
     virtual void    SlaveBegin(TTree *tree);
+    virtual void    Init(TTree *tree);
     virtual Bool_t  Process(Long64_t entry);
     virtual void    SlaveTerminate();
     virtual void    Terminate();
@@ -22,8 +23,13 @@ class AliTestESDtrackCutsSelector : public AliSelectorRL {
     void ReadUserObjects(TTree* tree);
 
     AliESDtrackCuts*  fEsdTrackCutsAll;  // esd track cuts for all tracks   
-    AliESDtrackCuts*  fEsdTrackCutsPri;  // cuts for tracks from primary particles 
-    AliESDtrackCuts*  fEsdTrackCutsSec;  // cuts for tracks from secondary particles 
+
+    AliESDtrackCuts*  fEsdTrackCutsPri;  // cuts for tracks from primary particles
+    AliESDtrackCuts*  fEsdTrackCutsSec;  // cuts for tracks from secondary particles
+    AliESDtrackCuts*  fEsdTrackCutsPlusZ;  // cuts for tracks that go to z > 0
+    AliESDtrackCuts*  fEsdTrackCutsMinusZ;  // cuts for tracks that go to z < 0
+    AliESDtrackCuts*  fEsdTrackCutsPos;  // cuts for tracks from positive particles
+    AliESDtrackCuts*  fEsdTrackCutsNeg;  // cuts for tracks from negative particles
 
  private:
     AliTestESDtrackCutsSelector(const AliTestESDtrackCutsSelector&);
index 1ac7034..847cae3 100644 (file)
@@ -7,22 +7,19 @@
 #include "../CreateESDChain.C"
 #include "../PWG0Helper.C"
 
-TChain* testESDtrackCuts(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE)
+TChain* testESDtrackCuts(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, Char_t* proofServer = "jgrosseo@lxb6046")
 {
   if (aProof)
-    connectProof("proof01@lxb6046");
+    connectProof(proofServer);
 
-  TString libraries("libEG;libGeom;libESD;libPWG0base;libVMC;libMinuit;libSTEER;libPWG0dep;libEVGEN;libFASTSIM;libmicrocern;libpdf;libpythia6;lib
-EGPythia6;libAliPythia6");
-  TString packages("PWG0base;PWG0dep");
+  TString libraries("libEG;libGeom;libESD;libPWG0base");
+  TString packages("PWG0base");
 
-  if (!prepareQuery(libraries, packages, kTRUE))
+  if (!prepareQuery(libraries, packages, 1))
     return;
 
   // selection of esd tracks
   AliESDtrackCuts* esdTrackCutsAll = new AliESDtrackCuts("esdTrackCutsAll");
-  AliESDtrackCuts* esdTrackCutsPri = new AliESDtrackCuts("esdTrackCutsPri");
-  AliESDtrackCuts* esdTrackCutsSec = new AliESDtrackCuts("esdTrackCutsSec");
 
   esdTrackCutsAll->DefineHistograms(1);
   esdTrackCutsAll->SetMinNClustersTPC(50);
@@ -33,29 +30,8 @@ EGPythia6;libAliPythia6");
   esdTrackCutsAll->SetRequireSigmaToVertex(kTRUE);
   esdTrackCutsAll->SetAcceptKingDaughters(kFALSE);
 
-  esdTrackCutsPri->DefineHistograms(4);
-  esdTrackCutsPri->SetMinNClustersTPC(50);
-  esdTrackCutsPri->SetMaxChi2PerClusterTPC(3.5);
-  esdTrackCutsPri->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
-  esdTrackCutsPri->SetRequireTPCRefit(kTRUE);
-  esdTrackCutsPri->SetMinNsigmaToVertex(3);
-  esdTrackCutsPri->SetRequireSigmaToVertex(kTRUE);
-  esdTrackCutsPri->SetAcceptKingDaughters(kFALSE);
-
-  esdTrackCutsSec->DefineHistograms(2);
-  esdTrackCutsSec->SetMinNClustersTPC(50);
-  esdTrackCutsSec->SetMaxChi2PerClusterTPC(3.5);
-  esdTrackCutsSec->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
-  esdTrackCutsSec->SetRequireTPCRefit(kTRUE);
-  esdTrackCutsSec->SetMinNsigmaToVertex(3);
-  esdTrackCutsSec->SetRequireSigmaToVertex(kTRUE);
-  esdTrackCutsSec->SetAcceptKingDaughters(kFALSE);
-
-
   TList inputList;
   inputList.Add(esdTrackCutsAll);
-  inputList.Add(esdTrackCutsPri);
-  inputList.Add(esdTrackCutsSec);
 
   TChain* chain = CreateESDChain(data, nRuns, offset);
 
@@ -76,3 +52,24 @@ EGPythia6;libAliPythia6");
   }
 }
 
+void draw(const char* dir, const char* fileName = "trackCuts.root")
+{
+  /*
+   draw("esdTrackCutsAll")
+   draw("fEsdTrackCutsPri")
+   draw("fEsdTrackCutsSec")
+   draw("fEsdTrackCutsPlusZ")
+   draw("fEsdTrackCutsMinusZ")
+   draw("fEsdTrackCutsPos")
+   draw("fEsdTrackCutsNeg")
+  */
+
+  gSystem->Load("libPWG0base");
+
+  TFile::Open(fileName);
+
+  AliESDtrackCuts* cuts = new AliESDtrackCuts(dir, dir);
+  cuts->LoadHistograms();
+
+  cuts->DrawHistograms();
+}