CMS 3D CMS Logo

L1TdeCSCTPGClient.cc
Go to the documentation of this file.
2 
9 #include "TRandom.h"
10 using namespace edm;
11 using namespace std;
12 
14  : monitorDir_(ps.getParameter<string>("monitorDir")),
15  chambers_(ps.getParameter<std::vector<std::string>>("chambers")),
16  // variables
17  alctVars_(ps.getParameter<std::vector<std::string>>("alctVars")),
18  clctVars_(ps.getParameter<std::vector<std::string>>("clctVars")),
19  lctVars_(ps.getParameter<std::vector<std::string>>("lctVars")),
20  // binning
21  alctNBin_(ps.getParameter<std::vector<unsigned>>("alctNBin")),
22  clctNBin_(ps.getParameter<std::vector<unsigned>>("clctNBin")),
23  lctNBin_(ps.getParameter<std::vector<unsigned>>("lctNBin")),
24  alctMinBin_(ps.getParameter<std::vector<double>>("alctMinBin")),
25  clctMinBin_(ps.getParameter<std::vector<double>>("clctMinBin")),
26  lctMinBin_(ps.getParameter<std::vector<double>>("lctMinBin")),
27  alctMaxBin_(ps.getParameter<std::vector<double>>("alctMaxBin")),
28  clctMaxBin_(ps.getParameter<std::vector<double>>("clctMaxBin")),
29  lctMaxBin_(ps.getParameter<std::vector<double>>("lctMaxBin")),
30  B904Setup_(ps.getParameter<bool>("B904Setup")),
31  isRun3_(ps.getParameter<bool>("isRun3")) {}
32 
34 
36  DQMStore::IGetter &igetter,
37  const edm::LuminosityBlock &lumiSeg,
38  const edm::EventSetup &c) {
39  book(ibooker);
40  processHistograms(igetter);
41 }
42 
43 //--------------------------------------------------------
45  book(ibooker);
46  processHistograms(igetter);
47 }
48 
51 
52  // do not analyze Run-3 properties in Run-1 and Run-2 eras
53  if (!isRun3_) {
54  clctVars_.resize(4);
55  lctVars_.resize(5);
56  }
57 
58  // remove the non-ME1/1 chambers from the list when B904Setup is set to true
59  if (B904Setup_) {
60  chambers_.resize(1);
61  }
62  // do not analyze the 1/4-strip bit, 1/8-strip bit
63  else {
64  clctVars_.resize(9);
65  lctVars_.resize(9);
66  }
67 
68  // chamber type
69  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
70  // alct variable
71  for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) {
72  const std::string key("alct_" + alctVars_[iVar] + "_diff");
73  const std::string histName(key + "_" + chambers_[iType]);
74  const std::string histTitle(chambers_[iType] + " ALCT " + alctVars_[iVar] + " (Emul - Data)");
75  if (chamberHistos_[iType][key] == nullptr)
76  chamberHistos_[iType][key] =
77  iBooker.book1D(histName, histTitle, alctNBin_[iVar], alctMinBin_[iVar], alctMaxBin_[iVar]);
78  else
79  chamberHistos_[iType][key]->Reset();
80  }
81 
82  // clct variable
83  for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) {
84  const std::string key("clct_" + clctVars_[iVar] + "_diff");
85  const std::string histName(key + "_" + chambers_[iType]);
86  const std::string histTitle(chambers_[iType] + " CLCT " + clctVars_[iVar] + " (Emul - Data)");
87  if (chamberHistos_[iType][key] == nullptr)
88  chamberHistos_[iType][key] =
89  iBooker.book1D(histName, histTitle, clctNBin_[iVar], clctMinBin_[iVar], clctMaxBin_[iVar]);
90  else
91  chamberHistos_[iType][key]->Reset();
92  }
93 
94  // lct variable
95  for (unsigned iVar = 0; iVar < lctVars_.size(); iVar++) {
96  const std::string key("lct_" + lctVars_[iVar] + "_diff");
97  const std::string histName(key + "_" + chambers_[iType]);
98  const std::string histTitle(chambers_[iType] + " LCT " + lctVars_[iVar] + " (Emul - Data)");
99  if (chamberHistos_[iType][key] == nullptr)
100  chamberHistos_[iType][key] =
101  iBooker.book1D(histName, histTitle, lctNBin_[iVar], lctMinBin_[iVar], lctMaxBin_[iVar]);
102  else
103  chamberHistos_[iType][key]->Reset();
104  }
105  }
106 }
107 
109  MonitorElement *dataMon;
110  MonitorElement *emulMon;
111 
112  // chamber type
113  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
114  // alct variable
115  for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) {
116  const std::string key("alct_" + alctVars_[iVar]);
117  const std::string histData(key + "_data_" + chambers_[iType]);
118  const std::string histEmul(key + "_emul_" + chambers_[iType]);
119 
120  dataMon = igetter.get(monitorDir_ + "/" + histData);
121  emulMon = igetter.get(monitorDir_ + "/" + histEmul);
122 
123  TH1F *hDiff = chamberHistos_[iType][key + "_diff"]->getTH1F();
124 
125  if (dataMon && emulMon) {
126  TH1F *hData = dataMon->getTH1F();
127  TH1F *hEmul = emulMon->getTH1F();
128  hDiff->Add(hEmul, hData, 1, -1);
129  }
130  }
131 
132  // clct variable
133  for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) {
134  const std::string key("clct_" + clctVars_[iVar]);
135  const std::string histData(key + "_data_" + chambers_[iType]);
136  const std::string histEmul(key + "_emul_" + chambers_[iType]);
137 
138  dataMon = igetter.get(monitorDir_ + "/" + histData);
139  emulMon = igetter.get(monitorDir_ + "/" + histEmul);
140 
141  TH1F *hDiff = chamberHistos_[iType][key + "_diff"]->getTH1F();
142 
143  if (dataMon && emulMon) {
144  TH1F *hData = dataMon->getTH1F();
145  TH1F *hEmul = emulMon->getTH1F();
146  hDiff->Add(hEmul, hData, 1, -1);
147  }
148  }
149 
150  // lct variable
151  for (unsigned iVar = 0; iVar < lctVars_.size(); iVar++) {
152  const std::string key("lct_" + lctVars_[iVar]);
153  const std::string histData(key + "_data_" + chambers_[iType]);
154  const std::string histEmul(key + "_emul_" + chambers_[iType]);
155 
156  dataMon = igetter.get(monitorDir_ + "/" + histData);
157  emulMon = igetter.get(monitorDir_ + "/" + histEmul);
158 
159  TH1F *hDiff = chamberHistos_[iType][key + "_diff"]->getTH1F();
160 
161  if (dataMon && emulMon) {
162  TH1F *hData = dataMon->getTH1F();
163  TH1F *hEmul = emulMon->getTH1F();
164  hDiff->Add(hEmul, hData, 1, -1);
165  }
166  }
167  }
168 }
L1TdeCSCTPGClient::alctVars_
std::vector< std::string > alctVars_
Definition: L1TdeCSCTPGClient.h:37
L1TdeCSCTPGClient::monitorDir_
std::string monitorDir_
Definition: L1TdeCSCTPGClient.h:32
electrons_cff.bool
bool
Definition: electrons_cff.py:366
L1TdeCSCTPGClient::clctVars_
std::vector< std::string > clctVars_
Definition: L1TdeCSCTPGClient.h:38
MessageLogger.h
ESHandle.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
L1TdeCSCTPGClient::clctMaxBin_
std::vector< double > clctMaxBin_
Definition: L1TdeCSCTPGClient.h:48
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
L1TdeCSCTPGClient::L1TdeCSCTPGClient
L1TdeCSCTPGClient(const edm::ParameterSet &ps)
Constructor.
Definition: L1TdeCSCTPGClient.cc:13
L1TdeCSCTPGClient::~L1TdeCSCTPGClient
~L1TdeCSCTPGClient() override
Destructor.
Definition: L1TdeCSCTPGClient.cc:33
L1TdeCSCTPGClient::B904Setup_
bool B904Setup_
Definition: L1TdeCSCTPGClient.h:56
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:479
L1TdeCSCTPGClient::book
void book(DQMStore::IBooker &ibooker)
Definition: L1TdeCSCTPGClient.cc:49
L1TdeCSCTPGClient::lctMinBin_
std::vector< double > lctMinBin_
Definition: L1TdeCSCTPGClient.h:46
L1TdeCSCTPGClient::alctNBin_
std::vector< unsigned > alctNBin_
Definition: L1TdeCSCTPGClient.h:41
L1TdeCSCTPGClient::processHistograms
void processHistograms(DQMStore::IGetter &)
Definition: L1TdeCSCTPGClient.cc:108
L1TdeCSCTPGClient::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: L1TdeCSCTPGClient.cc:44
L1TdeCSCTPGClient::isRun3_
bool isRun3_
Definition: L1TdeCSCTPGClient.h:58
Service.h
L1TdeCSCTPGClient::lctNBin_
std::vector< unsigned > lctNBin_
Definition: L1TdeCSCTPGClient.h:43
edm::ParameterSet
Definition: ParameterSet.h:47
B2GTnPMonitor_cfi.histTitle
histTitle
Definition: B2GTnPMonitor_cfi.py:112
L1TdeCSCTPGClient::alctMinBin_
std::vector< double > alctMinBin_
Definition: L1TdeCSCTPGClient.h:44
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
L1TdeCSCTPGClient::clctMinBin_
std::vector< double > clctMinBin_
Definition: L1TdeCSCTPGClient.h:45
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TdeCSCTPGClient.h
std
Definition: JetResolutionObject.h:76
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
EventSetup.h
L1TdeCSCTPGClient::chamberHistos_
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos_
Definition: L1TdeCSCTPGClient.h:62
dqm::implementation::IBooker
Definition: DQMStore.h:43
L1TdeCSCTPGClient::alctMaxBin_
std::vector< double > alctMaxBin_
Definition: L1TdeCSCTPGClient.h:47
L1TdeCSCTPGClient::chambers_
std::vector< std::string > chambers_
Definition: L1TdeCSCTPGClient.h:35
ParameterSet.h
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
crabWrapper.key
key
Definition: crabWrapper.py:19
L1TdeCSCTPGClient::lctMaxBin_
std::vector< double > lctMaxBin_
Definition: L1TdeCSCTPGClient.h:49
L1TdeCSCTPGClient::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: L1TdeCSCTPGClient.cc:35
L1TdeCSCTPGClient::clctNBin_
std::vector< unsigned > clctNBin_
Definition: L1TdeCSCTPGClient.h:42
L1TdeCSCTPGClient::lctVars_
std::vector< std::string > lctVars_
Definition: L1TdeCSCTPGClient.h:39
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98