ATLAS Offline Software
InDetSecVtxTrackSelectionTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 //Author: Lianyou Shan <lianyou.shan@cern.ch>
5 // -*- c++ -*-
6 #ifndef INDETSECVTXTRACKSELECTIONTOOL_H
7 #define INDETSECVTXTRACKSELECTIONTOOL_H
8 
9 // Local include(s):
11 
12 // Framework include(s):
13 #include "AsgTools/AsgTool.h"
14 // #include "CxxUtils/checker_macros.h" // ATLAS_THREAD_SAFE
15 #ifndef XAOD_ANALYSIS
16 #include "GaudiKernel/ToolHandle.h"
17 #include "GaudiKernel/ServiceHandle.h"
19 #endif
20 
21 #include <atomic>
22 #include <limits>
23 #include <map>
24 // #include <mutex>
25 
26 namespace InDet {
27 
28  // forward declaration of helper classes
29  class SecVtxTrackAccessor;
30  class SecVtxTrackCut;
31 
35  public virtual IInDetTrackSelectionTool,
36  public asg::AsgTool {
37 
38  friend class SecVtxTrackCut;
39 
44 
45  public:
47  InDetSecVtxTrackSelectionTool( const std::string& name );
48 
49  // The default destructor is OK but it must be defined in the
50  // implementation file in order to forward declare with unique_ptr
52 
55 
57  virtual StatusCode initialize() override;
59  virtual StatusCode finalize() override;
60 
62 
65 
67  virtual const asg::AcceptInfo& getAcceptInfo() const override;
68 
70  virtual asg::AcceptData accept( const xAOD::IParticle* ) const override;
71 
73 
76 
79  const xAOD::Vertex* vertex = nullptr ) const override;
80 
81 #ifndef XAOD_ANALYSIS
82  virtual asg::AcceptData accept( const Trk::Track& track,
83  const Trk::Vertex* vertex = nullptr) const override;
84 #endif
85 
87  virtual void setCutLevel( InDet::CutLevel level, Bool_t overwrite = true ) override
88  __attribute__ ((deprecated("For consistency with the athena interface, the cut level is best set through the \"CutLevel\" property.")));
89 
90  private:
91  bool m_isInitialized = false; // flag whether or not the tool has been initialized, to check erroneous use cases.
92  mutable std::atomic<bool> m_warnInit = false; // flag to keep track of whether we have warned about a lack of initialization
93 
94  std::unordered_map< std::string, std::shared_ptr<SecVtxTrackAccessor> > m_trackAccessors;
95 
96  // first element is cut family, second is the set of cuts
97  std::map< std::string, std::vector< std::unique_ptr<SecVtxTrackCut> > > m_trackCuts;
98 
99  mutable std::atomic<ULong64_t> m_numTracksProcessed = 0;
100  mutable std::atomic<ULong64_t> m_numTracksPassed = 0;
101  // mutable std::vector<ULong64_t> m_numTracksPassedCuts ATLAS_THREAD_SAFE; //!< tracks the number of tracks that passed each cut family Guarded by m_mutex
102  // mutable std::mutex m_mutex;
103 
104  constexpr static Double_t LOCAL_MAX_DOUBLE = 1.0e16;
105  constexpr static Int_t LOCAL_MAX_INT = std::numeric_limits<Int_t>::max();
106 
109 
110  Double_t m_minD0 = -1.;
111 
112  Int_t m_NPixel0TRT = -1 ;
113  Int_t m_minInDetHits = -1 ; // Minimum number of total InDet hits
114 
115 // ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter ;
116 #ifndef XAOD_ANALYSIS
117  Bool_t m_initTrkTools = false;
118  Bool_t m_trackSumToolAvailable = false;
119 #endif // XAOD_ANALYSIS
120 
121  }; // class InDetSecVtxTrackSelectionTool
122 
123 } // namespace InDet
124 
125 #endif // INDETSECVTXTRACKSELECTIONTOOL_INDETSECVTXTRACKSELECTIONTOOL_H
InDet::InDetSecVtxTrackSelectionTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: InDetSecVtxTrackSelectionTool.cxx:38
Trk::Vertex
Definition: Tracking/TrkEvent/VxVertex/VxVertex/Vertex.h:26
athena
Definition: athena.py:1
ITrackSummaryTool.h
InDet::InDetSecVtxTrackSelectionTool::m_initTrkTools
Bool_t m_initTrkTools
Whether to initialize the Trk::Track tools.
Definition: InDetSecVtxTrackSelectionTool.h:117
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
max
#define max(a, b)
Definition: cfImp.cxx:41
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition: AsgToolMacros.h:77
InDet
DUMMY Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
asg
Definition: DataHandleTestTool.h:28
InDet::InDetSecVtxTrackSelectionTool::finalize
virtual StatusCode finalize() override
Function finalizing the tool.
Definition: InDetSecVtxTrackSelectionTool.cxx:118
InDet::InDetSecVtxTrackSelectionTool::getAcceptInfo
virtual const asg::AcceptInfo & getAcceptInfo() const override
Get an object describing the "selection steps" of the tool.
Definition: InDetSecVtxTrackSelectionTool.cxx:138
IAsgSelectionTool
Definition: IAsgSelectionTool.h:28
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
InDet::IInDetTrackSelectionTool
Interface for track selection tool.
Definition: IInDetTrackSelectionTool.h:53
InDet::InDetSecVtxTrackSelectionTool::setCutLevel
virtual void setCutLevel(InDet::CutLevel level, Bool_t overwrite=true) override __attribute__((deprecated("For consistency with the athena interface
Function to set the cut level within standalone ROOT.
Definition: InDetSecVtxTrackSelectionTool.cxx:232
asg::AcceptInfo
Definition: AcceptInfo.h:28
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
InDet::InDetSecVtxTrackSelectionTool::m_acceptInfo
asg::AcceptInfo m_acceptInfo
Object used to store the last decision.
Definition: InDetSecVtxTrackSelectionTool.h:108
InDet::InDetSecVtxTrackSelectionTool::m_minD0
Double_t m_minD0
Minimum |d0| of tracks.
Definition: InDetSecVtxTrackSelectionTool.h:110
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
InDet::InDetSecVtxTrackSelectionTool::m_NPixel0TRT
Int_t m_NPixel0TRT
Definition: InDetSecVtxTrackSelectionTool.h:112
python.utils.best
def best(iterable, priorities=[3, 2, 1, -1, 0])
Definition: DataQuality/DQUtils/python/utils.py:50
InDet::InDetSecVtxTrackSelectionTool::m_isInitialized
bool m_isInitialized
Definition: InDetSecVtxTrackSelectionTool.h:91
InDet::InDetSecVtxTrackSelectionTool::m_trackSumToolAvailable
Bool_t m_trackSumToolAvailable
Whether the summary tool is available
Definition: InDetSecVtxTrackSelectionTool.h:118
InDet::InDetSecVtxTrackSelectionTool::accept
virtual asg::AcceptData accept(const xAOD::IParticle *) const override
Get the decision using a generic IParticle pointer.
Definition: InDetSecVtxTrackSelectionTool.cxx:145
InDet::InDetSecVtxTrackSelectionTool::LOCAL_MAX_INT
constexpr static Int_t LOCAL_MAX_INT
Definition: InDetSecVtxTrackSelectionTool.h:105
InDet::SecVtxTrackCut
Definition: InDetSecVtxTrackCut.h:25
IInDetTrackSelectionTool.h
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
InDet::SecVtxTrackAccessor
Definition: InDetSecVtxTrackAccessor.h:33
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
InDet::InDetSecVtxTrackSelectionTool::m_warnInit
std::atomic< bool > m_warnInit
Definition: InDetSecVtxTrackSelectionTool.h:92
InDet::InDetSecVtxTrackSelectionTool::property
virtual void the cut level is best set through the CutLevel property
Definition: InDetSecVtxTrackSelectionTool.h:88
InDet::InDetSecVtxTrackSelectionTool
Implementation of the track selector tool.
Definition: InDetSecVtxTrackSelectionTool.h:36
InDet::InDetSecVtxTrackSelectionTool::m_numTracksProcessed
std::atomic< ULong64_t > m_numTracksProcessed
a counter of the number of tracks proccessed
Definition: InDetSecVtxTrackSelectionTool.h:99
runJobs.deprecated
deprecated
Definition: runJobs.py:191
InDet::InDetSecVtxTrackSelectionTool::m_trackAccessors
std::unordered_map< std::string, std::shared_ptr< SecVtxTrackAccessor > > m_trackAccessors
list of the accessors that need to be run for each track
Definition: InDetSecVtxTrackSelectionTool.h:94
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
InDet::InDetSecVtxTrackSelectionTool::LOCAL_MAX_DOUBLE
constexpr static Double_t LOCAL_MAX_DOUBLE
Definition: InDetSecVtxTrackSelectionTool.h:104
InDet::InDetSecVtxTrackSelectionTool::m_trackCuts
std::map< std::string, std::vector< std::unique_ptr< SecVtxTrackCut > > > m_trackCuts
First element is the name of the cut family, second element is the set of cuts.
Definition: InDetSecVtxTrackSelectionTool.h:97
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
AcceptInfo
Object to describe a series of cuts.
AsgTool.h
InDet::InDetSecVtxTrackSelectionTool::m_numTracksPassed
std::atomic< ULong64_t > m_numTracksPassed
a counter of the number of tracks that passed all cuts
Definition: InDetSecVtxTrackSelectionTool.h:100
asg::AcceptData
Definition: AcceptData.h:30
InDet::InDetSecVtxTrackSelectionTool::m_minInDetHits
Int_t m_minInDetHits
< Minimum number of Pixel hits when TRT has no hit
Definition: InDetSecVtxTrackSelectionTool.h:113
InDet::CutLevel
CutLevel
Definition: IInDetTrackSelectionTool.h:40