2 // Class AliRsnLoopEffDaughter
4 // Inherits from basic AliRsnLoopEff for efficiency,
5 // and computed efficiencies for single-tracks
6 // using cut set definitions.
8 // author: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
13 #include "AliRsnDaughterDef.h"
14 #include "AliRsnCutSet.h"
16 #include "AliRsnLoopEffDaughter.h"
18 ClassImp(AliRsnLoopEffDaughter)
20 //_____________________________________________________________________________
21 AliRsnLoopEffDaughter::AliRsnLoopEffDaughter(const char *name, AliRsnDaughterDef *def) :
26 // Default constructor.
27 // Do not repeat 'DefineOutput' since it is done in base class and we don't add new ones.
31 //_____________________________________________________________________________
32 AliRsnLoopEffDaughter::AliRsnLoopEffDaughter(const AliRsnLoopEffDaughter ©) :
41 //_____________________________________________________________________________
42 AliRsnLoopEffDaughter &AliRsnLoopEffDaughter::operator=(const AliRsnLoopEffDaughter ©)
45 // Assignment operator.
46 // Owned data members are meaningless for this operator.
49 AliRsnLoopEff::operator=(copy);
57 //_____________________________________________________________________________
58 Bool_t AliRsnLoopEffDaughter::OkStepMC(TObject *target, Int_t istep)
64 AliRsnCutSet *cuts = (AliRsnCutSet *)fStepsMC[istep];
65 return cuts->IsSelected(target);
68 //_____________________________________________________________________________
69 Bool_t AliRsnLoopEffDaughter::OkStepRec(TObject *target, Int_t istep)
75 AliRsnCutSet *cuts = (AliRsnCutSet *)fStepsRec[istep];
76 return cuts->IsSelected(target);
79 //_____________________________________________________________________________
80 Int_t AliRsnLoopEffDaughter::ProcessEventESD(AliRsnEvent *rsn)
83 // Process current event with the definitions of the specified step in MC list
84 // and store results in the container slot defined in second argument.
85 // It is associated with the AliCFContainer with the name of the pair.
88 AliESDEvent *esd = rsn->GetRefESD();
89 AliMCEvent *mc = rsn->GetRefMCESD();
91 Int_t imax, istep, icheck, itrack, ipart;
92 Int_t nsteps = NSteps();
94 static AliRsnDaughter daughter;
95 daughter.SetOwnerEvent(rsn);
97 // loop on the MC list of particles
98 for (ipart = 0; ipart < stack->GetNprimary(); ipart++) {
101 daughter.SetRefMC((AliMCParticle *)mc->GetTrack(ipart));
103 // search for reconstructed track
104 // if no tracks are found with that label, rec ref is set to zero
105 // if more than one tracks are found we use the one which passes
107 indexes = FindTracks(ipart, esd);
108 if (indexes.GetSize() < 1)
109 daughter.SetRef(0x0);
110 else if (indexes.GetSize() == 1)
111 daughter.SetRef(esd->GetTrack(indexes[0]));
113 imax = istep = itrack = 0;
114 for (icheck = 0; icheck < indexes.GetSize(); icheck++) {
115 daughter.SetRef(esd->GetTrack(indexes[icheck]));
116 daughter.SetMass(def->GetMass());
117 istep = NGoodSteps(&daughter);
118 if (istep > imax) itrack = icheck;
120 daughter.SetRef(esd->GetTrack(indexes[itrack]));
124 daughter.SetMass(def->GetMass());
127 for (istep = 0; istep < nsteps; istep++) {
128 if (!OkStep(&daughter, istep)) break;
129 GetOutput()->Fill(&daughter, istep);
134 //_____________________________________________________________________________
135 Int_t AliRsnLoopEffDaughter::ProcessEventAOD(AliRsnEvent *rsn)
138 // Process current event with the definitions of the specified step in MC list
139 // and store results in the container slot defined in second argument.
140 // It is associated with the AliCFContainer with the name of the pair.
143 AliAODEvent *aod = fRsnEvent[0].GetRefAOD();
144 TClonesArray *mcArray = (TClonesArray *)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
145 if (!mcArray) return;
147 Int_t imax, istep, icheck, itrack, ipart;
149 static AliRsnDaughter daughter;
150 daughter->SetOwnerEvent(rsn);
152 // loop on the MC list of particles
153 TObjArrayIter next(mcArray);
154 AliAODMCParticle *particle;
155 while ((particle = (AliAODMCParticle *)next())) {
158 daughter.SetRefMC(particle);
160 // search for reconstructed track
161 // if no tracks are found with that label, rec ref is set to zero
162 // if more than one tracks are found we use the one which passes
164 ipart = particle->GetLabel();
165 indexes = FindTracks(ipart, aod);
166 if (indexes.GetSize() < 1)
167 daughter.SetRef(0x0);
168 else if (indexes.GetSize() == 1)
169 daughter.SetRef(aod->GetTrack(indexes[0]));
171 imax = istep = itrack = 0;
172 for (icheck = 0; icheck < indexes.GetSize(); icheck++) {
173 daughter.SetRef(aod->GetTrack(indexes[icheck]));
174 daughter.SetMass(def->GetMass());
175 istep = NGoodSteps();
181 daughter.SetRef(aod->GetTrack(indexes[itrack]));
185 daughter.SetMass(def->GetMass());
188 for (istep = 0; istep < nsteps; istep++) {
189 if (!OkStep(&daughter, istep)) break;
190 GetOutput()->Fill(&daughter, istep);