15 #include <TClonesArray.h>
16 #include "AliVEvent.h"
19 #include "AliVParticle.h"
35 AliEmcalContainer::AliEmcalContainer():
40 fIsParticleLevel(kFALSE),
72 AliEmcalContainer::AliEmcalContainer(
const char *name):
77 fIsParticleLevel(kFALSE),
108 TObject *AliEmcalContainer::operator[](
int index)
const {
109 if(index >= 0 && index < GetNEntries())
return fClArray->At(index);
117 void AliEmcalContainer::SetClassName(
const char *clname)
120 if (cls.InheritsFrom(fBaseClassName)) {
124 AliError(Form(
"Unable to set class name %s for this container, it must inherits from %s!",clname,fBaseClassName.Data()));
133 void AliEmcalContainer::SetArray(
const AliVEvent *event)
136 if(fClArrayName ==
"usedefault"){
137 fClArrayName = GetDefaultArrayName(event);
146 if (!embedding)
return;
153 const AliVVertex *vertex =
event->GetPrimaryVertex();
154 if (vertex) vertex->GetXYZ(fVertex);
156 if (!fClArrayName.IsNull() && !fClArray) {
157 fClArray =
dynamic_cast<TClonesArray*
>(
event->FindListObject(fClArrayName));
159 AliError(Form(
"%s: Could not retrieve array with name %s!", GetName(), fClArrayName.Data()));
166 fLoadedClass = fClArray->GetClass();
168 if (!fClassName.IsNull()) {
169 if (!fLoadedClass->InheritsFrom(fClassName)) {
170 AliError(Form(
"%s: Objects of type %s in %s are not inherited from %s!",
171 GetName(), fLoadedClass->GetName(), fClArrayName.Data(), fClassName.Data()));
177 fLabelMap =
dynamic_cast<AliNamedArrayI*
>(
event->FindListObject(fClArrayName +
"_Map"));
184 Int_t AliEmcalContainer::GetNAcceptEntries()
const{
186 for(
int index = 0; index < GetNEntries(); index++){
187 UInt_t rejectionReason = 0;
188 if(AcceptObject(index, rejectionReason)) result++;
198 Int_t AliEmcalContainer::GetIndexFromLabel(
Int_t lab)
const
201 if (lab < fLabelMap->GetSize()) {
202 return fLabelMap->At(lab);
205 AliDebug(3,Form(
"%s_AliEmcalContainer::GetIndexFromLabel - Label not found in the map, returning -1...",fClArrayName.Data()));
210 AliDebug(3,Form(
"%s_AliEmcalContainer::GetIndexFromLabel - No index-label map found, returning label...",fClArrayName.Data()));
220 UShort_t AliEmcalContainer::GetRejectionReasonBitPosition(
UInt_t rejectionReason)
222 UInt_t rs = rejectionReason;
224 while (rs >>= 1) { p++; }
235 Bool_t AliEmcalContainer::SamePart(
const AliVParticle* part1,
const AliVParticle* part2,
Double_t dist)
237 if(!part1)
return kFALSE;
238 if(!part2)
return kFALSE;
239 Double_t dPhi = TMath::Abs(part1->Phi() - part2->Phi());
240 Double_t dEta = TMath::Abs(part1->Eta() - part2->Eta());
241 Double_t dpT = TMath::Abs(part1->Pt() - part2->Pt());
242 dPhi = TVector2::Phi_mpi_pi(dPhi);
243 if (dPhi > dist)
return kFALSE;
244 if (dEta > dist)
return kFALSE;
245 if (dpT > dist)
return kFALSE;
260 if (mom.Pt() < fMinPt || mom.Pt() > fMaxPt) {
261 rejectionReason |= kPtCut;
265 if (mom.E() < fMinE || mom.E() > fMaxE) {
266 rejectionReason |= kPtCut;
273 if (fMinEta < fMaxEta && (eta < fMinEta || eta > fMaxEta)) {
274 rejectionReason |= kAcceptanceCut;
278 if (fMinPhi < fMaxPhi && (phi < fMinPhi || phi > fMaxPhi)) {
279 rejectionReason |= kAcceptanceCut;
309 const AliEmcalIterableMomentumContainer AliEmcalContainer::all_momentum()
const {
310 return AliEmcalIterableMomentumContainer(
this,
false);
318 const AliEmcalIterableMomentumContainer AliEmcalContainer::accepted_momentum()
const {
319 return AliEmcalIterableMomentumContainer(
this,
true);
330 vphi = TVector2::Phi_0_2pi(vphi);
331 mphi = TVector2::Phi_0_2pi(mphi);
333 Double_t dphi = TVector2::Phi_mpi_pi(mphi - vphi);
Declaration of class AliTLorentzVector.
Declaration of class AliAnalysisTaskEmcalEmbeddingHelper.
AliVEvent * GetExternalEvent() const
Double_t Phi_0_2pi() const
Implementation of task to embed external events.
Container implementing iterable functionality of the EMCAL containers.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
static const AliAnalysisTaskEmcalEmbeddingHelper * GetInstance()