adding support for AliESDEvent in AliESDtrackCuts
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Nov 2007 17:18:44 +0000 (17:18 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Nov 2007 17:18:44 +0000 (17:18 +0000)
adding task that applies track cuts and create the contained standard distributions

PWG0/esdTrackCuts/AliCutTask.cxx [new file with mode: 0644]
PWG0/esdTrackCuts/AliCutTask.h [new file with mode: 0644]
PWG0/esdTrackCuts/AliESDtrackCuts.cxx
PWG0/esdTrackCuts/AliESDtrackCuts.h
PWG0/esdTrackCuts/AliTestESDtrackCutsSelector.cxx
PWG0/esdTrackCuts/AliTestESDtrackCutsSelector.h
PWG0/esdTrackCuts/CreateCuts.C [new file with mode: 0644]
PWG0/esdTrackCuts/run.C [new file with mode: 0644]
PWG0/esdTrackCuts/testESDtrackCuts.C

diff --git a/PWG0/esdTrackCuts/AliCutTask.cxx b/PWG0/esdTrackCuts/AliCutTask.cxx
new file mode 100644 (file)
index 0000000..2c1a121
--- /dev/null
@@ -0,0 +1,140 @@
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TCanvas.h"
+#include "TList.h"
+#include "TFile.h"
+
+#include "esdTrackCuts/AliESDtrackCuts.h"
+#include "AliPWG0Helper.h"
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliESDVertex.h"
+
+#include "AliCutTask.h"
+
+// simple task that runs the esd track cuts to evaluate the basic plots created during the cuts
+
+ClassImp(AliCutTask)
+
+//________________________________________________________________________
+AliCutTask::AliCutTask(const char *name) 
+  : AliAnalysisTask(name, ""), fESD(0), fTrackCuts(0), fVertex(0), fOutput(0)
+{
+  // Constructor
+
+  // Define input and output slots here
+  DefineInput(0, TChain::Class());
+  DefineOutput(0, TList::Class());
+}
+
+//________________________________________________________________________
+void AliCutTask::ConnectInputData(Option_t *) 
+{
+  // Connect ESD or AOD here
+  // Called once
+
+  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
+  if (!tree) {
+    Printf("ERROR: Could not read chain from input slot 0");
+  } else {
+    // Disable all branches and enable only the needed ones
+    //tree->SetBranchStatus("*", kFALSE);
+
+    tree->SetBranchStatus("fTracks.*", kTRUE);
+    tree->SetBranchStatus("Tracks.*", kTRUE);
+
+    tree->SetBranchStatus("fTriggerMask", kTRUE);
+    tree->SetBranchStatus("AliESDHeader", kTRUE);
+
+    tree->SetBranchStatus("fSPDVertex*", kTRUE);
+    tree->SetBranchStatus("SPDVertex", kTRUE);
+    //tree->SetBranchStatus("fPosition[3]", kTRUE);
+
+    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+
+    if (!esdH) {
+      Printf("ERROR: Could not get ESDInputHandler");
+    } else
+      fESD = esdH->GetEvent();
+  }
+}
+
+//________________________________________________________________________
+void AliCutTask::CreateOutputObjects()
+{
+  // Create histograms
+  // Called once
+
+  fOutput = new TList;
+  fOutput->SetOwner();
+
+  fOutput->Add(fTrackCuts);
+
+  fVertex = new TH1F("fVertex", "fVertex;z vtx (cm);Count", 201, -20, 20);
+  fOutput->Add(fVertex);
+}
+
+//________________________________________________________________________
+void AliCutTask::Exec(Option_t *) 
+{
+  // Main loop
+  // Called for each event
+
+  if (!fESD) {
+    Printf("ERROR: fESD not available");
+    return;
+  }
+
+  // Post output data.
+  PostData(0, fOutput);
+
+  if (!AliPWG0Helper::IsVertexReconstructed(fESD->GetVertex()))
+    return;
+
+  Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
+  fTrackCuts->CountAcceptedTracks(fESD);
+
+  // get the ESD vertex
+  fVertex->Fill(fESD->GetVertex()->GetZv());
+}
+
+//________________________________________________________________________
+void AliCutTask::Terminate(Option_t *) 
+{
+  // Draw result to the screen
+  // Called once at the end of the query
+
+  fOutput = dynamic_cast<TList*> (GetOutputData(0));
+  if (!fOutput) {
+    Printf("ERROR: fOutput not available");
+    return;
+  }
+
+  fTrackCuts = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("AliESDtrackCuts"));
+  if (!fTrackCuts) {
+    Printf("ERROR: fTrackCuts not available");
+    return;
+  }
+
+  fVertex = dynamic_cast<TH1F*> (fOutput->FindObject("fVertex"));
+  if (!fVertex) {
+    Printf("ERROR: fVertex not available");
+    return;
+  }
+
+  TFile* file = TFile::Open("trackCuts.root", "RECREATE");
+
+  fTrackCuts->SaveHistograms();
+  fVertex->Write();
+
+  file->Close();
+
+       fTrackCuts->DrawHistograms();
+
+  new TCanvas;
+  fVertex->Draw();
+}
diff --git a/PWG0/esdTrackCuts/AliCutTask.h b/PWG0/esdTrackCuts/AliCutTask.h
new file mode 100644 (file)
index 0000000..3d9b27b
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef AliCutTask_cxx
+#define AliCutTask_cxx
+
+// simple task that runs the esd track cuts to evaluate the basic plots created during the cuts
+
+class TH1F;
+class AliESDtrackCuts;
+class AliESDEvent;
+class TList;
+
+#include "AliAnalysisTask.h"
+
+class AliCutTask : public AliAnalysisTask {
+ public:
+  AliCutTask(const char *name = "AliCutTask");
+  virtual ~AliCutTask() {}
+  
+  virtual void   ConnectInputData(Option_t *);
+  virtual void   CreateOutputObjects();
+  virtual void   Exec(Option_t *option);
+  virtual void   Terminate(Option_t *);
+
+  void SetTrackCuts(AliESDtrackCuts* cuts) { fTrackCuts = cuts; }
+  
+ private:
+  AliESDEvent *fESD;           //! ESD object
+  AliESDtrackCuts* fTrackCuts; // track cuts
+
+  TH1F* fVertex;   //! event z vertex distribution
+
+  TList* fOutput;                  //! list send on output slot 0
+
+  AliCutTask(const AliCutTask&); // not implemented
+  AliCutTask& operator=(const AliCutTask&); // not implemented
+  
+  ClassDef(AliCutTask, 1); // example of analysis
+};
+
+#endif
index 9b4e8b1..b0fa627 100644 (file)
@@ -17,9 +17,9 @@
 
 #include "AliESDtrackCuts.h"
 
-
 #include <AliESDtrack.h>
 #include <AliESD.h>
+#include <AliESDEvent.h>
 #include <AliLog.h>
 
 #include <TTree.h>
@@ -55,49 +55,7 @@ const Char_t* AliESDtrackCuts::fgkCutNames[kNCuts] = {
 };
 
 //____________________________________________________________________
-AliESDtrackCuts::AliESDtrackCuts() : AliAnalysisCuts(),
-  fCutMinNClusterTPC(0),
-  fCutMinNClusterITS(0),
-  fCutMaxChi2PerClusterTPC(0),
-  fCutMaxChi2PerClusterITS(0),
-  fCutMaxC11(0),
-  fCutMaxC22(0),
-  fCutMaxC33(0),
-  fCutMaxC44(0),
-  fCutMaxC55(0),
-  fCutAcceptKinkDaughters(0),
-  fCutRequireTPCRefit(0),
-  fCutRequireITSRefit(0),
-  fCutNsigmaToVertex(0),
-  fCutSigmaToVertexRequired(0),
-  fPMin(0),
-  fPMax(0),
-  fPtMin(0),
-  fPtMax(0),
-  fPxMin(0),
-  fPxMax(0),
-  fPyMin(0),
-  fPyMax(0),
-  fPzMin(0),
-  fPzMax(0),
-  fEtaMin(0),
-  fEtaMax(0),
-  fRapMin(0),
-  fRapMax(0),
-  fHistogramsOn(0),
-  ffDTheoretical(0),                                
-  fhCutStatistics(0),         
-  fhCutCorrelation(0)
-{
-  //
-  // default constructor
-  //
-
-  Init();
-}
-
-//____________________________________________________________________
-AliESDtrackCuts::AliESDtrackCuts(Char_t* name, Char_t* title) : AliAnalysisCuts(name,title),
+AliESDtrackCuts::AliESDtrackCuts(const Char_t* name, const Char_t* title) : AliAnalysisCuts(name,title),
   fCutMinNClusterTPC(0),
   fCutMinNClusterITS(0),
   fCutMaxChi2PerClusterTPC(0),
@@ -637,7 +595,7 @@ AliESDtrackCuts::AcceptTrack(AliESDtrack* esdTrack) {
     cuts[9]=kTRUE;  
   if (extCov[14]  > fCutMaxC55) 
     cuts[10]=kTRUE;  
-  if (nSigmaToVertex > fCutNsigmaToVertex)
+  if (nSigmaToVertex > fCutNsigmaToVertex && fCutSigmaToVertexRequired)
     cuts[11] = kTRUE;
   // if n sigma could not be calculated
   if (nSigmaToVertex<0 && fCutSigmaToVertexRequired)
@@ -766,8 +724,47 @@ AliESDtrackCuts::AcceptTrack(AliESDtrack* esdTrack) {
 }
 
 //____________________________________________________________________
-TObjArray*
-AliESDtrackCuts::GetAcceptedTracks(AliESD* esd)
+TObjArray* AliESDtrackCuts::GetAcceptedTracks(AliESD* esd)
+{
+  //
+  // returns an array of all tracks that pass the cuts
+  //
+
+  TObjArray* acceptedTracks = new TObjArray();
+
+  // loop over esd tracks
+  for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) {
+    AliESDtrack* track = esd->GetTrack(iTrack);
+
+    if (AcceptTrack(track))
+      acceptedTracks->Add(track);
+  }
+
+  return acceptedTracks;
+}
+
+//____________________________________________________________________
+Int_t AliESDtrackCuts::CountAcceptedTracks(AliESD* esd)
+{
+  //
+  // returns an the number of tracks that pass the cuts
+  //
+
+  Int_t count = 0;
+
+  // loop over esd tracks
+  for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) {
+    AliESDtrack* track = esd->GetTrack(iTrack);
+
+    if (AcceptTrack(track))
+      count++;
+  }
+
+  return count;
+}
+
+//____________________________________________________________________
+TObjArray* AliESDtrackCuts::GetAcceptedTracks(AliESDEvent* esd)
 {
   //
   // returns an array of all tracks that pass the cuts
@@ -787,8 +784,7 @@ AliESDtrackCuts::GetAcceptedTracks(AliESD* esd)
 }
 
 //____________________________________________________________________
-Int_t
-AliESDtrackCuts::CountAcceptedTracks(AliESD* esd)
+Int_t AliESDtrackCuts::CountAcceptedTracks(AliESDEvent* esd)
 {
   //
   // returns an the number of tracks that pass the cuts
index bf2c89f..8d40eb8 100644 (file)
 #include "AliAnalysisCuts.h"
 
 class AliESD;
+class AliESDEvent;
 class AliESDtrack;
 class AliLog;
 class TTree;
 
-class AliESDtrackCuts : public AliAnalysisCuts 
+class AliESDtrackCuts : public AliAnalysisCuts
 {
-
 public:
-  AliESDtrackCuts();
-  AliESDtrackCuts(Char_t* name, Char_t* title="");
+  AliESDtrackCuts(const Char_t* name = "AliESDtrackCuts", const Char_t* title = "");
   virtual ~AliESDtrackCuts();
   Bool_t IsSelected(TObject* obj)
        {return AcceptTrack((AliESDtrack*)obj);}
   Bool_t AcceptTrack(AliESDtrack* esdTrack);
   TObjArray* GetAcceptedTracks(AliESD* esd);
   Int_t CountAcceptedTracks(AliESD* esd);
+  TObjArray* GetAcceptedTracks(AliESDEvent* esd);
+  Int_t CountAcceptedTracks(AliESDEvent* esd);
 
   virtual Long64_t Merge(TCollection* list);
   virtual void Copy(TObject &c) const;
@@ -66,7 +67,11 @@ public:
   void SetMinNsigmaToVertex(Float_t sigma=1e99)       {fCutNsigmaToVertex = sigma;}
   void SetRequireSigmaToVertex(Bool_t b=kTRUE )       {fCutSigmaToVertexRequired = b;}
 
-  // track kinmatic cut setters  
+  // getters
+  Float_t GetMinNsigmaToVertex()       { return fCutNsigmaToVertex;}
+  Bool_t GetRequireSigmaToVertex( )    { return fCutSigmaToVertexRequired;}
+
+  // track kinmatic cut setters
   void SetPRange(Float_t r1=0, Float_t r2=1e99)       {fPMin=r1;   fPMax=r2;}
   void SetPtRange(Float_t r1=0, Float_t r2=1e99)      {fPtMin=r1;  fPtMax=r2;}
   void SetPxRange(Float_t r1=-1e99, Float_t r2=1e99)  {fPxMin=r1;  fPxMax=r2;}
@@ -75,8 +80,6 @@ public:
   void SetEtaRange(Float_t r1=-1e99, Float_t r2=1e99) {fEtaMin=r1; fEtaMax=r2;}
   void SetRapRange(Float_t r1=-1e99, Float_t r2=1e99) {fRapMin=r1; fRapMax=r2;}
 
-  Float_t GetMinNsigmaToVertex() { return fCutNsigmaToVertex; } 
-
   //######################################################
   void SetHistogramsOn(Bool_t b=kFALSE) {fHistogramsOn = b;}
   void DefineHistograms(Int_t color=1);
index 5fae6de..f23f821 100644 (file)
@@ -11,6 +11,7 @@
 #include <TChain.h>
 #include <TFile.h>
 #include <TH1F.h>
+#include <TH3F.h>
 
 #include <TSelector.h>
 #include <TFile.h>
@@ -29,12 +30,16 @@ ClassImp(AliTestESDtrackCutsSelector)
 AliTestESDtrackCutsSelector::AliTestESDtrackCutsSelector() :
   AliSelectorRL(),
   fEsdTrackCutsAll(0),
+  fEsdTrackCutsNoVtx(0),
   fEsdTrackCutsPri(0),
   fEsdTrackCutsSec(0),
   fEsdTrackCutsPlusZ(0),
   fEsdTrackCutsMinusZ(0),
   fEsdTrackCutsPos(0),
-  fEsdTrackCutsNeg(0)
+  fEsdTrackCutsNeg(0),
+  fPIDAfterCutNoVtx(0),
+  fPIDAfterCutAll(0),
+  fVertex(0)
 {
   //
   // Constructor. Initialization of pointers
@@ -77,6 +82,9 @@ void AliTestESDtrackCutsSelector::ReadUserObjects(TTree* tree)
   if (!fEsdTrackCutsAll)
      AliDebug(AliLog::kError, "ERROR: Could not read fEsdTrackCutsAll from input list.");
 
+  fEsdTrackCutsNoVtx =    dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsNoVtx"));
+  fEsdTrackCutsNoVtx->SetRequireSigmaToVertex(kFALSE);
+
   fEsdTrackCutsPri =    dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsPri"));
   fEsdTrackCutsSec =    dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsSec"));
   fEsdTrackCutsPlusZ =  dynamic_cast<AliESDtrackCuts*> (fEsdTrackCutsAll->Clone("fEsdTrackCutsPlusZ"));
@@ -94,6 +102,11 @@ void AliTestESDtrackCutsSelector::SlaveBegin(TTree* tree)
   AliSelectorRL::SlaveBegin(tree);
 
   ReadUserObjects(tree);
+
+  fPIDAfterCutNoVtx = new TH1F("fPIDAfterCutNoVtx", "fPIDAfterCutNoVtx", 5001, -2500.5, 2500.5);
+  fPIDAfterCutAll   = new TH1F("fPIDAfterCutAll", "fPIDAfterCutAll", 5001, -2500.5, 2500.5);
+
+  fVertex = new TH3F("fVertex", "fVertex", 100, -10, 10, 100, -10, 10, 100, -10, 10);
 }
 
 void AliTestESDtrackCutsSelector::Init(TTree* tree)
@@ -172,7 +185,7 @@ Bool_t AliTestESDtrackCutsSelector::Process(Long64_t entry)
 
     AliESDtrack* esdTrack = fESD->GetTrack(t);
 
-    fEsdTrackCutsAll->AcceptTrack(esdTrack);
+    Bool_t passed = fEsdTrackCutsAll->AcceptTrack(esdTrack);
 
     // using the properties of the mc particle
     Int_t label = TMath::Abs(esdTrack->GetLabel());
@@ -189,7 +202,17 @@ Bool_t AliTestESDtrackCutsSelector::Process(Long64_t entry)
     if (label < nPrim)
       fEsdTrackCutsPri->AcceptTrack(esdTrack);
     else
+    {
       fEsdTrackCutsSec->AcceptTrack(esdTrack);
+      if (passed)
+      {
+        fPIDAfterCutAll->Fill(particle->GetPdgCode());
+        fVertex->Fill(particle->Vx(), particle->Vy(), particle->Vz());
+      }
+
+      if (fEsdTrackCutsNoVtx->AcceptTrack(esdTrack))
+        fPIDAfterCutNoVtx->Fill(particle->GetPdgCode());
+    }
 
     TParticlePDG* pdgPart = particle->GetPDG();
     if (pdgPart)
@@ -225,12 +248,16 @@ void AliTestESDtrackCutsSelector::SlaveTerminate()
   }
 
   fOutput->Add(fEsdTrackCutsAll);
+  fOutput->Add(fEsdTrackCutsNoVtx);
   fOutput->Add(fEsdTrackCutsPri);
   fOutput->Add(fEsdTrackCutsSec);
   fOutput->Add(fEsdTrackCutsPlusZ);
   fOutput->Add(fEsdTrackCutsMinusZ);
   fOutput->Add(fEsdTrackCutsPos);
   fOutput->Add(fEsdTrackCutsNeg);
+  fOutput->Add(fPIDAfterCutNoVtx);
+  fOutput->Add(fPIDAfterCutAll);
+  fOutput->Add(fVertex);
 }
 
 void AliTestESDtrackCutsSelector::Terminate()
@@ -242,12 +269,16 @@ void AliTestESDtrackCutsSelector::Terminate()
   AliSelectorRL::Terminate();
 
   fEsdTrackCutsAll = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("esdTrackCutsAll"));
+  fEsdTrackCutsNoVtx = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCutsNoVtx"));
   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"));
+  fPIDAfterCutNoVtx = dynamic_cast<TH1F*> (fOutput->FindObject("fPIDAfterCutNoVtx"));
+  fPIDAfterCutAll = dynamic_cast<TH1F*> (fOutput->FindObject("fPIDAfterCutAll"));
+  fVertex = dynamic_cast<TH3F*> (fOutput->FindObject("fVertex"));
 
   // check if the esd track cut objects are there
   if (!fEsdTrackCutsAll || !fEsdTrackCutsPri || !fEsdTrackCutsSec || !fEsdTrackCutsPlusZ || !fEsdTrackCutsMinusZ || !fEsdTrackCutsPos || !fEsdTrackCutsNeg) {
@@ -258,12 +289,16 @@ void AliTestESDtrackCutsSelector::Terminate()
   TFile* file = TFile::Open("trackCuts.root", "RECREATE");
 
   fEsdTrackCutsAll->SaveHistograms();
+  fEsdTrackCutsNoVtx->SaveHistograms();
   fEsdTrackCutsPri->SaveHistograms();
   fEsdTrackCutsSec->SaveHistograms();
   fEsdTrackCutsPlusZ->SaveHistograms();
   fEsdTrackCutsMinusZ->SaveHistograms();
   fEsdTrackCutsPos->SaveHistograms();
   fEsdTrackCutsNeg->SaveHistograms();
+  fPIDAfterCutNoVtx->Write();
+  fPIDAfterCutAll->Write();
+  fVertex->Write();
 
   file->Close();
 
index 6aa71c6..53b93b0 100644 (file)
@@ -6,6 +6,8 @@
 #include "AliSelectorRL.h"
 
 class AliESDtrackCuts;
+class TH1F;
+class TH3F;
 
 class AliTestESDtrackCutsSelector : public AliSelectorRL {
   public:
@@ -23,6 +25,7 @@ class AliTestESDtrackCutsSelector : public AliSelectorRL {
     void ReadUserObjects(TTree* tree);
 
     AliESDtrackCuts*  fEsdTrackCutsAll;  // esd track cuts for all tracks   
+    AliESDtrackCuts*  fEsdTrackCutsNoVtx;  // all cuts except vtx
 
     AliESDtrackCuts*  fEsdTrackCutsPri;  // cuts for tracks from primary particles
     AliESDtrackCuts*  fEsdTrackCutsSec;  // cuts for tracks from secondary particles
@@ -31,6 +34,12 @@ class AliTestESDtrackCutsSelector : public AliSelectorRL {
     AliESDtrackCuts*  fEsdTrackCutsPos;  // cuts for tracks from positive particles
     AliESDtrackCuts*  fEsdTrackCutsNeg;  // cuts for tracks from negative particles
 
+    TH1F*             fPIDAfterCutNoVtx;      // true PID of tracks that passed all cuts except vtx
+    TH1F*             fPIDAfterCutAll;        // true PID of tracks that passed all cuts incl. vtx
+
+    TH3F*             fVertex;                // originating vertex of specific particles
+
+
  private:
     AliTestESDtrackCutsSelector(const AliTestESDtrackCutsSelector&);
     AliTestESDtrackCutsSelector& operator=(const AliTestESDtrackCutsSelector&);
diff --git a/PWG0/esdTrackCuts/CreateCuts.C b/PWG0/esdTrackCuts/CreateCuts.C
new file mode 100644 (file)
index 0000000..e0e4435
--- /dev/null
@@ -0,0 +1,22 @@
+/* $Id$ */
+
+// this macro creates the track and event cuts used in this analysis
+
+AliESDtrackCuts* CreateTrackCuts(Bool_t hists = kTRUE)
+{
+  AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
+
+  if (hists)
+    esdTrackCuts->DefineHistograms(1);
+
+  esdTrackCuts->SetMinNClustersTPC(50);
+  esdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
+  esdTrackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
+  esdTrackCuts->SetRequireTPCRefit(kTRUE);
+
+  esdTrackCuts->SetMinNsigmaToVertex(3);
+  esdTrackCuts->SetRequireSigmaToVertex(kTRUE);
+  esdTrackCuts->SetAcceptKingDaughters(kFALSE);
+
+  return esdTrackCuts;
+}
diff --git a/PWG0/esdTrackCuts/run.C b/PWG0/esdTrackCuts/run.C
new file mode 100644 (file)
index 0000000..1891c2e
--- /dev/null
@@ -0,0 +1,79 @@
+void run(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, const char* option = "")
+{
+  if (aProof)
+  {
+    TProof::Open("lxb6046");
+
+    // Enable the needed package
+    gProof->UploadPackage("STEERBase");
+    gProof->EnablePackage("STEERBase");
+    gProof->UploadPackage("ESD");
+    gProof->EnablePackage("ESD");
+    gProof->UploadPackage("ANALYSIS");
+    gProof->EnablePackage("ANALYSIS");
+    gProof->UploadPackage("PWG0base");
+    gProof->EnablePackage("PWG0base");
+
+    //gProof->AddInput(new TNamed("PROOF_Packetizer", "TPacketizer"));
+  }
+  else
+  {
+    gSystem->Load("libVMC");
+    gSystem->Load("libTree");
+    gSystem->Load("libSTEERBase");
+    gSystem->Load("libESD");
+    gSystem->Load("libANALYSIS");
+    gSystem->Load("libPWG0base");
+  }
+
+  // Create chain of input files
+  gROOT->LoadMacro("../CreateESDChain.C");
+  chain = CreateESDChain(data, nRuns, offset);
+
+  // Create the analysis manager
+  mgr = new AliAnalysisManager("testAnalysis");
+
+  // selection of esd tracks
+  gROOT->ProcessLine(".L CreateCuts.C");
+  AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
+  if (!esdTrackCuts)
+  {
+    printf("ERROR: esdTrackCuts could not be created\n");
+    return;
+  }
+
+  TString taskName("AliCutTask.cxx+");
+  if (aDebug)
+    taskName += "+g";
+
+  // Create, add task
+  if (aProof) {
+    gProof->Load(taskName);
+  } else
+    gROOT->Macro(taskName);
+
+  task = new AliCutTask;
+  task->SetTrackCuts(esdTrackCuts);
+  mgr->AddTask(task);
+
+  // Add ESD handler
+  AliESDInputHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);
+
+  // Attach input
+  cInput  = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
+  mgr->ConnectInput(task, 0, cInput);
+
+  // Attach output
+  cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
+  mgr->ConnectOutput(task, 0, cOutput);
+
+  // Enable debug printouts
+  if (aDebug)
+    mgr->SetDebugLevel(2);
+
+  // Run analysis
+  mgr->InitAnalysis();
+  mgr->PrintStatus();
+  mgr->StartAnalysis((aProof) ? "proof" : "local", chain);
+}
index 847cae3..9ee1fa1 100644 (file)
@@ -7,7 +7,7 @@
 #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, Char_t* proofServer = "jgrosseo@lxb6046")
+TChain* testESDtrackCuts(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, Char_t* proofServer = "lxb6046")
 {
   if (aProof)
     connectProof(proofServer);
@@ -38,7 +38,7 @@ TChain* testESDtrackCuts(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aD
   TString selectorName = "AliTestESDtrackCutsSelector";
   AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
 
-  selectorName += ".cxx+";
+  selectorName += ".cxx++";
 
   if (aDebug != kFALSE)
     selectorName += "g";