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  // get back-end interface
41 
42  // base folder for the contents of this job
43  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","");
44 // cout << "Monitor name = " << monitorName_ << endl;
45  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
46 // cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
47  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
48 // cout << "DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
49  output_dir_ = parameters_.getUntrackedParameter<string>("output_dir","");
50 // cout << "DQM output dir = " << output_dir_ << endl;
51  input_dir_ = parameters_.getUntrackedParameter<string>("input_dir","");
52 // cout << "DQM input dir = " << input_dir_ << endl;
53 
54  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
55 
56  LogInfo( "TriggerDQM");
57 
58 
59 }
60 
61 //--------------------------------------------------------
63 
64  LogInfo("TriggerDQM")<<"[TriggerDQM]: Begin Job";
65 
66  // get backendinterface
68 
69  dbe_->setCurrentFolder(output_dir_);
70 
71  m_deadChannels = dbe_->book2D("RPCTF_deadchannels",
72  "RPCTF deadchannels",
73  33, -16.5, 16.5,
74  144, -0.5, 143.5);
75  m_noisyChannels = dbe_->book2D("RPCTF_noisychannels",
76  "RPCTF noisy channels",
77  33, -16.5, 16.5,
78  144, -0.5, 143.5);
79 }
80 //--------------------------------------------------------
81 void L1TRPCTFClient::beginRun(const Run& r, const EventSetup& context) {
82 }
83 
84 //--------------------------------------------------------
85 void L1TRPCTFClient::beginLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
86  // optionally reset histograms here
87  // clientHisto->Reset();
88 }
89 //--------------------------------------------------------
90 
92  const edm::EventSetup& c)
93 {
94  if (verbose_) std::cout << "L1TRPCTFClient::endLuminosityBlock" << std::endl;
95 
96  dbe_->setCurrentFolder(input_dir_);
97 
98  {
99 
100  MonitorElement *me
101  = dbe_->get( (input_dir_+"/RPCTF_muons_eta_phi_bx0").c_str() );
102 
103  if (me){
104  const QReport *qreport;
105 
106  qreport = me->getQReport("DeadChannels_RPCTF_2D");
107  if (qreport) {
108  vector<dqm::me_util::Channel> badChannels = qreport->getBadChannels();
109  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
110  channel != badChannels.end();
111  ++channel)
112  {
113  m_deadChannels->setBinContent((*channel).getBinX(),
114  (*channel).getBinY(),
115  100);
116  } // for(badchannels)
117  } //if (qreport)
118 
119  qreport = me->getQReport("HotChannels_RPCTF_2D");
120  if (qreport) {
121  vector<dqm::me_util::Channel> badChannels = qreport->getBadChannels();
122  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
123  channel != badChannels.end();
124  ++channel)
125  {
126  // (*channel).getBinY() == 0 for NoisyChannels QTEST
127  m_noisyChannels->setBinContent((*channel).getBinX(), 100);
128  } // for(badchannels)
129  } //if (qreport)
130 // else std::cout << "dupa" << std::endl;
131  } // if (me)
132 
133 
134  }
135 
136 
137  if (verbose_)
138  {
139  std::vector<string> meVec = dbe_->getMEs();
140  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
141 
142  std::string full_path = input_dir_ + "/" + (*it);
143  MonitorElement * me =dbe_->get(full_path);
144 
145  // for this MEs, get list of associated QTs
146  std::vector<QReport *> Qtest_map = me->getQReports();
147 
148  if (Qtest_map.size() > 0) {
149  std::cout << "Test: " << full_path << std::endl;
150  for (std::vector<QReport *>::const_iterator it = Qtest_map.begin();
151  it != Qtest_map.end();
152  ++it)
153  {
154  std::cout
155  << " Name "<< (*it)->getQRName()
156  << " Status " << (*it)->getStatus()
157  <<std::endl;
158 
159  std::vector<dqm::me_util::Channel> badChannels=(*it)->getBadChannels();
160 
161  vector<dqm::me_util::Channel>::iterator badchsit = badChannels.begin();
162  while(badchsit != badChannels.end())
163  {
164  int ix = (*badchsit).getBinX();
165  int iy = (*badchsit).getBinY();
166  std::cout << "(" << ix <<","<< iy << ") ";
167  ++badchsit;
168  }
169  std::cout << std::endl;
170 
171  }
172  }
173 
174  } //
175  }
176 }
177 //--------------------------------------------------------
178 void L1TRPCTFClient::analyze(const Event& e, const EventSetup& context){
179 // cout << "L1TRPCTFClient::analyze" << endl;
180  counterEvt_++;
181  if (prescaleEvt_<1) return;
182  if (prescaleEvt_>0 && counterEvt_%prescaleEvt_ != 0) return;
183 
184 
185 
186 
187 }
188 
189 //--------------------------------------------------------
190 void L1TRPCTFClient::endRun(const Run& r, const EventSetup& context){
191 }
192 
193 //--------------------------------------------------------
195 }
196 
197 
198 
199 
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void endJob()
Endjob.
L1TRPCTFClient(const edm::ParameterSet &ps)
Constructor.
virtual ~L1TRPCTFClient()
Destructor.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1270
void beginJob(void)
BeginJob.
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
DQMStore * dbe_
void analyze(const edm::Event &e, const edm::EventSetup &c)
Fake Analyze.
std::vector< QReport * > getQReports(void) const
get map of QReports
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
Definition: DQMStore.cc:1244
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
DQM Client Diagnostic.
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
tuple cout
Definition: gather_cfg.py:41
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:647
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
Definition: Run.h:31