CMS 3D CMS Logo

L1TRPCTFClient.cc
Go to the documentation of this file.
2 
9 #include "TRandom.h"
10 
11 #include <TF1.h>
12 #include <cstdio>
13 #include <sstream>
14 #include <cmath>
15 #include <TProfile.h>
16 #include <TProfile2D.h>
17 
18 using namespace edm;
19 using namespace std;
20 
22  parameters_ = ps;
23  initialize();
24 }
25 
26 L1TRPCTFClient::~L1TRPCTFClient() { LogInfo("TriggerDQM") << "[TriggerDQM]: ending... "; }
27 
28 //--------------------------------------------------------
30  counterLS_ = 0;
31  counterEvt_ = 0;
32 
33  // base folder for the contents of this job
34  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName", "");
35  // cout << "Monitor name = " << monitorName_ << endl;
36  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
37  // cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
38  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
39  // cout << "DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
40  output_dir_ = parameters_.getUntrackedParameter<string>("output_dir", "");
41  // cout << "DQM output dir = " << output_dir_ << endl;
42  input_dir_ = parameters_.getUntrackedParameter<string>("input_dir", "");
43  // cout << "DQM input dir = " << input_dir_ << endl;
44 
45  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
46 
47  m_runInEventLoop = parameters_.getUntrackedParameter<bool>("runInEventLoop", false);
48  m_runInEndLumi = parameters_.getUntrackedParameter<bool>("runInEndLumi", false);
49  m_runInEndRun = parameters_.getUntrackedParameter<bool>("runInEndRun", false);
50  m_runInEndJob = parameters_.getUntrackedParameter<bool>("runInEndJob", false);
51 
52  LogInfo("TriggerDQM");
53 }
54 
55 //--------------------------------------------------------
57  LogInfo("TriggerDQM") << "[TriggerDQM]: Begin Job";
58 
59  ibooker.setCurrentFolder(output_dir_);
60 
61  m_deadChannels = ibooker.book2D("RPCTF_deadchannels", "RPCTF deadchannels", 33, -16.5, 16.5, 144, -0.5, 143.5);
62  m_noisyChannels = ibooker.book2D("RPCTF_noisychannels", "RPCTF noisy channels", 33, -16.5, 16.5, 144, -0.5, 143.5);
63 }
64 
65 //--------------------------------------------------------
66 
68  DQMStore::IGetter &igetter,
69  const edm::LuminosityBlock &lumiSeg,
70  const edm::EventSetup &c) {
71  if (verbose_)
72  std::cout << "L1TRPCTFClient::endLuminosityBlock" << std::endl;
73 
74  if (m_runInEndLumi) {
75  book(ibooker);
76  processHistograms(igetter);
77  }
78 }
79 
81  book(ibooker);
82  processHistograms(igetter);
83 }
84 
85 //--------------------------------------------------------
87  igetter.setCurrentFolder(input_dir_);
88 
89  {
90  MonitorElement *me = igetter.get(input_dir_ + "/RPCTF_muons_eta_phi_bx0");
91 
92  if (me) {
93  const QReport *qreport;
94 
95  qreport = me->getQReport("DeadChannels_RPCTF_2D");
96  if (qreport) {
97  vector<dqm::me_util::Channel> badChannels = qreport->getBadChannels();
98  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
99  ++channel) {
100  m_deadChannels->setBinContent((*channel).getBinX(), (*channel).getBinY(), 100);
101  } // for(badchannels)
102  } //if (qreport)
103 
104  qreport = me->getQReport("HotChannels_RPCTF_2D");
105  if (qreport) {
106  vector<dqm::me_util::Channel> badChannels = qreport->getBadChannels();
107  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
108  ++channel) {
109  // (*channel).getBinY() == 0 for NoisyChannels QTEST
110  m_noisyChannels->setBinContent((*channel).getBinX(), 100);
111  } // for(badchannels)
112  } //if (qreport)
113  // else std::cout << "dupa" << std::endl;
114  } // if (me)
115  }
116 
117  if (verbose_) {
118  std::vector<string> meVec = igetter.getMEs();
119  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
120  std::string full_path = input_dir_ + "/" + (*it);
121  MonitorElement *me = igetter.get(full_path);
122 
123  // for this MEs, get list of associated QTs
124  std::vector<QReport *> Qtest_map = me->getQReports();
125 
126  if (!Qtest_map.empty()) {
127  std::cout << "Test: " << full_path << std::endl;
128  for (std::vector<QReport *>::const_iterator it = Qtest_map.begin(); it != Qtest_map.end(); ++it) {
129  std::cout << " Name " << (*it)->getQRName() << " Status " << (*it)->getStatus() << std::endl;
130 
131  std::vector<dqm::me_util::Channel> badChannels = (*it)->getBadChannels();
132 
133  vector<dqm::me_util::Channel>::iterator badchsit = badChannels.begin();
134  while (badchsit != badChannels.end()) {
135  int ix = (*badchsit).getBinX();
136  int iy = (*badchsit).getBinY();
137  std::cout << "(" << ix << "," << iy << ") ";
138  ++badchsit;
139  }
140  std::cout << std::endl;
141  }
142  }
143 
144  } //
145  }
146 }
static AlgebraicMatrix initialize()
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:759
const std::vector< DQMChannel > & getBadChannels() const
void book(DQMStore::IBooker &ibooker)
L1TRPCTFClient(const edm::ParameterSet &ps)
Constructor.
void processHistograms(DQMStore::IGetter &igetter)
Log< level::Info, false > LogInfo
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
~L1TRPCTFClient() override
Destructor.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
HLT enums.
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override