6 #include "AliESDEvent.h"
7 #include "AliESDInputHandler.h"
9 #include "AliMCEvent.h"
11 #include "AliESDtrackCuts.h"
13 #include "AliAnalysisNetParticleDCA.h"
17 // Task for NetParticle checks
18 // Author: Jochen Thaeder <jochen@thaeder.de>
20 ClassImp(AliAnalysisNetParticleDCA)
23 * ---------------------------------------------------------------------------------
24 * Constructor / Destructor
25 * ---------------------------------------------------------------------------------
28 //________________________________________________________________________
29 AliAnalysisNetParticleDCA::AliAnalysisNetParticleDCA() :
34 fESDTrackCutsBkg(NULL),
42 AliLog::SetClassDebugLevel("AliAnalysisNetParticleDCA",10);
45 //________________________________________________________________________
46 AliAnalysisNetParticleDCA::~AliAnalysisNetParticleDCA() {
54 * ---------------------------------------------------------------------------------
56 * ---------------------------------------------------------------------------------
59 //________________________________________________________________________
60 void AliAnalysisNetParticleDCA::Initialize(AliESDtrackCuts *cuts, AliESDtrackCuts *cutsBkg, AliAnalysisNetParticleHelper* helper) {
67 // -------------------
69 fESDTrackCutsBkg = cutsBkg;
72 // -- Get particle species / pdgCode
73 // -------------------------
74 fPdgCode = AliPID::ParticleCode(fHelper->GetParticleSpecies());
76 // -- MC Labels for efficiency
77 // -----------------------------
78 fLabelsRec = new Int_t*[2];
79 for (Int_t ii = 0; ii < 2 ; ++ii)
80 fLabelsRec[ii] = NULL;
82 // -- Create THnSparse Histograms
83 // --------------------------------
90 * ---------------------------------------------------------------------------------
91 * Setup/Reset Methods - private
92 * ---------------------------------------------------------------------------------
95 //________________________________________________________________________
96 Int_t AliAnalysisNetParticleDCA::SetupEvent(AliESDInputHandler *esdHandler, AliMCEvent *mcEvent) {
100 // -------------------
104 // -------------------
105 fESD = esdHandler->GetEvent();
108 fStack = fMCEvent->Stack();
110 fCentralityBin = centBin;
112 // -- Create label arrays
113 // ------------------------
114 fLabelsRec[0] = new Int_t[fNTracks];
116 AliError("Cannot create fLabelsRec[0]");
120 fLabelsRec[1] = new Int_t[fNTracks];
122 AliError("Cannot create fLabelsRec[1] for TPC");
126 for(Int_t ii = 0; ii < fNTracks; ++ii) {
127 fLabelsRec[0][ii] = 0;
128 fLabelsRec[1][ii] = 0;
134 //________________________________________________________________________
135 void AliAnalysisNetParticleDCA::ResetEvent() {
138 for (Int_t ii = 0; ii < 2 ; ++ii) {
140 delete[] fLabelsRec[ii];
141 fLabelsRec[ii] = NULL;
147 //________________________________________________________________________
148 void AliAnalysisNetParticleDCA::Process() {
151 // -- Setup (clean, create and fill) MC labels
152 // ---------------------------------------------
155 // -- Fill MC histograms for efficiency studies
156 // -----------------------------------------------
163 * ---------------------------------------------------------------------------------
165 * ---------------------------------------------------------------------------------
168 //________________________________________________________________________
169 void AliAnalysisNetParticleDCA::CreateHistograms() {
170 // -- Create histograms
172 Double_t dCent[2] = {-0.5, 8.5};
175 Double_t dEta[2] = {-0.9, 0.9};
176 Int_t iEta = Int_t((dEta[1]-dEta[0]) / 0.075) +1 ;
178 Double_t dRap[2] = {-0.5, 0.5};
179 Int_t iRap = Int_t((dRap[1]-dRap[0]) / 0.075) +1 ;
181 Double_t dPhi[2] = {0.0, TMath::TwoPi()};
184 Double_t dPt[2] = {0.1, 3.0};
185 Int_t iPt = Int_t((dPt[1]-dPt[0]) / 0.075);
187 Double_t dSign[2] = {-1.5, 1.5};
190 // ------------------------------------------------------------------
191 // -- Create THnSparseF - DCA
192 // ------------------------------------------------------------------
194 // cent: etaMC: yMC: phiMC: ptMC: sign:contPart:DCArAccepted:DCAr
195 Int_t binHnDCA[9] = { iCent, iEta, iRap, iPhi, iPt, iSign, 4, 2, 50 };
196 Double_t minHnDCA[9] = {dCent[0], dEta[0], dRap[0], dPhi[0], dPt[0], dSign[0], 0.5, -0.5, -10.};
197 Double_t maxHnDCA[9] = {dCent[1], dEta[1], dRap[1], dPhi[1], dPt[1], dSign[1], 4.5, 1.5, 10.};
198 fHnDCA = new THnSparseF("fHnDCA", "cent:etaMC:yMC:phiMC:ptMC:sign:contPart:contSign:DCArAccepted:DCAr", 9, binHnDCA, minHnDCA, maxHnDCA);
201 fHnDCA->GetAxis(0)->SetTitle("centrality"); // 0-5|5-10|10-20|20-30|30-40|40-50|50-60|60-70|70-80|80-90 --> 10 bins
202 fHnDCA->GetAxis(1)->SetTitle("#eta_{MC}"); // eta [-0.9,0.9]
203 fHnDCA->GetAxis(2)->SetTitle("#it{y}_{MC}"); // rapidity [-0.5, 0.5]
204 fHnDCA->GetAxis(3)->SetTitle("#varphi_{MC} (rad)"); // phi [ 0. ,2Pi]
205 fHnDCA->GetAxis(4)->SetTitle("#it{p}_{T,MC} (GeV/#it{c})"); // pT [ 0.1,1.3]
206 fHnDCA->GetAxis(5)->SetTitle("sign"); // -1 | 0 | +1
207 fHnDCA->GetAxis(6)->SetTitle("contPart"); // 1 primary | 2 missId | 3 from WeakDecay | 4 p from Material
208 fHnDCA->GetAxis(7)->SetTitle("DCArAccepted"); // 0 not accepted | 1 accepted
209 fHnDCA->GetAxis(8)->SetTitle("DCAr"); // DCAr [-10,10]
211 // ------------------------------------------------------------------
216 //________________________________________________________________________
217 void AliAnalysisNetParticleDCA::FillMCDCA() {
219 // Loop over ESD tracks and fill arrays with MC lables
220 // fLabelsRec[0] : all Tracks
221 // fLabelsRec[1] : all Tracks accepted by PID of TPC
222 // Check every accepted track if correctly identified
223 // otherwise check for contamination
225 for (Int_t idxTrack = 0; idxTrack < fNTracks; ++idxTrack) {
226 AliESDtrack *track = fESD->GetTrack(idxTrack);
228 // -- Check if track is accepted for basic parameters
229 if (!fHelper->IsTrackAcceptedBasicCharged(track))
232 // -- Check if accepted
233 if (!fESDTrackCuts->AcceptTrack(track))
236 // -- Check if accepted in rapidity window
238 if (!fHelper->IsTrackAcceptedRapidity(track, yP))
241 // -- Check if accepted with thighter DCA cuts
242 if (!fHelper->IsTrackAcceptedDCA(track))
245 Int_t label = TMath::Abs(track->GetLabel());
247 // -- Fill Label of all reconstructed
248 fLabelsRec[0][idxTrack] = label;
250 // -- Check if accepted by PID from TPC or TPC+TOF
252 if (!fHelper->IsTrackAcceptedPID(track, pid))
255 // -- Fill Label of all reconstructed && recPid_TPC+TOF
256 fLabelsRec[1][idxTrack] = label;
258 // -- Check for contamination and fill contamination THnSparse
259 CheckContTrack(label, track->GetSign(), idxTrack);
261 } // for (Int_t idxTrack = 0; idxTrack < fNTracks; ++idxTrack) {
266 //________________________________________________________________________
267 void AliAnalysisNetParticleDCA::CheckDCATrack(Int_t label, Float_t sign, Float_t isDCArAccepted, Float_t dcar) {
268 // Check if DCA of contamination or correctly identified
269 // Fill contamination DCA THnSparse
271 TParticle* particle = fStack->Particle(label);
275 Bool_t isSecondaryFromWeakDecay = kFALSE;
276 Bool_t isSecondaryFromMaterial = kFALSE;
280 // -- Check if correctly identified
281 if (particle->GetPdgCode() == (sign*fPdgCode)) {
283 // Check if is physical primary -> all ok
284 if (fStack->IsPhysicalPrimary(label))
286 // -- Check if secondaries from weak decay
287 else if(isSecondaryFromWeakDecay = fStack->IsSecondaryFromWeakDecay(label))
289 // -- Check if secondaries from material decay
290 else if (isSecondaryFromMaterial = fStack->IsSecondaryFromMaterial(label))
293 // -- MissIdentification
297 Double_t hnDCA[9] = {fCentralityBin, particle->Eta(), particle->Y(), particle->Phi(), particle->Pt(), sign, contPart, isDCArAccepted, dcar};
298 fHnDCA->Fill(hnContDCA);