ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
jet::LabelIndex Class Reference

#include <LabelIndex.h>

Collaboration diagram for jet::LabelIndex:

Public Types

typedef std::string Label
 
typedef unsigned int Index
 

Public Member Functions

 LabelIndex (Label nam)
 Ctor. More...
 
Index addLabel (const Label &lab)
 Add a label and get its index. More...
 
Label name () const
 Return the name of this map. More...
 
Label label (Index idx) const
 Fetch the label for an index. More...
 
Index index (const Label &lab) const
 Fetch the index for a label. More...
 
xAOD::JetConstitScale constitScale (Index idx) const
 Fetch the constit scale corresponding to the index. More...
 
Index size () const
 Number of label stored in this map. WARNING the index starts at 1, so range is [1...size()+1]. More...
 

Private Member Functions

 LabelIndex (const LabelIndex &nam)
 
LabelIndexoperator= (const Label &nam)
 

Private Attributes

Label m_name
 
std::vector< Labelm_labs
 
std::vector< xAOD::JetConstitScalem_constitScales
 

Detailed Description

Definition at line 22 of file LabelIndex.h.

Member Typedef Documentation

◆ Index

typedef unsigned int jet::LabelIndex::Index

Definition at line 27 of file LabelIndex.h.

◆ Label

typedef std::string jet::LabelIndex::Label

Definition at line 26 of file LabelIndex.h.

Constructor & Destructor Documentation

◆ LabelIndex() [1/2]

LabelIndex::LabelIndex ( Label  nam)
explicit

Ctor.

Definition at line 19 of file LabelIndex.cxx.

19 : m_name(std::move(nam)) { }

◆ LabelIndex() [2/2]

LabelIndex::LabelIndex ( const LabelIndex nam)
explicitprivate

Definition at line 66 of file LabelIndex.cxx.

66 : m_name("") { }

Member Function Documentation

◆ addLabel()

Index LabelIndex::addLabel ( const Label lab)

Add a label and get its index.

Current index is returned if the label is already indexed. Return 0 for error.

Definition at line 23 of file LabelIndex.cxx.

23  {
24  Index idx = index(lab);
25  if ( idx ) return idx;
26  m_labs.push_back(lab);
28  if ( lab == "EMTopo" ) conscale = xAOD::UncalibratedJetConstituent;
29  m_constitScales.push_back(conscale);
30  return m_labs.size();
31 }

◆ constitScale()

xAOD::JetConstitScale LabelIndex::constitScale ( Index  idx) const

Fetch the constit scale corresponding to the index.

Definition at line 49 of file LabelIndex.cxx.

49  {
50  if ( idx < 1 ) return xAOD::CalibratedJetConstituent;
51  if ( idx-1 > m_constitScales.size() ) return xAOD::UncalibratedJetConstituent;
52  return m_constitScales[idx - 1];
53 }

◆ index()

Index LabelIndex::index ( const Label lab) const

Fetch the index for a label.

Returns "" for error, e.g. unknown label.

Definition at line 57 of file LabelIndex.cxx.

57  {
58  for ( Index jdx=0; jdx<m_labs.size(); ++jdx ) {
59  if ( m_labs[jdx] == lab ) return jdx + 1;
60  }
61  return 0;
62 }

◆ label()

Label LabelIndex::label ( Index  idx) const

Fetch the label for an index.

Returns "" for error, e.g. unused index.

Definition at line 41 of file LabelIndex.cxx.

41  {
42  if ( idx < 1 ) return "";
43  if ( idx-1 > m_labs.size() ) return "";
44  return m_labs[idx - 1];
45 }

◆ name()

Label LabelIndex::name ( ) const

Return the name of this map.

Definition at line 35 of file LabelIndex.cxx.

35  {
36  return m_name;
37 }

◆ operator=()

LabelIndex & LabelIndex::operator= ( const Label nam)
private

Definition at line 70 of file LabelIndex.cxx.

70  {
71  return *this;
72 }

◆ size()

Index LabelIndex::size ( ) const

Number of label stored in this map. WARNING the index starts at 1, so range is [1...size()+1].

Definition at line 76 of file LabelIndex.cxx.

76 { return m_labs.size() ; }

Member Data Documentation

◆ m_constitScales

std::vector<xAOD::JetConstitScale> jet::LabelIndex::m_constitScales
private

Definition at line 63 of file LabelIndex.h.

◆ m_labs

std::vector<Label> jet::LabelIndex::m_labs
private

Definition at line 62 of file LabelIndex.h.

◆ m_name

Label jet::LabelIndex::m_name
private

Definition at line 61 of file LabelIndex.h.


The documentation for this class was generated from the following files:
jet::LabelIndex::m_name
Label m_name
Definition: LabelIndex.h:61
jet::LabelIndex::m_labs
std::vector< Label > m_labs
Definition: LabelIndex.h:62
Index
IndexedConstituentUserInfo::Index Index
Definition: IndexedConstituentUserInfo.cxx:12
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
xAOD::CalibratedJetConstituent
@ CalibratedJetConstituent
Definition: JetTypes.h:22
xAOD::JetConstitScale
JetConstitScale
Definition: JetTypes.h:20
xAOD::UncalibratedJetConstituent
@ UncalibratedJetConstituent
Definition: JetTypes.h:21
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69