ATLAS Offline Software
AsgPtEtaSelectionTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 #ifndef ASG_ANALYSIS_ALGORITHMS__ASG_PT_ETA_SELECTION_TOOL_H
10 #define ASG_ANALYSIS_ALGORITHMS__ASG_PT_ETA_SELECTION_TOOL_H
11 
12 #include <AsgTools/AsgTool.h>
16 #include <atomic>
17 
18 namespace CP
19 {
33 
35  : public asg::AsgTool, virtual public IAsgSelectionTool
36  {
37  //
38  // public interface
39  //
40 
41  // Create a proper constructor for Athena
43 
44 
45 
46  public:
52 
53 
54  //
55  // inherited interface
56  //
57 
58  virtual StatusCode initialize () override;
59 
60  virtual const asg::AcceptInfo& getAcceptInfo( ) const override;
61 
62  virtual asg::AcceptData accept( const xAOD::IParticle *particle ) const override;
63 
64 
65 
66  //
67  // private interface
68  //
69 
72 
73  private:
74  Gaudi::Property<float> m_minPt {this, "minPt", 0, "minimum pt to require (or 0 for no pt cut)"};
75  Gaudi::Property<float> m_maxPt {this, "maxPt", 0, "maximum pt to require (or 0 for no pt cut)"};
76  Gaudi::Property<float> m_maxEta {this, "maxEta", 0, "maximum abs(eta) to allow (or 0 for no eta cut)"};
77  Gaudi::Property<float> m_etaGapLow {this, "etaGapLow", 0, "low end of the eta gap"};
78  Gaudi::Property<float> m_etaGapHigh {this, "etaGapHigh", 0, "high end of the eta gap (or 0 for no eta gap)"};
79  Gaudi::Property<bool> m_useClusterEta {this, "useClusterEta", false, "whether to use the cluster eta (for electrons only)"};
80  Gaudi::Property<bool> m_useDressedProperties {this, "useDressedProperties", false, "whether to use the dressed kinematic properties (for truth particles only)"};
81  Gaudi::Property<bool> m_printCastWarning {this, "printCastWarning", true, "whether to print a warning/error when the cast fails"};
82  Gaudi::Property<bool> m_printClusterWarning {this, "printClusterWarning", true, "whether to print a warning/error when the cluster is missing"};
83 
85 
87  int m_minPtCutIndex{ -1 };
89  int m_maxPtCutIndex{ -1 };
91  int m_maxEtaCutIndex{ -1 };
93  int m_etaGapCutIndex{ -1 };
100 
111  private:
112  mutable std::atomic<bool> m_shouldPrintCastWarning {true};
113 
124  private:
125  mutable std::atomic<bool> m_shouldPrintClusterWarning {true};
126 
128  private:
130 
132  private:
133  std::unique_ptr<SG::AuxElement::ConstAccessor<float>> m_dressedPtAccessor{};
134  std::unique_ptr<SG::AuxElement::ConstAccessor<float>> m_dressedEtaAccessor{};
135  };
136 }
137 
138 #endif
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
CP::AsgPtEtaSelectionTool::m_accept
asg::AcceptInfo m_accept
the asg::AcceptInfo we are using
Definition: AsgPtEtaSelectionTool.h:129
CP::AsgPtEtaSelectionTool::m_useClusterEta
Gaudi::Property< bool > m_useClusterEta
Definition: AsgPtEtaSelectionTool.h:79
CP::AsgPtEtaSelectionTool::m_useDressedProperties
Gaudi::Property< bool > m_useDressedProperties
Definition: AsgPtEtaSelectionTool.h:80
CP::AsgPtEtaSelectionTool::m_egammaClusterCutIndex
int m_egammaClusterCutIndex
Index for the e/gamma calo-cluster.
Definition: AsgPtEtaSelectionTool.h:97
IAsgSelectionTool
Definition: IAsgSelectionTool.h:28
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
IAsgSelectionTool.h
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::AsgPtEtaSelectionTool::m_shouldPrintCastWarning
std::atomic< bool > m_shouldPrintCastWarning
a version of m_printCastWarning that we modify once we printed the warning
Definition: AsgPtEtaSelectionTool.h:112
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition: AsgTool.cxx:58
CP::AsgPtEtaSelectionTool::m_shouldPrintClusterWarning
std::atomic< bool > m_shouldPrintClusterWarning
a version of m_printClusterWarning that we modify once we printed the warning
Definition: AsgPtEtaSelectionTool.h:125
asg::AcceptInfo
Definition: AcceptInfo.h:28
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::AsgPtEtaSelectionTool::m_egammaCastCutIndex
int m_egammaCastCutIndex
Index for the e/gamma casting.
Definition: AsgPtEtaSelectionTool.h:95
CP::AsgPtEtaSelectionTool::m_etaGapLow
Gaudi::Property< float > m_etaGapLow
Definition: AsgPtEtaSelectionTool.h:77
CP::AsgPtEtaSelectionTool::m_maxEta
Gaudi::Property< float > m_maxEta
Definition: AsgPtEtaSelectionTool.h:76
CP::AsgPtEtaSelectionTool::m_minPtCutIndex
int m_minPtCutIndex
Index for the minimum pT selection.
Definition: AsgPtEtaSelectionTool.h:87
CP::AsgPtEtaSelectionTool::accept
virtual asg::AcceptData accept(const xAOD::IParticle *particle) const override
The main accept method: the actual cuts are applied here.
Definition: AsgPtEtaSelectionTool.cxx:115
CP::AsgPtEtaSelectionTool::getAcceptInfo
virtual const asg::AcceptInfo & getAcceptInfo() const override
Declare the interface ID for this pure-virtual interface class to the Athena framework.
Definition: AsgPtEtaSelectionTool.cxx:107
CP::AsgPtEtaSelectionTool::m_etaGapHigh
Gaudi::Property< float > m_etaGapHigh
Definition: AsgPtEtaSelectionTool.h:78
CP::AsgPtEtaSelectionTool::m_maxEtaCutIndex
int m_maxEtaCutIndex
Index for the maximum eta selection.
Definition: AsgPtEtaSelectionTool.h:91
CP::AsgPtEtaSelectionTool::m_etaGapCutIndex
int m_etaGapCutIndex
Index for the eta gap selection.
Definition: AsgPtEtaSelectionTool.h:93
CP::AsgPtEtaSelectionTool::m_printClusterWarning
Gaudi::Property< bool > m_printClusterWarning
Definition: AsgPtEtaSelectionTool.h:82
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
CP::AsgPtEtaSelectionTool
an IAsgSelectionTool that performs basic pt and eta cut (with an optional eta gap)
Definition: AsgPtEtaSelectionTool.h:36
CP::AsgPtEtaSelectionTool::m_dressedPtAccessor
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_dressedPtAccessor
dressed pt and eta accessors
Definition: AsgPtEtaSelectionTool.h:133
CP::AsgPtEtaSelectionTool::m_dressedEtaAccessor
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_dressedEtaAccessor
Definition: AsgPtEtaSelectionTool.h:134
CP::AsgPtEtaSelectionTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: AsgPtEtaSelectionTool.cxx:27
CP::AsgPtEtaSelectionTool::m_maxPtCutIndex
int m_maxPtCutIndex
Index for the maximum pT selection.
Definition: AsgPtEtaSelectionTool.h:89
AsgTool.h
asg::AcceptData
Definition: AcceptData.h:30
CP::AsgPtEtaSelectionTool::m_minPt
Gaudi::Property< float > m_minPt
tool properties
Definition: AsgPtEtaSelectionTool.h:74
CP::AsgPtEtaSelectionTool::m_printCastWarning
Gaudi::Property< bool > m_printCastWarning
Definition: AsgPtEtaSelectionTool.h:81
AuxElement.h
Base class for elements of a container that can have aux data.
CP::AsgPtEtaSelectionTool::m_maxPt
Gaudi::Property< float > m_maxPt
Definition: AsgPtEtaSelectionTool.h:75
CP::AsgPtEtaSelectionTool::m_dressedPropertiesIndex
int m_dressedPropertiesIndex
Index for the existence of dressed properties.
Definition: AsgPtEtaSelectionTool.h:99