CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
23  // If in the future additional algorithm names are added,
24  // it is important that they be added at the end of the list.
25  // The LumiDetails::algoNames function in LumiDetails.cc also
26  // would need to be updated to keep the list of names in sync.
27  enum Algos {
30  kET,
33  };
34  typedef unsigned int AlgoType;
35  typedef std::pair<std::vector<float>::const_iterator, std::vector<float>::const_iterator> ValueRange;
36  typedef std::pair<std::vector<float>::const_iterator, std::vector<float>::const_iterator> ErrorRange;
37  typedef std::pair<std::vector<short>::const_iterator, std::vector<short>::const_iterator> QualityRange;
38 
39  LumiDetails();
40  explicit LumiDetails(std::string const& lumiVersion);
41  ~LumiDetails();
42 
43  void setLumiVersion(std::string const& lumiVersion);
44  std::string const& lumiVersion() const;
45  bool isValid() const;
46 
47  // This will perform more efficiently if the calls to this
48  // are in the same order as the Algos enumeration. It will
49  // work properly even if they are not.
50  void fill(AlgoType algo,
51  std::vector<float> const& values,
52  std::vector<float> const& errors,
53  std::vector<short> const& qualities);
54 
55  void fillBeamIntensities(std::vector<float> const& beam1Intensities,
56  std::vector<float> const& beam2Intensities);
57 
58  float lumiValue(AlgoType algo, unsigned int bx) const;
59  float lumiError(AlgoType algo, unsigned int bx) const;
60  short lumiQuality(AlgoType algo, unsigned int bx) const;
61  float lumiBeam1Intensity(unsigned int bx) const;
62  float lumiBeam2Intensity(unsigned int bx) const;
63 
67  std::vector<float> const& lumiBeam1Intensities() const;
68  std::vector<float> const& lumiBeam2Intensities() const;
69 
70  bool isProductEqual(LumiDetails const& lumiDetails) const;
71 
72  static std::vector<std::string> const& algoNames();
73 
74  static std::vector<std::string> const& dipalgoNames();
75 
76 private:
77 
78  void checkAlgo(AlgoType algo) const;
79  void checkAlgoAndBX(AlgoType algo, unsigned int bx) const;
80 
81  static std::vector<std::string> m_algoNames;
82 
83  std::string m_lumiVersion;
84 
85  /* m_algoToFirstIndex is 'kMaxNumAlgos' long. Each algorithm's
86  numerical value from the enum Algos is used as the index into m_algoToFirstIndex
87  to find the first entry into the m_all* vectors containing data for that
88  algorithm. The entry beyond the last entry is found by using the numerical value + 1.
89  If the first and last index are the same then there is no information recorded for that
90  algorithm.
91  */
92  std::vector<unsigned int> m_algoToFirstIndex;
93  std::vector<float> m_allValues;
94  std::vector<float> m_allErrors;
95  std::vector<short> m_allQualities;
96  std::vector<float> m_beam1Intensities;
97  std::vector<float> m_beam2Intensities;
98 };
99 
100 std::ostream& operator<<(std::ostream & s, LumiDetails const& lumiDetails);
101 
102 #endif
float lumiBeam2Intensity(unsigned int bx) const
Definition: LumiDetails.cc:104
std::vector< float > const & lumiBeam2Intensities() const
Definition: LumiDetails.cc:135
std::pair< std::vector< float >::const_iterator, std::vector< float >::const_iterator > ValueRange
Definition: LumiDetails.h:35
ValueRange lumiValuesForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:109
bool isValid() const
Definition: LumiDetails.cc:46
void checkAlgoAndBX(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:185
std::vector< float > m_allErrors
Definition: LumiDetails.h:94
std::pair< std::vector< float >::const_iterator, std::vector< float >::const_iterator > ErrorRange
Definition: LumiDetails.h:36
std::vector< float > const & lumiBeam1Intensities() const
Definition: LumiDetails.cc:130
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
float lumiValue(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:81
std::vector< float > m_beam2Intensities
Definition: LumiDetails.h:97
float lumiBeam1Intensity(unsigned int bx) const
Definition: LumiDetails.cc:99
short lumiQuality(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:93
void setLumiVersion(std::string const &lumiVersion)
Definition: LumiDetails.cc:36
std::string m_lumiVersion
Definition: LumiDetails.h:83
std::pair< std::vector< short >::const_iterator, std::vector< short >::const_iterator > QualityRange
Definition: LumiDetails.h:37
static std::vector< std::string > m_algoNames
Definition: LumiDetails.h:81
ErrorRange lumiErrorsForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:116
void fill(AlgoType algo, std::vector< float > const &values, std::vector< float > const &errors, std::vector< short > const &qualities)
Definition: LumiDetails.cc:51
static std::vector< std::string > const & dipalgoNames()
Definition: LumiDetails.cc:157
std::vector< float > m_allValues
Definition: LumiDetails.h:93
static std::vector< std::string > const & algoNames()
Definition: LumiDetails.cc:140
unsigned int AlgoType
Definition: LumiDetails.h:34
void checkAlgo(AlgoType algo) const
Definition: LumiDetails.cc:177
std::vector< unsigned int > m_algoToFirstIndex
Definition: LumiDetails.h:92
QualityRange lumiQualitiesForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:123
float lumiError(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:87
std::vector< short > m_allQualities
Definition: LumiDetails.h:95
void fillBeamIntensities(std::vector< float > const &beam1Intensities, std::vector< float > const &beam2Intensities)
Definition: LumiDetails.cc:74
LimitAlgo * algo
Definition: Combine.cc:60
std::string const & lumiVersion() const
Definition: LumiDetails.cc:41
bool isProductEqual(LumiDetails const &lumiDetails) const
Definition: LumiDetails.cc:162
std::vector< float > m_beam1Intensities
Definition: LumiDetails.h:96