ATLAS Offline Software
ClassTraits.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
8 #ifndef TRIGGER_DECISION_TOOL_ClassTraits_H
9 #define TRIGGER_DECISION_TOOL_ClassTraits_H
10 
11 namespace TrigDec {
12 
13  // Here we define the trait classes. The basic problem is
14  // this:
15  //
16  // Some classes are attached to the navigation as basic objects
17  // for example - MuonFeature
18  // Other classes are attached to the navigation as containers of
19  // objects for example - egamma's are attached as egammaContainers
20  // Still other classes are not attached at all, but can be gotten
21  // from the ancestor method in the TDT, such as the L1 items
22  // We need to make this complexity invisible to the user, so they
23  // can just call whatever they want to match to and not worry
24  // about how it interacts with the navigation
25  // We solve this with traits classes (thanks to Scott Snyder for
26  // the suggestion) which tell us whether or not a class is a
27  // container and if it is, allows us to map from the class to
28  // the container class and similarly for ancest style objects
29 
30  struct DirectAttached {}; // identifies objects as attached directly
31  struct AncestorAttached {}; // identifies objects as attached via ancest
32 
33  // by default, we assume a class is attached directly
34  template<typename T>
35  struct ClassTraits {
36  typedef T type;
37  };
38 
39 }
40 
41 // now we specialize for the container classes
42 
43 // This macro specializes the definition of the
44 // ContainerForClass trait class
45 #define SPECIALIZE_CONTAINER_FOR_CLASS(x,y) \
46  namespace TrigDec { \
47  template<> \
48  struct ClassTraits<x> { \
49  typedef y type; \
50  }; \
51  }
52 
53 // This macro does the forward declaration
54 // for objects without a namespace
55 #define DECLARE_ATTACHED_CONTAINER(x,y) \
56  class x; \
57  class y; \
58  SPECIALIZE_CONTAINER_FOR_CLASS(x,y)
59 
60 // This macro does the forward declaration
61 // for objects with the same namespace
62 // as the container
63 #define DECLARE_ATTACHED_CONTAINER_NAMESPACE(a,x,y) \
64  namespace a { \
65  class x; \
66  class y; \
67  } \
68  SPECIALIZE_CONTAINER_FOR_CLASS(a::x,a::y)
69 
70 // This macro does the forward declaration
71 // for objects with a namespace, but not namespace
72 // on the container
73 #define DECLARE_ATTACHED_CONTAINER_OBJECT_NAMESPACE(a,x,y) \
74  namespace a { \
75  class x; \
76  } \
77  class y; \
78  SPECIALIZE_CONTAINER_FOR_CLASS(a::x,y)
79 
80 // This macro does the forward declaration
81 // for objects with a namespace, and containers
82 // that are a typedef
83 #define DECLARE_ATTACHED_CONTAINER_TYPEDEF(a, x, y) \
84  namespace a { \
85  class x; \
86  } \
87  SPECIALZE_CONTAINER_FOR_CLASS(a::x, y)
88 
93  //DECLARE_ATTACHED_CONTAINER(CosmicMuon, CosmicMuonCollection)
94  //DECLARE_ATTACHED_CONTAINER(MdtTrackSegment, MdtTrackSegmentCollection)
104  DECLARE_ATTACHED_CONTAINER_NAMESPACE(Analysis, TauDetails, TauDetailsContainer)
112 
113 #undef SPECIALIZE_CONTAINER_FOR_CLASS
114 #undef DECLARE_ATTACHED_CONTAINER
115 #undef DECLARE_ATTACHED_CONTAINER_NAMESPACE
116 #undef DECLARE_ATTACHED_CONTAINER_TYPEDEF
117 #undef DECLARE_ATTACHED_CONTAINER_OBJECT_NAMESPACE
118 
119 // now we set up the traits for the L1 items
120 
121 // this macro setups a template specialization
122 // for the L1 objects
123  /*
124  #define DECLARE_L1_TRIGGER_OBJECT(x) \
125  class x; \
126  namespace TrigDec { \
127  template<> \
128  struct ClassTraits<x> { \
129  typedef AncestorAttached type; \
130  }; \
131  }
132 
133  DECLARE_L1_TRIGGER_OBJECT(Muon_ROI)
134  DECLARE_L1_TRIGGER_OBJECT(Jet_ROI)
135  DECLARE_L1_TRIGGER_OBJECT(EmTau_ROI)
136  */
137 #undef DECLARE_L1_TRIGGER_OBJECT
138 
139 #endif
TrigDec
Definition: ITrigDecisionCnvTool.h:18
DECLARE_ATTACHED_CONTAINER_OBJECT_NAMESPACE
#define DECLARE_ATTACHED_CONTAINER_OBJECT_NAMESPACE(a, x, y)
Definition: ClassTraits.h:73
TrigEFBphys
Definition: TrigEFBphys.h:42
CaloShowerContainer
Container class for CaloShower.
Definition: CaloShowerContainer.h:15
AthCUDAExamples::TrackParticleContainer
vecmem::edm::container< TrackParticleInterface, vecmem::edm::type::vector< float >, vecmem::edm::type::vector< float >, vecmem::edm::type::vector< float > > TrackParticleContainer
SoA, GPU friendly TrackParticleContainer.
Definition: Control/AthenaExamples/AthExCUDA/src/TrackParticleContainer.h:46
Jet
Basic data class defines behavior for all Jet objects The Jet class is the principal data class for...
Definition: Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
TrigInDetTrackCollection
Definition: TrigInDetTrackCollection.h:13
DECLARE_ATTACHED_CONTAINER
#define DECLARE_ATTACHED_CONTAINER(x, y)
Definition: ClassTraits.h:55
CaloClusterContainer
Storable container for CaloCluster.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloClusterContainer.h:37
TrigEFBjetContainer
Container of TrigEFBjet objects to be stored in POOL.
Definition: TrigEFBjetContainer.h:31
TrigDec::ClassTraits::type
T type
Definition: ClassTraits.h:36
TrigL2Bphys
Definition: TrigL2Bphys.h:43
TrigElectron
File: TrigElectron.h.
Definition: Trigger/TrigEvent/TrigParticle/TrigParticle/TrigElectron.h:63
TrigMuonEFInfoContainer
Definition: TrigMuonEFInfoContainer.h:27
CaloShower
Data class for cluster variables associated with a CaloCluster.
Definition: CaloShower.h:12
TrigInDetTrack
Definition: TrigInDetTrack.h:34
egamma
Definition: egamma.h:58
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
TrigEFBjet
Class representing a b-jet candidate created at EF.
Definition: TrigEFBjet.h:38
CaloTowerContainer
Storable container class for CaloTower.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloTowerContainer.h:77
TrigL2Bjet
Class representing a b-jet candidate created at L2.
Definition: TrigL2Bjet.h:38
Rec
Name: MuonSpContainer.h Package : offline/Reconstruction/MuonIdentification/muonEvent.
Definition: FakeTrackBuilder.h:10
TrigMuonEF
Definition: TrigMuonEF.h:26
egammaContainer
Definition: egammaContainer.h:41
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
TrigDec::AncestorAttached
Definition: ClassTraits.h:31
VxContainer
Definition: VxContainer.h:28
TrigDec::DirectAttached
Definition: ClassTraits.h:30
TrigDec::ClassTraits
Definition: ClassTraits.h:35
CaloTower
Data class for calorimeter cell towers.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloTower.h:55
TrigL2BjetContainer
Container of TrigEFBjet objects to be stored in POOL.
Definition: TrigL2BjetContainer.h:32
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
xAOD::TauJetContainer
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
Definition: Event/xAOD/xAODTau/xAODTau/TauJetContainer.h:17
TrigVertexCollection
Definition: TrigVertexCollection.h:13
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
TrigPhotonContainer
File: TrigPhotonContainer.h.
Definition: Trigger/TrigEvent/TrigParticle/TrigParticle/TrigPhotonContainer.h:32
TauJet
@ TauJet
Definition: TruthClasses.h:47
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
TrigVertex
Definition: TrigVertex.h:28
DECLARE_ATTACHED_CONTAINER_NAMESPACE
#define DECLARE_ATTACHED_CONTAINER_NAMESPACE(a, x, y)
Definition: ClassTraits.h:63
JetCollection
Container for Jets
Definition: JetCollection.h:30
TrigL2BphysContainer
Definition: TrigL2BphysContainer.h:33
TrigMuonEFContainer
Definition: TrigMuonEFContainer.h:27
TrigEFBphysContainer
Definition: TrigEFBphysContainer.h:34
TrigElectronContainer
File: TrigElectronContainer.h.
Definition: Trigger/TrigEvent/TrigParticle/TrigParticle/TrigElectronContainer.h:32
egDetail
Definition: egDetail.h:29
TrigPhoton
File: TrigPhoton.h.
Definition: Trigger/TrigEvent/TrigParticle/TrigParticle/TrigPhoton.h:44
egDetailContainer
Definition: egDetailContainer.h:18
TrigMuonEFInfo
Definition: TrigMuonEFInfo.h:24