3 #include "AlidNdEtaAnalysisESDSelector.h"
12 #include <AliESDVertex.h>
15 #include "esdTrackCuts/AliESDtrackCuts.h"
16 #include "dNdEtaAnalysis.h"
18 ClassImp(AlidNdEtaAnalysisESDSelector)
20 AlidNdEtaAnalysisESDSelector::AlidNdEtaAnalysisESDSelector() :
21 AlidNdEtaAnalysisSelector(),
25 // Constructor. Initialization of pointers
29 AlidNdEtaAnalysisESDSelector::~AlidNdEtaAnalysisESDSelector()
35 // histograms are in the output list and deleted when the output
36 // list is deleted by the TSelector dtor
39 void AlidNdEtaAnalysisESDSelector::SlaveBegin(TTree * tree)
41 // The SlaveBegin() function is called after the Begin() function.
42 // When running with PROOF SlaveBegin() is called on each slave server.
43 // The tree argument is deprecated (on PROOF 0 is passed).
45 AlidNdEtaAnalysisSelector::SlaveBegin(tree);
49 fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fChain->GetUserInfo()->FindObject("AliESDtrackCuts"));
53 AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from user info.");
56 Bool_t AlidNdEtaAnalysisESDSelector::Process(Long64_t entry)
58 // The Process() function is called for each entry in the tree (or possibly
59 // keyed object in the case of PROOF) to be processed. The entry argument
60 // specifies which entry in the currently loaded tree is to be processed.
61 // It can be passed to either TTree::GetEntry() or TBranch::GetEntry()
62 // to read either all or the required parts of the data. When processing
63 // keyed objects with PROOF, the object is already loaded and is available
64 // via the fObject pointer.
66 // This function should contain the "body" of the analysis. It can contain
67 // simple or elaborate selection criteria, run algorithms on the data
68 // of the event and typically fill histograms.
70 // WARNING when a selector is used with a TChain, you must use
71 // the pointer to the current TTree to call GetEntry(entry).
72 // The entry is always the local entry number in the current tree.
73 // Assuming that fChain is the pointer to the TChain being processed,
74 // use fChain->GetTree()->GetEntry(entry).
76 if (AlidNdEtaAnalysisSelector::Process(entry) == kFALSE)
79 // Check prerequisites
82 AliDebug(AliLog::kError, "ESD branch not available");
88 AliDebug(AliLog::kError, "fESDTrackCuts not available");
92 // ########################################################
94 const AliESDVertex* vtxESD = fESD->GetVertex();
96 // the vertex should be reconstructed
97 if (strcmp(vtxESD->GetName(),"default")==0)
101 vtx_res[0] = vtxESD->GetXRes();
102 vtx_res[1] = vtxESD->GetYRes();
103 vtx_res[2] = vtxESD->GetZRes();
105 // the resolution should be reasonable???
106 if (vtx_res[2]==0 || vtx_res[2]>0.1)
112 // ########################################################
113 // loop over esd tracks
114 Int_t nTracks = fESD->GetNumberOfTracks();
115 for (Int_t t=0; t<nTracks; t++)
117 AliESDtrack* esdTrack = fESD->GetTrack(t);
120 AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", t));
124 // cut the esd track?
125 if (!fEsdTrackCuts->AcceptTrack(esdTrack))
129 esdTrack->GetConstrainedPxPyPz(p); // ### TODO or GetInnerPxPyPy / GetOuterPxPyPy
132 Float_t theta = vector.Theta();
133 Float_t eta = -TMath::Log(TMath::Tan(theta/2.));
135 fdNdEtaAnalysis->FillTrack(vtx[2], eta);
137 } // end of track loop
139 // for event count per vertex
140 fdNdEtaAnalysis->FillEvent(vtx[2]);
145 void AlidNdEtaAnalysisESDSelector::WriteObjects()
147 AlidNdEtaAnalysisSelector::WriteObjects();
150 fEsdTrackCuts->SaveHistograms("esd_tracks_cuts");