CMS 3D CMS Logo

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