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& copy) :
41 //_____________________________________________________________________________
42 AliRsnLoopEffDaughter& AliRsnLoopEffDaughter::operator=(const AliRsnLoopEffDaughter& copy)
45 // Assignment operator.
46 // Owned data members are meaningless for this operator.
49 AliRsnLoopEff::operator=(copy);
55 //_____________________________________________________________________________
56 Bool_t AliRsnLoopEffDaughter::OkStepMC(TObject *target, Int_t istep)
62 AliRsnCutSet *cuts = (AliRsnCutSet*)fStepsMC[istep];
63 return cuts->IsSelected(target);
66 //_____________________________________________________________________________
67 Bool_t AliRsnLoopEffDaughter::OkStepRec(TObject *target, Int_t istep)
73 AliRsnCutSet *cuts = (AliRsnCutSet*)fStepsRec[istep];
74 return cuts->IsSelected(target);
77 //_____________________________________________________________________________
78 Int_t AliRsnLoopEffDaughter::ProcessEventESD(AliRsnEvent *rsn)
81 // Process current event with the definitions of the specified step in MC list
82 // and store results in the container slot defined in second argument.
83 // It is associated with the AliCFContainer with the name of the pair.
86 AliESDEvent *esd = rsn->GetRefESD();
87 AliMCEvent *mc = rsn->GetRefMCESD();
89 Int_t imax, istep, icheck, itrack, ipart;
90 Int_t nsteps = NSteps();
92 static AliRsnDaughter daughter;
93 daughter.SetOwnerEvent(rsn);
95 // loop on the MC list of particles
96 for (ipart = 0; ipart < stack->GetNprimary(); ipart++) {
99 daughter.SetRefMC((AliMCParticle*)mc->GetTrack(ipart));
101 // search for reconstructed track
102 // if no tracks are found with that label, rec ref is set to zero
103 // if more than one tracks are found we use the one which passes
105 indexes = FindTracks(ipart, esd);
106 if (indexes.GetSize() < 1)
107 daughter.SetRef(0x0);
108 else if (indexes.GetSize() == 1)
109 daughter.SetRef(esd->GetTrack(indexes[0]));
111 imax = istep = itrack = 0;
112 for (icheck = 0; icheck < indexes.GetSize(); icheck++) {
113 daughter.SetRef(esd->GetTrack(indexes[icheck]));
114 daughter.SetMass(def->GetMass());
115 istep = NGoodSteps(&daughter);
116 if (istep > imax) itrack = icheck;
118 daughter.SetRef(esd->GetTrack(indexes[itrack]));
122 daughter.SetMass(def->GetMass());
125 for (istep = 0; istep < nsteps; istep++) {
126 if (!OkStep(&daughter, istep)) break;
127 GetOutput()->Fill(&daughter, istep);
132 //_____________________________________________________________________________
133 Int_t AliRsnLoopEffDaughter::ProcessEventAOD(AliRsnEvent *rsn)
136 // Process current event with the definitions of the specified step in MC list
137 // and store results in the container slot defined in second argument.
138 // It is associated with the AliCFContainer with the name of the pair.
141 AliAODEvent *aod = fRsnEvent[0].GetRefAOD();
142 TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
143 if (!mcArray) return;
145 Int_t imax, istep, icheck, itrack, ipart;
147 static AliRsnDaughter daughter;
148 daughter->SetOwnerEvent(rsn);
150 // loop on the MC list of particles
151 TObjArrayIter next(mcArray);
152 AliAODMCParticle *particle;
153 while ((particle = (AliAODMCParticle*)next())) {
156 daughter.SetRefMC(particle);
158 // search for reconstructed track
159 // if no tracks are found with that label, rec ref is set to zero
160 // if more than one tracks are found we use the one which passes
162 ipart = particle->GetLabel();
163 indexes = FindTracks(ipart, aod);
164 if (indexes.GetSize() < 1)
165 daughter.SetRef(0x0);
166 else if (indexes.GetSize() == 1)
167 daughter.SetRef(aod->GetTrack(indexes[0]));
169 imax = istep = itrack = 0;
170 for (icheck = 0; icheck < indexes.GetSize(); icheck++) {
171 daughter.SetRef(aod->GetTrack(indexes[icheck]));
172 daughter.SetMass(def->GetMass());
173 istep = NGoodSteps();
179 daughter.SetRef(aod->GetTrack(indexes[itrack]));
183 daughter.SetMass(def->GetMass());
186 for (istep = 0; istep < nsteps; istep++) {
187 if (!OkStep(&daughter, istep)) break;
188 GetOutput()->Fill(&daughter, istep);