Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-08 08:15:52

0001 #ifndef BEAMSPOTONLINEOBJECTS_H
0002 #define BEAMSPOTONLINEOBJECTS_H
0003 /** \class BeamSpotOnlineObjects
0004  *
0005  * Class inheriting from BeamSpotObjects. 
0006  * New members of the class:
0007  *  - lastAnalyzedLumi : last lumisection analyzed
0008  *  - lastAnalyzedRun  : run of the last analyzed lumisection
0009  *  - lastAnalyzedFill : fill of the last analyzed lumisection
0010  *
0011  * \author Francisco Brivio, Milano-Bicocca (francesco.brivio@cern.ch)
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   /// default constructor
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   /// Enums
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   /// Setters Methods
0047   // set lastAnalyzedLumi_, last analyzed lumisection
0048   void setLastAnalyzedLumi(int val) { lastAnalyzedLumi_ = val; }
0049 
0050   // set lastAnalyzedRun_, run of the last analyzed lumisection
0051   void setLastAnalyzedRun(int val) { lastAnalyzedRun_ = val; }
0052 
0053   // set lastAnalyzedFill_, fill of the last analyzed lumisection
0054   void setLastAnalyzedFill(int val) { lastAnalyzedFill_ = val; }
0055 
0056   // set number of tracks used in the BeamSpot fit
0057   void setNumTracks(int val);
0058 
0059   // set number of Primary Vertices used in the BeamSpot fit
0060   void setNumPVs(int val);
0061 
0062   // set number of Events used in the BeamSpot fit (for DIP)
0063   void setUsedEvents(int val);
0064 
0065   // set max number of Primary Vertices used in the BeamSpot fit (for DIP)
0066   void setMaxPVs(int val);
0067 
0068   // set mean number of PVs (for DIP)
0069   void setMeanPV(float val);
0070 
0071   // set error on mean number of PVs (for DIP)
0072   void setMeanErrorPV(float val);
0073 
0074   // set rms of number of PVs (for DIP)
0075   void setRmsPV(float val);
0076 
0077   // set error on rm of number of PVs (for DIP)
0078   void setRmsErrorPV(float val);
0079 
0080   // set start time of the firs LS as string (for DIP)
0081   void setStartTime(std::string val);
0082 
0083   // set end time of the last LS as string (for DIP)
0084   void setEndTime(std::string val);
0085 
0086   // set lumi range as string (for DIP)
0087   void setLumiRange(std::string val);
0088 
0089   // set creation time of the payload
0090   void setCreationTime(cond::Time_t val);
0091 
0092   // set timestamp of the first LS (for DIP)
0093   void setStartTimeStamp(cond::Time_t val);
0094 
0095   // set timestamp of the last LS (for DIP)
0096   void setEndTimeStamp(cond::Time_t val);
0097 
0098   /// Getters Methods
0099   // get lastAnalyzedLumi_, last analyzed lumisection
0100   int lastAnalyzedLumi() const { return lastAnalyzedLumi_; }
0101 
0102   // get lastAnalyzedRun_, run of the last analyzed lumisection
0103   int lastAnalyzedRun() const { return lastAnalyzedRun_; }
0104 
0105   // get lastAnalyzedFill_, fill of the last analyzed lumisection
0106   int lastAnalyzedFill() const { return lastAnalyzedFill_; }
0107 
0108   // get number of tracks used in the BeamSpot fit
0109   int numTracks() const;
0110 
0111   // get number of Primary Vertices used in the BeamSpot fit
0112   int numPVs() const;
0113 
0114   // get number of Events used in the BeamSpot fit (for DIP)
0115   int usedEvents() const;
0116 
0117   // get max number of Primary Vertices used in the BeamSpot fit (for DIP)
0118   int maxPVs() const;
0119 
0120   // get mean number of PVs (for DIP)
0121   float meanPV() const;
0122 
0123   // get error on mean number of PVs (for DIP)
0124   float meanErrorPV() const;
0125 
0126   // get rms of number of PVs (for DIP)
0127   float rmsPV() const;
0128 
0129   // get error on rm of number of PVs (for DIP)
0130   float rmsErrorPV() const;
0131 
0132   // get start time of the firs LS as string (for DIP)
0133   std::string startTime() const;
0134 
0135   // get end time of the last LS as string (for DIP)
0136   std::string endTime() const;
0137 
0138   // get lumi range as string (for DIP)
0139   std::string lumiRange() const;
0140 
0141   // get creation time of the payload
0142   cond::Time_t creationTime() const;
0143 
0144   // get timestamp of the first LS (for DIP)
0145   cond::Time_t startTimeStamp() const;
0146 
0147   // get timestamp of the last LS (for DIP)
0148   cond::Time_t endTimeStamp() const;
0149 
0150   /// Print BeamSpotOnline parameters
0151   void print(std::stringstream& ss) const;
0152 
0153 private:
0154   int lastAnalyzedLumi_;
0155   int lastAnalyzedRun_;
0156   int lastAnalyzedFill_;
0157   std::vector<std::vector<int> > intParams_;
0158   std::vector<std::vector<float> > floatParams_;
0159   std::vector<std::vector<std::string> > stringParams_;
0160   std::vector<std::vector<unsigned long long> > timeParams_;  // unsigned long long is equal to cond::Time_t
0161 
0162   COND_SERIALIZABLE;
0163 };
0164 
0165 std::ostream& operator<<(std::ostream&, BeamSpotOnlineObjects beam);
0166 
0167 #endif