ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetEDM
Root
LabelIndex.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// LabelIndex.h
6
7
#include "
JetEDM/LabelIndex.h
"
8
#include <map>
9
#include <utility>
10
11
using
jet::LabelIndex
;
12
13
using
LIMap
= std::map<std::string, LabelIndex *>;
14
using
Index
=
LabelIndex::Index
;
15
using
Label
=
LabelIndex::Label
;
16
17
//**********************************************************************
18
19
LabelIndex::LabelIndex
(
Label
nam) :
m_name
(
std
::move(nam)) { }
20
21
//**********************************************************************
22
23
Index
LabelIndex::addLabel
(
const
Label
& lab) {
24
Index
idx =
index
(lab);
25
if
( idx )
return
idx;
26
m_labs
.push_back(lab);
27
xAOD::JetConstitScale
conscale =
xAOD::CalibratedJetConstituent
;
28
if
( lab ==
"EMTopo"
) conscale =
xAOD::UncalibratedJetConstituent
;
29
m_constitScales
.push_back(conscale);
30
return
m_labs
.size();
31
}
32
33
//**********************************************************************
34
35
const
Label
&
LabelIndex::name
()
const
{
36
return
m_name
;
37
}
38
39
//**********************************************************************
40
41
Label
LabelIndex::label
(
Index
idx)
const
{
42
if
( idx < 1 )
return
""
;
43
if
( idx-1 >
m_labs
.size() )
return
""
;
44
return
m_labs
[idx - 1];
45
}
46
47
//**********************************************************************
48
49
xAOD::JetConstitScale
LabelIndex::constitScale
(
Index
idx)
const
{
50
if
( idx < 1 )
return
xAOD::CalibratedJetConstituent
;
51
if
( idx-1 >
m_constitScales
.size() )
return
xAOD::UncalibratedJetConstituent
;
52
return
m_constitScales
[idx - 1];
53
}
54
55
//**********************************************************************
56
57
Index
LabelIndex::index
(
const
Label
& lab)
const
{
58
for
(
Index
jdx=0; jdx<
m_labs
.size(); ++jdx ) {
59
if
(
m_labs
[jdx] == lab )
return
jdx + 1;
60
}
61
return
0;
62
}
63
64
//**********************************************************************
65
66
LabelIndex::LabelIndex
(
const
LabelIndex
&) :
m_name
(
""
) { }
67
68
//**********************************************************************
69
70
LabelIndex
&
LabelIndex::operator=
(
const
Label
&) {
71
return
*
this
;
72
}
73
74
//**********************************************************************
75
76
Index
LabelIndex::size
()
const
{
return
m_labs
.size() ; }
Index
IndexedConstituentUserInfo::Index Index
Definition
IndexedConstituentUserInfo.cxx:12
Label
IndexedConstituentUserInfo::Label Label
Definition
IndexedConstituentUserInfo.cxx:11
LIMap
std::map< std::string, LabelIndex * > LIMap
Definition
LabelIndex.cxx:13
LabelIndex.h
LabelIndex::Label
std::string Label
Definition
LabelIndex.h:26
LabelIndex::Index
unsigned int Index
Definition
LabelIndex.h:27
LabelIndex::LabelIndex
LabelIndex(Label nam)
Ctor.
Definition
LabelIndex.cxx:19
jet::LabelIndex
Definition
LabelIndex.h:22
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::name
const 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
jet::LabelIndex::index
Index index(const Label &lab) const
Fetch the index for a label.
Definition
LabelIndex.cxx:57
jet::LabelIndex::Label
std::string Label
Definition
LabelIndex.h:26
jet::LabelIndex::Index
unsigned int Index
Definition
LabelIndex.h:27
jet::LabelIndex::LabelIndex
LabelIndex(Label nam)
Ctor.
Definition
LabelIndex.cxx:19
jet::LabelIndex::label
Label label(Index idx) const
Fetch the label for an index.
Definition
LabelIndex.cxx:41
jet::LabelIndex::operator=
LabelIndex & operator=(const Label &nam)
Definition
LabelIndex.cxx:70
jet::LabelIndex::m_name
Label m_name
Definition
LabelIndex.h:61
jet::LabelIndex::constitScale
xAOD::JetConstitScale constitScale(Index idx) const
Fetch the constit scale corresponding to the index.
Definition
LabelIndex.cxx:49
jet::LabelIndex::m_labs
std::vector< Label > m_labs
Definition
LabelIndex.h:62
index
Definition
index.py:1
std
STL namespace.
xAOD::JetConstitScale
JetConstitScale
Definition
JetTypes.h:20
xAOD::UncalibratedJetConstituent
@ UncalibratedJetConstituent
Definition
JetTypes.h:21
xAOD::CalibratedJetConstituent
@ CalibratedJetConstituent
Definition
JetTypes.h:22
Generated on
for ATLAS Offline Software by
1.17.0