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
 
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 11 of file CalibrationInterface.h.

Constructor & Destructor Documentation

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

Definition at line 50 of file CalibrationInterface.h.

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

Definition at line 55 of file CalibrationInterface.h.

56 {
57 }

Member Function Documentation

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

Definition at line 102 of file CalibrationInterface.h.

References CalibrationInterface< CategoryT, CalibDataT >::addEntry().

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

103 {
104  CalibDataT emptyData;
105  return addEntry(categoryDefinition,emptyData);
106 }
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 109 of file CalibrationInterface.h.

References CalibrationInterface< CategoryT, CalibDataT >::m_categoriesWithData.

Referenced by CalibrationInterface< CategoryT, CalibDataT >::addCategoryDefinition(), and CalibrationInterface< T, CO >::getCalibData().

110 {
111  std::pair<CategoryT,CalibDataT> newEntry(categoryDefinition,data);
112  m_categoriesWithData.push_back(newEntry);
113  return m_categoriesWithData.size();
114 }
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
template<class CategoryT, class CalibDataT>
const std::vector<std::pair<CategoryT, CalibDataT> >& CalibrationInterface< CategoryT, CalibDataT >::categoriesWithData ( ) const
inline

Definition at line 41 of file CalibrationInterface.h.

41 {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 18 of file CalibrationInterface.h.

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

19  {
20  return(getCalibData(getIndex(calibrationInput)));
21  }
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 23 of file CalibrationInterface.h.

24  {
25  return(getCalibData(getIndex(calibrationInput)));
26  }
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 81 of file CalibrationInterface.h.

References mps_fire::i, cuy::ii, CalibrationInterface< CategoryT, CalibDataT >::m_categoriesWithData, and edm::second().

82 {
83  size_t ii=i;
84  if(i>=0 && ii < m_categoriesWithData.size() )
85  return &m_categoriesWithData[i].second;
86  else
87  return 0;
88 }
U second(std::pair< T, U > const &p)
ii
Definition: cuy.py:588
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
template<class CategoryT, class CalibDataT >
CalibDataT * CalibrationInterface< CategoryT, CalibDataT >::getCalibData ( int  index)

Definition at line 92 of file CalibrationInterface.h.

References mps_fire::i, cuy::ii, CalibrationInterface< CategoryT, CalibDataT >::m_categoriesWithData, and edm::second().

93 {
94  size_t ii=i;
95  if(i>=0 && ii < m_categoriesWithData.size() )
96  return &m_categoriesWithData[i].second;
97  else
98  return 0;
99 }
U second(std::pair< T, U > const &p)
ii
Definition: cuy.py:588
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 60 of file CalibrationInterface.h.

References runEdmFileComparison::found, mps_fire::i, and CalibrationInterface< CategoryT, CalibDataT >::m_categoriesWithData.

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

61 {
62  int i=0;
63  int found=-1;
64  for(typename std::vector<std::pair<CategoryT,CalibDataT> >::const_iterator it = m_categoriesWithData.begin();it!=m_categoriesWithData.end();it++)
65  {
66 
67  if((*it).first.match(calibrationInput))
68  {
69  if(found >=0 )
70  {
71  edm::LogWarning("BTagCalibration") << "WARNING: OVERLAP in categories, using latest one" ;
72  }
73 
74  found=i;
75  }
76  i++;
77  }
78  return found;
79 }
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
template<class CategoryT , class CalibDataT>
void CalibrationInterface< CategoryT, CalibDataT >::setCalibData ( int  index,
const CalibDataT &  data 
)

Definition at line 118 of file CalibrationInterface.h.

References data, and CalibrationInterface< CategoryT, CalibDataT >::m_categoriesWithData.

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

119 {
121 }
std::vector< std::pair< CategoryT, CalibDataT > > m_categoriesWithData
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
template<class CategoryT, class CalibDataT>
int CalibrationInterface< CategoryT, CalibDataT >::size ( void  ) const
inline

Definition at line 42 of file CalibrationInterface.h.

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

42 {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