AliPhysics  5403132 (5403132)
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,
110  };
111 
113  AliTrackContainer(const char *name, const char *period = "");
114  virtual ~AliTrackContainer(){;}
115 
116  virtual Bool_t ApplyTrackCuts(const AliVTrack* vp, UInt_t &rejectionReason) const;
117  virtual Bool_t AcceptObject(Int_t i, UInt_t &rejectionReason) const { return AcceptTrack(i, rejectionReason) ; }
118  virtual Bool_t AcceptObject(const TObject* obj, UInt_t &rejectionReason) const { return AcceptTrack(dynamic_cast<const AliVTrack*>(obj), rejectionReason); }
119  virtual Bool_t AcceptParticle(Int_t i, UInt_t &rejectionReason) const { return AcceptTrack(i, rejectionReason); }
120  virtual Bool_t AcceptParticle(const AliVParticle* vp, UInt_t &rejectionReason) const { return AcceptTrack(dynamic_cast<const AliVTrack*>(vp), rejectionReason); }
121  virtual AliVParticle *GetParticle(Int_t i=-1) const { return GetTrack(i) ; }
122  virtual AliVParticle *GetAcceptParticle(Int_t i=-1) const { return GetAcceptTrack(i) ; }
123  virtual AliVParticle *GetNextAcceptParticle() { return GetNextAcceptTrack() ; }
124  virtual AliVParticle *GetNextParticle() { return GetNextTrack() ; }
125  virtual Bool_t AcceptTrack(const AliVTrack* vp, UInt_t &rejectionReason) const;
126  virtual Bool_t AcceptTrack(Int_t i, UInt_t &rejectionReason) const;
127  virtual AliVTrack *GetLeadingTrack(const char* opt="") { return static_cast<AliVTrack*>(GetLeadingParticle(opt)); }
128  virtual AliVTrack *GetTrack(Int_t i=-1) const;
129  virtual AliVTrack *GetAcceptTrack(Int_t i=-1) const;
130  virtual AliVTrack *GetNextAcceptTrack() ;
131  virtual AliVTrack *GetNextTrack() ;
132  Char_t GetTrackType(const AliVTrack* track) const;
133  virtual Bool_t GetMomentumFromTrack(TLorentzVector &mom, const AliVTrack* track, Double_t mass) const;
134  virtual Bool_t GetMomentumFromTrack(TLorentzVector &mom, const AliVTrack* track) const;
135  virtual Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const;
136  virtual Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const;
137  virtual Bool_t GetNextMomentum(TLorentzVector &mom);
138  virtual Bool_t GetNextAcceptMomentum(TLorentzVector &mom);
139  Int_t GetNTracks() const { return GetNParticles() ; }
141  ETrackFilterType_t GetTrackFilterType() const { return fTrackFilterType; }
142  Char_t GetTrackType(Int_t i) const { return i >= 0 && i < fTrackTypes.GetSize() ? fTrackTypes[i] : (Char_t)kUndefined ; }
143 
144  void SetArray(const AliVEvent *event);
145 
146  void SetTrackFilterType(ETrackFilterType_t f) { fTrackFilterType = f; }
149 
150  void SetTrackCutsPeriod(const char* period) { fTrackCutsPeriod = period; }
151  void AddTrackCuts(AliVCuts *cuts);
153  AliVCuts *GetTrackCuts(Int_t icut);
154  void SetAODFilterBits(UInt_t bits) { fAODFilterBits = bits ; }
155  void AddAODFilterBit(UInt_t bit) { fAODFilterBits |= bit ; }
158 
161 
162  void NextEvent(const AliVEvent* event);
163 
164  static void SetDefTrackCutsPeriod(const char* period) { fgDefTrackCutsPeriod = period; }
166 
167  const char* GetTitle() const;
168 
175 
176 #if !(defined(__CINT__) || defined(__MAKECINT__))
177  const AliTrackIterableContainer all() const;
178  const AliTrackIterableContainer accepted() const;
179 
182 #endif
183 
184  protected:
193  virtual TString GetDefaultArrayName(const AliVEvent * const ev) const;
194 
196 
198 
199  ETrackFilterType_t fTrackFilterType;
207  TArrayC fTrackTypes;
208 
209  private:
210  AliTrackContainer(const AliTrackContainer& obj); // copy constructor
211  AliTrackContainer& operator=(const AliTrackContainer& other); // assignment
212 
214  ClassDef(AliTrackContainer,1);
216 };
217 
218 #endif
219 
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
Track selected under the constrained hybrid track cuts.
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)
virtual AliVTrack * GetAcceptTrack(Int_t i=-1) const
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