CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CalibrationInterface< CategoryT, CalibDataT > Class Template Reference

#include <CalibrationInterface.h>

Public Member Functions

int addCategoryDefinition (const CategoryT &categoryDefinition)
 
int addEntry (const CategoryT &categoryDefinition, const CalibDataT &data)
 
 CalibrationInterface ()
 
const std::vector< std::pair< CategoryT, CalibDataT > > & categoriesWithData () const
 
CalibDataT * getCalibData (const typename CategoryT::Input &calibrationInput)
 
const CalibDataT * getCalibData (const typename CategoryT::Input &calibrationInput) const
 
CalibDataT * getCalibData (int index)
 
const CalibDataT * getCalibData (int index) const
 
const CategoryT * getCategoryDefinition (int index) const
 
int getIndex (const typename CategoryT::Input &calibrationInput) const
 
void setCalibData (int index, const CalibDataT &data)
 
int size () const
 
 ~CalibrationInterface ()
 

Private Attributes

std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
 

Detailed Description

template<class CategoryT, class CalibDataT>
class CalibrationInterface< CategoryT, CalibDataT >

Definition at line 12 of file CalibrationInterface.h.

Constructor & Destructor Documentation

◆ CalibrationInterface()

template<class CategoryT , class CalibDataT >
CalibrationInterface< CategoryT, CalibDataT >::CalibrationInterface ( )

Definition at line 45 of file CalibrationInterface.h.

45 {}

◆ ~CalibrationInterface()

template<class CategoryT , class CalibDataT >
CalibrationInterface< CategoryT, CalibDataT >::~CalibrationInterface ( )

Definition at line 48 of file CalibrationInterface.h.

48 {}

Member Function Documentation

◆ addCategoryDefinition()

template<class CategoryT, class CalibDataT >
int CalibrationInterface< CategoryT, CalibDataT >::addCategoryDefinition ( const CategoryT &  categoryDefinition)

Definition at line 87 of file CalibrationInterface.h.

87  {
88  CalibDataT emptyData;
89  return addEntry(categoryDefinition, emptyData);
90 }

◆ addEntry()

template<class CategoryT, class CalibDataT>
int CalibrationInterface< CategoryT, CalibDataT >::addEntry ( const CategoryT &  categoryDefinition,
const CalibDataT &  data 
)

Definition at line 93 of file CalibrationInterface.h.

93  {
94  std::pair<CategoryT, CalibDataT> newEntry(categoryDefinition, data);
95  m_categoriesWithData.push_back(newEntry);
96  return m_categoriesWithData.size();
97 }

◆ categoriesWithData()

template<class CategoryT, class CalibDataT>
const std::vector<std::pair<CategoryT, CalibDataT> >& CalibrationInterface< CategoryT, CalibDataT >::categoriesWithData ( ) const
inline

Definition at line 37 of file CalibrationInterface.h.

37 { return m_categoriesWithData; }

◆ getCalibData() [1/4]

template<class CategoryT, class CalibDataT>
CalibDataT* CalibrationInterface< CategoryT, CalibDataT >::getCalibData ( const typename CategoryT::Input &  calibrationInput)
inline

Definition at line 21 of file CalibrationInterface.h.

21  {
22  return (getCalibData(getIndex(calibrationInput)));
23  }

◆ getCalibData() [2/4]

template<class CategoryT, class CalibDataT>
const CalibDataT* CalibrationInterface< CategoryT, CalibDataT >::getCalibData ( const typename CategoryT::Input &  calibrationInput) const
inline

Definition at line 17 of file CalibrationInterface.h.

17  {
18  return (getCalibData(getIndex(calibrationInput)));
19  }

Referenced by CalibrationInterface< T, CO >::getCalibData().

◆ getCalibData() [3/4]

template<class CategoryT, class CalibDataT >
CalibDataT * CalibrationInterface< CategoryT, CalibDataT >::getCalibData ( int  index)

Definition at line 78 of file CalibrationInterface.h.

78  {
79  size_t ii = i;
80  if (i >= 0 && ii < m_categoriesWithData.size())
81  return &m_categoriesWithData[i].second;
82  else
83  return nullptr;
84 }

◆ getCalibData() [4/4]

template<class CategoryT, class CalibDataT >
const CalibDataT * CalibrationInterface< CategoryT, CalibDataT >::getCalibData ( int  index) const

Definition at line 69 of file CalibrationInterface.h.

69  {
70  size_t ii = i;
71  if (i >= 0 && ii < m_categoriesWithData.size())
72  return &m_categoriesWithData[i].second;
73  else
74  return 0;
75 }

◆ getCategoryDefinition()

template<class CategoryT, class CalibDataT>
const CategoryT* CalibrationInterface< CategoryT, CalibDataT >::getCategoryDefinition ( int  index) const

◆ getIndex()

template<class CategoryT, class CalibDataT >
int CalibrationInterface< CategoryT, CalibDataT >::getIndex ( const typename CategoryT::Input &  calibrationInput) const

Definition at line 51 of file CalibrationInterface.h.

51  {
52  int i = 0;
53  int found = -1;
54  for (typename std::vector<std::pair<CategoryT, CalibDataT> >::const_iterator it = m_categoriesWithData.begin();
55  it != m_categoriesWithData.end();
56  it++) {
57  if ((*it).first.match(calibrationInput)) {
58  if (found >= 0) {
59  edm::LogWarning("BTagCalibration") << "WARNING: OVERLAP in categories, using latest one";
60  }
61 
62  found = i;
63  }
64  i++;
65  }
66  return found;
67 }

Referenced by CalibrationInterface< T, CO >::getCalibData().

◆ setCalibData()

template<class CategoryT , class CalibDataT>
void CalibrationInterface< CategoryT, CalibDataT >::setCalibData ( int  index,
const CalibDataT &  data 
)

Definition at line 100 of file CalibrationInterface.h.

100  {
101  m_categoriesWithData[index].second = data;
102 }

◆ size()

template<class CategoryT, class CalibDataT>
int CalibrationInterface< CategoryT, CalibDataT >::size ( void  ) const
inline

Member Data Documentation

◆ m_categoriesWithData

template<class CategoryT, class CalibDataT>
std::vector<std::pair<CategoryT, CalibDataT> > CalibrationInterface< CategoryT, CalibDataT >::m_categoriesWithData
private
mps_fire.i
i
Definition: mps_fire.py:428
CalibrationInterface::getIndex
int getIndex(const typename CategoryT::Input &calibrationInput) const
Definition: CalibrationInterface.h:51
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CalibrationInterface::addEntry
int addEntry(const CategoryT &categoryDefinition, const CalibDataT &data)
Definition: CalibrationInterface.h:93
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
CalibrationInterface::getCalibData
const CalibDataT * getCalibData(const typename CategoryT::Input &calibrationInput) const
Definition: CalibrationInterface.h:17
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
cuy.ii
ii
Definition: cuy.py:589
CalibrationInterface::m_categoriesWithData
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
Definition: CalibrationInterface.h:41