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  //loop on all geometry and get all histos
122  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
123  if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
124 
125  RPCChamber* ch = dynamic_cast< RPCChamber* >( *it );
126  std::vector< const RPCRoll*> roles = (ch->rolls());
127  //Loop on rolls in given chamber
128  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
129  RPCDetId detId = (*r)->id();
130 
131  //Get Occupancy ME for roll
132  RPCGeomServ RPCname(detId);
133  std::string rollName= "";
134  //loop on clients
135  for( unsigned int cl = 0; cl<clientModules_.size(); cl++ ){
136  if(useRollInfo_) rollName = RPCname.name();
137  else rollName = RPCname.chambername();
138 
139  myMe = NULL;
140  myMe = dbe_->get(prefixDir_ +"/"+ folderStr->folderStructure(detId)+"/"+clientHisto_[cl]+ "_"+rollName);
141 
142  if (!myMe)continue;
143 
144  dbe_->tag(myMe, clientTag_[cl]);
145 
146  myMeVect.push_back(myMe);
147  myDetIds.push_back(detId);
148  }//end loop on clients
149  }//end loop on roll in given chamber
150  }
151  }//end loop on all geometry and get all histos
152 
153 
154  RPCEvents_ = dbe_->get(prefixDir_ +"/RPCEvents");
155 
156 
157  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
158  (*it)->getMonitorElements(myMeVect, myDetIds);
159  }
160 
161  delete folderStr;
162 
163 }
164 
165 
166 
168  if (!enableDQMClients_) return;
169 
170  for ( std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
171  (*it)->beginLuminosityBlock(lumiSeg,context);
172 }
173 
175 
176  if (!enableDQMClients_) return;
177 
178  for ( std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
179  (*it)->analyze( iEvent,iSetup);
180 }
181 
182 
184 
185  if (!enableDQMClients_ ) return;
186 
187  if(offlineDQM_) return;
188 
189  edm::LogVerbatim ("rpcdqmclient") <<"[RPCDqmClient]: End of LS ";
190 
191  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ )
192  (*it)->endLuminosityBlock( lumiSeg, c);
193 
194  float rpcevents = minimumEvents_;
195  if(RPCEvents_) rpcevents = RPCEvents_ ->getBinContent(1);
196 
197  if( rpcevents < minimumEvents_) return;
198 
199  if( !init_ ){
200 
201  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
202  (*it)->clientOperation(c);
203  }
204  init_ = true;
205  return;
206  }
207 
208  lumiCounter_++;
209 
210  if (lumiCounter_%prescaleGlobalFactor_ != 0) return;
211 
212 
213  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
214  (*it)->clientOperation(c);
215  }
216 
217 }
218 
219 
220 
222  if (!enableDQMClients_) return;
223 
224  for ( std::vector<RPCClient*>::iterator it= clientModules_.begin(); it!=clientModules_.end(); it++ )
225  (*it)->endJob();
226 }
227 
228 
230 
231  for(unsigned int i = 0; i<clientList_.size(); i++){
232 
233  if( clientList_[i] == "RPCMultiplicityTest" ) {
234  clientHisto_.push_back("Multiplicity");
235  clientTag_.push_back(rpcdqm::MULTIPLICITY);
237  } else if ( clientList_[i] == "RPCDeadChannelTest" ){
238  clientHisto_.push_back("Occupancy");
240  clientTag_.push_back(rpcdqm::OCCUPANCY);
241  } else if ( clientList_[i] == "RPCClusterSizeTest" ){
242  clientHisto_.push_back("ClusterSize");
244  clientTag_.push_back(rpcdqm::CLUSTERSIZE);
245  } else if ( clientList_[i] == "RPCOccupancyTest" ){
246  clientHisto_.push_back("Occupancy");
248  clientTag_.push_back(rpcdqm::OCCUPANCY);
249  } else if ( clientList_[i] == "RPCNoisyStripTest" ){
250  clientHisto_.push_back("Occupancy");
252  clientTag_.push_back(rpcdqm::OCCUPANCY);
253  }
254  }
255 
256  return;
257 
258 }
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:1359
std::vector< std::string > clientList_
Definition: RPCDqmClient.h:56
int iEvent
Definition: GenABIO.cc:243
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:70
bool useRollInfo_
Definition: RPCDqmClient.h:53
std::string globalFolder_
Definition: RPCDqmClient.h:55
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
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:36