CMS 3D CMS Logo

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 
22 
23 #include <string>
24 
25 //----------------------------------------------------------------------------------------------------
26 
28 {
29  public:
31  ~TotemDAQTriggerDQMSource() override;
32 
33  protected:
34  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
35  void analyze(edm::Event const& e, edm::EventSetup const& eSetup) override;
36 
37  private:
38  unsigned int verbosity;
39 
41 
45 };
46 
47 //----------------------------------------------------------------------------------------------------
48 //----------------------------------------------------------------------------------------------------
49 
50 using namespace std;
51 using namespace edm;
52 
53 //----------------------------------------------------------------------------------------------------
54 
56  verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0))
57 {
58  tokenFEDInfo = consumes<vector<TotemFEDInfo>>(ps.getParameter<edm::InputTag>("tagFEDInfo"));
59 }
60 
61 //----------------------------------------------------------------------------------------------------
62 
64 {
65 }
66 
67 //----------------------------------------------------------------------------------------------------
68 
70 {
71  ibooker.cd();
72 
73  ibooker.setCurrentFolder("CTPPS/DAQ/");
74 
75  daq_bx_diff = ibooker.book1D("bx_diff", ";OptoRx_{i}.BX - OptoRx_{j}.BX", 21, -10.5, +10.5);
76  daq_event_bx_diff = ibooker.book1D("daq_event_bx_diff", ";OptoRx_{i}.BX - Event.BX", 21, -10.5, +10.5);
77  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);
78 }
79 
80 //----------------------------------------------------------------------------------------------------
81 
83 {
84  // get input
86  event.getByToken(tokenFEDInfo, fedInfo);
87 
88  // check validity
89  bool daqValid = fedInfo.isValid();
90 
91  if (!daqValid)
92  {
93  if (verbosity)
94  {
95  LogPrint("TotemDAQTriggerDQMSource") <<
96  "WARNING in TotemDAQTriggerDQMSource::analyze > some of the inputs are not valid.\n"
97  << " fedInfo.isValid = " << fedInfo.isValid();
98  }
99  }
100 
101  // DAQ plots
102  if (daqValid)
103  {
104  for (auto &it1 : *fedInfo)
105  {
106  daq_event_bx_diff->Fill(it1.getBX() - event.bunchCrossing());
107  daq_event_bx_diff_vs_fed->Fill(it1.getFEDId(), it1.getBX() - event.bunchCrossing());
108 
109  for (auto &it2 : *fedInfo)
110  {
111  if (it2.getFEDId() <= it1.getFEDId())
112  continue;
113 
114  daq_bx_diff->Fill(it2.getBX() - it1.getBX());
115  }
116  }
117  }
118 }
119 
120 //----------------------------------------------------------------------------------------------------
121 
T getParameter(std::string const &) const
TotemDAQTriggerDQMSource(const edm::ParameterSet &ps)
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo
void Fill(long long x)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
HLT enums.
Definition: event.py:1
Definition: Run.h:45