All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalibrationExtraInfo.cxx
Go to the documentation of this file.
1 #include "CalibrationExtraInfo.h"
2 #include "IOVDataError.h"
3 
4 namespace lariov {
5 
6  void CalibrationExtraInfo::AddOrReplaceBoolData(std::string const& label, bool const data) {
7  fBoolData[label] = data;
8  }
9 
10  void CalibrationExtraInfo::AddOrReplaceIntData(std::string const& label, int const data) {
11  fIntData[label] = data;
12  }
13 
14  void CalibrationExtraInfo::AddOrReplaceVecIntData(std::string const& label, std::vector<int> const& data) {
15  fVecIntData[label] = data;
16  }
17 
18  void CalibrationExtraInfo::AddOrReplaceFloatData(std::string const& label, float const data) {
19  fFloatData[label] = data;
20  }
21 
22  void CalibrationExtraInfo::AddOrReplaceVecFloatData(std::string const& label, std::vector<float> const& data) {
23  fVecFloatData[label] = data;
24  }
25 
26  void CalibrationExtraInfo::AddOrReplaceStringData(std::string const& label, std::string const& data) {
27  fStringData[label] = data;
28  }
29 
30  void CalibrationExtraInfo::ClearDataByLabel(std::string const& label) {
31  unsigned int n_erased = 0;
32 
33  n_erased += fBoolData.erase(label);
34  n_erased += fIntData.erase(label);
35  n_erased += fVecIntData.erase(label);
36  n_erased += fFloatData.erase(label);
37  n_erased += fVecFloatData.erase(label);
38  n_erased += fStringData.erase(label);
39 
40  if (n_erased > 1) {
41  std::cout<<"INFO(CalibrationExtraInfo): Erased more than one entry with label "<<label<<". Recommend that you do not use identical labels"<<std::endl;
42  }
43  }
44 
46  fBoolData.clear();
47  fIntData.clear();
48  fVecIntData.clear();
49  fFloatData.clear();
50  fVecFloatData.clear();
51  fStringData.clear();
52  }
53 
54  bool CalibrationExtraInfo::GetBoolData(std::string const& label) const {
55  if (fBoolData.find(label) != fBoolData.end()) {
56  return fBoolData.at(label);
57  }
58 
59  throw IOVDataError("CalibrationExtraInfo: Could not find extra bool data "+label+" for calibration "+fName);
60 
61  }
62 
63  int CalibrationExtraInfo::GetIntData(std::string const& label) const {
64  if (fIntData.find(label) != fIntData.end()) {
65  return fIntData.at(label);
66  }
67 
68  throw IOVDataError("CalibrationExtraInfo: Could not find extra int data "+label+" for calibration "+fName);
69 
70  }
71 
72  std::vector<int> const& CalibrationExtraInfo::GetVecIntData(std::string const& label) const {
73  if (fVecIntData.find(label) != fVecIntData.end()) {
74  return fVecIntData.at(label);
75  }
76 
77  throw IOVDataError("CalibrationExtraInfo: Could not find extra vector int data "+label+" for calibration "+fName);
78 
79  }
80 
81  float CalibrationExtraInfo::GetFloatData(std::string const& label) const {
82  if (fFloatData.find(label) != fFloatData.end()) {
83  return fFloatData.at(label);
84  }
85 
86  throw IOVDataError("CalibrationExtraInfo: Could not find extra float data "+label+" for calibration "+fName);
87 
88  }
89 
90  std::vector<float> const& CalibrationExtraInfo::GetVecFloatData(std::string const& label) const {
91  if (fVecFloatData.find(label) != fVecFloatData.end()) {
92  return fVecFloatData.at(label);
93  }
94 
95  throw IOVDataError("CalibrationExtraInfo: Could not find extra vector float data "+label+" for calibration "+fName);
96 
97  }
98 
99  std::string const& CalibrationExtraInfo::GetStringData(std::string const& label) const {
100  if (fStringData.find(label) != fStringData.end()) {
101  return fStringData.at(label);
102  }
103 
104  throw IOVDataError("CalibrationExtraInfo: Could not find extra string data "+label+" for calibration "+fName);
105 
106  }
107 }//end namesplace lariov
void AddOrReplaceVecIntData(std::string const &label, std::vector< int > const &data)
std::map< std::string, std::vector< float > > fVecFloatData
float GetFloatData(std::string const &label) const
void ClearDataByLabel(std::string const &label)
std::vector< float > const & GetVecFloatData(std::string const &label) const
std::map< std::string, std::string > fStringData
std::map< std::string, int > fIntData
std::string const & GetStringData(std::string const &label) const
void AddOrReplaceBoolData(std::string const &label, bool const data)
void AddOrReplaceVecFloatData(std::string const &label, std::vector< float > const &data)
void AddOrReplaceIntData(std::string const &label, int const data)
void AddOrReplaceStringData(std::string const &label, std::string const &data)
std::map< std::string, bool > fBoolData
bool GetBoolData(std::string const &label) const
void AddOrReplaceFloatData(std::string const &label, float const data)
Collection of exception classes for IOVData.
std::map< std::string, std::vector< int > > fVecIntData
int GetIntData(std::string const &label) const
std::vector< int > const & GetVecIntData(std::string const &label) const
std::map< std::string, float > fFloatData
BEGIN_PROLOG could also be cout