CMS 3D CMS Logo

BeamMonitorBx.h
Go to the documentation of this file.
1 #ifndef BeamMonitorBx_H
2 #define BeamMonitorBx_H
3 
10 // C++
11 #include <string>
12 // CMS
19 #include <fstream>
20 
21 //
22 // class declaration
23 //
24 
26  : public edm::one::EDAnalyzer<edm::one::SharedResources, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks> {
27 public:
30 
32  ~BeamMonitorBx() override;
33 
34  typedef int BxNum;
35  typedef std::map<BxNum, reco::BeamSpot> BeamSpotMapBx;
36 
37 protected:
38  // BeginJob
39  void beginJob() override;
40 
41  // BeginRun
42  void beginRun(const edm::Run& r, const edm::EventSetup& c) override;
43 
44  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
45 
46  void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override;
47 
48  void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) override;
49  // EndRun
50  void endRun(const edm::Run& r, const edm::EventSetup& c) override;
51 
52 private:
53  void FitAndFill(const edm::LuminosityBlock& lumiSeg, int&, int&, int&);
54  void BookTables(int, std::map<std::string, std::string>&, std::string);
55  void BookTrendHistos(bool, int, std::map<std::string, std::string>&, std::string, const TString&, const TString&);
56  void FillTables(int, int, std::map<std::string, std::string>&, reco::BeamSpot&, std::string);
57  void FillTrendHistos(int, int, std::map<std::string, std::string>&, reco::BeamSpot&, const TString&);
58  void weight(BeamSpotMapBx&, const BeamSpotMapBx&);
59  void weight(double& mean, double& meanError, const double& val, const double& valError);
60  void formatFitTime(char*, const std::time_t&);
61 
64  edm::InputTag bsSrc_; // beam spot
65 
66  int fitNLumi_;
68  bool debug_;
69 
72 
73  unsigned int countBx_;
74  int countEvt_; //counter
75  int countLumi_; //counter
78  int lastlumi_; // previous LS processed
79  int nextlumi_; // next LS of Fit
80  int firstlumi_; // first LS with good fit
82  std::time_t refBStime[2];
83 
85  bool processed_;
86  // ----------member data ---------------------------
87  BeamSpotMapBx fbspotMap; //for weighted beam spots of each bunch
88  std::map<std::string, std::string> varMap;
89  std::map<std::string, std::string> varMap1;
90  // MonitorElements:
91  std::map<TString, MonitorElement*> hs; // Tables
92  std::map<TString, MonitorElement*> hst; // Trending Histos
93 
94  //Test
95  // MonitorElement * h_x0;
96 
97  //
98  std::time_t tmpTime;
99  std::time_t refTime;
100  std::time_t startTime;
102 };
103 
104 #endif
edm::ParameterSet parameters_
Definition: BeamMonitorBx.h:62
void beginJob() override
void FillTrendHistos(int, int, std::map< std::string, std::string > &, reco::BeamSpot &, const TString &)
dqm::legacy::DQMStore DQMStore
Definition: BeamMonitorBx.h:29
void FillTables(int, int, std::map< std::string, std::string > &, reco::BeamSpot &, std::string)
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
BeamMonitorBx(const edm::ParameterSet &)
void FitAndFill(const edm::LuminosityBlock &lumiSeg, int &, int &, int &)
std::map< BxNum, reco::BeamSpot > BeamSpotMapBx
Definition: BeamMonitorBx.h:35
dqm::legacy::MonitorElement MonitorElement
Definition: BeamMonitorBx.h:28
std::time_t startTime
std::map< TString, MonitorElement * > hs
Definition: BeamMonitorBx.h:91
BeamSpotMapBx fbspotMap
Definition: BeamMonitorBx.h:87
void endRun(const edm::Run &r, const edm::EventSetup &c) override
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
unsigned int countBx_
Definition: BeamMonitorBx.h:73
edm::TimeValue_t ftimestamp
std::string monitorName_
Definition: BeamMonitorBx.h:63
BeamFitter * theBeamFitter
Definition: BeamMonitorBx.h:71
unsigned long long TimeValue_t
Definition: Timestamp.h:21
std::time_t refBStime[2]
Definition: BeamMonitorBx.h:82
edm::InputTag bsSrc_
Definition: BeamMonitorBx.h:64
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::time_t tmpTime
Definition: BeamMonitorBx.h:98
void weight(BeamSpotMapBx &, const BeamSpotMapBx &)
std::time_t refTime
Definition: BeamMonitorBx.h:99
void BookTables(int, std::map< std::string, std::string > &, std::string)
DQMStore * dbe_
Definition: BeamMonitorBx.h:70
std::map< std::string, std::string > varMap
Definition: BeamMonitorBx.h:88
void BookTrendHistos(bool, int, std::map< std::string, std::string > &, std::string, const TString &, const TString &)
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
std::map< std::string, std::string > varMap1
Definition: BeamMonitorBx.h:89
std::map< TString, MonitorElement * > hst
Definition: BeamMonitorBx.h:92
void formatFitTime(char *, const std::time_t &)
~BeamMonitorBx() override
Definition: Run.h:45