CMS 3D CMS Logo

DQMScalInfo.cc
Go to the documentation of this file.
1 /*
2  * \file DQMDcsInfo.cc
3  * \author A.Meyer - DESY
4  * Last Update:
5  *
6  */
7 /*
8  * \file DQMDcsInfo.h
9  *
10  * \author A.Meyer - DESY
11  *
12 */
13 
39 
40 class DQMScalInfo : public DQMEDAnalyzer {
41 public:
43  DQMScalInfo(const edm::ParameterSet& ps);
44 
46  ~DQMScalInfo() override = default;
47 
48 protected:
50  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
51  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
52 
53 private:
54  void makeL1Scalars(const edm::Event& e);
55  void makeLumiScalars(const edm::Event& e);
56 
63 
64  // histograms
72 
74 };
75 
76 using namespace std;
77 using namespace edm;
78 
79 // Framework
80 
82  parameters_ = ps;
83 
84  scalfolder_ = parameters_.getUntrackedParameter<std::string>("dqmScalFolder", "Scal");
85  gtCollection_ = consumes<L1GlobalTriggerReadoutRecord>(
86  parameters_.getUntrackedParameter<edm::InputTag>("gtCollection", edm::InputTag("gtDigis")));
87  dcsStatusCollection_ = consumes<DcsStatusCollection>(
88  parameters_.getUntrackedParameter<edm::InputTag>("dcsStatusCollection", edm::InputTag("scalersRawToDigi")));
89  l1tscollectionToken_ = consumes<Level1TriggerScalersCollection>(
90  parameters_.getUntrackedParameter<edm::InputTag>("l1TSCollection", edm::InputTag("scalersRawToDigi")));
91  lumicollectionToken_ = consumes<LumiScalersCollection>(
92  parameters_.getUntrackedParameter<edm::InputTag>("lumiCollection", edm::InputTag("scalersRawToDigi")));
93 }
94 
96  edm::Run const& /* iRun */,
97  edm::EventSetup const& /* iSetup */) {
98  const int maxNbins = 2001;
99 
100  // Fetch GlobalTag information and fill the string/ME.
101  ibooker.cd();
102  ibooker.setCurrentFolder(scalfolder_ + "/L1TriggerScalers/");
103  const int fracLS = 16;
104  const int maxLS = 250;
105  hlresync_ = ibooker.book1D("lresync", "Orbit of last resync", fracLS * maxLS, 0, maxLS * 262144);
106  hlOC0_ = ibooker.book1D("lOC0", "Orbit of last OC0", fracLS * maxLS, 0, maxLS * 262144);
107  hlTE_ = ibooker.book1D("lTE", "Orbit of last TestEnable", fracLS * maxLS, 0, maxLS * 262144);
108  hlstart_ = ibooker.book1D("lstart", "Orbit of last Start", fracLS * maxLS, 0, maxLS * 262144);
109  hlEC0_ = ibooker.book1D("lEC0", "Orbit of last EC0", fracLS * maxLS, 0, maxLS * 262144);
110  hlHR_ = ibooker.book1D("lHR", "Orbit of last HardReset", fracLS * maxLS, 0, maxLS * 262144);
111 
112  hphysTrig_ = ibooker.book1D("Physics_Triggers", "Physics Triggers", maxNbins, -0.5, double(maxNbins) - 0.5);
113  hphysTrig_->setAxisTitle("Lumi Section", 1);
114 
115  ibooker.cd();
116  ibooker.setCurrentFolder(scalfolder_ + "/LumiScalers/");
117  hinstLumi_ = ibooker.book1D("Instant_Lumi", "Instant Lumi", maxNbins, -0.5, double(maxNbins) - 0.5);
118 }
119 
121  makeL1Scalars(e);
122  makeLumiScalars(e);
123  return;
124 }
125 
128  e.getByToken(l1tscollectionToken_, l1ts);
130  e.getByToken(lumicollectionToken_, lumiScalers);
131 
132  auto it = l1ts->begin();
133 
134  if (l1ts->empty())
135  return;
136  hlresync_->Fill((*l1ts)[0].lastResync());
137  hlOC0_->Fill((*l1ts)[0].lastOrbitCounter0());
138  hlTE_->Fill((*l1ts)[0].lastTestEnable());
139  hlstart_->Fill((*l1ts)[0].lastStart());
140  hlEC0_->Fill((*l1ts)[0].lastEventCounter0());
141  hlHR_->Fill((*l1ts)[0].lastHardReset());
142 
143  unsigned int lumisection = it->lumiSegmentNr();
144  if (lumisection) {
145  hphysTrig_->setBinContent(lumisection + 1, it->l1AsPhysics());
146  }
147 
148  return;
149 }
150 
153  e.getByToken(lumicollectionToken_, lumiScalers);
154 
155  auto it = lumiScalers->begin();
156 
157  if (!lumiScalers->empty()) {
158  unsigned int lumisection = it->sectionNumber();
159  if (lumisection) {
160  hinstLumi_->setBinContent(lumisection + 1, it->instantLumi());
161  }
162  }
163 
164  return;
165 }
166 
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonitorElement * hlOC0_
Definition: DQMScalInfo.cc:66
std::string scalfolder_
Definition: DQMScalInfo.cc:58
void makeL1Scalars(const edm::Event &e)
Definition: DQMScalInfo.cc:126
T getUntrackedParameter(std::string const &, T const &) const
void makeLumiScalars(const edm::Event &e)
Definition: DQMScalInfo.cc:151
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DQMScalInfo.cc:95
edm::EDGetTokenT< DcsStatusCollection > dcsStatusCollection_
Definition: DQMScalInfo.cc:60
~DQMScalInfo() override=default
Destructor.
DQMScalInfo(const edm::ParameterSet &ps)
Constructor.
Definition: DQMScalInfo.cc:81
MonitorElement * hphysTrig_
Definition: DQMScalInfo.cc:71
MonitorElement * hinstLumi_
Definition: DQMScalInfo.cc:73
edm::EDGetTokenT< LumiScalersCollection > lumicollectionToken_
Definition: DQMScalInfo.cc:62
MonitorElement * hlstart_
Definition: DQMScalInfo.cc:68
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
Definition: DQMScalInfo.cc:120
MonitorElement * hlTE_
Definition: DQMScalInfo.cc:67
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtCollection_
Definition: DQMScalInfo.cc:59
HLT enums.
MonitorElement * hlEC0_
Definition: DQMScalInfo.cc:69
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
edm::ParameterSet parameters_
Definition: DQMScalInfo.cc:57
Definition: Run.h:45
edm::EDGetTokenT< Level1TriggerScalersCollection > l1tscollectionToken_
Definition: DQMScalInfo.cc:61
MonitorElement * hlHR_
Definition: DQMScalInfo.cc:70
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * hlresync_
Definition: DQMScalInfo.cc:65