File indexing completed on 2024-04-06 12:01:56
0001 #ifndef BEAMSPOTONLINEOBJECTS_H
0002 #define BEAMSPOTONLINEOBJECTS_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "CondFormats/Serialization/interface/Serializable.h"
0016 #include "CondFormats/Common/interface/Time.h"
0017 #include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
0018
0019 #include <cmath>
0020 #include <sstream>
0021 #include <cstring>
0022 #include <vector>
0023 #include <string>
0024
0025 class BeamSpotOnlineObjects : public BeamSpotObjects {
0026 public:
0027
0028 BeamSpotOnlineObjects() {
0029 lastAnalyzedLumi_ = 0;
0030 lastAnalyzedRun_ = 0;
0031 lastAnalyzedFill_ = 0;
0032 intParams_.resize(ISIZE, std::vector<int>(1, 0));
0033 floatParams_.resize(FSIZE, std::vector<float>(1, 0.0));
0034 stringParams_.resize(SSIZE, std::vector<std::string>(1, ""));
0035 timeParams_.resize(TSIZE, std::vector<unsigned long long>(1, 0ULL));
0036 }
0037
0038 ~BeamSpotOnlineObjects() override {}
0039
0040
0041 enum IntParamIndex { NUM_TRACKS = 0, NUM_PVS = 1, USED_EVENTS = 2, MAX_PVS = 3, ISIZE = 4 };
0042 enum FloatParamIndex { MEAN_PV = 0, ERR_MEAN_PV = 1, RMS_PV = 2, ERR_RMS_PV = 3, FSIZE = 4 };
0043 enum StringParamIndex { START_TIME = 0, END_TIME = 1, LUMI_RANGE = 2, SSIZE = 3 };
0044 enum TimeParamIndex { CREATE_TIME = 0, START_TIMESTAMP = 1, END_TIMESTAMP = 2, TSIZE = 3 };
0045
0046
0047
0048 void copyFromBeamSpotObject(const BeamSpotObjects& bs);
0049
0050
0051 void setLastAnalyzedLumi(int val) { lastAnalyzedLumi_ = val; }
0052
0053
0054 void setLastAnalyzedRun(int val) { lastAnalyzedRun_ = val; }
0055
0056
0057 void setLastAnalyzedFill(int val) { lastAnalyzedFill_ = val; }
0058
0059
0060 void setNumTracks(int val);
0061
0062
0063 void setNumPVs(int val);
0064
0065
0066 void setUsedEvents(int val);
0067
0068
0069 void setMaxPVs(int val);
0070
0071
0072 void setMeanPV(float val);
0073
0074
0075 void setMeanErrorPV(float val);
0076
0077
0078 void setRmsPV(float val);
0079
0080
0081 void setRmsErrorPV(float val);
0082
0083
0084 void setStartTime(std::string val);
0085
0086
0087 void setEndTime(std::string val);
0088
0089
0090 void setLumiRange(std::string val);
0091
0092
0093 void setCreationTime(cond::Time_t val);
0094
0095
0096 void setStartTimeStamp(cond::Time_t val);
0097
0098
0099 void setEndTimeStamp(cond::Time_t val);
0100
0101
0102
0103 int lastAnalyzedLumi() const { return lastAnalyzedLumi_; }
0104
0105
0106 int lastAnalyzedRun() const { return lastAnalyzedRun_; }
0107
0108
0109 int lastAnalyzedFill() const { return lastAnalyzedFill_; }
0110
0111
0112 int numTracks() const;
0113
0114
0115 int numPVs() const;
0116
0117
0118 int usedEvents() const;
0119
0120
0121 int maxPVs() const;
0122
0123
0124 float meanPV() const;
0125
0126
0127 float meanErrorPV() const;
0128
0129
0130 float rmsPV() const;
0131
0132
0133 float rmsErrorPV() const;
0134
0135
0136 std::string startTime() const;
0137
0138
0139 std::string endTime() const;
0140
0141
0142 std::string lumiRange() const;
0143
0144
0145 cond::Time_t creationTime() const;
0146
0147
0148 cond::Time_t startTimeStamp() const;
0149
0150
0151 cond::Time_t endTimeStamp() const;
0152
0153
0154 void print(std::stringstream& ss) const;
0155
0156 private:
0157 int lastAnalyzedLumi_;
0158 int lastAnalyzedRun_;
0159 int lastAnalyzedFill_;
0160 std::vector<std::vector<int> > intParams_;
0161 std::vector<std::vector<float> > floatParams_;
0162 std::vector<std::vector<std::string> > stringParams_;
0163 std::vector<std::vector<unsigned long long> > timeParams_;
0164
0165 COND_SERIALIZABLE;
0166 };
0167
0168 std::ostream& operator<<(std::ostream&, BeamSpotOnlineObjects beam);
0169
0170 #endif