CMS 3D CMS Logo

RPCDqmClient.cc
Go to the documentation of this file.
1 // Package: RPCDqmClient
2 // Original Author: Anna Cimmino
6 //include client headers
12 //Geometry
15 //Framework
18 
19 #include <fmt/format.h>
20 
22  edm::LogVerbatim("rpcdqmclient") << "[RPCDqmClient]: Constructor";
23 
24  offlineDQM_ = pset.getUntrackedParameter<bool>("OfflineDQM", true);
25  useRollInfo_ = pset.getUntrackedParameter<bool>("UseRollInfo", false);
26  //check enabling
27  enableDQMClients_ = pset.getUntrackedParameter<bool>("EnableRPCDqmClient", true);
28  minimumEvents_ = pset.getUntrackedParameter<int>("MinimumRPCEvents", 10000);
29 
30  std::string subsystemFolder = pset.getUntrackedParameter<std::string>("RPCFolder", "RPC");
31  std::string recHitTypeFolder = pset.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
32  std::string summaryFolder = pset.getUntrackedParameter<std::string>("SummaryFolder", "SummaryHistograms");
33 
34  prefixDir_ = subsystemFolder + "/" + recHitTypeFolder;
35  globalFolder_ = subsystemFolder + "/" + recHitTypeFolder + "/" + summaryFolder;
36 
37  //get prescale factor
38  prescaleGlobalFactor_ = pset.getUntrackedParameter<int>("DiagnosticGlobalPrescale", 5);
39 
40  //make default client list
41  clientList_ = {{"RPCMultiplicityTest", "RPCDeadChannelTest", "RPCClusterSizeTest"}};
42  clientList_ = pset.getUntrackedParameter<std::vector<std::string> >("RPCDqmClientList", clientList_);
43 
44  //get all the possible RPC DQM clients
45  this->makeClientMap(pset);
46 
47  //clear counters
48  lumiCounter_ = 0;
49 
50  rpcGeomToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();
51 }
52 
54  if (!enableDQMClients_) {
55  return;
56  };
57  edm::LogVerbatim("rpcdqmclient") << "[RPCDqmClient]: Begin Job";
58 
59  //Do whatever the begin jobs of all client modules do
60  for (auto& module : clientModules_) {
61  module->beginJob(globalFolder_);
62  }
63 }
64 
66  DQMStore::IGetter& igetter,
67  edm::LuminosityBlock const& lumiSeg,
68  edm::EventSetup const& c) {
69  if (!enableDQMClients_) {
70  return;
71  }
72  edm::LogVerbatim("rpcdqmclient") << "[RPCDqmClient]: End DQM LB";
73 
74  if (myDetIds_.empty()) {
75  //Get RPCdetId...
76 
77  this->getRPCdetId(c);
78 
79  //...book summary histograms
80  for (auto& module : clientModules_) {
81  module->myBooker(ibooker);
82  }
83  }
84 
85  if (!offlineDQM_) { //Do this only for the online
86 
87  if (lumiCounter_ == 0) { //only for the first lumi section do this...
88  // ...get chamber based histograms and pass them to the client modules
89  this->getMonitorElements(igetter);
90  }
91 
92  //Do not perform client oparations every lumi block
93  ++lumiCounter_;
95  return;
96  }
97 
98  //Check if there's enough statistics
99  float rpcevents = minimumEvents_;
100  if (RPCEvents_) {
101  rpcevents = RPCEvents_->getBinContent(1);
102  }
103  if (rpcevents < minimumEvents_) {
104  return;
105  }
106 
107  edm::LogVerbatim("rpcdqmclient") << "[RPCDqmClient]: Client operations";
108  for (auto& module : clientModules_) {
109  module->clientOperation();
110  }
111  } //end of online operations
112 }
113 
115  if (!enableDQMClients_) {
116  return;
117  }
118 
119  edm::LogVerbatim("rpcdqmclient") << "[RPCDqmClient]: End DQM Job";
120 
121  if (offlineDQM_) { // ...get chamber based histograms and pass them to the client modules
122  this->getMonitorElements(igetter);
123  }
124 
125  float rpcevents = minimumEvents_;
126  if (RPCEvents_) {
127  rpcevents = RPCEvents_->getBinContent(1);
128  }
129  if (rpcevents < minimumEvents_) {
130  return;
131  }
132 
133  edm::LogVerbatim("rpcdqmclient") << "[RPCDqmClient]: Client operations";
134  for (auto& module : clientModules_) {
135  module->clientOperation();
136  }
137 }
138 
140  std::vector<MonitorElement*> myMeVect;
141  std::vector<RPCDetId> myDetIds;
142 
143  //loop on all geometry and get all histos
144  for (auto& detId : myDetIds_) {
145  //Get name
146  const std::string rollName = RPCNameHelper::name(detId, useRollInfo_);
148 
149  //loop on clients
150  for (unsigned int cl = 0, nCL = clientModules_.size(); cl < nCL; ++cl) {
151  MonitorElement* myMe = igetter.get(fmt::format("{}/{}/{}_{}", prefixDir_, folder, clientHisto_[cl], rollName));
152  if (!myMe)
153  continue;
154 
155  myMeVect.push_back(myMe);
156  myDetIds.push_back(detId);
157 
158  } //end loop on clients
159  } //end loop on all geometry and get all histos
160 
161  RPCEvents_ = igetter.get(prefixDir_ + "/RPCEvents");
162  for (unsigned int cl = 0; cl < clientModules_.size(); ++cl) {
163  clientModules_[cl]->getMonitorElements(myMeVect, myDetIds, clientHisto_[cl]);
164  }
165 }
166 
168  myDetIds_.clear();
169 
170  auto rpcGeo = eventSetup.getHandle(rpcGeomToken_);
171 
172  for (auto& det : rpcGeo->dets()) {
173  const RPCChamber* ch = dynamic_cast<const RPCChamber*>(det);
174  if (!ch)
175  continue;
176 
177  //Loop on rolls in given chamber
178  for (auto& r : ch->rolls()) {
179  myDetIds_.push_back(r->id());
180  }
181  }
182 }
183 
185  for (unsigned int i = 0; i < clientList_.size(); i++) {
186  if (clientList_[i] == "RPCMultiplicityTest") {
187  clientHisto_.push_back("Multiplicity");
188  // clientTag_.push_back(rpcdqm::MULTIPLICITY);
189  clientModules_.emplace_back(new RPCMultiplicityTest(pset));
190  } else if (clientList_[i] == "RPCDeadChannelTest") {
191  clientHisto_.push_back("Occupancy");
192  clientModules_.emplace_back(new RPCDeadChannelTest(pset));
193  // clientTag_.push_back(rpcdqm::OCCUPANCY);
194  } else if (clientList_[i] == "RPCClusterSizeTest") {
195  clientHisto_.push_back("ClusterSize");
196  clientModules_.emplace_back(new RPCClusterSizeTest(pset));
197  // clientTag_.push_back(rpcdqm::CLUSTERSIZE);
198  } else if (clientList_[i] == "RPCOccupancyTest") {
199  clientHisto_.push_back("Occupancy");
200  clientModules_.emplace_back(new RPCOccupancyTest(pset));
201  // clientTag_.push_back(rpcdqm::OCCUPANCY);
202  } else if (clientList_[i] == "RPCNoisyStripTest") {
203  clientHisto_.push_back("Occupancy");
204  clientModules_.emplace_back(new RPCNoisyStripTest(pset));
205  //clientTag_.push_back(rpcdqm::OCCUPANCY);
206  }
207  }
208 
209  return;
210 }
RPCDqmClient::myDetIds_
std::vector< RPCDetId > myDetIds_
Definition: RPCDqmClient.h:46
RPCDqmClient::clientList_
std::vector< std::string > clientList_
Definition: RPCDqmClient.h:43
RPCDqmClient::globalFolder_
std::string globalFolder_
Definition: RPCDqmClient.h:42
RPCDqmClient::prefixDir_
std::string prefixDir_
Definition: RPCDqmClient.h:41
RPCDqmClient::RPCEvents_
MonitorElement * RPCEvents_
Definition: RPCDqmClient.h:45
mps_fire.i
i
Definition: mps_fire.py:428
RPCDeadChannelTest.h
MessageLogger.h
RPCDqmClient::lumiCounter_
int lumiCounter_
Definition: RPCDqmClient.h:44
ESHandle.h
RPCDqmClient::offlineDQM_
bool offlineDQM_
Definition: RPCDqmClient.h:37
RPCDqmClient::getRPCdetId
void getRPCdetId(const edm::EventSetup &)
Definition: RPCDqmClient.cc:167
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
printsummarytable.folder
folder
Definition: printsummarytable.py:7
RPCNameHelper.h
RPC_Client_on_RootFile.RPCNoisyStripTest
RPCNoisyStripTest
Definition: RPC_Client_on_RootFile.py:79
RPCDqmClient::minimumEvents_
int minimumEvents_
Definition: RPCDqmClient.h:38
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
RPCNoisyStripTest.h
RPCChamber::rolls
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:40
RPCChamber
Definition: RPCChamber.h:19
RPCDqmClient::makeClientMap
void makeClientMap(const edm::ParameterSet &parameters_)
Definition: RPCDqmClient.cc:184
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
RPCDqmClient::clientModules_
std::vector< std::unique_ptr< RPCClient > > clientModules_
Definition: RPCDqmClient.h:48
RPCGeomServ.h
RPCDqmClient::beginJob
void beginJob() override
Definition: RPCDqmClient.cc:53
RPCDqmClient::enableDQMClients_
bool enableDQMClients_
Definition: RPCDqmClient.h:40
dqm-mbProfile.format
format
Definition: dqm-mbProfile.py:16
RPCDqmClient::RPCDqmClient
RPCDqmClient(const edm::ParameterSet &ps)
Constructor.
Definition: RPCDqmClient.cc:21
RPCOccupancyTest.h
RPCClusterSizeTest.h
RPCDqmClient::prescaleGlobalFactor_
int prescaleGlobalFactor_
Definition: RPCDqmClient.h:38
RPCBookFolderStructure::folderStructure
static std::string folderStructure(const RPCDetId &detId)
Definition: RPCBookFolderStructure.h:15
RPCDqmClient::getMonitorElements
void getMonitorElements(DQMStore::IGetter &)
Definition: RPCDqmClient.cc:139
RPC_Client_on_RootFile.RPCMultiplicityTest
RPCMultiplicityTest
Definition: RPC_Client_on_RootFile.py:77
RPCNameHelper::name
static std::string name(const RPCDetId &detId, const bool useRoll)
Definition: RPCNameHelper.cc:6
RPC_Client_on_RootFile.RPCDeadChannelTest
RPCDeadChannelTest
RPC Client Modules #######################.
Definition: RPC_Client_on_RootFile.py:72
edm::ParameterSet
Definition: ParameterSet.h:47
RPCMultiplicityTest.h
RPCDqmClient::rpcGeomToken_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
Definition: RPCDqmClient.h:52
RPCDqmClient::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: RPCDqmClient.cc:114
RPCBookFolderStructure.h
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
RPC_Client_on_RootFile.RPCOccupancyTest
RPCOccupancyTest
Definition: RPC_Client_on_RootFile.py:73
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
alignCSCRings.r
r
Definition: alignCSCRings.py:93
callgraph.module
module
Definition: callgraph.py:61
RPCDqmClient.h
RPCDqmClient::useRollInfo_
bool useRollInfo_
Definition: RPCDqmClient.h:40
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
RPCDqmClient::clientHisto_
std::vector< std::string > clientHisto_
Definition: RPCDqmClient.h:47
dqm::implementation::IBooker
Definition: DQMStore.h:43
RPC_Client_on_RootFile.RPCClusterSizeTest
RPCClusterSizeTest
Definition: RPC_Client_on_RootFile.py:74
RPCDqmClient::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: RPCDqmClient.cc:65
MuonGeometryRecord.h
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:583
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27