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++) {
134 AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
135 nBins[iaxis] = fcnAxis->GetArray().GetSize() - 1;
138 // create ouput list of containers
139 fContainerList = new TList;
140 fContainerList->SetOwner();
141 fContainerList->SetName(Form("%s_containers", GetName()));
143 // initialize output list
145 fOutList = new TList();
146 fOutList->SetOwner();
148 // create the containers
149 Int_t i = 0, nDef = (Int_t)fPairDefList.GetEntries();
150 for (i = 0; i < nDef; i++) {
151 AliRsnPairDef *def = (AliRsnPairDef*)fPairDefList[i];
152 AliCFContainer *cont = new AliCFContainer(Form("%s", def->GetPairName()), "", nSteps, nAxes, nBins);
153 // set the bin limits for each axis
154 for (iaxis = 0; iaxis < nAxes; iaxis++) {
155 AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
156 cont->SetBinLimits(iaxis, fcnAxis->GetArray().GetArray());
158 // add the container to output list
159 fContainerList->Add(cont);
162 fOutList->Add(fContainerList);
165 PostData(2, fOutList);
170 AliDebug(AliLog::kDebug + 2, "->");
173 //_____________________________________________________________________________
174 void AliRsnAnalysisEffSE::RsnUserExec(Option_t*)
177 // Execution of the analysis task.
178 // Recovers the input event and processes it with all included pair objects.
179 // In this case, we NEED to have ESD and MC, otherwise we cannod do anything.
182 // process first MC steps and then ESD steps
183 AliRsnPairDef *pairDef = 0;
184 TObjArrayIter iter(&fPairDefList);
185 while ((pairDef = (AliRsnPairDef*)iter.Next())) {
186 if (fRsnEvent.IsESD()) ProcessEventESD(pairDef);
187 if (fRsnEvent.IsAOD()) ProcessEventAOD(pairDef);
191 PostData(2, fOutList);
194 //_____________________________________________________________________________
195 void AliRsnAnalysisEffSE::ProcessEventESD(AliRsnPairDef *pairDef)
198 // Process current event with the definitions of the specified step in MC list
199 // and store results in the container slot defined in second argument.
200 // It is associated with the AliCFContainer with the name of the pair.
203 AliStack *stack = fRsnEvent.GetRefMCESD()->Stack();
204 AliESDEvent *esd = fRsnEvent.GetRefESD();
205 AliMCEvent *mc = fRsnEvent.GetRefMCESD();
206 AliMCParticle *mother;
208 if (!pairDef) return;
209 AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName());
212 // get informations from pairDef
214 Int_t pdgD[2] = {0, 0};
215 Short_t chargeD[2] = {0, 0};
216 pdgM = pairDef->GetMotherPDG();
217 pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0));
218 pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1));
219 chargeD[0] = pairDef->GetChargeS(0);
220 chargeD[1] = pairDef->GetChargeS(1);
222 // other utility variables
223 Int_t first, j, ipart;
224 Int_t label[2] = { -1, -1};
225 Short_t charge[2] = {0, 0};
226 Short_t pairDefMatch[2] = { -1, -1};
227 Int_t esdIndex[2] = { -1, -1};
228 TParticle *part[2] = {0, 0};
230 // in this case, we first take the resonance from MC
231 // and then we find its daughters and compute cuts on them
232 for (ipart = 0; ipart < stack->GetNprimary(); ipart++) {
233 // take a track from the MC event
234 mother = (AliMCParticle*) fMCEvent->GetTrack(ipart);
236 // check that it is a binary decay and the PDG code matches
237 if (mother->Particle()->GetNDaughters() != 2) continue;
238 if (mother->Particle()->GetPdgCode() != pdgM) continue;
240 // store the labels of the two daughters
241 label[0] = mother->Particle()->GetFirstDaughter();
242 label[1] = mother->Particle()->GetLastDaughter();
244 // retrieve the particles and other stuff
245 // check if they match the order in the pairDef
246 for (j = 0; j < 2; j++) {
247 if (label[j] < 0) continue;
248 part[j] = stack->Particle(label[j]);
249 pdgD[j] = TMath::Abs(part[j]->GetPdgCode());
250 charge[j] = (Short_t)(part[j]->GetPDG()->Charge() / 3);
251 if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeS(0))
253 else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeS(1))
256 pairDefMatch[j] = -1;
258 // find corresponding ESD particle: first try rejecting fakes,
259 // and in case of failure, try accepting fakes
260 esdIndex[j] = FindESDtrack(label[j], esd, kTRUE);
261 //TArrayI idx = FindESDtracks(label[j], esd);
262 //for (Int_t kk = 0; kk < idx.GetSize(); kk++) cout << "DAUGHTER " << j << " --> FOUND INDEX: " << idx[kk] << endl;
263 if (esdIndex[j] < 0) esdIndex[j] = FindESDtrack(label[j], esd, kFALSE);
264 //cout << "DAUGHTER " << j << " SINGLE FOUND INDEX = " << esdIndex[j] << endl;
267 // since each candidate good resonance is taken once, we must check
268 // that it matches the pair definition in any order, and reject in case
269 // in none of them the pair is OK
270 // anyway, we must associate the correct daughter to the correct data member
271 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) {
272 // 1st track --> 1st member of PairDef
273 fDaughter[0].SetRef(mc->GetTrack(label[0]));
274 fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[0]));
275 fDaughter[0].SetGood();
276 // 2nd track --> 2nd member of PairDef
277 fDaughter[1].SetRef(mc->GetTrack(label[1]));
278 fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[1]));
279 fDaughter[1].SetGood();
280 } else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) {
281 // 1st track --> 2nd member of PairDef
282 fDaughter[0].SetRef(mc->GetTrack(label[1]));
283 fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[1]));
284 fDaughter[0].SetGood();
285 // 2nd track --> 1st member of PairDef
286 fDaughter[1].SetRef(mc->GetTrack(label[0]));
287 fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[0]));
288 fDaughter[1].SetGood();
290 fDaughter[0].SetBad();
291 fDaughter[1].SetBad();
294 // reject the pair if the matching was unsuccessful
295 if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue;
297 // first, we set the internal AliRsnMother object to
298 // the MC particles and then operate the selections on MC
299 fPair.SetDaughter(0, &fDaughter[0]);
300 fPair.SetDaughter(1, &fDaughter[1]);
301 fPair.ComputeSum(pairDef->GetMass1(), pairDef->GetMass2());
302 FillContainer(cont, &fStepListMC, pairDef, 0);
304 // then, if both particles found a good match in the ESD
305 // reassociate the ESD tracks to the pair and fill ESD containers
306 if (esdIndex[0] < 0 || esdIndex[1] < 0) continue;
307 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) {
308 // 1st track --> 1st member of PairDef
309 fDaughter[0].SetRef(esd->GetTrack(esdIndex[0]));
310 // 2nd track --> 2nd member of PairDef
311 fDaughter[1].SetRef(esd->GetTrack(esdIndex[1]));
312 //cout << "****** MATCHING SCHEME 1" << endl;
313 } else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) {
314 // 1st track --> 2nd member of PairDef
315 fDaughter[0].SetRef(esd->GetTrack(esdIndex[1]));
316 // 2nd track --> 1st member of PairDef
317 fDaughter[1].SetRef(esd->GetTrack(esdIndex[0]));
318 //cout << "****** MATCHING SCHEME 2" << endl;
320 //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl;
321 // here we must remember how many steps were already filled
322 first = (Int_t)fStepListMC.GetEntries();
323 FillContainer(cont, &fStepListESD, pairDef, first);
327 //_____________________________________________________________________________
328 void AliRsnAnalysisEffSE::ProcessEventAOD(AliRsnPairDef *pairDef)
331 // Process current event with the definitions of the specified step in MC list
332 // and store results in the container slot defined in second argument.
333 // It is associated with the AliCFContainer with the name of the pair.
336 AliAODEvent *aod = fRsnEvent.GetRefAOD();
337 AliAODMCParticle *mother;
338 TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
339 if (!mcArray) return;
341 if (!pairDef) return;
342 AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName());
345 // get informations from pairDef
347 Int_t pdgD[2] = {0, 0};
348 Short_t chargeD[2] = {0, 0};
349 pdgM = pairDef->GetMotherPDG();
350 pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0));
351 pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1));
352 chargeD[0] = pairDef->GetChargeS(0);
353 chargeD[1] = pairDef->GetChargeS(1);
355 // other utility variables
357 Int_t label [2] = { -1, -1};
358 Short_t charge[2] = {0, 0};
359 Short_t pairDefMatch[2] = { -1, -1};
360 Int_t aodIndex[2] = { -1, -1};
361 AliAODMCParticle *part[2] = {0, 0};
363 // loop on MC particles
364 TObjArrayIter next(mcArray);
365 while ((mother = (AliAODMCParticle*)next())) {
366 // check that it is a binary decay and the PDG code matches
367 if (mother->GetNDaughters() != 2) continue;
368 if (mother->GetPdgCode() != pdgM) continue;
370 // store the labels of the two daughters
371 label[0] = mother->GetDaughter(0);
372 label[1] = mother->GetDaughter(1);
374 // retrieve the particles and other stuff
375 // check if they match the order in the pairDef
376 for (j = 0; j < 2; j++) {
377 if (label[j] < 0) continue;
378 part[j] = (AliAODMCParticle*)mcArray->At(label[j]);
379 pdgD[j] = TMath::Abs(part[j]->GetPdgCode());
380 charge[j] = (Short_t)(part[j]->Charge());
381 if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeS(0))
383 else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeS(1))
386 pairDefMatch[j] = -1;
388 // find corresponding ESD particle: first try rejecting fakes,
389 // and in case of failure, try accepting fakes
390 aodIndex[j] = FindAODtrack(label[j], aod, kTRUE);
391 if (aodIndex[j] < 0) aodIndex[j] = FindAODtrack(label[j], aod, kFALSE);
394 // since each candidate good resonance is taken once, we must check
395 // that it matches the pair definition in any order, and reject in case
396 // in none of them the pair is OK
397 // anyway, we must associate the correct daughter to the correct data member
398 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) {
399 // 1st track --> 1st member of PairDef
400 fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[0]));
401 fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[0]));
402 fDaughter[0].SetGood();
403 // 2nd track --> 2nd member of PairDef
404 fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[1]));
405 fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[1]));
406 fDaughter[1].SetGood();
407 } else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) {
408 // 1st track --> 2nd member of PairDef
409 fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[1]));
410 fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[1]));
411 fDaughter[0].SetGood();
412 // 2nd track --> 1st member of PairDef
413 fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[0]));
414 fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[0]));
415 fDaughter[1].SetGood();
417 fDaughter[0].SetBad();
418 fDaughter[1].SetBad();
421 // reject the pair if the matching was unsuccessful
422 if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue;
424 // first, we set the internal AliRsnMother object to
425 // the MC particles and then operate the selections on MC
426 fPair.SetDaughter(0, &fDaughter[0]);
427 fPair.SetDaughter(1, &fDaughter[1]);
428 fPair.ComputeSum(pairDef->GetMass1(), pairDef->GetMass2());
429 FillContainer(cont, &fStepListMC, pairDef, 0);
431 // then, if both particles found a good match in the AOD
432 // reassociate the AOD tracks to the pair and fill AOD containers
433 if (aodIndex[0] < 0 || aodIndex[1] < 0) continue;
434 if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) {
435 // 1st track --> 1st member of PairDef
436 fDaughter[0].SetRef(aod->GetTrack(aodIndex[0]));
437 // 2nd track --> 2nd member of PairDef
438 fDaughter[1].SetRef(aod->GetTrack(aodIndex[1]));
439 //cout << "****** MATCHING SCHEME 1" << endl;
440 } else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) {
441 // 1st track --> 2nd member of PairDef
442 fDaughter[0].SetRef(aod->GetTrack(aodIndex[1]));
443 // 2nd track --> 1st member of PairDef
444 fDaughter[1].SetRef(aod->GetTrack(aodIndex[0]));
445 //cout << "****** MATCHING SCHEME 2" << endl;
447 //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl;
448 // here we must remember how many steps were already filled
449 first = (Int_t)fStepListMC.GetEntries();
450 FillContainer(cont, &fStepListESD, pairDef, first);
454 //_____________________________________________________________________________
455 void AliRsnAnalysisEffSE::FillContainer(AliCFContainer *cont, const TObjArray *stepList, AliRsnPairDef *pd, Int_t firstOutStep)
458 // Fill the containers
461 Int_t iaxis, nAxes = fAxisList.GetEntries();
462 Int_t istep, nSteps = stepList->GetEntries();
465 // set daughters to pair
466 fPair.SetDaughter(0, &fDaughter[0]);
467 fPair.SetDaughter(1, &fDaughter[1]);
468 fPair.ComputeSum(pd->GetMass1(), pd->GetMass2());
470 // compute values for all axes
471 for (iaxis = 0; iaxis < nAxes; iaxis++) {
472 AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
474 switch (fcnAxis->GetTargetType()) {
475 case AliRsnTarget::kMother:
476 fcnAxis->SetSupportObject(pd);
477 computeOK = fcnAxis->Eval(&fPair);
479 case AliRsnTarget::kEvent:
480 computeOK = fcnAxis->Eval(&fRsnEvent);
483 AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", fcnAxis->GetName(), fcnAxis->GetTargetTypeName()));
486 if (computeOK) fVar[iaxis] = ((Float_t)fcnAxis->GetComputedValue());
490 for (istep = 0; istep < nSteps; istep++) {
491 AliRsnCutManager *cutMgr = (AliRsnCutManager*)stepList->At(istep);
492 if (!cutMgr->PassCommonDaughterCuts(&fDaughter[0])) break;
493 if (!cutMgr->PassCommonDaughterCuts(&fDaughter[1])) break;
494 if (!cutMgr->PassDaughter1Cuts(&fDaughter[0])) break;
495 if (!cutMgr->PassDaughter2Cuts(&fDaughter[1])) break;
496 if (!cutMgr->PassMotherCuts(&fPair)) break;
497 //cout << "**************************************** FILLING STEP " << istep << endl;
498 cont->Fill(fVar.GetArray(), istep + firstOutStep);
502 //_____________________________________________________________________________
503 void AliRsnAnalysisEffSE::RsnTerminate(Option_t*)
507 // Could be added some monitor histograms here.
510 AliDebug(AliLog::kDebug + 2, "<-");
511 AliDebug(AliLog::kDebug + 2, "->");
514 //_____________________________________________________________________________
515 void AliRsnAnalysisEffSE::AddPairDef(AliRsnPairDef* pairDef)
518 // Adds pair definition
520 fPairDefList.AddLast(pairDef);
523 //_____________________________________________________________________________
524 Int_t AliRsnAnalysisEffSE::FindESDtrack(Int_t label, AliESDEvent *esd, Bool_t rejectFakes)
527 // Finds in the ESD a track whose label corresponds to that in argument.
528 // When global tracks are enabled, tries first to find a global track
529 // satisfying that requirement.
530 // If no global tracks are found, if ITS-SA are enable, tries to search among them
531 // otherwise return a negative number.
532 // If global tracks are disabled, search only among ITS SA
536 Int_t ntracks = esd->GetNumberOfTracks();
541 // loop for global tracks
543 for (i = 0; i < ntracks; i++) {
544 AliESDtrack *track = esd->GetTrack(i);
545 status = (ULong_t)track->GetStatus();
546 isTPC = ((status & AliESDtrack::kTPCin) != 0);
547 if (!isTPC) continue;
549 // check that label match
550 if (TMath::Abs(track->GetLabel()) != label) continue;
552 // if required, reject fakes
553 if (rejectFakes && track->GetLabel() < 0) continue;
555 // if all checks are passed and we are searching among global
556 // this means that thie track is a global one with the right label
557 // then, the return value is set to this, and returned
562 // loop for ITS-SA tracks (this happens only if no global tracks were found
563 // or searching among globals is disabled)
565 for (i = 0; i < ntracks; i++) {
566 AliESDtrack *track = esd->GetTrack(i);
567 status = (ULong_t)track->GetStatus();
568 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
569 if (!isITSSA) continue;
571 // check that label match
572 if (TMath::Abs(track->GetLabel()) != label) continue;
574 // if required, reject fakes
575 if (rejectFakes && track->GetLabel() < 0) continue;
577 // if all checks are passed and we are searching among global
578 // this means that thie track is a global one with the right label
579 // then, the return value is set to this, and returned
584 // if we reach this point, no match were found
588 //_____________________________________________________________________________
589 TArrayI AliRsnAnalysisEffSE::FindESDtracks(Int_t label, AliESDEvent *esd)
592 // Finds in the ESD a track whose label corresponds to that in argument.
593 // When global tracks are enabled, tries first to find a global track
594 // satisfying that requirement.
595 // If no global tracks are found, if ITS-SA are enable, tries to search among them
596 // otherwise return a negative number.
597 // If global tracks are disabled, search only among ITS SA
601 Int_t ntracks = esd->GetNumberOfTracks();
608 // loop for global tracks
610 for (i = 0; i < ntracks; i++) {
611 AliESDtrack *track = esd->GetTrack(i);
612 status = (ULong_t)track->GetStatus();
613 isTPC = ((status & AliESDtrack::kTPCin) != 0);
614 if (!isTPC) continue;
616 // check that label match
617 if (TMath::Abs(track->GetLabel()) != label) continue;
623 // loop for ITS-SA tracks (this happens only if no global tracks were found
624 // or searching among globals is disabled)
626 for (i = 0; i < ntracks; i++) {
627 AliESDtrack *track = esd->GetTrack(i);
628 status = (ULong_t)track->GetStatus();
629 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
630 if (!isITSSA) continue;
632 // check that label match
633 if (TMath::Abs(track->GetLabel()) != label) continue;
643 //_____________________________________________________________________________
644 Int_t AliRsnAnalysisEffSE::FindAODtrack(Int_t label, AliAODEvent *aod, Bool_t rejectFakes)
647 // Finds in the ESD a track whose label corresponds to that in argument.
648 // When global tracks are enabled, tries first to find a global track
649 // satisfying that requirement.
650 // If no global tracks are found, if ITS-SA are enable, tries to search among them
651 // otherwise return a negative number.
652 // If global tracks are disabled, search only among ITS SA
656 Int_t ntracks = aod->GetNumberOfTracks();
661 // loop for global tracks
663 for (i = 0; i < ntracks; i++) {
664 AliAODTrack *track = aod->GetTrack(i);
665 status = (ULong_t)track->GetStatus();
666 isTPC = ((status & AliESDtrack::kTPCin) != 0);
667 if (!isTPC) continue;
669 // check that label match
670 if (TMath::Abs(track->GetLabel()) != label) continue;
672 // if required, reject fakes
673 if (rejectFakes && track->GetLabel() < 0) continue;
675 // if all checks are passed and we are searching among global
676 // this means that thie track is a global one with the right label
677 // then, the return value is set to this, and returned
682 // loop for ITS-SA tracks (this happens only if no global tracks were found
683 // or searching among globals is disabled)
685 for (i = 0; i < ntracks; i++) {
686 AliAODTrack *track = aod->GetTrack(i);
687 status = (ULong_t)track->GetStatus();
688 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
689 if (!isITSSA) continue;
691 // check that label match
692 if (TMath::Abs(track->GetLabel()) != label) continue;
694 // if required, reject fakes
695 if (rejectFakes && track->GetLabel() < 0) continue;
697 // if all checks are passed and we are searching among global
698 // this means that thie track is a global one with the right label
699 // then, the return value is set to this, and returned
704 // if we reach this point, no match were found
708 //_____________________________________________________________________________
709 TArrayI AliRsnAnalysisEffSE::FindAODtracks(Int_t label, AliAODEvent *aod)
712 // Finds in the ESD a track whose label corresponds to that in argument.
713 // When global tracks are enabled, tries first to find a global track
714 // satisfying that requirement.
715 // If no global tracks are found, if ITS-SA are enable, tries to search among them
716 // otherwise return a negative number.
717 // If global tracks are disabled, search only among ITS SA
721 Int_t ntracks = aod->GetNumberOfTracks();
728 // loop for global tracks
730 for (i = 0; i < ntracks; i++) {
731 AliAODTrack *track = aod->GetTrack(i);
732 status = (ULong_t)track->GetStatus();
733 isTPC = ((status & AliESDtrack::kTPCin) != 0);
734 if (!isTPC) continue;
736 // check that label match
737 if (TMath::Abs(track->GetLabel()) != label) continue;
743 // loop for ITS-SA tracks (this happens only if no global tracks were found
744 // or searching among globals is disabled)
746 for (i = 0; i < ntracks; i++) {
747 AliAODTrack *track = aod->GetTrack(i);
748 status = (ULong_t)track->GetStatus();
749 isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
750 if (!isITSSA) continue;
752 // check that label match
753 if (TMath::Abs(track->GetLabel()) != label) continue;
763 //______________________________________________________________________________
764 Bool_t AliRsnAnalysisEffSE::EventProcess()
767 // Customized event pre-processing.
768 // First checks if the current event passes all cuts,
769 // and if it does, updates the informations and then
770 // call the operations which are already defined in the
771 // omonyme function in mother class
774 // initially, an event is expected to be bad
775 fTaskInfo.SetEventUsed(kFALSE);
777 // check the event cuts and update the info data accordingly
778 // events not passing the cuts must be rejected
779 if (!fEventCuts.IsSelected(&fRsnEvent)) {
780 fTaskInfo.SetEventUsed(kFALSE);
784 // if we reach this point, cuts were passed;
785 // then additional operations can be done
787 // find leading particle (without any PID/momentum restriction)
788 fRsnEvent.SelectLeadingParticle(0);
790 // final return value is positive
791 // but call the mother class method which updates info object
792 fTaskInfo.SetEventUsed(kTRUE);
793 return AliRsnVAnalysisTaskSE::EventProcess();