ATLAS Offline Software
Loading...
Searching...
No Matches
JetKeyDescriptor.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 JETEVENT_JETKEYDESCRIPTOR_H
6#define JETEVENT_JETKEYDESCRIPTOR_H
7
8#include <string>
9#include <vector>
33
34class MsgStream;
35
36
37// forward declare some conversion class
38template <class T1, class T2, class T3>
39 class TPPolyCnvBase;
41
42// payload for the JetKeyDescriptor framework.
44{
45 // allow access to private data members for these classes
49 public:
50
51 typedef std::string category_t;
52 typedef std::string key_t;
53
54 typedef std::vector<key_t> keystore_t;
55 typedef std::vector<keystore_t> storelist_t;
56 typedef std::vector<category_t> catlist_t;
57
58 // dummy implementation, needed for the DataLink to call the converter
59 void access() const { };
60
61
62 virtual ~JetKeyDescriptor();
63
64
65
66 // dummy implementation, just to be called from the converters
68
69 // For debugging.
70 const storelist_t& keyStore() const { return m_keyStore; }
71 const catlist_t& catStore() const { return m_catStore; }
72
73 protected:
74
76
78
79};
80
83
86
88 static const key_t ShapeCat;
90 static const key_t AssoCat;
92 static const key_t TagCat;
94 static const key_t InfoCat;
95
96};
97
98
100{
101 friend class JetKeyDescriptor;
102 friend class JetCollection;
109
110
111 public:
112
113 typedef std::string category_t;
114 typedef std::string key_t;
115
116 typedef std::vector<key_t> keystore_t;
117 typedef std::vector<keystore_t> storelist_t;
118 typedef std::vector<category_t> catlist_t;
119
120 // singleton implementation for now
122
124 {
126 return &instance;
127 }
128
129 // get a unique index
130 size_t getIndex(const category_t& cat,const key_t& key, bool createIfMissing = true );
131 size_t getIndex(const category_t& cat,const key_t& key) const;
132
133 // get key for a given category and index
134 const key_t& getKey(const category_t& cat,size_t index) const;
135
136 // get all keys for a given category
137 const std::vector<key_t>& getKeys(const category_t& cat) const;
138
139 // get all categories
140 const std::vector<category_t>& getCategories() const;
141
142 // check validity
143 bool isValid(size_t index) const;
144
145 // printout some stuff
146 void printOut(MsgStream& msgStream) const;
147
148 // retrieve the key store :
150
151 protected:
152
153 JetKeyDescriptorInstance(bool create=true);
154
157
158 void createKeyStore() const;
159
160 private:
161
162
163 static const size_t m_invalid;
164 static const std::string m_notFound;
165 static const std::vector<key_t> m_invalidKeys;
166
167 static const bool m_persistified;
168};
169
171{
172 return index != m_invalid;
173}
174
175inline const std::vector<JetKeyDescriptorInstance::category_t>&
177{
178 if(bool(m_ConstStores))
179 return m_ConstStores->m_catStore;
180 static const std::vector<JetKeyDescriptorInstance::category_t> v;
181 return v;
182}
183
193
194#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
const std::vector< category_t > & getCategories() const
static const bool m_persistified
const JetKeyDescriptor * m_ConstStores
static const std::string m_notFound
std::vector< key_t > keystore_t
virtual ~JetKeyDescriptorInstance()
JetKeyDescriptor * m_Stores
std::vector< category_t > catlist_t
JetKeyDescriptor * getKeyStore()
bool isValid(size_t index) const
const std::vector< key_t > & getKeys(const category_t &cat) const
std::vector< keystore_t > storelist_t
static JetKeyDescriptorInstance * instance()
size_t getIndex(const category_t &cat, const key_t &key, bool createIfMissing=true)
static const size_t m_invalid
JetKeyDescriptorInstance(bool create=true)
void printOut(MsgStream &msgStream) const
const key_t & getKey(const category_t &cat, size_t index) const
static const std::vector< key_t > m_invalidKeys
//////////////////////////////////////////////////
std::string category_t
void access() const
friend class JetKeyDescriptorInstance
std::vector< key_t > keystore_t
storelist_t m_keyStore
std::vector< category_t > catlist_t
std::vector< keystore_t > storelist_t
const storelist_t & keyStore() const
const catlist_t & catStore() const
friend class JetKeyDescriptorCnv_p1
Base TP converter template parametrized by transient and persistent types.
Definition index.py:1
static const key_t ShapeCat
Index category for jet shapes.
static const key_t TagCat
Index category for jet tag info.
static const key_t InfoCat
Index category for general jet info.
JetKeyDescriptor::key_t key_t
static const key_t AssoCat
Index category for jet associations.