CMS 3D CMS Logo

L1TDTTPGClient.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 L1TDTTPGClient::~L1TDTTPGClient() { LogInfo("TriggerDQM") << "[TriggerDQM]: ending... "; }
27 
28 //--------------------------------------------------------
30  counterLS_ = 0;
31  counterEvt_ = 0;
32 
33  // get back-end interface
34  //dbe_ = Service<DQMStore>().operator->();
35 
36  // base folder for the contents of this job
37  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName", "");
38  // cout << "Monitor name = " << monitorName_ << endl;
39  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
40  // cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
41  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
42  // cout << "DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
43  output_dir_ = parameters_.getUntrackedParameter<string>("output_dir", "");
44  // cout << "DQM output dir = " << output_dir_ << endl;
45  input_dir_ = parameters_.getUntrackedParameter<string>("input_dir", "");
46  // cout << "DQM input dir = " << input_dir_ << endl;
47 
48  LogInfo("TriggerDQM");
49 }
50 
51 //--------------------------------------------------------
53  ibooker.setCurrentFolder(output_dir_);
54 
55  // booking
56 
57  dttpgphmapcorrf = ibooker.book2D(
58  "DT_TPG_phi_map_corr_frac", "Fraction of correlated best triggers per station", 20, 1, 21, 12, 0, 12);
59  dttpgphmap2ndf =
60  ibooker.book2D("DT_TPG_phi_map_2nd_frac", "Fraction of second tracks per station", 20, 1, 21, 12, 0, 12);
61  dttpgphmapbxf[0] =
62  ibooker.book2D("DT_TPG_phi_map_bx-1_frac", "Fraction of triggers per station (BX=-1)", 20, 1, 21, 12, 0, 12);
63  dttpgphmapbxf[1] =
64  ibooker.book2D("DT_TPG_phi_map_bx0_frac", "Fraction of triggers per station (BX=0)", 20, 1, 21, 12, 0, 12);
65  dttpgphmapbxf[2] =
66  ibooker.book2D("DT_TPG_phi_map_bx+1_frac", "Fraction of triggers per station (BX=1)", 20, 1, 21, 12, 0, 12);
67  setMapPhLabel(dttpgphmapcorrf);
68  setMapPhLabel(dttpgphmap2ndf);
69  setMapPhLabel(dttpgphmapbxf[0]);
70  setMapPhLabel(dttpgphmapbxf[1]);
71  setMapPhLabel(dttpgphmapbxf[2]);
72 
73  dttpgthmaphf = ibooker.book2D(
74  "DT_TPG_theta_map_corr_frac", "Fraction of H quality best triggers per station", 15, 1, 16, 12, 0, 12);
75  dttpgthmapbxf[0] =
76  ibooker.book2D("DT_TPG_theta_map_bx-1_frac", "Fraction of triggers per station (BX=-1)", 15, 1, 16, 12, 0, 12);
77  dttpgthmapbxf[1] =
78  ibooker.book2D("DT_TPG_theta_map_bx0_frac", "Fraction of triggers per station (BX=0)", 15, 1, 16, 12, 0, 12);
79  dttpgthmapbxf[2] =
80  ibooker.book2D("DT_TPG_theta_map_bx+1_frac", "Fraction of triggers per station (BX=1)", 15, 1, 16, 12, 0, 12);
81  setMapThLabel(dttpgthmaphf);
82  setMapThLabel(dttpgthmapbxf[0]);
83  setMapThLabel(dttpgthmapbxf[1]);
84  setMapThLabel(dttpgthmapbxf[2]);
85 
86  // cout << "L1TDTTPGClient::analyze" << endl;
87  counterEvt_++;
88  if (prescaleEvt_ < 1)
89  return;
90  if (prescaleEvt_ > 0 && counterEvt_ % prescaleEvt_ != 0)
91  return;
92 
93  string nName = "DT_TPG_phi_best_map_corr";
94  string dName = "DT_TPG_phi_best_map";
95  makeRatioHisto(igetter, dttpgphmapcorrf, nName, dName);
96  dName = "DT_TPG_phi_map";
97  nName = "DT_TPG_phi_map_2nd";
98  makeRatioHisto(igetter, dttpgphmap2ndf, nName, dName);
99  nName = "DT_TPG_phi_map_bx-1";
100  makeRatioHisto(igetter, dttpgphmapbxf[0], nName, dName);
101  nName = "DT_TPG_phi_map_bx0";
102  makeRatioHisto(igetter, dttpgphmapbxf[1], nName, dName);
103  nName = "DT_TPG_phi_map_bx+1";
104  makeRatioHisto(igetter, dttpgphmapbxf[2], nName, dName);
105 
106  nName = "DT_TPG_theta_best_map_h";
107  dName = "DT_TPG_theta_best_map";
108  makeRatioHisto(igetter, dttpgthmaphf, nName, dName);
109  dName = "DT_TPG_theta_map";
110  nName = "DT_TPG_theta_map_bx-1";
111  makeRatioHisto(igetter, dttpgthmapbxf[0], nName, dName);
112  nName = "DT_TPG_theta_map_bx0";
113  makeRatioHisto(igetter, dttpgthmapbxf[1], nName, dName);
114  nName = "DT_TPG_theta_map_bx+1";
115  makeRatioHisto(igetter, dttpgthmapbxf[2], nName, dName);
116 }
117 
118 void L1TDTTPGClient::makeRatioHisto(DQMStore::IGetter &igetter, MonitorElement *ratioME, string &nName, string &dName) {
119  TH2F *numerator;
120  TH2F *denominator;
121 
122  denominator = this->get2DHisto(input_dir_ + "/" + dName, igetter);
123  numerator = this->get2DHisto(input_dir_ + "/" + nName, igetter);
124 
125  if (numerator && denominator) {
126  TH2F *ratio = ratioME->getTH2F();
127  if (ratio) {
128  ratio->Divide(numerator, denominator);
129  } else {
130  LogInfo("TriggerDQM") << "[TriggerDQM]: ratio histo named \"" << ratioME->getName() << "\" not found!" << endl;
131  }
132  } else {
133  if (!numerator)
134  LogInfo("TriggerDQM") << "[TriggerDQM]: numerator histo \"" << nName << "\" not found!" << endl;
135  if (!denominator)
136  LogInfo("TriggerDQM") << "[TriggerDQM]: denominator histo \"" << dName << "\" not found!" << endl;
137  }
138 }
139 
140 TH1F *L1TDTTPGClient::get1DHisto(string meName, DQMStore::IGetter &igetter) {
141  MonitorElement *me_ = igetter.get(meName);
142 
143  if (!me_) {
144  LogInfo("TriggerDQM") << "ME NOT FOUND.";
145  return nullptr;
146  }
147 
148  return me_->getTH1F();
149 }
150 
151 TH2F *L1TDTTPGClient::get2DHisto(string meName, DQMStore::IGetter &igetter) {
152  MonitorElement *me_ = igetter.get(meName);
153 
154  if (!me_) {
155  LogInfo("TriggerDQM") << "ME NOT FOUND.";
156  return nullptr;
157  }
158 
159  return me_->getTH2F();
160 }
161 
162 TProfile2D *L1TDTTPGClient::get2DProfile(string meName, DQMStore::IGetter &igetter) {
163  MonitorElement *me_ = igetter.get(meName);
164 
165  if (!me_) {
166  LogInfo("TriggerDQM") << "ME NOT FOUND.";
167  return nullptr;
168  }
169 
170  return me_->getTProfile2D();
171 }
172 
173 TProfile *L1TDTTPGClient::get1DProfile(string meName, DQMStore::IGetter &igetter) {
174  MonitorElement *me_ = igetter.get(meName);
175 
176  if (!me_) {
177  LogInfo("TriggerDQM") << "ME NOT FOUND.";
178  return nullptr;
179  }
180 
181  return me_->getTProfile();
182 }
183 
185  me->setAxisTitle("DTTF Sector", 2);
186  for (int i = 0; i < 5; i++) {
187  ostringstream wheel;
188  wheel << i - 2;
189  me->setBinLabel(1 + i * 4, "Wheel " + wheel.str(), 1);
190  }
191 }
192 
194  me->setAxisTitle("DTTF Sector", 2);
195  for (int i = 0; i < 5; i++) {
196  ostringstream wheel;
197  wheel << i - 2;
198  me->setBinLabel(1 + i * 3, "Wheel " + wheel.str(), 1);
199  }
200 }
L1TDTTPGClient::~L1TDTTPGClient
~L1TDTTPGClient() override
Destructor.
Definition: L1TDTTPGClient.cc:26
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
L1TDTTPGClient::get2DHisto
TH2F * get2DHisto(std::string meName, DQMStore::IGetter &igetter)
Definition: L1TDTTPGClient.cc:151
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
L1TDTTPGClient::initialize
void initialize()
Definition: L1TDTTPGClient.cc:29
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:479
L1TDTTPGClient::makeRatioHisto
void makeRatioHisto(DQMStore::IGetter &igetter, MonitorElement *ratioME, std::string &nName, std::string &dName)
Definition: L1TDTTPGClient.cc:118
dqm::legacy::MonitorElement::getTProfile2D
virtual TProfile2D * getTProfile2D() const
Definition: MonitorElement.h:511
Service.h
dqm::legacy::MonitorElement::getTProfile
virtual TProfile * getTProfile() const
Definition: MonitorElement.h:507
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
L1TDTTPGClient::get1DProfile
TProfile * get1DProfile(std::string meName, DQMStore::IGetter &igetter)
Definition: L1TDTTPGClient.cc:173
edm::ParameterSet
Definition: ParameterSet.h:47
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
L1TDTTPGClient::get1DHisto
TH1F * get1DHisto(std::string meName, DQMStore::IGetter &igetter)
Definition: L1TDTTPGClient.cc:140
HLTTauDQMOffline_cfi.numerator
numerator
Definition: HLTTauDQMOffline_cfi.py:179
L1TDTTPGClient.h
HLTTauDQMOffline_cfi.denominator
denominator
Definition: HLTTauDQMOffline_cfi.py:180
std
Definition: JetResolutionObject.h:76
L1TDTTPGClient::L1TDTTPGClient
L1TDTTPGClient(const edm::ParameterSet &ps)
Constructor.
Definition: L1TDTTPGClient.cc:21
L1TDTTPGClient::get2DProfile
TProfile2D * get2DProfile(std::string meName, DQMStore::IGetter &igetter)
Definition: L1TDTTPGClient.cc:162
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IBooker::book2D
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:177
dqm::impl::MonitorElement::getName
const std::string & getName() const
get name of ME
Definition: MonitorElement.h:250
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
L1TDTTPGClient::setMapThLabel
void setMapThLabel(MonitorElement *me)
Definition: L1TDTTPGClient.cc:193
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
L1TDTTPGClient::dqmEndJob
void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
Definition: L1TDTTPGClient.cc:52
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
ParameterSet.h
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
L1TDTTPGClient::setMapPhLabel
void setMapPhLabel(MonitorElement *me)
Definition: L1TDTTPGClient.cc:184
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:491