ATLAS Offline Software
LabelIndex.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 // LabelIndex.h
6 
7 #ifndef jet__LabelIndex
8 #define jet__LabelIndex
9 
10 // David Adams
11 // January 13, 2014
12 //
13 // Bi-directional map assigning indices to string labels.
14 
15 #include <vector>
16 #include <string>
17 #include "xAODCore/CLASS_DEF.h"
18 #include "xAODJet/JetTypes.h"
19 
20 namespace jet {
21 
22 class LabelIndex {
23 
24 public:
25 
26  typedef std::string Label;
27  typedef unsigned int Index;
28 
30  explicit LabelIndex(Label nam);
31 
35  Index addLabel(const Label& lab);
36 
38  Label name() const;
39 
42  Label label(Index idx) const;
43 
46  Index index(const Label& lab) const;
47 
50 
52  Index size() const ;
53 
54 private:
55 
56  // Hide ctors and copy.
57  explicit LabelIndex(const LabelIndex& nam);
58  LabelIndex& operator=(const Label& nam);
59 
60  // Data.
62  std::vector<Label> m_labs;
63  std::vector<xAOD::JetConstitScale> m_constitScales;
64 
65 };
66 
67 } // end namespace jet
68 
69 CLASS_DEF( jet::LabelIndex , 94979360 , 1 )
70 
71 #endif
jet::LabelIndex::constitScale
xAOD::JetConstitScale constitScale(Index idx) const
Fetch the constit scale corresponding to the index.
Definition: LabelIndex.cxx:49
jet::LabelIndex
Definition: LabelIndex.h:22
jet::LabelIndex::m_name
Label m_name
Definition: LabelIndex.h:61
jet::LabelIndex::Label
std::string Label
Definition: LabelIndex.h:26
jet::LabelIndex::label
Label label(Index idx) const
Fetch the label for an index.
Definition: LabelIndex.cxx:41
jet::LabelIndex::LabelIndex
LabelIndex(Label nam)
Ctor.
Definition: LabelIndex.cxx:19
jet::LabelIndex::m_labs
std::vector< Label > m_labs
Definition: LabelIndex.h:62
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
jet::LabelIndex::addLabel
Index addLabel(const Label &lab)
Add a label and get its index.
Definition: LabelIndex.cxx:23
jet::LabelIndex::m_constitScales
std::vector< xAOD::JetConstitScale > m_constitScales
Definition: LabelIndex.h:63
jet::LabelIndex::index
Index index(const Label &lab) const
Fetch the index for a label.
Definition: LabelIndex.cxx:57
jet::LabelIndex::Index
unsigned int Index
Definition: LabelIndex.h:27
xAOD::JetConstitScale
JetConstitScale
Definition: JetTypes.h:20
CLASS_DEF.h
File providing the different SG_BASE macros.
jet::LabelIndex::name
Label name() const
Return the name of this map.
Definition: LabelIndex.cxx:35
jet::LabelIndex::size
Index size() const
Number of label stored in this map. WARNING the index starts at 1, so range is [1....
Definition: LabelIndex.cxx:76
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
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
JetTypes.h
jet::LabelIndex::operator=
LabelIndex & operator=(const Label &nam)
Definition: LabelIndex.cxx:70