File indexing completed on 2024-04-06 12:04:40
0001 #ifndef DataFormats_Luminosity_BeamCurrentInfo_h
0002 #define DataFormats_Luminosity_BeamCurrentInfo_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include <vector>
0027 #include <iosfwd>
0028 #include <string>
0029 #include <cstdint>
0030 #include "DataFormats/Luminosity/interface/LumiConstants.h"
0031
0032 class BeamCurrentInfo {
0033 public:
0034 static const float scaleFactor;
0035
0036
0037 BeamCurrentInfo() {
0038 beam1IntensitiesUnpacked_.assign(LumiConstants::numBX, 0.0);
0039 beam2IntensitiesUnpacked_.assign(LumiConstants::numBX, 0.0);
0040 beam1IntensitiesPacked_.assign(LumiConstants::numBX, 0);
0041 beam2IntensitiesPacked_.assign(LumiConstants::numBX, 0);
0042 }
0043
0044
0045 BeamCurrentInfo(const std::vector<float>& beam1Intensities, const std::vector<float>& beam2Intensities) {
0046 beam1IntensitiesUnpacked_.assign(beam1Intensities.begin(), beam1Intensities.end());
0047 beam2IntensitiesUnpacked_.assign(beam2Intensities.begin(), beam2Intensities.end());
0048 packData();
0049 }
0050
0051
0052 ~BeamCurrentInfo() {}
0053
0054
0055 float getBeam1IntensityBX(int bx) const;
0056 const std::vector<float>& getBeam1Intensities() const;
0057 float getBeam2IntensityBX(int bx) const;
0058 const std::vector<float>& getBeam2Intensities() const;
0059
0060
0061 const std::vector<uint16_t>& getBeam1IntensitiesPacked() const { return beam1IntensitiesPacked_; }
0062 const std::vector<uint16_t>& getBeam2IntensitiesPacked() const { return beam2IntensitiesPacked_; }
0063
0064 bool isProductEqual(BeamCurrentInfo const& next) const;
0065
0066
0067
0068
0069
0070
0071 void fillBeamIntensities(const std::vector<float>& beam1Intensities, const std::vector<float>& beam2Intensities);
0072
0073 void fill(const std::vector<float>& beam1Intensities, const std::vector<float>& beam2Intensities);
0074
0075
0076 static void unpackData(const std::vector<uint16_t>& packed, std::vector<float>& unpacked);
0077
0078 private:
0079 std::vector<uint16_t> beam1IntensitiesPacked_;
0080 std::vector<uint16_t> beam2IntensitiesPacked_;
0081 std::vector<float> beam1IntensitiesUnpacked_;
0082 std::vector<float> beam2IntensitiesUnpacked_;
0083 void packData();
0084 void unpackData();
0085 };
0086
0087 std::ostream& operator<<(std::ostream& s, const BeamCurrentInfo& beamInfo);
0088
0089 #endif