AliPhysics  9b6b435 (9b6b435)
AliEmcalContainer.h
Go to the documentation of this file.
1 /************************************************************************************
2  * Copyright (C) 2016, Copyright Holders of the ALICE Collaboration *
3  * All rights reserved. *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions are met: *
7  * * Redistributions of source code must retain the above copyright *
8  * notice, this list of conditions and the following disclaimer. *
9  * * Redistributions in binary form must reproduce the above copyright *
10  * notice, this list of conditions and the following disclaimer in the *
11  * documentation and/or other materials provided with the distribution. *
12  * * Neither the name of the <organization> nor the *
13  * names of its contributors may be used to endorse or promote products *
14  * derived from this software without specific prior written permission. *
15  * *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19  * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26  ************************************************************************************/
30 
31 #ifndef ALIEMCALCONTAINER_H
32 #define ALIEMCALCONTAINER_H
33 
34 class TLorentzVector;
35 class AliTLorentzVector;
36 class AliVEvent;
37 class AliNamedArrayI;
38 class AliVParticle;
39 
40 #include <TNamed.h>
41 #include <TClonesArray.h>
42 
43 #if !(defined(__CINT__) || defined(__MAKECINT__))
46 #endif
47 
101 class AliEmcalContainer : public TObject {
102  public:
108  // General
109  kNullObject = 1<<0,
110  kPtCut = 1<<1,
111  kAcceptanceCut = 1<<2,
112  kMCLabelCut = 1<<3,
113  kBitMapCut = 1<<4,
114  kHFCut = 1<<5,
115  // leave bit 6 free for future implementations
116 
117  // AliParticleContainer
119  kMCFlag = 1<<8,
121  kChargeCut = 1<<10,
123  // leave bit 12 free for future implementations
124 
125  // AliClusterContainer
126  kIsEMCalCut = 1<<13,
127  kTimeCut = 1<<14,
128  kEnergyCut = 1<<15,
129  kExoticCut = 1<<16,
130  // leave bit 17 free for future implementations
131 
132  // AliJetContainer
133  kAreaCut = 1<<18,
134  kAreaEmcCut = 1<<19,
135  kZLeadingChCut = 1<<20,
136  kZLeadingEmcCut = 1<<21,
137  kNEFCut = 1<<22,
138  kMinLeadPtCut = 1<<23,
139  kMaxTrackPtCut = 1<<24,
141  kFlavourCut = 1<<26,
142  kTagStatus = 1<<27,
145  };
146 
154 
164  AliEmcalContainer(const char *name);
165 
169  virtual ~AliEmcalContainer(){;}
170 
179  virtual TObject *operator[](int index) const = 0;
180 
192  virtual Bool_t ApplyKinematicCuts(const AliTLorentzVector& mom, UInt_t &rejectionReason) const;
193  TClonesArray *GetArray() const { return fClArray ; }
194  const TString& GetArrayName() const { return fClArrayName ; }
195  const TString& GetClassName() const { return fClassName ; }
196  TClass *GetClass() const { return fClArray == 0 ? 0 : fClArray->GetClass(); }
197  Double_t GetMinE() const { return fMinE ; }
198  Double_t GetMaxE() const { return fMaxE ; }
199  Double_t GetMinPt() const { return fMinPt ; }
200  Double_t GetMaxPt() const { return fMaxPt ; }
201  Double_t GetMinEta() const { return fMinEta ; }
202  Double_t GetMaxEta() const { return fMaxEta ; }
203  Double_t GetMinPhi() const { return fMinPhi ; }
204  Double_t GetMaxPhi() const { return fMaxPhi ; }
205  Double_t GetEtaSwing() const { return fMaxEta - fMinEta; }
206  Double_t GetPhiSwing() const { return fMaxPhi - fMinPhi; }
207  Double_t GetAcceptance() const { return GetEtaSwing() * GetPhiSwing(); }
208  Int_t GetCurrentID() const { return fCurrentID ; }
210 
216  Int_t GetIndexFromLabel(Int_t lab) const;
217 
218  Int_t GetNEntries() const { return fClArray ? fClArray->GetEntriesFast() : 0 ; }
219  virtual Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const = 0;
220  virtual Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const = 0;
221  virtual Bool_t GetNextMomentum(TLorentzVector &mom) = 0;
222  virtual Bool_t GetNextAcceptMomentum(TLorentzVector &mom) = 0;
223  virtual Bool_t AcceptObject(Int_t i, UInt_t &rejectionReason) const = 0;
224  virtual Bool_t AcceptObject(const TObject* obj, UInt_t &rejectionReason) const = 0;
225 
230  Int_t GetNAcceptEntries() const;
231 
241  void ResetCurrentID(Int_t i=-1) { fCurrentID = i ; }
242 
248  virtual void SetArray(const AliVEvent *event);
249  void SetArrayName(const char *n) { fClArrayName = n ; }
250  void SetVertex(Double_t *vtx) { memcpy(fVertex, vtx, sizeof(Double_t) * 3); }
251  void SetBitMap(UInt_t m) { fBitMap = m ; }
253  void SortArray() { fClArray->Sort() ; }
254 
255  TClass* GetLoadedClass() { return fLoadedClass ; }
256 
261  virtual void NextEvent(const AliVEvent *event);
262  void SetMinMCLabel(Int_t s) { fMinMCLabel = s ; }
263  void SetMaxMCLabel(Int_t s) { fMaxMCLabel = s ; }
264  void SetMCLabelRange(Int_t min, Int_t max) { SetMinMCLabel(min) ; SetMaxMCLabel(max) ; }
265  void SetELimits(Double_t min, Double_t max) { fMinE = min ; fMaxE = max ; }
266  void SetMinE(Double_t min) { fMinE = min ; }
267  void SetMaxE(Double_t max) { fMaxE = max ; }
268  void SetPtLimits(Double_t min, Double_t max) { fMinPt = min ; fMaxPt = max ; }
269  void SetMinPt(Double_t min) { fMinPt = min ; }
270  void SetMaxPt(Double_t max) { fMaxPt = max ; }
271  void SetEtaLimits(Double_t min, Double_t max) { fMaxEta = max ; fMinEta = min ; }
272  void SetPhiLimits(Double_t min, Double_t max) { fMaxPhi = max ; fMinPhi = min ; }
274  void SetClassName(const char *clname);
275 
283 
290  Bool_t GetIsEmbedding() const { return fIsEmbedding; }
291 
292  const char* GetName() const { return fName.Data() ; }
293 
298  void SetName(const char* n) { fName = n ; }
299 
306  static Double_t RelativePhi(Double_t ang1, Double_t ang2);
307 
315  static Bool_t SamePart(const AliVParticle* part1, const AliVParticle* part2, Double_t dist = 1.e-4);
316 
322  static UShort_t GetRejectionReasonBitPosition(UInt_t rejectionReason);
323 
324 #if !(defined(__CINT__) || defined(__MAKECINT__))
325 
330  const AliEmcalIterableContainer all() const;
331 
337  const AliEmcalIterableContainer accepted() const;
338 
345 
352 #endif
353 
354  protected:
365  virtual TString GetDefaultArrayName(const AliVEvent * const ev) const { return ""; }
366 
373  void GetVertexFromEvent(const AliVEvent * event);
374 
392  TClonesArray *fClArray;
396  TClass *fLoadedClass;
397 
398  private:
400 
401  AliEmcalContainer(const AliEmcalContainer& obj); // copy constructor
402  AliEmcalContainer& operator=(const AliEmcalContainer& other); // assignment
403 
404  ClassDef(AliEmcalContainer,9);
405 };
406 #endif
particle not in acceptance in and/or
virtual Bool_t ApplyKinematicCuts(const AliTLorentzVector &mom, UInt_t &rejectionReason) const
Apply kinematical selection to the momentum vector provided.
void SetMassHypothesis(Double_t m)
const AliEmcalIterableContainer all() const
Create an iterable container interface over all objects in the EMCAL container.
Int_t GetNAcceptEntries() const
Count accepted entries in the container.
virtual Bool_t GetNextMomentum(TLorentzVector &mom)=0
double Double_t
Definition: External.C:58
Double_t fMinE
Max. cut on particle energy.
Double_t GetAcceptance() const
EMCALIterableContainer::AliEmcalIterableContainerT< TObject, EMCALIterableContainer::operator_star_pair< TObject > > AliEmcalIterableMomentumContainer
Double_t fMinPhi
Min. cut on particle .
Bool_t fIsEmbedding
if true, this container will connect to an external event
Cut on the z of the leading particle in the EMCAL.
Double_t fMaxE
Min. cut on particle energy.
Double_t GetMinPhi() const
void SetName(const char *n)
Set the name of the class of the objets inside the underlying array.
Double_t GetPhiSwing() const
Int_t GetIndexFromLabel(Int_t lab) const
Get the index in the container from a given label.
Cut on the jet area in the EMCAL.
void SetMinE(Double_t min)
Double_t GetMaxEta() const
void SetMaxE(Double_t max)
virtual ~AliEmcalContainer()
Destructor.
static Double_t RelativePhi(Double_t ang1, Double_t ang2)
Calculates the relative phi between two angle values and returns it in [-Pi, +Pi] range...
UInt_t fBitMap
bitmap mask
Double_t GetEtaSwing() const
TString fClassName
name of the class in the TClonesArray
void SetMinPt(Double_t min)
Track too close to the TPC sector boundary.
static UShort_t GetRejectionReasonBitPosition(UInt_t rejectionReason)
Returns the highest bit in the rejection map as reason why the object was rejected.
Double_t fMinPt
Min. cut on particle .
void SetArrayName(const char *n)
void SetEtaLimits(Double_t min, Double_t max)
void SetVertex(Double_t *vtx)
TClass * fLoadedClass
! Class of the objects contained in the TClonesArray
Cell time cut not passed.
virtual void NextEvent(const AliVEvent *event)
Preparation for the next event.
void SetMCLabelRange(Int_t min, Int_t max)
const TString & GetClassName() const
Cut on flavour content in the jet.
void SetIsEmbedding(Bool_t b)
Set embedding status.
Bool_t fIsParticleLevel
whether or not it is a particle level object collection
Cluster is exotic cluster.
virtual Bool_t AcceptObject(Int_t i, UInt_t &rejectionReason) const =0
TString fName
object name
Double_t GetMaxPhi() const
Energy below threshold.
int Int_t
Definition: External.C:63
void SetBitMap(UInt_t m)
Double_t GetMinEta() const
unsigned int UInt_t
Definition: External.C:33
Double_t GetMinE() const
Double_t GetMinPt() const
const AliEmcalIterableMomentumContainer accepted_momentum() const
Create an iterable container interface over accepted objects in the EMCAL container.
Int_t GetCurrentID() const
EMCALIterableContainer::AliEmcalIterableContainerT< TObject, EMCALIterableContainer::operator_star_object< TObject > > AliEmcalIterableContainer
Bool_t GetIsEmbedding() const
Get embedding status.
Double_t fMaxPhi
Max. cut on particle .
Cut on the z of the leading charged constituent.
TClass * GetClass() const
virtual TObject * operator[](int index) const =0
Index operator.
Base class for container structures within the EMCAL framework.
void SetMaxPt(Double_t max)
void SetMinMCLabel(Int_t s)
virtual Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const =0
TClonesArray * GetArray() const
RejectionReason
Bit definition for the reason a particle was rejected.
Container implementing iterable functionality of the EMCAL containers.
Track did not pass the hybrid track cuts.
AliNamedArrayI * fLabelMap
! Label-Index map
void SetPtLimits(Double_t min, Double_t max)
void SetClassName(const char *clname)
Int_t fMinMCLabel
minimum MC label
const TString & GetArrayName() const
Double_t fMassHypothesis
if < 0 it will use a PID mass when available
Cut on jet tag status.
Cluster not in the EMCAL.
Double_t fVertex[3]
! event vertex array
const char * GetName() const
Double_t fMaxPt
Max. cut on particle .
AliEmcalContainer & operator=(const AliEmcalContainer &other)
void SetMaxMCLabel(Int_t s)
Cut on the minimum of the leading particle.
Cut on the neutral energy fraction.
static Bool_t SamePart(const AliVParticle *part1, const AliVParticle *part2, Double_t dist=1.e-4)
Helper function to calculate the distance between two jets or a jet and a particle.
Cut on the regions of acceptance with bad sectors.
Double_t fMinEta
Min. cut on particle .
virtual Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const =0
void SetIsParticleLevel(Bool_t b)
virtual void SetArray(const AliVEvent *event)
void SetELimits(Double_t min, Double_t max)
Particle charge did not match.
TString fBaseClassName
name of the base class that this container can handle
TString fClArrayName
name of branch
Cut on the minimum number of constituents.
Int_t fMaxMCLabel
maximum MC label
unsigned short UShort_t
Definition: External.C:28
Double_t fMaxEta
Max. cut on particle .
const AliEmcalIterableContainer accepted() const
Create an iterable container interface over accepted objects in the EMCAL container.
void GetVertexFromEvent(const AliVEvent *event)
Retrieve the vertex from the given event.
Cut on the maximum cluster .
TClonesArray * fClArray
! Pointer to array in input event
Int_t GetNEntries() const
void SetPhiLimits(Double_t min, Double_t max)
virtual Bool_t GetNextAcceptMomentum(TLorentzVector &mom)=0
bool Bool_t
Definition: External.C:53
Cut on the maximum track .
Int_t fCurrentID
! current ID for automatic loops
Double_t GetMaxE() const
Double_t GetMaxPt() const
const AliEmcalIterableMomentumContainer all_momentum() const
Create an iterable container interface over all objects in the EMCAL container.
void ResetCurrentID(Int_t i=-1)
Reset the iterator to a given index.
Bool_t GetIsParticleLevel() const
virtual TString GetDefaultArrayName(const AliVEvent *const ev) const
Handling default Array names.
AliEmcalContainer()
Default constructor.