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.
185 // process first MC steps and then ESD steps
186 AliRsnPairDef *pairDef = 0;
187 TObjArrayIter iter(&fPairDefList);
188 while ( (pairDef = (AliRsnPairDef*)iter.Next()) )
190 if (fRsnEvent.IsESD()) ProcessEventESD(pairDef);
191 if (fRsnEvent.IsAOD()) ProcessEventAOD(pairDef);
195 PostData(2, fOutList);
198 //_____________________________________________________________________________
199 void AliRsnAnalysisEffSE::ProcessEventESD(AliRsnPairDef *pairDef)
202 // Process current event with the definitions of the specified step in MC list
203 // and store results in the container slot defined in second argument.
204 // It is associated with the AliCFContainer with the name of the pair.
207 AliStack *stack = fRsnEvent.GetRefMCESD()->Stack();
208 AliESDEvent *esd = fRsnEvent.GetRefESD();
209 AliMCEvent *mc = fRsnEvent.GetRefMCESD();
210 AliMCParticle *mother;
212 if (!pairDef) return;
213 AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName());
216 // get informations from pairDef
218 Int_t pdgD[2] = {0, 0};
219 Short_t chargeD[2] = {0, 0};
220 pdgM = pairDef->GetMotherPDG();
221 pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0));
222 pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1));
223 chargeD[0] = pairDef->GetChargeShort(0);
224 chargeD[1] = pairDef->GetChargeShort(1);
226 // other utility variables
227 Int_t first, j, ipart;
228 Int_t label[2] = {-1, -1};
229 Short_t charge[2] = {0, 0};
230 Short_t pairDefMatch[2] = {-1, -1};
231 Int_t esdIndex[2] = {-1, -1};
232 TParticle *part[2] = {0, 0};
234 // in this case, we first take the resonance from MC
235 // and then we find its daughters and compute cuts on them
236 for (ipart = 0; ipart < stack->GetNprimary(); ipart++)
238 // take a track from the MC event
239 mother = (AliMCParticle*) fMCEvent->GetTrack(ipart);
241 // check that it is a binary decay and the PDG code matches
242 if (mother->Particle()->GetNDaughters() != 2) continue;
243 if (mother->Particle()->GetPdgCode() != pdgM) continue;
245 // store the labels of the two daughters
246 label[0] = mother->Particle()->GetFirstDaughter();
247 label[1] = mother->Particle()->GetLastDaughter();
249 // retrieve the particles and other stuff
250 // check if they match the order in the pairDef
251 for (j = 0; j < 2; j++)
253 if (label[j] < 0) continue;
254 part[j] = stack->Particle(label[j]);
255 pdgD[j] = TMath::Abs(part[j]->GetPdgCode());
256 charge[j] = (Short_t)(part[j]->GetPDG()->Charge() / 3);
257 if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeShort(0))
259 else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeShort(1))
262 pairDefMatch[j] = -1;
264 // find corresponding ESD particle: first try rejecting fakes,
265 // and in case of failure, try accepting fakes
266 esdIndex[j] = FindESDtrack(label[j], esd, kTRUE);
267 //TArrayI idx = FindESDtracks(label[j], esd);
268 //for (Int_t kk = 0; kk < idx.GetSize(); kk++) cout << "DAUGHTER " << j << " --> FOUND INDEX: " << idx[kk] << endl;
269 if (esdIndex[j] < 0) esdIndex[j] = FindESDtrack(label[j], esd, kFALSE);
270 //cout << "DAUGHTER " << j << " SINGLE FOUND INDEX = " << esdIndex[j] << endl;
273 // since each candidate good resonance is taken once, we must check
274 // that it matches the pair definition in any order, and reject in case
275 // in none of them the pair is OK
276 // anyway, we must associate the correct daughter to the correct data member
277 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
279 // 1st track --> 1st member of PairDef
280 fDaughter[0].SetRef(mc->GetTrack(label[0]));
281 fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[0]));
282 fDaughter[0].SetGood();
283 // 2nd track --> 2nd member of PairDef
284 fDaughter[1].SetRef(mc->GetTrack(label[1]));
285 fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[1]));
286 fDaughter[1].SetGood();
288 else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
290 // 1st track --> 2nd member of PairDef
291 fDaughter[0].SetRef(mc->GetTrack(label[1]));
292 fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[1]));
293 fDaughter[0].SetGood();
294 // 2nd track --> 1st member of PairDef
295 fDaughter[1].SetRef(mc->GetTrack(label[0]));
296 fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[0]));
297 fDaughter[1].SetGood();
301 fDaughter[0].SetBad();
302 fDaughter[1].SetBad();
305 // reject the pair if the matching was unsuccessful
306 if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue;
308 // first, we set the internal AliRsnMother object to
309 // the MC particles and then operate the selections on MC
310 fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1));
311 FillContainer(cont, &fStepListMC, pairDef, 0);
313 // then, if both particles found a good match in the ESD
314 // reassociate the ESD tracks to the pair and fill ESD containers
315 if (esdIndex[0] < 0 || esdIndex[1] < 0) continue;
316 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
318 // 1st track --> 1st member of PairDef
319 fDaughter[0].SetRef(esd->GetTrack(esdIndex[0]));
320 // 2nd track --> 2nd member of PairDef
321 fDaughter[1].SetRef(esd->GetTrack(esdIndex[1]));
322 //cout << "****** MATCHING SCHEME 1" << endl;
324 else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
326 // 1st track --> 2nd member of PairDef
327 fDaughter[0].SetRef(esd->GetTrack(esdIndex[1]));
328 // 2nd track --> 1st member of PairDef
329 fDaughter[1].SetRef(esd->GetTrack(esdIndex[0]));
330 //cout << "****** MATCHING SCHEME 2" << endl;
332 //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl;
333 // here we must remember how many steps were already filled
334 first = (Int_t)fStepListMC.GetEntries();
335 FillContainer(cont, &fStepListESD, pairDef, first);
339 //_____________________________________________________________________________
340 void AliRsnAnalysisEffSE::ProcessEventAOD(AliRsnPairDef *pairDef)
343 // Process current event with the definitions of the specified step in MC list
344 // and store results in the container slot defined in second argument.
345 // It is associated with the AliCFContainer with the name of the pair.
348 AliAODEvent *aod = fRsnEvent.GetRefAOD();
349 AliAODMCParticle *mother;
350 TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
351 if (!mcArray) return;
353 if (!pairDef) return;
354 AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName());
357 // get informations from pairDef
359 Int_t pdgD[2] = {0, 0};
360 Short_t chargeD[2] = {0, 0};
361 pdgM = pairDef->GetMotherPDG();
362 pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0));
363 pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1));
364 chargeD[0] = pairDef->GetChargeShort(0);
365 chargeD[1] = pairDef->GetChargeShort(1);
367 // other utility variables
369 Int_t label [2] = {-1, -1};
370 Short_t charge[2] = {0, 0};
371 Short_t pairDefMatch[2] = {-1, -1};
372 Int_t aodIndex[2] = {-1, -1};
373 AliAODMCParticle *part[2] = {0, 0};
375 // loop on MC particles
376 TObjArrayIter next(mcArray);
377 while ( (mother = (AliAODMCParticle*)next()) )
379 // check that it is a binary decay and the PDG code matches
380 if (mother->GetNDaughters() != 2) continue;
381 if (mother->GetPdgCode() != pdgM) continue;
383 // store the labels of the two daughters
384 label[0] = mother->GetDaughter(0);
385 label[1] = mother->GetDaughter(1);
387 // retrieve the particles and other stuff
388 // check if they match the order in the pairDef
389 for (j = 0; j < 2; j++)
391 if (label[j] < 0) continue;
392 part[j] = (AliAODMCParticle*)mcArray->At(label[j]);
393 pdgD[j] = TMath::Abs(part[j]->GetPdgCode());
394 charge[j] = (Short_t)(part[j]->Charge());
395 if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeShort(0))
397 else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeShort(1))
400 pairDefMatch[j] = -1;
402 // find corresponding ESD particle: first try rejecting fakes,
403 // and in case of failure, try accepting fakes
404 aodIndex[j] = FindAODtrack(label[j], aod, kTRUE);
405 if (aodIndex[j] < 0) aodIndex[j] = FindAODtrack(label[j], aod, kFALSE);
408 // since each candidate good resonance is taken once, we must check
409 // that it matches the pair definition in any order, and reject in case
410 // in none of them the pair is OK
411 // anyway, we must associate the correct daughter to the correct data member
412 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
414 // 1st track --> 1st member of PairDef
415 fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[0]));
416 fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[0]));
417 fDaughter[0].SetGood();
418 // 2nd track --> 2nd member of PairDef
419 fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[1]));
420 fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[1]));
421 fDaughter[1].SetGood();
423 else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
425 // 1st track --> 2nd member of PairDef
426 fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[1]));
427 fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[1]));
428 fDaughter[0].SetGood();
429 // 2nd track --> 1st member of PairDef
430 fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[0]));
431 fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[0]));
432 fDaughter[1].SetGood();
436 fDaughter[0].SetBad();
437 fDaughter[1].SetBad();
440 // reject the pair if the matching was unsuccessful
441 if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue;
443 // first, we set the internal AliRsnMother object to
444 // the MC particles and then operate the selections on MC
445 fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1));
446 FillContainer(cont, &fStepListMC, pairDef, 0);
448 // then, if both particles found a good match in the AOD
449 // reassociate the AOD tracks to the pair and fill AOD containers
450 if (aodIndex[0] < 0 || aodIndex[1] < 0) continue;
451 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1)
453 // 1st track --> 1st member of PairDef
454 fDaughter[0].SetRef(aod->GetTrack(aodIndex[0]));
455 // 2nd track --> 2nd member of PairDef
456 fDaughter[1].SetRef(aod->GetTrack(aodIndex[1]));
457 //cout << "****** MATCHING SCHEME 1" << endl;
459 else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0))
461 // 1st track --> 2nd member of PairDef
462 fDaughter[0].SetRef(aod->GetTrack(aodIndex[1]));
463 // 2nd track --> 1st member of PairDef
464 fDaughter[1].SetRef(aod->GetTrack(aodIndex[0]));
465 //cout << "****** MATCHING SCHEME 2" << endl;
467 //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl;
468 // here we must remember how many steps were already filled
469 first = (Int_t)fStepListMC.GetEntries();
470 FillContainer(cont, &fStepListESD, pairDef, first);
474 //_____________________________________________________________________________
475 void AliRsnAnalysisEffSE::FillContainer(AliCFContainer *cont, const TObjArray *stepList, AliRsnPairDef *pd, Int_t firstOutStep)
478 // Fill the containers
481 Int_t iaxis, nAxes = fAxisList.GetEntries();
482 Int_t istep, nSteps = stepList->GetEntries();
485 // set daughters to pair
486 fPair.SetDaughters(&fDaughter[0], pd->GetMass(0), &fDaughter[1], pd->GetMass(1));
488 // compute values for all axes
489 for (iaxis = 0; iaxis < nAxes; iaxis++)
491 AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
493 switch (fcnAxis->GetTargetType())
495 case AliRsnTarget::kMother:
496 fcnAxis->SetSupportObject(pd);
497 computeOK = fcnAxis->Eval(&fPair);
499 case AliRsnTarget::kEvent:
500 computeOK = fcnAxis->Eval(&fRsnEvent);
503 AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", fcnAxis->GetName(), fcnAxis->GetTargetTypeName()));
506 if (computeOK) fVar[iaxis] = ((Float_t)fcnAxis->GetComputedValue());
510 for (istep = 0; istep < nSteps; istep++)
512 AliRsnCutManager *cutMgr = (AliRsnCutManager*)stepList->At(istep);
513 AliRsnTarget::SwitchToFirst();
514 if (!cutMgr->PassCommonDaughterCuts(&fDaughter[0])) break;
515 if (!cutMgr->PassCommonDaughterCuts(&fDaughter[1])) break;
516 if (!cutMgr->PassDaughter1Cuts(&fDaughter[0])) break;
517 if (!cutMgr->PassDaughter2Cuts(&fDaughter[1])) break;
518 if (!cutMgr->PassMotherCuts(&fPair)) break;
519 //cout << "**************************************** FILLING STEP " << istep << endl;
520 cont->Fill(fVar.GetArray(), istep + firstOutStep);
524 //_____________________________________________________________________________
525 void AliRsnAnalysisEffSE::RsnTerminate(Option_t*)
529 // Could be added some monitor histograms here.
532 AliDebug(AliLog::kDebug+2,"<-");
533 AliDebug(AliLog::kDebug+2,"->");
536 //_____________________________________________________________________________
537 void AliRsnAnalysisEffSE::AddPairDef(AliRsnPairDef* pairDef)
540 // Adds pair definition
542 fPairDefList.AddLast(pairDef);
545 //_____________________________________________________________________________
546 Int_t AliRsnAnalysisEffSE::FindESDtrack(Int_t label, AliESDEvent *esd, Bool_t rejectFakes)
549 // Finds in the ESD a track whose label corresponds to that in argument.
550 // When global tracks are enabled, tries first to find a global track
551 // satisfying that requirement.
552 // If no global tracks are found, if ITS-SA are enable, tries to search among them
553 // otherwise return a negative number.
554 // If global tracks are disabled, search only among ITS SA
558 Int_t ntracks = esd->GetNumberOfTracks();
563 // loop for global tracks
566 for (i = 0; i < ntracks; i++)
568 AliESDtrack *track = esd->GetTrack(i);
569 status = (ULong_t)track->GetStatus();
570 isTPC = ((status & AliESDtrack::kTPCin) != 0);
571 if (!isTPC) continue;
573 // check that label match
574 if (TMath::Abs(track->GetLabel()) != label) continue;
576 // if required, reject fakes
577 if (rejectFakes && track->GetLabel() < 0) continue;
579 // if all checks are passed and we are searching among global
580 // this means that thie track is a global one with the right label
581 // then, the return value is set to this, and returned
586 // loop for ITS-SA tracks (this happens only if no global tracks were found
587 // or searching among globals is disabled)
590 for (i = 0; i < ntracks; i++)
592 AliESDtrack *track = esd->GetTrack(i);
593 status = (ULong_t)track->GetStatus();
594 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
595 if (!isITSSA) continue;
597 // check that label match
598 if (TMath::Abs(track->GetLabel()) != label) continue;
600 // if required, reject fakes
601 if (rejectFakes && track->GetLabel() < 0) continue;
603 // if all checks are passed and we are searching among global
604 // this means that thie track is a global one with the right label
605 // then, the return value is set to this, and returned
610 // if we reach this point, no match were found
614 //_____________________________________________________________________________
615 TArrayI AliRsnAnalysisEffSE::FindESDtracks(Int_t label, AliESDEvent *esd)
618 // Finds in the ESD a track whose label corresponds to that in argument.
619 // When global tracks are enabled, tries first to find a global track
620 // satisfying that requirement.
621 // If no global tracks are found, if ITS-SA are enable, tries to search among them
622 // otherwise return a negative number.
623 // If global tracks are disabled, search only among ITS SA
627 Int_t ntracks = esd->GetNumberOfTracks();
634 // loop for global tracks
637 for (i = 0; i < ntracks; i++)
639 AliESDtrack *track = esd->GetTrack(i);
640 status = (ULong_t)track->GetStatus();
641 isTPC = ((status & AliESDtrack::kTPCin) != 0);
642 if (!isTPC) continue;
644 // check that label match
645 if (TMath::Abs(track->GetLabel()) != label) continue;
651 // loop for ITS-SA tracks (this happens only if no global tracks were found
652 // or searching among globals is disabled)
655 for (i = 0; i < ntracks; i++)
657 AliESDtrack *track = esd->GetTrack(i);
658 status = (ULong_t)track->GetStatus();
659 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
660 if (!isITSSA) continue;
662 // check that label match
663 if (TMath::Abs(track->GetLabel()) != label) continue;
673 //_____________________________________________________________________________
674 Int_t AliRsnAnalysisEffSE::FindAODtrack(Int_t label, AliAODEvent *aod, Bool_t rejectFakes)
677 // Finds in the ESD a track whose label corresponds to that in argument.
678 // When global tracks are enabled, tries first to find a global track
679 // satisfying that requirement.
680 // If no global tracks are found, if ITS-SA are enable, tries to search among them
681 // otherwise return a negative number.
682 // If global tracks are disabled, search only among ITS SA
686 Int_t ntracks = aod->GetNumberOfTracks();
691 // loop for global tracks
694 for (i = 0; i < ntracks; i++)
696 AliAODTrack *track = aod->GetTrack(i);
697 status = (ULong_t)track->GetStatus();
698 isTPC = ((status & AliESDtrack::kTPCin) != 0);
699 if (!isTPC) continue;
701 // check that label match
702 if (TMath::Abs(track->GetLabel()) != label) continue;
704 // if required, reject fakes
705 if (rejectFakes && track->GetLabel() < 0) continue;
707 // if all checks are passed and we are searching among global
708 // this means that thie track is a global one with the right label
709 // then, the return value is set to this, and returned
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 AliAODTrack *track = aod->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;
728 // if required, reject fakes
729 if (rejectFakes && track->GetLabel() < 0) continue;
731 // if all checks are passed and we are searching among global
732 // this means that thie track is a global one with the right label
733 // then, the return value is set to this, and returned
738 // if we reach this point, no match were found
742 //_____________________________________________________________________________
743 TArrayI AliRsnAnalysisEffSE::FindAODtracks(Int_t label, AliAODEvent *aod)
746 // Finds in the ESD a track whose label corresponds to that in argument.
747 // When global tracks are enabled, tries first to find a global track
748 // satisfying that requirement.
749 // If no global tracks are found, if ITS-SA are enable, tries to search among them
750 // otherwise return a negative number.
751 // If global tracks are disabled, search only among ITS SA
755 Int_t ntracks = aod->GetNumberOfTracks();
762 // loop for global tracks
765 for (i = 0; i < ntracks; i++)
767 AliAODTrack *track = aod->GetTrack(i);
768 status = (ULong_t)track->GetStatus();
769 isTPC = ((status & AliESDtrack::kTPCin) != 0);
770 if (!isTPC) continue;
772 // check that label match
773 if (TMath::Abs(track->GetLabel()) != label) continue;
779 // loop for ITS-SA tracks (this happens only if no global tracks were found
780 // or searching among globals is disabled)
783 for (i = 0; i < ntracks; i++)
785 AliAODTrack *track = aod->GetTrack(i);
786 status = (ULong_t)track->GetStatus();
787 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
788 if (!isITSSA) continue;
790 // check that label match
791 if (TMath::Abs(track->GetLabel()) != label) continue;
801 //______________________________________________________________________________
802 Bool_t AliRsnAnalysisEffSE::EventProcess()
805 // Customized event pre-processing.
806 // First checks if the current event passes all cuts,
807 // and if it does, updates the informations and then
808 // call the operations which are already defined in the
809 // omonyme function in mother class
812 // initially, an event is expected to be bad
813 fTaskInfo.SetEventUsed(kFALSE);
815 // check the event cuts and update the info data accordingly
816 // events not passing the cuts must be rejected
817 if (!fEventCuts.IsSelected(&fRsnEvent))
819 fTaskInfo.SetEventUsed(kFALSE);
823 // if we reach this point, cuts were passed;
824 // then additional operations can be done
826 // find leading particle (without any PID/momentum restriction)
827 fRsnEvent.SelectLeadingParticle(0);
829 // final return value is positive
830 // but call the mother class method which updates info object
831 fTaskInfo.SetEventUsed(kTRUE);
832 return AliRsnVAnalysisTaskSE::EventProcess();