ATLAS Offline Software
Loading...
Searching...
No Matches
ClassTraits.h
Go to the documentation of this file.
1// -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2026 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
11namespace 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
90 //DECLARE_ATTACHED_CONTAINER(CosmicMuon, CosmicMuonCollection)
91 //DECLARE_ATTACHED_CONTAINER(MdtTrackSegment, MdtTrackSegmentCollection)
96 DECLARE_ATTACHED_CONTAINER(egamma, egammaContainer)
97 DECLARE_ATTACHED_CONTAINER_NAMESPACE(Rec, TrackParticle, TrackParticleContainer)
98 DECLARE_ATTACHED_CONTAINER_NAMESPACE(Analysis, TauDetails, TauDetailsContainer)
99 DECLARE_ATTACHED_CONTAINER_NAMESPACE(Analysis, TauJet, TauJetContainer)
100 DECLARE_ATTACHED_CONTAINER(Jet, JetCollection)
102 DECLARE_ATTACHED_CONTAINER(egDetail, egDetailContainer)
104
105#undef SPECIALIZE_CONTAINER_FOR_CLASS
106#undef DECLARE_ATTACHED_CONTAINER
107#undef DECLARE_ATTACHED_CONTAINER_NAMESPACE
108#undef DECLARE_ATTACHED_CONTAINER_TYPEDEF
109#undef DECLARE_ATTACHED_CONTAINER_OBJECT_NAMESPACE
110
111// now we set up the traits for the L1 items
112
113// this macro setups a template specialization
114// for the L1 objects
115 /*
116 #define DECLARE_L1_TRIGGER_OBJECT(x) \
117 class x; \
118 namespace TrigDec { \
119 template<> \
120 struct ClassTraits<x> { \
121 typedef AncestorAttached type; \
122 }; \
123 }
124
125 DECLARE_L1_TRIGGER_OBJECT(Muon_ROI)
126 DECLARE_L1_TRIGGER_OBJECT(Jet_ROI)
127 DECLARE_L1_TRIGGER_OBJECT(EmTau_ROI)
128 */
129#undef DECLARE_L1_TRIGGER_OBJECT
130
131#endif
#define DECLARE_ATTACHED_CONTAINER_OBJECT_NAMESPACE(a, x, y)
Definition ClassTraits.h:73
#define DECLARE_ATTACHED_CONTAINER(x, y)
Definition ClassTraits.h:55
#define DECLARE_ATTACHED_CONTAINER_NAMESPACE(a, x, y)
Definition ClassTraits.h:63
Jet_v1 Jet
Definition of the current "jet version".
Container class for CaloCell.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
Principal data class for CaloCell clusters.
Container class for CaloShower.
Data class for cluster variables associated with a CaloCluster.
Definition CaloShower.h:12
Storable container class for CaloTower.
Data class for calorimeter cell towers.
represents a LVL2 ID track
encapsulates LVL2 vertex parameters (in the global reference frame), covariance matrix,...
Definition TrigVertex.h:31
The namespace of all packages in PhysicsAnalysis/JetTagging.
namespace for combined reconstruction tools and interfaces
Ensure that the ATLAS eigen extensions are properly loaded.