CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BeamSpotDipServer.h
Go to the documentation of this file.
1 #ifndef DQM_BeamMonitor__BeamSpotDipServer_h
2 #define DQM_BeamMonitor__BeamSpotDipServer_h
3 
8 
10 
13 
16 
19 
20 #include <string>
21 #include <bits/stdc++.h>
22 
23 class DipFactory;
24 class DipData;
25 class DipPublication;
26 
27 class LuminosityBlock;
28 
30 public:
31  explicit BeamSpotDipServer(const edm::ParameterSet&);
32 
33 protected:
34  void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override;
35  void dqmBeginRun(const edm::Run& r, const edm::EventSetup&) override;
36  void analyze(const edm::Event& e, const edm::EventSetup&) override;
37  void dqmBeginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup&) override;
38  void dqmEndLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup&) override;
39  void dqmEndRun(const edm::Run&, const edm::EventSetup& iSetup) override;
40 
41 private:
43  time_t getLastTime(std::string filename);
44 
45  std::vector<std::string> parse(std::string line, const std::string& delimiter);
47 
48  bool readRcd(const BeamSpotOnlineObjects& bs); // read from database
49  bool readRcd(std::ifstream& file); // read from NFS
50 
51  void problem();
52  void CMS2LHCRF_POS(float x, float y, float z);
53 
54  void trueRcd();
55  void fakeRcd();
56  void publishRcd(std::string qlty, std::string err, bool pubCMS, bool fitTime);
57 
59  std::string getDateTime(long epoch);
60 
61  // constants
62  const char* qualities[3] = {"Uncertain", "Bad", "Good"};
63  const bool publishStatErrors = true;
64  const int rad2urad = 1000000;
65  const int cm2um = 10000;
66  const int cm2mm = 10;
67  const int intLS = 1; // for CMS scaler
68 
69  // variables
70  long lastFitTime = 0;
71  long lastModTime = 0;
72  std::bitset<8> alive;
73  int lsCount = 0;
74  int currentLS = 0;
75 
76  // DIP objects
77  DipFactory* dip;
78  DipData* messageCMS;
79  DipData* messageLHC;
80  DipData* messagePV;
81  DipPublication* publicationCMS;
82  DipPublication* publicationLHC;
83  DipPublication* publicationPV;
84 
85  // initial values of beamspot object
86  int runnum;
89  time_t startTimeStamp = 0;
90  time_t endTimeStamp = 0;
92  std::string quality = "Uncertain";
93  int type = -1;
94  float x = 0;
95  float y = 0;
96  float z = 0;
97  float dxdz = 0;
98  float dydz = 0;
99  float err_x = 0;
100  float err_y = 0;
101  float err_z = 0;
102  float err_dxdz = 0;
103  float err_dydz = 0;
104  float width_x = 0;
105  float width_y = 0;
106  float sigma_z = 0;
107  float err_width_x = 0;
108  float err_width_y = 0;
109  float err_sigma_z = 0;
110 
111  // added for PV information
112  int events = 0;
113  float meanPV = 0;
114  float err_meanPV = 0;
115  float rmsPV = 0;
116  float err_rmsPV = 0;
117  int maxPV = 0;
118  int nPV = 0;
119 
120  //
121  float Size[3];
122  float Centroid[3];
123  float Tilt[2];
124 
125  // tracker status
128 
129  int lastlumi = -1;
130  bool wholeTrackerOn = false;
131 
132  // online beamspot
134 
135  // inputs
136  bool verbose;
137  bool testing;
138 
142 
144 
147 
148  std::vector<int> timeoutLS;
149 };
150 
151 #endif
void CMS2LHCRF_POS(float x, float y, float z)
DipPublication * publicationPV
edm::EDGetTokenT< DCSRecord > dcsRecordToken_
std::string getDateTime()
void dqmEndRun(const edm::Run &, const edm::EventSetup &iSetup) override
bool readRcd(const BeamSpotOnlineObjects &bs)
std::vector< int > timeoutLS
edm::InputTag dcsRecordInputTag_
void dqmEndLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &) override
std::bitset< 8 > alive
void publishRcd(std::string qlty, std::string err, bool pubCMS, bool fitTime)
long getFileSize(std::string filename)
BeamSpotDipServer(const edm::ParameterSet &)
void analyze(const edm::Event &e, const edm::EventSetup &) override
std::vector< std::string > parse(std::string line, const std::string &delimiter)
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd > bsLegacyToken_
time_t getLastTime(std::string filename)
void dqmBeginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &) override
const char * qualities[3]
const bool publishStatErrors
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &) override
tuple filename
Definition: lut2db_cfg.py:20
DipPublication * publicationCMS
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
DipPublication * publicationLHC
Definition: Run.h:45
std::string tkStatus()