ATLAS Offline Software
PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 #ifndef ISOLATIONSELECTION_DEFS_H
6 #define ISOLATIONSELECTION_DEFS_H
7 
8 // EDM include(s):
11 #include <xAODPFlow/FlowElement.h>
14 
15 #include <set>
16 namespace CP {
17 
20 
23 
24  using SelectionAccessor = std::unique_ptr<CharAccessor>;
25  using SelectionDecorator = std::unique_ptr<CharDecorator>;
26 
29 
32 
35 
37  using IsoVector = std::vector<IsoType>;
38 
40  template <class Obj> struct SortedObjPtr {
41  SortedObjPtr() = default;
42  SortedObjPtr(const Obj* _ptr) : m_ptr{_ptr} {}
43 
44  const Obj* get() const { return m_ptr; }
45  const Obj* operator->() const { return m_ptr; }
46  const Obj& operator*() const { return *m_ptr; }
47  bool operator!() const { return !m_ptr; }
48  operator bool() const { return m_ptr; }
49  operator const Obj*() const { return m_ptr; }
50  bool operator<(const SortedObjPtr<Obj>& other) const {
51  return other.get() != get() && get() &&
52  (!other || other->pt() < get()->pt() || (other->pt() == get()->pt() && other.get() < get()));
53  }
54 
55  private:
56  const Obj* m_ptr{nullptr};
57  };
59  struct FlowElementPtr : public SortedObjPtr<xAOD::FlowElement> {
60  FlowElementPtr(const xAOD::FlowElement* ele, float _weight) : SortedObjPtr<xAOD::FlowElement>{ele}, weight{_weight} {}
61  FlowElementPtr() = default;
62  bool operator<(const FlowElementPtr& other) const {
63  if (other.weight != weight) return weight < other.weight;
65  }
66  float weight{1.f};
67  };
68 
71 
72  using TrackSet = std::set<TrackPtr>;
73  using ClusterSet = std::set<CaloClusterPtr>;
74  using PflowSet = std::set<FlowElementPtr>;
75 } // namespace CP
76 
77 #endif
CP::SortedObjPtr::operator<
bool operator<(const SortedObjPtr< Obj > &other) const
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:50
IsolationType.h
CP::PflowSet
std::set< FlowElementPtr > PflowSet
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:74
CP::TrackSet
std::set< TrackPtr > TrackSet
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:72
CP::FlowElementPtr::operator<
bool operator<(const FlowElementPtr &other) const
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:62
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
CP::SortedObjPtr
Small helper struct to have sets of particle pointers sorted by pt.
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:40
CP::SortedObjPtr::operator!
bool operator!() const
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:47
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
CP::SortedObjPtr::SortedObjPtr
SortedObjPtr(const Obj *_ptr)
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:42
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::SortedObjPtr::get
const Obj * get() const
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:44
FlowElement.h
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
CaloCluster.h
xAOD::Iso::IsolationType
IsolationType
Overall enumeration for isolation types in xAOD files.
Definition: IsolationType.h:26
CP::SortedObjPtr::SortedObjPtr
SortedObjPtr()=default
CP::SortedObjPtr::m_ptr
const Obj * m_ptr
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:56
CP::SelectionAccessor
std::unique_ptr< CharAccessor > SelectionAccessor
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:24
CP::FlowElementPtr
For the flow elements we need a special derivate which also contains the weights.
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:59
CP::ClusterSet
std::set< CaloClusterPtr > ClusterSet
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:73
TrackParticle.h
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CP::SortedObjPtr::operator->
const Obj * operator->() const
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:45
CP::FlowElementPtr::FlowElementPtr
FlowElementPtr(const xAOD::FlowElement *ele, float _weight)
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:60
CP::FlowElementPtr::FlowElementPtr
FlowElementPtr()=default
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
CP::SortedObjPtr::operator*
const Obj & operator*() const
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:46
CP::FlowElementPtr::weight
float weight
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:66
CP::SelectionDecorator
std::unique_ptr< CharDecorator > SelectionDecorator
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:25
CP::IsoVector
std::vector< IsoType > IsoVector
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:37
AuxElement.h
Base class for elements of a container that can have aux data.
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25