test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TotemDAQTriggerDQMSource.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 * Rafał Leszko (rafal.leszko@gmail.com)
7 *
8 ****************************************************************************/
9 
16 
20 
23 
24 #include <string>
25 
26 //----------------------------------------------------------------------------------------------------
27 
29 {
30  public:
32  virtual ~TotemDAQTriggerDQMSource();
33 
34  protected:
35  void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override;
36  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
37  void analyze(edm::Event const& e, edm::EventSetup const& eSetup);
39  void endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& eSetup);
40  void endRun(edm::Run const& run, edm::EventSetup const& eSetup);
41 
42  private:
43  unsigned int verbosity;
44 
47 
52 
63 };
64 
65 //----------------------------------------------------------------------------------------------------
66 //----------------------------------------------------------------------------------------------------
67 
68 using namespace std;
69 using namespace edm;
70 
71 //----------------------------------------------------------------------------------------------------
72 
74  verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0))
75 {
76  tokenFEDInfo = consumes<vector<TotemFEDInfo>>(ps.getParameter<edm::InputTag>("tagFEDInfo"));
77  tokenTriggerCounters = consumes<TotemTriggerCounters>(ps.getParameter<edm::InputTag>("tagTriggerCounters"));
78 }
79 
80 //----------------------------------------------------------------------------------------------------
81 
83 {
84 }
85 
86 //----------------------------------------------------------------------------------------------------
87 
89 {
90 }
91 
92 //----------------------------------------------------------------------------------------------------
93 
95 {
96  ibooker.cd();
97 
98  ibooker.setCurrentFolder("CTPPS/DAQ/");
99 
100  daq_bx_diff = ibooker.book1D("bx_diff", ";OptoRx_{i}.BX - OptoRx_{j}.BX", 21, -10.5, +10.5);
101  daq_event_bx_diff = ibooker.book1D("daq_event_bx_diff", ";OptoRx_{i}.BX - Event.BX", 21, -10.5, +10.5);
102  daq_event_bx_diff_vs_fed = ibooker.book2D("daq_event_bx_diff_vs_fed", ";OptoRx.ID;OptoRx.BX - Event.BX", 10, 575.5, 585.5, 21, -10.5, +10.5);
103 
104  daq_trigger_bx_diff = ibooker.book1D("trigger_bx_diff", ";OptoRx_{i}.BX - LoneG.BX", 100, 0., 4000.);
105 
106  ibooker.setCurrentFolder("CTPPS/Trigger/");
107 
108  trigger_type = ibooker.book1D("type", ";type", 100, 0., 1000.);
109  trigger_event_num = ibooker.book1D("event_num", ";event_num", 100, 0., 1000.);
110  trigger_bunch_num = ibooker.book1D("bunch_num", ";bunch_num", 100, 0., 1000.);
111  trigger_src_id = ibooker.book1D("src_id", ";src_id", 100, 0., 1000.);
112  trigger_orbit_num = ibooker.book1D("orbit_num", ";orbit_num", 100, 0., 1000.);
113  trigger_revision_num = ibooker.book1D("revision_num", ";revision_num", 100, 0., 1000.);
114  trigger_run_num = ibooker.book1D("run_num", ";run_num", 100, 0., 1000.);
115  trigger_trigger_num = ibooker.book1D("trigger_num", ";trigger_num", 100, 0., 1000.);
116  trigger_inhibited_triggers_num = ibooker.book1D("inhibited_triggers_num", ";inhibited_triggers_num", 100, 0., 1000.);
117  trigger_input_status_bits = ibooker.book1D("input_status_bits", ";input_status_bits", 100, 0., 1000.);
118 }
119 
120 //----------------------------------------------------------------------------------------------------
121 
123 {
124 }
125 
126 //----------------------------------------------------------------------------------------------------
127 
129 {
130  // get input
132  event.getByToken(tokenFEDInfo, fedInfo);
133 
134  Handle<TotemTriggerCounters> triggerCounters;
135  event.getByToken(tokenTriggerCounters, triggerCounters);
136 
137  // check validity
138  bool daqValid = fedInfo.isValid();
139  bool triggerValid = triggerCounters.isValid();
140 
141  if (!daqValid || !triggerValid)
142  {
143  if (verbosity)
144  {
145  LogPrint("TotemDAQTriggerDQMSource") <<
146  "WARNING in TotemDAQTriggerDQMSource::analyze > some of the inputs are not valid.\n"
147  << " fedInfo.isValid = " << fedInfo.isValid() << "\n"
148  << " triggerCounters.isValid = " << triggerCounters.isValid();
149  }
150  }
151 
152  // DAQ plots
153  if (daqValid)
154  {
155  for (auto &it1 : *fedInfo)
156  {
157  daq_event_bx_diff->Fill(it1.getBX() - event.bunchCrossing());
158  daq_event_bx_diff_vs_fed->Fill(it1.getFEDId(), it1.getBX() - event.bunchCrossing());
159 
160  for (auto &it2 : *fedInfo)
161  {
162  if (it2.getFEDId() <= it1.getFEDId())
163  continue;
164 
165  daq_bx_diff->Fill(it2.getBX() - it1.getBX());
166  }
167  }
168  }
169 
170  // trigger plots
171  if (triggerValid)
172  {
173  trigger_type->Fill(triggerCounters->type);
174  trigger_event_num->Fill(triggerCounters->event_num);
175  trigger_bunch_num->Fill(triggerCounters->bunch_num);
176  trigger_src_id->Fill(triggerCounters->src_id);
177  trigger_orbit_num->Fill(triggerCounters->orbit_num);
178  trigger_revision_num->Fill(triggerCounters->revision_num);
179  trigger_run_num->Fill(triggerCounters->run_num);
180  trigger_trigger_num->Fill(triggerCounters->trigger_num);
181  trigger_inhibited_triggers_num->Fill(triggerCounters->inhibited_triggers_num);
182  trigger_input_status_bits->Fill(triggerCounters->input_status_bits);
183  }
184 
185  // combined DAQ + trigger plots
186  if (daqValid && triggerValid)
187  {
188  for (auto &it : *fedInfo)
189  daq_trigger_bx_diff->Fill(it.getBX() - triggerCounters->orbit_num);
190  }
191 }
192 
193 //----------------------------------------------------------------------------------------------------
194 
196 {
197 }
198 
199 //----------------------------------------------------------------------------------------------------
200 
202 {
203 }
204 
205 //----------------------------------------------------------------------------------------------------
206 
T getParameter(std::string const &) const
edm::EDGetTokenT< TotemTriggerCounters > tokenTriggerCounters
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
TotemDAQTriggerDQMSource(const edm::ParameterSet &ps)
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo
void cd(void)
Definition: DQMStore.cc:268
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
tuple lumi
Definition: fjr2json.py:35
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
MonitorElement * trigger_input_status_bits
void Fill(long long x)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:75
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
MonitorElement * trigger_inhibited_triggers_num
Definition: Run.h:43