CMS 3D CMS Logo

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