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 
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
LumiDetails::checkAlgo
void checkAlgo(AlgoType algo) const
Definition: LumiDetails.cc:129
LumiDetails::kET
Definition: LumiDetails.h:26
LumiDetails::m_allErrors
std::vector< float > m_allErrors
Definition: LumiDetails.h:85
LumiDetails::Algos
Algos
Definition: LumiDetails.h:26
LumiDetails::LumiDetails
LumiDetails()
Definition: LumiDetails.cc:20
LumiDetails::QualityRange
std::pair< std::vector< short >::const_iterator, std::vector< short >::const_iterator > QualityRange
Definition: LumiDetails.h:30
LumiDetails::m_lumiVersion
std::string m_lumiVersion
Definition: LumiDetails.h:74
LumiDetails::algoNames
static std::vector< std::string > const & algoNames()
Definition: LumiDetails.cc:113
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
LumiDetails::setLumiVersion
void setLumiVersion(std::string const &lumiVersion)
Definition: LumiDetails.cc:40
LumiDetails
Definition: LumiDetails.h:20
LumiDetails::kOCC1
Definition: LumiDetails.h:26
LumiDetails::kPLT
Definition: LumiDetails.h:26
LumiDetails::m_algoNames
static const std::vector< std::string > m_algoNames
Definition: LumiDetails.h:72
LumiDetails::fill
void fill(AlgoType algo, std::vector< float > const &values, std::vector< float > const &errors, std::vector< short > const &qualities)
Definition: LumiDetails.cc:46
cmsdt::algo
algo
Definition: constants.h:164
LumiDetails::ValueRange
std::pair< std::vector< float >::const_iterator, std::vector< float >::const_iterator > ValueRange
Definition: LumiDetails.h:28
alignCSCRings.s
s
Definition: alignCSCRings.py:92
LumiDetails::isValid
bool isValid() const
Definition: LumiDetails.cc:44
errors
Definition: errors.py:1
LumiDetails::m_allValues
std::vector< float > m_allValues
Definition: LumiDetails.h:84
LumiDetails::lumiError
float lumiError(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:77
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
LumiDetails::lumiValuesForAlgo
ValueRange lumiValuesForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:91
LumiDetails::lumiValue
float lumiValue(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:72
LumiDetails::checkAlgoAndBX
void checkAlgoAndBX(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:136
LumiDetails::m_algoToFirstIndex
std::vector< unsigned int > m_algoToFirstIndex
Definition: LumiDetails.h:83
LumiDetails::ErrorRange
std::pair< std::vector< float >::const_iterator, std::vector< float >::const_iterator > ErrorRange
Definition: LumiDetails.h:29
LumiDetails::m_beam2Intensities
std::vector< float > m_beam2Intensities
Definition: LumiDetails.h:88
LumiDetails::dipalgoNames
static std::vector< std::string > const & dipalgoNames()
Definition: LumiDetails.cc:118
LumiDetails::~LumiDetails
~LumiDetails()
Definition: LumiDetails.cc:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LumiDetails::kMaxNumAlgos
Definition: LumiDetails.h:26
LumiDetails::lumiBeam1Intensity
float lumiBeam1Intensity(unsigned int bx) const
Definition: LumiDetails.cc:87
LumiDetails::lumiBeam2Intensities
std::vector< float > const & lumiBeam2Intensities() const
Definition: LumiDetails.cc:111
LumiDetails::lumiQuality
short lumiQuality(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:82
LumiDetails::m_allQualities
std::vector< short > m_allQualities
Definition: LumiDetails.h:86
LumiDetails::m_beam1Intensities
std::vector< float > m_beam1Intensities
Definition: LumiDetails.h:87
LumiDetails::lumiVersion
std::string const & lumiVersion() const
Definition: LumiDetails.cc:42
LumiDetails::lumiErrorsForAlgo
ErrorRange lumiErrorsForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:97
LumiDetails::lumiBeam1Intensities
std::vector< float > const & lumiBeam1Intensities() const
Definition: LumiDetails.cc:109
LumiDetails::kOCC2
Definition: LumiDetails.h:26
LumiDetails::lumiQualitiesForAlgo
QualityRange lumiQualitiesForAlgo(AlgoType algo) const
Definition: LumiDetails.cc:103
LumiDetails::lumiBeam2Intensity
float lumiBeam2Intensity(unsigned int bx) const
Definition: LumiDetails.cc:89
LumiDetails::AlgoType
unsigned int AlgoType
Definition: LumiDetails.h:27
LumiDetails::fillBeamIntensities
void fillBeamIntensities(std::vector< float > const &beam1Intensities, std::vector< float > const &beam2Intensities)
Definition: LumiDetails.cc:66
LumiDetails::isProductEqual
bool isProductEqual(LumiDetails const &lumiDetails) const
Definition: LumiDetails.cc:119
operator<<
std::ostream & operator<<(std::ostream &s, LumiDetails const &lumiDetails)
Definition: LumiDetails.cc:144