CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
20 
22 
23  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: Constructor";
24 
25  parameters_ = iConfig;
26 
27  offlineDQM_ = parameters_.getUntrackedParameter<bool> ("OfflineDQM",true);
28  useRollInfo_= parameters_.getUntrackedParameter<bool>("UseRollInfo", false);
29  //check enabling
30  enableDQMClients_ =parameters_.getUntrackedParameter<bool> ("EnableRPCDqmClient",true);
31  minimumEvents_= parameters_.getUntrackedParameter<int>("MinimumRPCEvents", 10000);
32 
33  std::string subsystemFolder = parameters_.getUntrackedParameter<std::string>("RPCFolder", "RPC");
34  std::string recHitTypeFolder= parameters_.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
35  std::string summaryFolder = parameters_.getUntrackedParameter<std::string>("SummaryFolder", "SummaryHistograms");
36 
37  prefixDir_ = subsystemFolder+ "/"+ recHitTypeFolder;
38  globalFolder_ = subsystemFolder + "/"+ recHitTypeFolder + "/"+ summaryFolder;
39 
40  //get prescale factor
41  prescaleGlobalFactor_ = parameters_.getUntrackedParameter<int>("DiagnosticGlobalPrescale", 5);
42 
43 
44 
45  //make default client list
46  clientList_.push_back("RPCMultiplicityTest");
47  clientList_.push_back("RPCDeadChannelTest");
48  clientList_.push_back("RPCClusterSizeTest");
49  clientList_= parameters_.getUntrackedParameter<std::vector<std::string> >("RPCDqmClientList",clientList_);
50 
51 
52  //get all the possible RPC DQM clients
53  this->makeClientMap();
54 }
55 
57 
59 
60  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: Begin Job";
61  if (!enableDQMClients_) return; ;
62 
64  dbe_->setVerbose(0);
65 
66 
67  //Do whatever the begin jobs of all client modules do
68  for(std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
69  (*it)->beginJob(dbe_, globalFolder_);
70 
71 }
72 
73 
75 
76  if (!enableDQMClients_) return;
77 
78 
79  for ( std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
80  (*it)->beginRun(r,c);
81  }
82 
83  if(!offlineDQM_) this->getMonitorElements(r, c);
84 
86  init_ = false;
87 }
88 
89 
90 
92  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: End Run";
93 
94  if (!enableDQMClients_) return;
95 
96  if(offlineDQM_) this->getMonitorElements(r, c);
97 
98  float rpcevents = minimumEvents_;
99  if(RPCEvents_) rpcevents = RPCEvents_ ->getBinContent(1);
100 
101  if(rpcevents < minimumEvents_) return;
102 
103  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
104  (*it)->clientOperation(c);
105  (*it)->endRun(r,c);
106  }
107 }
108 
109 
111 
112  std::vector<MonitorElement *> myMeVect;
113  std::vector<RPCDetId> myDetIds;
114 
116  c.get<MuonGeometryRecord>().get(rpcGeo);
117 
118  //dbe_->setCurrentFolder(prefixDir_);
120  MonitorElement * myMe = NULL;
121  std::string rollName= "";
122  // std::set<int> disk_set, ring_set;
123 
124  //loop on all geometry and get all histos
125  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
126  if( dynamic_cast< const RPCChamber* >( *it ) != 0 ){
127 
128  const RPCChamber* ch = dynamic_cast< const RPCChamber* >( *it );
129  std::vector< const RPCRoll*> roles = (ch->rolls());
130 
131  //Loop on rolls in given chamber
132  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
133 
134  RPCDetId detId = (*r)->id();
135 
136  //Get name
137  RPCGeomServ RPCname(detId);
138  rollName= "";
139  if(useRollInfo_) {
140  rollName = RPCname.name();
141  }else{
142  rollName = RPCname.chambername();
143  }
144 
145  //loop on clients
146  for( unsigned int cl = 0; cl<clientModules_.size(); cl++ ){
147 
148  myMe = NULL;
149  myMe = dbe_->get(prefixDir_ +"/"+ folderStr->folderStructure(detId)+"/"+clientHisto_[cl]+ "_"+rollName);
150 
151  if (!myMe)continue;
152 
153  dbe_->tag(myMe, clientTag_[cl]);
154  myMeVect.push_back(myMe);
155  myDetIds.push_back(detId);
156 
157  }//end loop on clients
158 
159  }//end loop on roll in given chamber
160  }
161  }//end loop on all geometry and get all histos
162 
163 
164  RPCEvents_ = dbe_->get(prefixDir_ +"/RPCEvents");
165 
166  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
167  (*it)->getMonitorElements(myMeVect, myDetIds);
168  }
169 
170  delete folderStr;
171 
172 }
173 
174 
175 
177  if (!enableDQMClients_) return;
178 
179  for ( std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
180  (*it)->beginLuminosityBlock(lumiSeg,context);
181 }
182 
184 
185  if (!enableDQMClients_) return;
186 
187  for ( std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
188  (*it)->analyze( iEvent,iSetup);
189 }
190 
191 
193 
194  if (!enableDQMClients_ ) return;
195 
196  if(offlineDQM_) return;
197 
198  edm::LogVerbatim ("rpcdqmclient") <<"[RPCDqmClient]: End of LS ";
199 
200  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
201  (*it)->endLuminosityBlock( lumiSeg, c);
202 
203  float rpcevents = minimumEvents_;
204  if(RPCEvents_) rpcevents = RPCEvents_ ->getBinContent(1);
205 
206  if( rpcevents < minimumEvents_) return;
207 
208  if( !init_ ){
209 
210  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
211  (*it)->clientOperation(c);
212  }
213  init_ = true;
214  return;
215  }
216 
217  lumiCounter_++;
218 
219  if (lumiCounter_%prescaleGlobalFactor_ != 0) return;
220 
221 
222  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
223  (*it)->clientOperation(c);
224  }
225 
226 }
227 
228 
229 
231  if (!enableDQMClients_) return;
232 
233  for ( std::vector<RPCClient*>::iterator it= clientModules_.begin(); it!=clientModules_.end(); it++ )
234  (*it)->endJob();
235 }
236 
237 
239 
240  for(unsigned int i = 0; i<clientList_.size(); i++){
241 
242  if( clientList_[i] == "RPCMultiplicityTest" ) {
243  clientHisto_.push_back("Multiplicity");
244  clientTag_.push_back(rpcdqm::MULTIPLICITY);
246  } else if ( clientList_[i] == "RPCDeadChannelTest" ){
247  clientHisto_.push_back("Occupancy");
249  clientTag_.push_back(rpcdqm::OCCUPANCY);
250  } else if ( clientList_[i] == "RPCClusterSizeTest" ){
251  clientHisto_.push_back("ClusterSize");
253  clientTag_.push_back(rpcdqm::CLUSTERSIZE);
254  } else if ( clientList_[i] == "RPCOccupancyTest" ){
255  clientHisto_.push_back("Occupancy");
257  clientTag_.push_back(rpcdqm::OCCUPANCY);
258  } else if ( clientList_[i] == "RPCNoisyStripTest" ){
259  clientHisto_.push_back("Occupancy");
261  clientTag_.push_back(rpcdqm::OCCUPANCY);
262  }
263  }
264 
265  return;
266 
267 }
void analyze(const edm::Event &, const edm::EventSetup &)
Analyze.
virtual std::string chambername()
Definition: RPCGeomServ.cc:120
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
DQMStore * dbe_
Definition: RPCDqmClient.h:68
void beginJob()
BeginJob.
Definition: RPCDqmClient.cc:58
MonitorElement * RPCEvents_
Definition: RPCDqmClient.h:58
std::string prefixDir_
Definition: RPCDqmClient.h:54
void beginRun(const edm::Run &, const edm::EventSetup &)
Definition: RPCDqmClient.cc:74
#define NULL
Definition: scimark2.h:8
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
End Lumi Block.
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1604
std::vector< std::string > clientList_
Definition: RPCDqmClient.h:56
int iEvent
Definition: GenABIO.cc:230
virtual std::string name()
Definition: RPCGeomServ.cc:20
edm::ParameterSet parameters_
Definition: RPCDqmClient.h:66
std::vector< std::string > clientHisto_
Definition: RPCDqmClient.h:61
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Begin Lumi block.
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:68
bool useRollInfo_
Definition: RPCDqmClient.h:53
std::string globalFolder_
Definition: RPCDqmClient.h:55
void setVerbose(unsigned level)
Definition: DQMStore.cc:641
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1718
int minimumEvents_
Definition: RPCDqmClient.h:51
std::string folderStructure(RPCDetId detId)
void endJob()
Endjob.
const T & get() const
Definition: EventSetup.h:55
std::vector< int > clientTag_
Definition: RPCDqmClient.h:64
double getBinContent(int binx) const
get content of bin (1-D)
void makeClientMap(void)
void endRun(const edm::Run &, const edm::EventSetup &)
Definition: RPCDqmClient.cc:91
bool enableDQMClients_
Definition: RPCDqmClient.h:53
std::vector< RPCClient * > clientModules_
Definition: RPCDqmClient.h:62
RPCDqmClient(const edm::ParameterSet &ps)
Constructor.
Definition: RPCDqmClient.cc:21
void getMonitorElements(const edm::Run &, const edm::EventSetup &)
virtual ~RPCDqmClient()
Destructor.
Definition: RPCDqmClient.cc:56
int prescaleGlobalFactor_
Definition: RPCDqmClient.h:51
bool offlineDQM_
Definition: RPCDqmClient.h:50
Definition: Run.h:41