CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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 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

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

Definition at line 45 of file CalibrationInterface.h.

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

Definition at line 48 of file CalibrationInterface.h.

48 {}

Member Function Documentation

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 }
int addEntry(const CategoryT &categoryDefinition, const CalibDataT &data)
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 }
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
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; }
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
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.

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

17  {
18  return (getCalibData(getIndex(calibrationInput)));
19  }
int getIndex(const typename CategoryT::Input &calibrationInput) const
const CalibDataT * getCalibData(const typename CategoryT::Input &calibrationInput) const
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  }
int getIndex(const typename CategoryT::Input &calibrationInput) const
const CalibDataT * getCalibData(const typename CategoryT::Input &calibrationInput) const
template<class CategoryT, class CalibDataT >
const CalibDataT * CalibrationInterface< CategoryT, CalibDataT >::getCalibData ( int  index) const

Definition at line 69 of file CalibrationInterface.h.

References mps_fire::i, cuy::ii, and edm::second().

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 }
int ii
Definition: cuy.py:589
U second(std::pair< T, U > const &p)
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
template<class CategoryT, class CalibDataT >
CalibDataT * CalibrationInterface< CategoryT, CalibDataT >::getCalibData ( int  index)

Definition at line 78 of file CalibrationInterface.h.

References mps_fire::i, cuy::ii, and edm::second().

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 }
int ii
Definition: cuy.py:589
U second(std::pair< T, U > const &p)
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
template<class CategoryT, class CalibDataT>
const CategoryT* CalibrationInterface< CategoryT, CalibDataT >::getCategoryDefinition ( int  index) const
template<class CategoryT, class CalibDataT >
int CalibrationInterface< CategoryT, CalibDataT >::getIndex ( const typename CategoryT::Input &  calibrationInput) const

Definition at line 51 of file CalibrationInterface.h.

References newFWLiteAna::found, mps_fire::i, and trackerHitRTTI::vector.

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

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 }
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
Log< level::Warning, false > LogWarning
template<class CategoryT , class CalibDataT>
void CalibrationInterface< CategoryT, CalibDataT >::setCalibData ( int  index,
const CalibDataT &  data 
)

Definition at line 100 of file CalibrationInterface.h.

References data.

100  {
101  m_categoriesWithData[index].second = data;
102 }
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
template<class CategoryT, class CalibDataT>
int CalibrationInterface< CategoryT, CalibDataT >::size ( void  ) const
inline

Definition at line 38 of file CalibrationInterface.h.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

38 { return m_categoriesWithData.size(); }
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData

Member Data Documentation

template<class CategoryT, class CalibDataT>
std::vector<std::pair<CategoryT, CalibDataT> > CalibrationInterface< CategoryT, CalibDataT >::m_categoriesWithData
private