ATLAS Offline Software
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 
34 class MsgStream;
35 
36 
37 // forward declare some conversion class
38 template <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
46  friend class JetKeyDescriptorCnv_p1;
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 
81 #include "AthenaKernel/CLASS_DEF.h"
82 CLASS_DEF(JetKeyDescriptor,71458009,1)
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;
104  friend class JetCollectionCnv_p2;
105  friend class JetCollectionCnv_p3;
106  friend class JetCollectionCnv_p4;
107  friend class JetCollectionCnv_p5;
108  friend class JetCollectionCnv_p6;
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 
170 inline bool JetKeyDescriptorInstance::isValid(size_t index) const
171 {
172  return index != m_invalid;
173 }
174 
175 inline 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 }
194 #endif
JetKeyDescriptor::catStore
const catlist_t & catStore() const
Definition: JetKeyDescriptor.h:71
JetKeyDescriptorInstance::printOut
void printOut(MsgStream &msgStream) const
Definition: JetKeyDescriptor.cxx:144
JetKeyDescriptorInstance::m_Stores
JetKeyDescriptor * m_Stores
Definition: JetKeyDescriptor.h:155
JetKeyDescriptor_p1
Definition: JetKeyDescriptor_p1.h:12
JetKeyDescriptor::m_catStore
catlist_t m_catStore
Definition: JetKeyDescriptor.h:77
JetCollectionCnv_p4
Definition: JetCollectionCnv_p4.h:35
JetKeyDescriptorInstance::JetKeyDescriptorInstance
JetKeyDescriptorInstance(bool create=true)
Definition: JetKeyDescriptor.cxx:23
JetKeyDescriptorInstance::~JetKeyDescriptorInstance
virtual ~JetKeyDescriptorInstance()
index
Definition: index.py:1
JetKeyDescriptor::JetKeyDescriptor
JetKeyDescriptor()
Definition: JetKeyDescriptor.cxx:197
JetKeyConstants::ShapeCat
static const key_t ShapeCat
Index category for jet shapes.
Definition: JetKeyDescriptor.h:88
JetKeyDescriptor::m_keyStore
storelist_t m_keyStore
Definition: JetKeyDescriptor.h:75
JetKeyDescriptorInstance::m_invalid
static const size_t m_invalid
Definition: JetKeyDescriptor.h:163
JetKeyDescriptor::key_t
std::string key_t
Definition: JetKeyDescriptor.h:52
JetKeyDescriptor::keystore_t
std::vector< key_t > keystore_t
Definition: JetKeyDescriptor.h:54
JetKeyConstants::TagCat
static const key_t TagCat
Index category for jet tag info.
Definition: JetKeyDescriptor.h:92
JetKeyDescriptorInstance::getCategories
const std::vector< category_t > & getCategories() const
Definition: JetKeyDescriptor.h:176
JetCollectionCnv_p2
Definition: JetCollectionCnv_p2.h:36
JetKeyDescriptorInstance::category_t
std::string category_t
Definition: JetKeyDescriptor.h:113
JetKeyDescriptorInstance::instance
static JetKeyDescriptorInstance * instance()
Definition: JetKeyDescriptor.h:123
JetKeyDescriptorInstance::storelist_t
std::vector< keystore_t > storelist_t
Definition: JetKeyDescriptor.h:117
JetKeyDescriptorInstance::key_t
std::string key_t
Definition: JetKeyDescriptor.h:114
JetKeyDescriptor::storelist_t
std::vector< keystore_t > storelist_t
Definition: JetKeyDescriptor.h:55
JetKeyDescriptorInstance::m_invalidKeys
static const std::vector< key_t > m_invalidKeys
Definition: JetKeyDescriptor.h:165
JetKeyDescriptorInstance::getKeyStore
JetKeyDescriptor * getKeyStore()
Definition: JetKeyDescriptor.cxx:42
TPPolyCnvBase
Definition: TPConverter.h:674
JetKeyDescriptorInstance::createKeyStore
void createKeyStore() const
Definition: JetKeyDescriptor.cxx:34
JetKeyConstants::AssoCat
static const key_t AssoCat
Index category for jet associations.
Definition: JetKeyDescriptor.h:90
JetKeyDescriptor::~JetKeyDescriptor
virtual ~JetKeyDescriptor()
Definition: JetKeyDescriptor.cxx:217
JetKeyDescriptorInstance::isValid
bool isValid(size_t index) const
Definition: JetKeyDescriptor.h:170
JetKeyDescriptorInstance::keystore_t
std::vector< key_t > keystore_t
Definition: JetKeyDescriptor.h:116
JetKeyDescriptorInstance::catlist_t
std::vector< category_t > catlist_t
Definition: JetKeyDescriptor.h:118
JetCollectionCnv_p5
Definition: JetCollectionCnv_p5.h:35
JetKeyDescriptorInstance::getKey
const key_t & getKey(const category_t &cat, size_t index) const
Definition: JetKeyDescriptor.cxx:161
JetKeyDescriptorInstance::m_persistified
static const bool m_persistified
Definition: JetKeyDescriptor.h:167
JetKeyConstants::InfoCat
static const key_t InfoCat
Index category for general jet info.
Definition: JetKeyDescriptor.h:94
JetKeyDescriptorInstance::getKeys
const std::vector< key_t > & getKeys(const category_t &cat) const
Definition: JetKeyDescriptor.cxx:178
JetKeyDescriptor
//////////////////////////////////////////////////
Definition: JetKeyDescriptor.h:44
JetKeyDescriptorInstance::m_notFound
static const std::string m_notFound
Definition: JetKeyDescriptor.h:164
JetKeyDescriptor::catlist_t
std::vector< category_t > catlist_t
Definition: JetKeyDescriptor.h:56
JetKeyDescriptor::keyStore
const storelist_t & keyStore() const
Definition: JetKeyDescriptor.h:70
JetCollectionCnv_p6
Definition: JetCollectionCnv_p6.h:35
python.PyAthena.v
v
Definition: PyAthena.py:154
JetKeyDescriptorCnv_p1
Definition: JetKeyDescriptorCnv_p1.h:17
JetCollection
Container for Jets
Definition: JetCollection.h:30
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
JetKeyConstants::key_t
JetKeyDescriptor::key_t key_t
Definition: JetKeyDescriptor.h:85
JetKeyDescriptor::category_t
std::string category_t
Definition: JetKeyDescriptor.h:51
JetKeyDescriptorInstance::getIndex
size_t getIndex(const category_t &cat, const key_t &key, bool createIfMissing=true)
Definition: JetKeyDescriptor.cxx:47
JetCollectionCnv_p3
Definition: JetCollectionCnv_p3.h:36
JetKeyConstants
Definition: JetKeyDescriptor.h:84
JetKeyDescriptorInstance
Definition: JetKeyDescriptor.h:100
CLASS_DEF.h
macros to associate a CLID to a type
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
JetKeyDescriptor::access
void access() const
Definition: JetKeyDescriptor.h:59
JetKeyDescriptorInstance::m_ConstStores
const JetKeyDescriptor * m_ConstStores
Definition: JetKeyDescriptor.h:156