2 // Class AliRsnLoopEffDaughter
4 // Inherits from basic AliRsnLoopEff for efficiency,
5 // and computed efficiencies for single-tracks
7 // author: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
12 #include "AliRsnDaughterDef.h"
13 #include "AliRsnCutSet.h"
15 #include "AliRsnLoopEffDaughter.h"
17 ClassImp(AliRsnLoopEffDaughter)
19 //_____________________________________________________________________________
20 AliRsnLoopEffDaughter::AliRsnLoopEffDaughter(const char *name, AliRsnDaughterDef *def) :
25 // Default constructor.
26 // Do not repeat 'DefineOutput' since it is done in base class and we don't add new ones.
30 //_____________________________________________________________________________
31 AliRsnLoopEffDaughter::AliRsnLoopEffDaughter(const AliRsnLoopEffDaughter& copy) :
40 //_____________________________________________________________________________
41 AliRsnLoopEffDaughter& AliRsnLoopEffDaughter::operator=(const AliRsnLoopEffDaughter& copy)
44 // Assignment operator.
45 // Owned data members are meaningless for this operator.
48 AliRsnLoopEff::operator=(copy);
54 //_____________________________________________________________________________
55 Bool_t AliRsnLoopEffDaughter::OkStepMC(TObject *target, Int_t istep)
61 AliRsnCutSet *cuts = (AliRsnCutSet*)fStepsMC[istep];
62 return cuts->IsSelected(target);
65 //_____________________________________________________________________________
66 Bool_t AliRsnLoopEffDaughter::OkStepRec(TObject *target, Int_t istep)
72 AliRsnCutSet *cuts = (AliRsnCutSet*)fStepsRec[istep];
73 return cuts->IsSelected(target);
76 //_____________________________________________________________________________
77 Int_t AliRsnLoopEffDaughter::ProcessEventESD(AliRsnEvent *rsn)
80 // Process current event with the definitions of the specified step in MC list
81 // and store results in the container slot defined in second argument.
82 // It is associated with the AliCFContainer with the name of the pair.
85 AliESDEvent *esd = rsn->GetRefESD();
86 AliMCEvent *mc = rsn->GetRefMCESD();
88 Int_t imax, istep, icheck, itrack, ipart;
89 Int_t nsteps = NSteps();
91 static AliRsnDaughter daughter;
92 daughter.SetOwnerEvent(rsn);
94 // loop on the MC list of particles
95 for (ipart = 0; ipart < stack->GetNprimary(); ipart++) {
98 daughter.SetRefMC((AliMCParticle*)mc->GetTrack(ipart));
100 // search for reconstructed track
101 // if no tracks are found with that label, rec ref is set to zero
102 // if more than one tracks are found we use the one which passes
104 indexes = FindTracks(ipart, esd);
105 if (indexes.GetSize() < 1)
106 daughter.SetRef(0x0);
107 else if (indexes.GetSize() == 1)
108 daughter.SetRef(esd->GetTrack(indexes[0]));
110 imax = istep = itrack = 0;
111 for (icheck = 0; icheck < indexes.GetSize(); icheck++) {
112 daughter.SetRef(esd->GetTrack(indexes[icheck]));
113 daughter.SetMass(def->GetMass());
114 istep = NGoodSteps(&daughter);
115 if (istep > imax) itrack = icheck;
117 daughter.SetRef(esd->GetTrack(indexes[itrack]));
121 daughter.SetMass(def->GetMass());
124 for (istep = 0; istep < nsteps; istep++) {
125 if (!OkStep(&daughter, istep)) break;
126 GetOutput()->Fill(&daughter, istep);
131 //_____________________________________________________________________________
132 Int_t AliRsnLoopEffDaughter::ProcessEventAOD(AliRsnEvent *rsn)
135 // Process current event with the definitions of the specified step in MC list
136 // and store results in the container slot defined in second argument.
137 // It is associated with the AliCFContainer with the name of the pair.
140 AliAODEvent *aod = fRsnEvent[0].GetRefAOD();
141 TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
142 if (!mcArray) return;
144 Int_t imax, istep, icheck, itrack, ipart;
146 static AliRsnDaughter daughter;
147 daughter->SetOwnerEvent(rsn);
149 // loop on the MC list of particles
150 TObjArrayIter next(mcArray);
151 AliAODMCParticle *particle;
152 while ((particle = (AliAODMCParticle*)next())) {
155 daughter.SetRefMC(particle);
157 // search for reconstructed track
158 // if no tracks are found with that label, rec ref is set to zero
159 // if more than one tracks are found we use the one which passes
161 ipart = particle->GetLabel();
162 indexes = FindTracks(ipart, aod);
163 if (indexes.GetSize() < 1)
164 daughter.SetRef(0x0);
165 else if (indexes.GetSize() == 1)
166 daughter.SetRef(aod->GetTrack(indexes[0]));
168 imax = istep = itrack = 0;
169 for (icheck = 0; icheck < indexes.GetSize(); icheck++) {
170 daughter.SetRef(aod->GetTrack(indexes[icheck]));
171 daughter.SetMass(def->GetMass());
172 istep = NGoodSteps();
178 daughter.SetRef(aod->GetTrack(indexes[itrack]));
182 daughter.SetMass(def->GetMass());
185 for (istep = 0; istep < nsteps; istep++) {
186 if (!OkStep(&daughter, istep)) break;
187 GetOutput()->Fill(&daughter, istep);