15 #include <TClonesArray.h>
16 #include "AliVEvent.h"
19 #include "AliVParticle.h"
33 AliEmcalContainer::AliEmcalContainer():
38 fIsParticleLevel(kFALSE),
69 AliEmcalContainer::AliEmcalContainer(
const char *name):
74 fIsParticleLevel(kFALSE),
104 TObject *AliEmcalContainer::operator[](
int index)
const {
105 if(index >= 0 && index < GetNEntries())
return fClArray->At(index);
113 void AliEmcalContainer::SetClassName(
const char *clname)
116 if (cls.InheritsFrom(fBaseClassName)) {
120 AliError(Form(
"Unable to set class name %s for this container, it must inherits from %s!",clname,fBaseClassName.Data()));
129 void AliEmcalContainer::SetArray(
const AliVEvent *event)
131 const AliVVertex *vertex =
event->GetPrimaryVertex();
132 if (vertex) vertex->GetXYZ(fVertex);
134 if (!fClArrayName.IsNull() && !fClArray) {
135 fClArray =
dynamic_cast<TClonesArray*
>(
event->FindListObject(fClArrayName));
137 AliError(Form(
"%s: Could not retrieve array with name %s!", GetName(), fClArrayName.Data()));
144 fLoadedClass = fClArray->GetClass();
146 if (!fClassName.IsNull()) {
147 if (!fLoadedClass->InheritsFrom(fClassName)) {
148 AliError(Form(
"%s: Objects of type %s in %s are not inherited from %s!",
149 GetName(), fLoadedClass->GetName(), fClArrayName.Data(), fClassName.Data()));
155 fLabelMap =
dynamic_cast<AliNamedArrayI*
>(
event->FindListObject(fClArrayName +
"_Map"));
162 Int_t AliEmcalContainer::GetNAcceptEntries()
const{
164 for(
int index = 0; index < GetNEntries(); index++){
165 UInt_t rejectionReason = 0;
166 if(AcceptObject(index, rejectionReason)) result++;
176 Int_t AliEmcalContainer::GetIndexFromLabel(
Int_t lab)
const
179 if (lab < fLabelMap->GetSize()) {
180 return fLabelMap->At(lab);
183 AliDebug(3,Form(
"%s_AliEmcalContainer::GetIndexFromLabel - Label not found in the map, returning -1...",fClArrayName.Data()));
188 AliDebug(3,Form(
"%s_AliEmcalContainer::GetIndexFromLabel - No index-label map found, returning label...",fClArrayName.Data()));
198 UShort_t AliEmcalContainer::GetRejectionReasonBitPosition(
UInt_t rejectionReason)
200 UInt_t rs = rejectionReason;
202 while (rs >>= 1) { p++; }
213 Bool_t AliEmcalContainer::SamePart(
const AliVParticle* part1,
const AliVParticle* part2,
Double_t dist)
215 if(!part1)
return kFALSE;
216 if(!part2)
return kFALSE;
217 Double_t dPhi = TMath::Abs(part1->Phi() - part2->Phi());
218 Double_t dEta = TMath::Abs(part1->Eta() - part2->Eta());
219 Double_t dpT = TMath::Abs(part1->Pt() - part2->Pt());
220 dPhi = TVector2::Phi_mpi_pi(dPhi);
221 if (dPhi > dist)
return kFALSE;
222 if (dEta > dist)
return kFALSE;
223 if (dpT > dist)
return kFALSE;
238 if (mom.Pt() < fMinPt || mom.Pt() > fMaxPt) {
239 rejectionReason |= kPtCut;
243 if (mom.E() < fMinE || mom.E() > fMaxE) {
244 rejectionReason |= kPtCut;
251 if (fMinEta < fMaxEta && (eta < fMinEta || eta > fMaxEta)) {
252 rejectionReason |= kAcceptanceCut;
256 if (fMinPhi < fMaxPhi && (phi < fMinPhi || phi > fMaxPhi)) {
257 rejectionReason |= kAcceptanceCut;
287 const AliEmcalIterableMomentumContainer AliEmcalContainer::all_momentum()
const {
288 return AliEmcalIterableMomentumContainer(
this,
false);
296 const AliEmcalIterableMomentumContainer AliEmcalContainer::accepted_momentum()
const {
297 return AliEmcalIterableMomentumContainer(
this,
true);
308 vphi = TVector2::Phi_0_2pi(vphi);
309 mphi = TVector2::Phi_0_2pi(mphi);
311 Double_t dphi = TVector2::Phi_mpi_pi(mphi - vphi);
Declaration of class AliTLorentzVector.
Double_t Phi_0_2pi() const
Container implementing iterable functionality of the EMCAL containers.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC