AliPhysics  e6d2b2b (e6d2b2b)
AliTrackContainer.h
Go to the documentation of this file.
1 /************************************************************************************
2  * Copyright (C) 2017, 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  ************************************************************************************/
27 #ifndef ALITRACKCONTAINER_H
28 #define ALITRACKCONTAINER_H
29 
30 class AliVEvent;
31 class AliVParticle;
32 class AliVCuts;
34 
35 #include <map>
36 
37 #include <TArrayC.h>
38 
39 #include "AliVTrack.h"
40 #include "AliEmcalTrackSelection.h"
42 #include "AliParticleContainer.h"
43 
44 #if !(defined(__CINT__) || defined(__MAKECINT__))
47 #endif
48 
57  public:
58 
69  class TrackOwnerHandler : public TObject {
70  public:
72  TrackOwnerHandler(TObjArray *managedobject, Bool_t ownership);
75  virtual ~TrackOwnerHandler();
76 
77  void SetObject(TObjArray *obj);
78  void SetOwner(Bool_t owner);
79 
80  TObjArray *GetData() const { return fManagedObject; }
81  Bool_t IsOwner() const { return fOwnership; }
82 
85 
86  private:
89 
91  ClassDef(TrackOwnerHandler, 1);
93  };
94 
96 
98  static const std::map <std::string, AliEmcalTrackSelection::ETrackFilterType_t> fgkTrackFilterTypeMap;
99 
105  kRejected = -1,
111  };
112 
114  AliTrackContainer(const char *name, const char *period = "");
115  virtual ~AliTrackContainer(){;}
116 
117  virtual Bool_t ApplyTrackCuts(const AliVTrack* vp, UInt_t &rejectionReason) const;
118  virtual Bool_t AcceptObject(Int_t i, UInt_t &rejectionReason) const { return AcceptTrack(i, rejectionReason) ; }
119  virtual Bool_t AcceptObject(const TObject* obj, UInt_t &rejectionReason) const { return AcceptTrack(dynamic_cast<const AliVTrack*>(obj), rejectionReason); }
120  virtual Bool_t AcceptParticle(Int_t i, UInt_t &rejectionReason) const { return AcceptTrack(i, rejectionReason); }
121  virtual Bool_t AcceptParticle(const AliVParticle* vp, UInt_t &rejectionReason) const { return AcceptTrack(dynamic_cast<const AliVTrack*>(vp), rejectionReason); }
122  virtual AliVParticle *GetParticle(Int_t i=-1) const { return GetTrack(i) ; }
123  virtual AliVParticle *GetAcceptParticle(Int_t i=-1) const { return GetAcceptTrack(i) ; }
124  virtual AliVParticle *GetNextAcceptParticle() { return GetNextAcceptTrack() ; }
125  virtual AliVParticle *GetNextParticle() { return GetNextTrack() ; }
126  virtual Bool_t AcceptTrack(const AliVTrack* vp, UInt_t &rejectionReason) const;
127  virtual Bool_t AcceptTrack(Int_t i, UInt_t &rejectionReason) const;
128  virtual AliVTrack *GetLeadingTrack(const char* opt="") { return static_cast<AliVTrack*>(GetLeadingParticle(opt)); }
129  virtual AliVTrack *GetTrack(Int_t i=-1) const;
130  virtual AliVTrack *GetAcceptTrack(Int_t i=-1) const;
131  virtual AliVTrack *GetNextAcceptTrack() ;
132  virtual AliVTrack *GetNextTrack() ;
133  Char_t GetTrackType(const AliVTrack* track) const;
134  virtual Bool_t GetMomentumFromTrack(TLorentzVector &mom, const AliVTrack* track, Double_t mass) const;
135  virtual Bool_t GetMomentumFromTrack(TLorentzVector &mom, const AliVTrack* track) const;
136  virtual Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const;
137  virtual Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const;
138  virtual Bool_t GetNextMomentum(TLorentzVector &mom);
139  virtual Bool_t GetNextAcceptMomentum(TLorentzVector &mom);
140  Int_t GetNTracks() const { return GetNParticles() ; }
142  ETrackFilterType_t GetTrackFilterType() const { return fTrackFilterType; }
143  Char_t GetTrackType(Int_t i) const { return i >= 0 && i < fTrackTypes.GetSize() ? fTrackTypes[i] : (Char_t)kUndefined ; }
144 
145  void SetArray(const AliVEvent *event);
146 
147  void SetTrackFilterType(ETrackFilterType_t f) { fTrackFilterType = f; }
150 
151  void SetTrackCutsPeriod(const char* period) { fTrackCutsPeriod = period; }
152  void AddTrackCuts(AliVCuts *cuts);
154  AliVCuts *GetTrackCuts(Int_t icut);
155  void SetAODFilterBits(UInt_t bits) { fAODFilterBits = bits ; }
156  void AddAODFilterBit(UInt_t bit) { fAODFilterBits |= bit ; }
159 
162 
163  void NextEvent(const AliVEvent* event);
164 
165  static void SetDefTrackCutsPeriod(const char* period) { fgDefTrackCutsPeriod = period; }
167 
168  const char* GetTitle() const;
169 
176 
177 #if !(defined(__CINT__) || defined(__MAKECINT__))
178  const AliTrackIterableContainer all() const;
179  const AliTrackIterableContainer accepted() const;
180 
183 #endif
184 
185  protected:
194  virtual TString GetDefaultArrayName(const AliVEvent * const ev) const;
195 
197 
199 
200  ETrackFilterType_t fTrackFilterType;
208  TArrayC fTrackTypes;
209 
210  private:
211  AliTrackContainer(const AliTrackContainer& obj); // copy constructor
212  AliTrackContainer& operator=(const AliTrackContainer& other); // assignment
213 
215  ClassDef(AliTrackContainer,1);
217 };
218 
219 #endif
220 
Interface for virtual track selection.
void SetTrackCutsPeriod(const char *period)
double Double_t
Definition: External.C:58
Int_t GetNTracks() const
static TString fgDefTrackCutsPeriod
! default period string used to generate track cuts
const AliTrackIterableContainer accepted() const
Double_t mass
TrackOwnerHandler & operator=(const TrackOwnerHandler &other)
Int_t GetNParticles() const
Container with name, TClonesArray and cuts for particles.
EMCALIterableContainer::AliEmcalIterableContainerT< AliVTrack, EMCALIterableContainer::operator_star_object< AliVTrack > > AliTrackIterableContainer
virtual Bool_t AcceptParticle(const AliVParticle *vp, UInt_t &rejectionReason) const
char Char_t
Definition: External.C:18
UInt_t fAODFilterBits
track filter bits
void NextEvent(const AliVEvent *event)
Structure containing the result of a given track selection step.
const AliTrackIterableContainer all() const
void ReceiveOwnershipFrom(TrackOwnerHandler &source)
AliVCuts * GetTrackCuts(Int_t icut)
Bool_t CheckArrayConsistency() const
Test function checking whether the entries in the track array are the same as in the input array...
virtual Bool_t GetNextMomentum(TLorentzVector &mom)
Char_t GetTrackType(Int_t i) const
AliEmcalTrackSelection * fEmcalTrackSelection
! track selection object
virtual Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const
ETrackFilterType_t fTrackFilterType
track filter type
TString fTrackCutsPeriod
period string used to generate track cuts
Container for particles within the EMCAL framework.
Track selected under the constrained hybrid track cuts without ITS refit.
UInt_t GetAODFilterBits() const
PWG::EMCAL::AliEmcalTrackSelResultHybrid::HybridType_t GetHybridDefinition(const PWG::EMCAL::AliEmcalTrackSelResultPtr &selectionResult) const
Bool_t fITSHybridTrackDistinction
Distinct hybrid tracks via SPD information.
void SetITSHybridTrackDistinction(Bool_t doUse)
virtual Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const
virtual Bool_t GetMomentumFromTrack(TLorentzVector &mom, const AliVTrack *track, Double_t mass) const
ETrackType_t
Status of a track after track selection.
virtual Bool_t AcceptParticle(Int_t i, UInt_t &rejectionReason) const
void SetAODFilterBits(UInt_t bits)
TrackOwnerHandler fFilteredTracks
! tracks filtered using fEmcalTrackSelection
virtual Bool_t ApplyTrackCuts(const AliVTrack *vp, UInt_t &rejectionReason) const
virtual AliVParticle * GetAcceptParticle(Int_t i=-1) const
int Int_t
Definition: External.C:63
TObjArray * fManagedObject
Object managed by the handler.
virtual AliVParticle * GetParticle(Int_t i=-1) const
unsigned int UInt_t
Definition: External.C:33
EMCALIterableContainer::AliEmcalIterableContainerT< AliVTrack, EMCALIterableContainer::operator_star_pair< AliVTrack > > AliTrackIterableMomentumContainer
virtual Bool_t AcceptTrack(const AliVTrack *vp, UInt_t &rejectionReason) const
Int_t GetNumberOfCutObjects() const
static void SetDefTrackCutsPeriod(const char *period)
void SetFilterHybridTracks(Bool_t f)
virtual AliVParticle * GetLeadingParticle(const char *opt="")
static TString GetDefTrackCutsPeriod()
TArrayC fTrackTypes
! track types
TObjArray * fListOfCuts
list of track cut objects
void AddAODFilterBit(UInt_t bit)
virtual AliVParticle * GetNextParticle()
ETrackFilterType_t GetTrackFilterType() const
static const std::map< std::string, AliEmcalTrackSelection::ETrackFilterType_t > fgkTrackFilterTypeMap
Relates string to the track filter enumeration for YAML configuration.
virtual AliVTrack * GetNextTrack()
virtual ~AliTrackContainer()
virtual Bool_t AcceptObject(const TObject *obj, UInt_t &rejectionReason) const
Bool_t fSelectionModeAny
accept track if any of the cuts is fulfilled
virtual AliVTrack * GetTrack(Int_t i=-1) const
Track selected under the global hybrid track cuts.
virtual AliVTrack * GetLeadingTrack(const char *opt="")
Bool_t fOwnership
Ownership implementation.
virtual AliVTrack * GetNextAcceptTrack()
AliEmcalTrackSelection::ETrackFilterType_t ETrackFilterType_t
Char_t GetTrackType(const AliVTrack *track) const
void AddTrackCuts(AliVCuts *cuts)
ETrackFilterType_t
Pre-defined track filters.
virtual TString GetDefaultArrayName(const AliVEvent *const ev) const
void SetArray(const AliVEvent *event)
Track selected under the constrained hybrid track cuts (true constrained)
virtual AliVTrack * GetAcceptTrack(Int_t i=-1) const
Track selected under the constrained hybrid track cuts (fake constrained)
virtual Bool_t GetNextAcceptMomentum(TLorentzVector &mom)
const AliTrackIterableMomentumContainer accepted_momentum() const
const char * GetTitle() const
void SetTrackFilterType(ETrackFilterType_t f)
virtual AliVParticle * GetNextAcceptParticle()
bool Bool_t
Definition: External.C:53
void TransferOwnershipTo(TrackOwnerHandler &target)
Int_t GetNAcceptedParticles() const
Unique_ptr implementation for ROOT5 compatibility.
virtual Bool_t AcceptObject(Int_t i, UInt_t &rejectionReason) const
Track status undefined.
const AliTrackIterableMomentumContainer all_momentum() const
Bool_t IsHybridTrackSelection() const