2 // Class AliRsnAnalysisEffSE
7 // authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
8 // Martin Vala (martin.vala@cern.ch)
10 #include <Riostream.h>
12 #include "AliESDEvent.h"
13 #include "AliAODEvent.h"
14 #include "AliMCEvent.h"
16 #include "AliCFContainer.h"
17 #include "AliRsnCutManager.h"
18 #include "AliRsnValue.h"
19 #include "AliRsnAnalysisEffSE.h"
20 #include "AliRsnPairDef.h"
21 #include "AliRsnCutSet.h"
23 ClassImp(AliRsnAnalysisEffSE)
25 //_____________________________________________________________________________
26 AliRsnAnalysisEffSE::AliRsnAnalysisEffSE(const char *name) :
27 AliRsnVAnalysisTaskSE(name),
32 fAxisList("AliRsnValue", 0),
38 fEventCuts("eventCuts", AliRsnCut::kEvent)
41 // Default constructor.
44 AliDebug(AliLog::kDebug+2,"<-");
46 DefineOutput(2, TList::Class());
48 AliDebug(AliLog::kDebug+2,"->");
51 //_____________________________________________________________________________
52 AliRsnAnalysisEffSE::AliRsnAnalysisEffSE(const AliRsnAnalysisEffSE& copy) :
53 AliRsnVAnalysisTaskSE(copy),
54 fUseITSSA(copy.fUseITSSA),
55 fUseGlobal(copy.fUseGlobal),
56 fStepListMC(copy.fStepListMC),
57 fStepListESD(copy.fStepListESD),
58 fAxisList(copy.fAxisList),
59 fPairDefList(copy.fPairDefList),
60 fContainerList(copy.fContainerList),
64 fEventCuts(copy.fEventCuts)
71 //_____________________________________________________________________________
72 void AliRsnAnalysisEffSE::AddStepMC(AliRsnCutManager *mgr)
75 // Add a step on montecarlo
78 fStepListMC.AddLast(mgr);
81 //_____________________________________________________________________________
82 void AliRsnAnalysisEffSE::AddStepESD(AliRsnCutManager *mgr)
88 fStepListESD.AddLast(mgr);
91 //_____________________________________________________________________________
92 void AliRsnAnalysisEffSE::AddAxis(AliRsnValue *axis)
98 Int_t n = fAxisList.GetEntries();
99 new (fAxisList[n]) AliRsnValue(*axis);
102 //_____________________________________________________________________________
103 void AliRsnAnalysisEffSE::RsnUserCreateOutputObjects()
106 // Creation of output objects.
107 // These are created through the utility methods in the analysis manager,
108 // which produces a list of histograms for each specified set of pairs.
109 // Each of these lists is added to the main list of this task.
112 AliDebug(AliLog::kDebug+2,"<-");
114 // get number of steps and axes
116 Int_t nAxes = fAxisList.GetEntries();
117 Int_t nSteps = (Int_t)fStepListMC.GetEntries() + (Int_t)fStepListESD.GetEntries();
120 AliError("No steps defined");
124 AliError("No axes defined");
128 // initialize variable list
131 // retrieve number of bins for each axis
132 Int_t *nBins = new Int_t[nAxes];
133 for (iaxis = 0; iaxis < nAxes; iaxis++)
135 AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
136 nBins[iaxis] = fcnAxis->GetArray().GetSize() - 1;
139 // create ouput list of containers
140 fContainerList = new TList;
141 fContainerList->SetOwner();
142 fContainerList->SetName(Form("%s_containers", GetName()));
144 // initialize output list
146 fOutList = new TList();
147 fOutList->SetOwner();
149 // create the containers
150 Int_t i = 0, nDef = (Int_t)fPairDefList.GetEntries();
151 for (i = 0; i < nDef; i++)
153 AliRsnPairDef *def = (AliRsnPairDef*)fPairDefList[i];
154 AliCFContainer *cont = new AliCFContainer(Form("%s", def->GetPairName()), "", nSteps, nAxes, nBins);
155 // set the bin limits for each axis
156 for (iaxis = 0; iaxis < nAxes; iaxis++)
158 AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
159 cont->SetBinLimits(iaxis, fcnAxis->GetArray().GetArray());
161 // add the container to output list
162 fContainerList->Add(cont);
165 fOutList->Add(fContainerList);
168 PostData(2, fOutList);
173 AliDebug(AliLog::kDebug+2,"->");
176 //_____________________________________________________________________________
177 void AliRsnAnalysisEffSE::RsnUserExec(Option_t*)
180 // Execution of the analysis task.
181 // Recovers the input event and processes it with all included pair objects.
182 // In this case, we NEED to have ESD and MC, otherwise we cannod do anything.
186 for (Int_t i = 0; i <= AliPID::kSPECIES; i++)
188 cout << AliPID::ParticleName((AliPID::EParticleType)i) << ": " << endl;
189 for (Int_t m = 0; m < AliRsnDaughter::kMethods; m++)
191 cout << "-- method: " << AliRsnDaughter::MethodName((AliRsnDaughter::EPIDMethod)m) << endl;
192 Char_t sign[2] = {'+', '-'};
193 for (Int_t s = 0; s < 2; s++)
195 TArrayI *a = fRsnPIDIndex.GetTracksArray((AliRsnDaughter::EPIDMethod)m, sign[s], (AliPID::EParticleType)i);
196 Int_t n = a->GetSize();
197 for (Int_t j = 0; j < n; j++)
200 cout << "-- -- track " << Form("%4d ", k) << ": ";
201 fRsnEvent.SetDaughter(trk, k);
202 cout << "charge = " << (trk.IsPos() ? "+ " : (trk.IsNeg() ? "- " : "0 "));
203 cout << "truePID = " << Form("%10s ", AliPID::ParticleName(trk.PerfectPID()));
204 cout << "realPID = " << Form("%10s ", AliPID::ParticleName(trk.RealisticPID()));
206 cout << "-- -- -- weights (computed): ";
207 for (Int_t q = 0; q < AliPID::kSPECIES; q++)
208 cout << Form("%15.12f", trk.ComputedWeights()[q]) << ' ';
210 cout << "-- -- -- weights (original): ";
211 for (Int_t q = 0; q < AliPID::kSPECIES; q++)
212 cout << Form("%15.12f", trk.GetRef()->PID()[q]) << ' ';
220 AliDebug(AliLog::kDebug+2,"<-");
221 if (fMCOnly && fMCEvent)
223 fRsnEvent.SetRef (fMCEvent);
224 fRsnEvent.SetRefMC(fMCEvent);
228 fRsnEvent.SetRef (fESDEvent);
229 fRsnEvent.SetRefMC(fMCEvent);
231 else if (fAODEventOut)
233 fRsnEvent.SetRef (fAODEventOut);
234 fRsnEvent.SetRefMC(fAODEventOut);
236 else if (fAODEventIn)
238 fRsnEvent.SetRef (fAODEventIn);
239 fRsnEvent.SetRefMC(fAODEventIn);
242 AliError("NO ESD or AOD object!!! Skipping ...");
246 // if general event cuts are added to the task (recommended)
247 // they are checked here on the RSN event interface and,
248 // if the event does not pass them, it is skipped and ProcessInfo
249 // is updated accordingly
250 if (!fEventCuts.IsSelected(&fRsnEvent))
252 fTaskInfo.SetEventUsed(kFALSE);
256 // if cuts are passed or not cuts were defined,
257 // update the task info before processing the event
258 fTaskInfo.SetEventUsed(kTRUE);
260 // process first MC steps and then ESD steps
261 AliRsnPairDef *pairDef = 0;
262 TObjArrayIter iter(&fPairDefList);
263 while ( (pairDef = (AliRsnPairDef*)iter.Next()) )
265 if (fRsnEvent.IsESD()) ProcessEventESD(pairDef);
266 if (fRsnEvent.IsAOD()) ProcessEventAOD(pairDef);
270 PostData(2, fOutList);
272 AliDebug(AliLog::kDebug+2,"->");
275 //_____________________________________________________________________________
276 void AliRsnAnalysisEffSE::ProcessEventESD(AliRsnPairDef *pairDef)
279 // Process current event with the definitions of the specified step in MC list
280 // and store results in the container slot defined in second argument.
281 // It is associated with the AliCFContainer with the name of the pair.
284 AliStack *stack = fRsnEvent.GetRefMCESD()->Stack();
285 AliESDEvent *esd = fRsnEvent.GetRefESD();
286 AliMCEvent *mc = fRsnEvent.GetRefMCESD();
287 AliMCParticle *mother;
289 if (!pairDef) return;
290 AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName());
293 // get informations from pairDef
295 Int_t pdgD[2] = {0, 0};
296 Short_t chargeD[2] = {0, 0};
297 pdgM = pairDef->GetMotherPDG();
298 pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0));
299 pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1));
300 chargeD[0] = pairDef->GetChargeShort(0);
301 chargeD[1] = pairDef->GetChargeShort(1);
303 // other utility variables
304 Int_t first, j, ipart;
305 Int_t label[2] = {-1, -1};
306 Short_t charge[2] = {0, 0};
307 Short_t pairDefMatch[2] = {-1, -1};
308 Int_t esdIndex[2] = {-1, -1};
309 TParticle *part[2] = {0, 0};
311 // in this case, we first take the resonance from MC
312 // and then we find its daughters and compute cuts on them
313 for (ipart = 0; ipart < stack->GetNprimary(); ipart++)
315 // take a track from the MC event
316 mother = (AliMCParticle*) fMCEvent->GetTrack(ipart);
318 // check that it is a binary decay and the PDG code matches
319 if (mother->Particle()->GetNDaughters() != 2) continue;
320 if (mother->Particle()->GetPdgCode() != pdgM) continue;
322 // store the labels of the two daughters
323 label[0] = mother->Particle()->GetFirstDaughter();
324 label[1] = mother->Particle()->GetLastDaughter();
326 // retrieve the particles and other stuff
327 // check if they match the order in the pairDef
328 for (j = 0; j < 2; j++)
330 if (label[j] < 0) continue;
331 part[j] = stack->Particle(label[j]);
332 pdgD[j] = TMath::Abs(part[j]->GetPdgCode());
333 charge[j] = (Short_t)(part[j]->GetPDG()->Charge() / 3);
334 if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeShort(0))
336 else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeShort(1))
339 pairDefMatch[j] = -1;
341 // find corresponding ESD particle: first try rejecting fakes,
342 // and in case of failure, try accepting fakes
343 esdIndex[j] = FindESDtrack(label[j], esd, kTRUE);
344 //TArrayI idx = FindESDtracks(label[j], esd);
345 //for (Int_t kk = 0; kk < idx.GetSize(); kk++) cout << "DAUGHTER " << j << " --> FOUND INDEX: " << idx[kk] << endl;
346 if (esdIndex[j] < 0) esdIndex[j] = FindESDtrack(label[j], esd, kFALSE);
347 //cout << "DAUGHTER " << j << " SINGLE FOUND INDEX = " << esdIndex[j] << endl;
350 // since each candidate good resonance is taken once, we must check
351 // that it matches the pair definition in any order, and reject in case
352 // in none of them the pair is OK
353 // anyway, we must associate the correct daughter to the correct data member
354 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
356 // 1st track --> 1st member of PairDef
357 fDaughter[0].SetRef(mc->GetTrack(label[0]));
358 fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[0]));
359 fDaughter[0].SetGood();
360 // 2nd track --> 2nd member of PairDef
361 fDaughter[1].SetRef(mc->GetTrack(label[1]));
362 fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[1]));
363 fDaughter[1].SetGood();
365 else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
367 // 1st track --> 2nd member of PairDef
368 fDaughter[0].SetRef(mc->GetTrack(label[1]));
369 fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[1]));
370 fDaughter[0].SetGood();
371 // 2nd track --> 1st member of PairDef
372 fDaughter[1].SetRef(mc->GetTrack(label[0]));
373 fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[0]));
374 fDaughter[1].SetGood();
378 fDaughter[0].SetBad();
379 fDaughter[1].SetBad();
382 // reject the pair if the matching was unsuccessful
383 if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue;
385 // first, we set the internal AliRsnMother object to
386 // the MC particles and then operate the selections on MC
387 fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1));
388 FillContainer(cont, &fStepListMC, pairDef, 0);
390 // then, if both particles found a good match in the ESD
391 // reassociate the ESD tracks to the pair and fill ESD containers
392 if (esdIndex[0] < 0 || esdIndex[1] < 0) continue;
393 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
395 // 1st track --> 1st member of PairDef
396 fDaughter[0].SetRef(esd->GetTrack(esdIndex[0]));
397 // 2nd track --> 2nd member of PairDef
398 fDaughter[1].SetRef(esd->GetTrack(esdIndex[1]));
399 //cout << "****** MATCHING SCHEME 1" << endl;
401 else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
403 // 1st track --> 2nd member of PairDef
404 fDaughter[0].SetRef(esd->GetTrack(esdIndex[1]));
405 // 2nd track --> 1st member of PairDef
406 fDaughter[1].SetRef(esd->GetTrack(esdIndex[0]));
407 //cout << "****** MATCHING SCHEME 2" << endl;
409 //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl;
410 // here we must remember how many steps were already filled
411 first = (Int_t)fStepListMC.GetEntries();
412 FillContainer(cont, &fStepListESD, pairDef, first);
416 //_____________________________________________________________________________
417 void AliRsnAnalysisEffSE::ProcessEventAOD(AliRsnPairDef *pairDef)
420 // Process current event with the definitions of the specified step in MC list
421 // and store results in the container slot defined in second argument.
422 // It is associated with the AliCFContainer with the name of the pair.
425 AliAODEvent *aod = fRsnEvent.GetRefAOD();
426 AliAODMCParticle *mother;
427 TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
428 if (!mcArray) return;
430 if (!pairDef) return;
431 AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName());
434 // get informations from pairDef
436 Int_t pdgD[2] = {0, 0};
437 Short_t chargeD[2] = {0, 0};
438 pdgM = pairDef->GetMotherPDG();
439 pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0));
440 pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1));
441 chargeD[0] = pairDef->GetChargeShort(0);
442 chargeD[1] = pairDef->GetChargeShort(1);
444 // other utility variables
446 Int_t label [2] = {-1, -1};
447 Short_t charge[2] = {0, 0};
448 Short_t pairDefMatch[2] = {-1, -1};
449 Int_t aodIndex[2] = {-1, -1};
450 AliAODMCParticle *part[2] = {0, 0};
452 // loop on MC particles
453 TObjArrayIter next(mcArray);
454 while ( (mother = (AliAODMCParticle*)next()) )
456 // check that it is a binary decay and the PDG code matches
457 if (mother->GetNDaughters() != 2) continue;
458 if (mother->GetPdgCode() != pdgM) continue;
460 // store the labels of the two daughters
461 label[0] = mother->GetDaughter(0);
462 label[1] = mother->GetDaughter(1);
464 // retrieve the particles and other stuff
465 // check if they match the order in the pairDef
466 for (j = 0; j < 2; j++)
468 if (label[j] < 0) continue;
469 part[j] = (AliAODMCParticle*)mcArray->At(label[j]);
470 pdgD[j] = TMath::Abs(part[j]->GetPdgCode());
471 charge[j] = (Short_t)(part[j]->Charge());
472 if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeShort(0))
474 else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeShort(1))
477 pairDefMatch[j] = -1;
479 // find corresponding ESD particle: first try rejecting fakes,
480 // and in case of failure, try accepting fakes
481 aodIndex[j] = FindAODtrack(label[j], aod, kTRUE);
482 if (aodIndex[j] < 0) aodIndex[j] = FindAODtrack(label[j], aod, kFALSE);
485 // since each candidate good resonance is taken once, we must check
486 // that it matches the pair definition in any order, and reject in case
487 // in none of them the pair is OK
488 // anyway, we must associate the correct daughter to the correct data member
489 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
491 // 1st track --> 1st member of PairDef
492 fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[0]));
493 fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[0]));
494 fDaughter[0].SetGood();
495 // 2nd track --> 2nd member of PairDef
496 fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[1]));
497 fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[1]));
498 fDaughter[1].SetGood();
500 else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
502 // 1st track --> 2nd member of PairDef
503 fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[1]));
504 fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[1]));
505 fDaughter[0].SetGood();
506 // 2nd track --> 1st member of PairDef
507 fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[0]));
508 fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[0]));
509 fDaughter[1].SetGood();
513 fDaughter[0].SetBad();
514 fDaughter[1].SetBad();
517 // reject the pair if the matching was unsuccessful
518 if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue;
520 // first, we set the internal AliRsnMother object to
521 // the MC particles and then operate the selections on MC
522 fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1));
523 FillContainer(cont, &fStepListMC, pairDef, 0);
525 // then, if both particles found a good match in the AOD
526 // reassociate the AOD tracks to the pair and fill AOD containers
527 if (aodIndex[0] < 0 || aodIndex[1] < 0) continue;
528 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
530 // 1st track --> 1st member of PairDef
531 fDaughter[0].SetRef(aod->GetTrack(aodIndex[0]));
532 // 2nd track --> 2nd member of PairDef
533 fDaughter[1].SetRef(aod->GetTrack(aodIndex[1]));
534 //cout << "****** MATCHING SCHEME 1" << endl;
536 else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
538 // 1st track --> 2nd member of PairDef
539 fDaughter[0].SetRef(aod->GetTrack(aodIndex[1]));
540 // 2nd track --> 1st member of PairDef
541 fDaughter[1].SetRef(aod->GetTrack(aodIndex[0]));
542 //cout << "****** MATCHING SCHEME 2" << endl;
544 //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl;
545 // here we must remember how many steps were already filled
546 first = (Int_t)fStepListMC.GetEntries();
547 FillContainer(cont, &fStepListESD, pairDef, first);
551 //_____________________________________________________________________________
552 void AliRsnAnalysisEffSE::FillContainer(AliCFContainer *cont, const TObjArray *stepList, AliRsnPairDef *pd, Int_t firstOutStep)
555 // Fill the containers
558 Int_t iaxis, nAxes = fAxisList.GetEntries();
559 Int_t istep, nSteps = stepList->GetEntries();
561 // set daughters to pair
562 fPair.SetDaughters(&fDaughter[0], pd->GetMass(0), &fDaughter[1], pd->GetMass(1));
564 // compute values for all axes
565 for (iaxis = 0; iaxis < nAxes; iaxis++)
567 AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
569 if (fcnAxis->Eval(&fPair, pd, &fRsnEvent)) fVar[iaxis] = (Float_t)fcnAxis->GetValue();
573 for (istep = 0; istep < nSteps; istep++)
575 AliRsnCutManager *cutMgr = (AliRsnCutManager*)stepList->At(istep);
576 cutMgr->SetEvent(&fRsnEvent);
577 if (!cutMgr->PassCommonDaughterCuts(&fDaughter[0])) break;
578 if (!cutMgr->PassCommonDaughterCuts(&fDaughter[1])) break;
579 if (!cutMgr->PassDaughter1Cuts(&fDaughter[0])) break;
580 if (!cutMgr->PassDaughter2Cuts(&fDaughter[1])) break;
581 if (!cutMgr->PassMotherCuts(&fPair)) break;
582 //cout << "**************************************** FILLING STEP " << istep << endl;
583 cont->Fill(fVar.GetArray(), istep + firstOutStep);
587 //_____________________________________________________________________________
588 void AliRsnAnalysisEffSE::RsnTerminate(Option_t*)
592 // Could be added some monitor histograms here.
595 AliDebug(AliLog::kDebug+2,"<-");
596 AliDebug(AliLog::kDebug+2,"->");
599 //_____________________________________________________________________________
600 void AliRsnAnalysisEffSE::AddPairDef(AliRsnPairDef* pairDef)
603 // Adds pair definition
605 fPairDefList.AddLast(pairDef);
608 //_____________________________________________________________________________
609 Int_t AliRsnAnalysisEffSE::FindESDtrack(Int_t label, AliESDEvent *esd, Bool_t rejectFakes)
612 // Finds in the ESD a track whose label corresponds to that in argument.
613 // When global tracks are enabled, tries first to find a global track
614 // satisfying that requirement.
615 // If no global tracks are found, if ITS-SA are enable, tries to search among them
616 // otherwise return a negative number.
617 // If global tracks are disabled, search only among ITS SA
621 Int_t ntracks = esd->GetNumberOfTracks();
626 // loop for global tracks
629 for (i = 0; i < ntracks; i++)
631 AliESDtrack *track = esd->GetTrack(i);
632 status = (ULong_t)track->GetStatus();
633 isTPC = ((status & AliESDtrack::kTPCin) != 0);
634 if (!isTPC) continue;
636 // check that label match
637 if (TMath::Abs(track->GetLabel()) != label) continue;
639 // if required, reject fakes
640 if (rejectFakes && track->GetLabel() < 0) continue;
642 // if all checks are passed and we are searching among global
643 // this means that thie track is a global one with the right label
644 // then, the return value is set to this, and returned
649 // loop for ITS-SA tracks (this happens only if no global tracks were found
650 // or searching among globals is disabled)
653 for (i = 0; i < ntracks; i++)
655 AliESDtrack *track = esd->GetTrack(i);
656 status = (ULong_t)track->GetStatus();
657 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
658 if (!isITSSA) continue;
660 // check that label match
661 if (TMath::Abs(track->GetLabel()) != label) continue;
663 // if required, reject fakes
664 if (rejectFakes && track->GetLabel() < 0) continue;
666 // if all checks are passed and we are searching among global
667 // this means that thie track is a global one with the right label
668 // then, the return value is set to this, and returned
673 // if we reach this point, no match were found
677 //_____________________________________________________________________________
678 TArrayI AliRsnAnalysisEffSE::FindESDtracks(Int_t label, AliESDEvent *esd)
681 // Finds in the ESD a track whose label corresponds to that in argument.
682 // When global tracks are enabled, tries first to find a global track
683 // satisfying that requirement.
684 // If no global tracks are found, if ITS-SA are enable, tries to search among them
685 // otherwise return a negative number.
686 // If global tracks are disabled, search only among ITS SA
690 Int_t ntracks = esd->GetNumberOfTracks();
697 // loop for global tracks
700 for (i = 0; i < ntracks; i++)
702 AliESDtrack *track = esd->GetTrack(i);
703 status = (ULong_t)track->GetStatus();
704 isTPC = ((status & AliESDtrack::kTPCin) != 0);
705 if (!isTPC) continue;
707 // check that label match
708 if (TMath::Abs(track->GetLabel()) != label) continue;
714 // loop for ITS-SA tracks (this happens only if no global tracks were found
715 // or searching among globals is disabled)
718 for (i = 0; i < ntracks; i++)
720 AliESDtrack *track = esd->GetTrack(i);
721 status = (ULong_t)track->GetStatus();
722 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
723 if (!isITSSA) continue;
725 // check that label match
726 if (TMath::Abs(track->GetLabel()) != label) continue;
736 //_____________________________________________________________________________
737 Int_t AliRsnAnalysisEffSE::FindAODtrack(Int_t label, AliAODEvent *aod, Bool_t rejectFakes)
740 // Finds in the ESD a track whose label corresponds to that in argument.
741 // When global tracks are enabled, tries first to find a global track
742 // satisfying that requirement.
743 // If no global tracks are found, if ITS-SA are enable, tries to search among them
744 // otherwise return a negative number.
745 // If global tracks are disabled, search only among ITS SA
749 Int_t ntracks = aod->GetNumberOfTracks();
754 // loop for global tracks
757 for (i = 0; i < ntracks; i++)
759 AliAODTrack *track = aod->GetTrack(i);
760 status = (ULong_t)track->GetStatus();
761 isTPC = ((status & AliESDtrack::kTPCin) != 0);
762 if (!isTPC) continue;
764 // check that label match
765 if (TMath::Abs(track->GetLabel()) != label) continue;
767 // if required, reject fakes
768 if (rejectFakes && track->GetLabel() < 0) continue;
770 // if all checks are passed and we are searching among global
771 // this means that thie track is a global one with the right label
772 // then, the return value is set to this, and returned
777 // loop for ITS-SA tracks (this happens only if no global tracks were found
778 // or searching among globals is disabled)
781 for (i = 0; i < ntracks; i++)
783 AliAODTrack *track = aod->GetTrack(i);
784 status = (ULong_t)track->GetStatus();
785 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
786 if (!isITSSA) continue;
788 // check that label match
789 if (TMath::Abs(track->GetLabel()) != label) continue;
791 // if required, reject fakes
792 if (rejectFakes && track->GetLabel() < 0) continue;
794 // if all checks are passed and we are searching among global
795 // this means that thie track is a global one with the right label
796 // then, the return value is set to this, and returned
801 // if we reach this point, no match were found
805 //_____________________________________________________________________________
806 TArrayI AliRsnAnalysisEffSE::FindAODtracks(Int_t label, AliAODEvent *aod)
809 // Finds in the ESD a track whose label corresponds to that in argument.
810 // When global tracks are enabled, tries first to find a global track
811 // satisfying that requirement.
812 // If no global tracks are found, if ITS-SA are enable, tries to search among them
813 // otherwise return a negative number.
814 // If global tracks are disabled, search only among ITS SA
818 Int_t ntracks = aod->GetNumberOfTracks();
825 // loop for global tracks
828 for (i = 0; i < ntracks; i++)
830 AliAODTrack *track = aod->GetTrack(i);
831 status = (ULong_t)track->GetStatus();
832 isTPC = ((status & AliESDtrack::kTPCin) != 0);
833 if (!isTPC) continue;
835 // check that label match
836 if (TMath::Abs(track->GetLabel()) != label) continue;
842 // loop for ITS-SA tracks (this happens only if no global tracks were found
843 // or searching among globals is disabled)
846 for (i = 0; i < ntracks; i++)
848 AliAODTrack *track = aod->GetTrack(i);
849 status = (ULong_t)track->GetStatus();
850 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
851 if (!isITSSA) continue;
853 // check that label match
854 if (TMath::Abs(track->GetLabel()) != label) continue;