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 
11 #include "TRandom.h"
12 
13 #include <TF1.h>
14 #include <stdio.h>
15 #include <sstream>
16 #include <math.h>
17 #include <TProfile.h>
18 #include <TProfile2D.h>
19 
20 using namespace edm;
21 using namespace std;
22 
24 {
25  parameters_=ps;
26  initialize();
27 }
28 
30  LogInfo("TriggerDQM")<<"[TriggerDQM]: ending... ";
31 }
32 
33 //--------------------------------------------------------
35 
36  counterLS_=0;
37  counterEvt_=0;
38 
39  // base folder for the contents of this job
40  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","");
41 // cout << "Monitor name = " << monitorName_ << endl;
42  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
43 // cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
44  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
45 // cout << "DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
46  output_dir_ = parameters_.getUntrackedParameter<string>("output_dir","");
47 // cout << "DQM output dir = " << output_dir_ << endl;
48  input_dir_ = parameters_.getUntrackedParameter<string>("input_dir","");
49 // cout << "DQM input dir = " << input_dir_ << endl;
50 
51  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
52 
53  m_runInEventLoop = parameters_.getUntrackedParameter<bool>("runInEventLoop", false);
54  m_runInEndLumi = parameters_.getUntrackedParameter<bool>("runInEndLumi", false);
55  m_runInEndRun = parameters_.getUntrackedParameter<bool>("runInEndRun", false);
56  m_runInEndJob = parameters_.getUntrackedParameter<bool>("runInEndJob", false);
57 
58 
59  LogInfo( "TriggerDQM");
60 
61 
62 }
63 
64 //--------------------------------------------------------
66 
67  LogInfo("TriggerDQM")<<"[TriggerDQM]: Begin Job";
68 
69  ibooker.setCurrentFolder(output_dir_);
70 
71  m_deadChannels = ibooker.book2D("RPCTF_deadchannels",
72  "RPCTF deadchannels",
73  33, -16.5, 16.5,
74  144, -0.5, 143.5);
75  m_noisyChannels = ibooker.book2D("RPCTF_noisychannels",
76  "RPCTF noisy channels",
77  33, -16.5, 16.5,
78  144, -0.5, 143.5);
79 }
80 
81 //--------------------------------------------------------
82 
84 {
85  if (verbose_) std::cout << "L1TRPCTFClient::endLuminosityBlock" << std::endl;
86 
87  if (m_runInEndLumi) {
88  book(ibooker);
89  processHistograms(igetter);
90  }
91 
92 }
93 
95  book(ibooker);
96  processHistograms(igetter);
97 }
98 
99 //--------------------------------------------------------
101 
102  igetter.setCurrentFolder(input_dir_);
103 
104  {
105 
106  MonitorElement *me
107  = igetter.get( (input_dir_+"/RPCTF_muons_eta_phi_bx0").c_str() );
108 
109  if (me){
110  const QReport *qreport;
111 
112  qreport = me->getQReport("DeadChannels_RPCTF_2D");
113  if (qreport) {
114  vector<dqm::me_util::Channel> badChannels = qreport->getBadChannels();
115  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
116  channel != badChannels.end();
117  ++channel)
118  {
119  m_deadChannels->setBinContent((*channel).getBinX(),
120  (*channel).getBinY(),
121  100);
122  } // for(badchannels)
123  } //if (qreport)
124 
125  qreport = me->getQReport("HotChannels_RPCTF_2D");
126  if (qreport) {
127  vector<dqm::me_util::Channel> badChannels = qreport->getBadChannels();
128  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
129  channel != badChannels.end();
130  ++channel)
131  {
132  // (*channel).getBinY() == 0 for NoisyChannels QTEST
133  m_noisyChannels->setBinContent((*channel).getBinX(), 100);
134  } // for(badchannels)
135  } //if (qreport)
136  // else std::cout << "dupa" << std::endl;
137  } // if (me)
138 
139 
140  }
141 
142 
143  if (verbose_)
144  {
145  std::vector<string> meVec = igetter.getMEs();
146  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
147 
148  std::string full_path = input_dir_ + "/" + (*it);
149  MonitorElement * me =igetter.get(full_path);
150 
151  // for this MEs, get list of associated QTs
152  std::vector<QReport *> Qtest_map = me->getQReports();
153 
154  if (Qtest_map.size() > 0) {
155  std::cout << "Test: " << full_path << std::endl;
156  for (std::vector<QReport *>::const_iterator it = Qtest_map.begin();
157  it != Qtest_map.end();
158  ++it)
159  {
160  std::cout
161  << " Name "<< (*it)->getQRName()
162  << " Status " << (*it)->getStatus()
163  <<std::endl;
164 
165  std::vector<dqm::me_util::Channel> badChannels=(*it)->getBadChannels();
166 
167  vector<dqm::me_util::Channel>::iterator badchsit = badChannels.begin();
168  while(badchsit != badChannels.end())
169  {
170  int ix = (*badchsit).getBinX();
171  int iy = (*badchsit).getBinY();
172  std::cout << "(" << ix <<","<< iy << ") ";
173  ++badchsit;
174  }
175  std::cout << std::endl;
176 
177  }
178  }
179 
180  } //
181  }
182 
183 
184 }
185 
186 
static AlgebraicMatrix initialize()
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:301
void book(DQMStore::IBooker &ibooker)
L1TRPCTFClient(const edm::ParameterSet &ps)
Constructor.
virtual ~L1TRPCTFClient()
Destructor.
void processHistograms(DQMStore::IGetter &igetter)
std::vector< std::string > getMEs(void)
Definition: DQMStore.cc:309
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:273
std::vector< QReport * > getQReports(void) const
get map of QReports
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:329
tuple cout
Definition: gather_cfg.py:145
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override