CMS 3D CMS Logo

LumiDetails.h
Go to the documentation of this file.
1 #ifndef DataFormats_Luminosity_LumiDetails_h
2 #define DataFormats_Luminosity_LumiDetails_h
3 
15 #include <utility>
16 #include <vector>
17 #include <string>
18 #include <iosfwd>
19 
20 class LumiDetails {
21 public:
22  // If in the future additional algorithm names are added,
23  // it is important that they be added at the end of the list.
24  // The LumiDetails::algoNames function in LumiDetails.cc also
25  // would need to be updated to keep the list of names in sync.
27  typedef unsigned int AlgoType;
28  typedef std::pair<std::vector<float>::const_iterator, std::vector<float>::const_iterator> ValueRange;
29  typedef std::pair<std::vector<float>::const_iterator, std::vector<float>::const_iterator> ErrorRange;
30  typedef std::pair<std::vector<short>::const_iterator, std::vector<short>::const_iterator> QualityRange;
31 
32  LumiDetails();
33  explicit LumiDetails(std::string const& lumiVersion);
34  ~LumiDetails();
35 
37  std::string const& lumiVersion() const;
38  bool isValid() const;
39 
40  // This will perform more efficiently if the calls to this
41  // are in the same order as the Algos enumeration. It will
42  // work properly even if they are not.
43  void fill(AlgoType algo,
44  std::vector<float> const& values,
45  std::vector<float> const& errors,
46  std::vector<short> const& qualities);
47 
48  void fillBeamIntensities(std::vector<float> const& beam1Intensities, std::vector<float> const& beam2Intensities);
49 
50  float lumiValue(AlgoType algo, unsigned int bx) const;
51  float lumiError(AlgoType algo, unsigned int bx) const;
52  short lumiQuality(AlgoType algo, unsigned int bx) const;
53  float lumiBeam1Intensity(unsigned int bx) const;
54  float lumiBeam2Intensity(unsigned int bx) const;
55 
56  ValueRange lumiValuesForAlgo(AlgoType algo) const;
57  ErrorRange lumiErrorsForAlgo(AlgoType algo) const;
58  QualityRange lumiQualitiesForAlgo(AlgoType algo) const;
59  std::vector<float> const& lumiBeam1Intensities() const;
60  std::vector<float> const& lumiBeam2Intensities() const;
61 
62  bool isProductEqual(LumiDetails const& lumiDetails) const;
63 
64  static std::vector<std::string> const& algoNames();
65 
66  static std::vector<std::string> const& dipalgoNames();
67 
68 private:
69  void checkAlgo(AlgoType algo) const;
70  void checkAlgoAndBX(AlgoType algo, unsigned int bx) const;
71 
72  static std::vector<std::string> const m_algoNames;
73 
75 
76  /* m_algoToFirstIndex is 'kMaxNumAlgos' long. Each algorithm's
77  numerical value from the enum Algos is used as the index into m_algoToFirstIndex
78  to find the first entry into the m_all* vectors containing data for that
79  algorithm. The entry beyond the last entry is found by using the numerical value + 1.
80  If the first and last index are the same then there is no information recorded for that
81  algorithm.
82  */
83  std::vector<unsigned int> m_algoToFirstIndex;
84  std::vector<float> m_allValues;
85  std::vector<float> m_allErrors;
86  std::vector<short> m_allQualities;
87  std::vector<float> m_beam1Intensities;
88  std::vector<float> m_beam2Intensities;
89 };
90 
91 std::ostream& operator<<(std::ostream& s, LumiDetails const& lumiDetails);
92 
93 #endif
float lumiBeam2Intensity(unsigned int bx) const
Definition: LumiDetails.cc:89
std::vector< float > const & lumiBeam2Intensities() const
Definition: LumiDetails.cc:111
std::pair< std::vector< float >::const_iterator, std::vector< float >::const_iterator > ValueRange
Definition: LumiDetails.h:28
ValueRange lumiValuesForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:91
std::ostream & operator<<(std::ostream &s, LumiDetails const &lumiDetails)
Definition: LumiDetails.cc:144
bool isValid() const
Definition: LumiDetails.cc:44
void checkAlgoAndBX(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:136
std::vector< float > m_allErrors
Definition: LumiDetails.h:85
std::pair< std::vector< float >::const_iterator, std::vector< float >::const_iterator > ErrorRange
Definition: LumiDetails.h:29
std::vector< float > const & lumiBeam1Intensities() const
Definition: LumiDetails.cc:109
float lumiValue(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:72
std::vector< float > m_beam2Intensities
Definition: LumiDetails.h:88
float lumiBeam1Intensity(unsigned int bx) const
Definition: LumiDetails.cc:87
static std::vector< std::string > const m_algoNames
Definition: LumiDetails.h:72
short lumiQuality(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:82
void setLumiVersion(std::string const &lumiVersion)
Definition: LumiDetails.cc:40
std::string m_lumiVersion
Definition: LumiDetails.h:74
std::pair< std::vector< short >::const_iterator, std::vector< short >::const_iterator > QualityRange
Definition: LumiDetails.h:30
ErrorRange lumiErrorsForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:97
void fill(AlgoType algo, std::vector< float > const &values, std::vector< float > const &errors, std::vector< short > const &qualities)
Definition: LumiDetails.cc:46
static std::vector< std::string > const & dipalgoNames()
Definition: LumiDetails.cc:118
std::vector< float > m_allValues
Definition: LumiDetails.h:84
static std::vector< std::string > const & algoNames()
Definition: LumiDetails.cc:113
unsigned int AlgoType
Definition: LumiDetails.h:27
void checkAlgo(AlgoType algo) const
Definition: LumiDetails.cc:129
std::vector< unsigned int > m_algoToFirstIndex
Definition: LumiDetails.h:83
QualityRange lumiQualitiesForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:103
float lumiError(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:77
std::vector< short > m_allQualities
Definition: LumiDetails.h:86
void fillBeamIntensities(std::vector< float > const &beam1Intensities, std::vector< float > const &beam2Intensities)
Definition: LumiDetails.cc:66
Definition: errors.py:1
std::string const & lumiVersion() const
Definition: LumiDetails.cc:42
bool isProductEqual(LumiDetails const &lumiDetails) const
Definition: LumiDetails.cc:119
std::vector< float > m_beam1Intensities
Definition: LumiDetails.h:87