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
21 
23 
24  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: Constructor";
25 
26  // parameters_ = iConfig;
27 
28  offlineDQM_ = parameters_.getUntrackedParameter<bool> ("OfflineDQM",true);
29  useRollInfo_= parameters_.getUntrackedParameter<bool>("UseRollInfo", false);
30  //check enabling
31  enableDQMClients_ = parameters_.getUntrackedParameter<bool> ("EnableRPCDqmClient",true);
32  minimumEvents_= parameters_.getUntrackedParameter<int>("MinimumRPCEvents", 10000);
33 
34  std::string subsystemFolder = parameters_.getUntrackedParameter<std::string>("RPCFolder", "RPC");
35  std::string recHitTypeFolder= parameters_.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
36  std::string summaryFolder = parameters_.getUntrackedParameter<std::string>("SummaryFolder", "SummaryHistograms");
37 
38  prefixDir_ = subsystemFolder+ "/"+ recHitTypeFolder;
39  globalFolder_ = subsystemFolder + "/"+ recHitTypeFolder + "/"+ summaryFolder;
40 
41  //get prescale factor
42  prescaleGlobalFactor_ = parameters_.getUntrackedParameter<int>("DiagnosticGlobalPrescale", 5);
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(parameters_);
54 
56  init_ = false;
57 
58 }
59 
61 
63 
64  if (!enableDQMClients_) {return;} ;
65  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: Begin Job";
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( globalFolder_ );
70  }
71 }
72 
73 
74 
76 
77  if (!enableDQMClients_ ) {return;}
78  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: End DQM LB";
79 
80 
81  if(!init_) { //At the end of the first LumiBlock...
82  // ...get chamber based histograms
83  this->getMonitorElements(igetter, c);
84 
85  //...book summary histograms
86  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
87  (*it)->myBooker( ibooker);
88  }
89 
91  init_= true;
92  }
93 
94  lumiCounter_++;
95 
96  if (offlineDQM_) {return;} // If in offlineDQM mode, do nothing. Client operation will be done only at endJob
97 
98  //Check if there's enough statistics
99  float rpcevents = minimumEvents_;
100  if(RPCEvents_) {rpcevents = RPCEvents_->getBinContent(1);}
101  if( rpcevents < minimumEvents_) {return;}
102  //Do not perform client oparations every lumi block
103  if (lumiCounter_%prescaleGlobalFactor_ != 0) {return;}
104 
105  edm::LogVerbatim ("rpcdqmclient") <<"[RPCDqmClient]: Client operations";
106  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
107  (*it)->clientOperation();
108  }
109 
110 }
111 
112 
113 
115 
116  if (!enableDQMClients_ || !init_) {return;}
117 
118  edm::LogVerbatim ("rpcdqmclient") << "[RPCDqmClient]: End DQM Job";
119 
120  float rpcevents = minimumEvents_;
121  if(RPCEvents_) {rpcevents = RPCEvents_ ->getBinContent(1);}
122  if(rpcevents < minimumEvents_) {return;}
123 
124  edm::LogVerbatim ("rpcdqmclient") <<"[RPCDqmClient]: Client operations";
125  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
126  (*it)->clientOperation();
127  }
128 
129 }
130 
131 
132 
134 
135  std::vector<MonitorElement *> myMeVect;
136  std::vector<RPCDetId> myDetIds;
137 
139  c.get<MuonGeometryRecord>().get(rpcGeo);
140 
141  //dbe_->setCurrentFolder(prefixDir_);
143  MonitorElement * myMe = NULL;
144  std::string rollName= "";
145 
146  //loop on all geometry and get all histos
147  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
148  if( dynamic_cast< const RPCChamber* >( *it ) != 0 ){
149 
150  const RPCChamber* ch = dynamic_cast< const RPCChamber* >( *it );
151  std::vector< const RPCRoll*> roles = (ch->rolls());
152 
153  //Loop on rolls in given chamber
154  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
155 
156  RPCDetId detId = (*r)->id();
157 
158  //Get name
159  RPCGeomServ RPCname(detId);
160  rollName= "";
161  if(useRollInfo_) {
162  rollName = RPCname.name();
163  }else{
164  rollName = RPCname.chambername();
165  }
166 
167  //loop on clients
168  for( unsigned int cl = 0; cl<clientModules_.size(); cl++ ){
169 
170  myMe = NULL;
171  myMe = igetter.get(prefixDir_ +"/"+ folderStr->folderStructure(detId)+"/"+clientHisto_[cl]+ "_"+rollName);
172 
173  if (!myMe)continue;
174  // dbe_->tag(myMe, clientTag_[cl]);
175  myMeVect.push_back(myMe);
176  myDetIds.push_back(detId);
177 
178  }//end loop on clients
179  }//end loop on roll in given chamber
180  }
181  }//end loop on all geometry and get all histos
182 
183 
184  RPCEvents_ = igetter.get(prefixDir_ +"/RPCEvents");
185  unsigned int cl = 0;
186  for (std::vector<RPCClient*>::iterator it = clientModules_.begin(); it!=clientModules_.end(); it++ ){
187  (*it)->getMonitorElements(myMeVect, myDetIds, clientHisto_[cl]);
188  cl++;
189  }
190 
191  delete folderStr;
192 }
193 
194 
195 
196 
197 
199 
200  for(unsigned int i = 0; i<clientList_.size(); i++){
201 
202  if( clientList_[i] == "RPCMultiplicityTest" ) {
203  clientHisto_.push_back("Multiplicity");
204  // clientTag_.push_back(rpcdqm::MULTIPLICITY);
205  clientModules_.push_back( new RPCMultiplicityTest(parameters_));
206  } else if ( clientList_[i] == "RPCDeadChannelTest" ){
207  clientHisto_.push_back("Occupancy");
208  clientModules_.push_back( new RPCDeadChannelTest(parameters_));
209  // clientTag_.push_back(rpcdqm::OCCUPANCY);
210  } else if ( clientList_[i] == "RPCClusterSizeTest" ){
211  clientHisto_.push_back("ClusterSize");
212  clientModules_.push_back( new RPCClusterSizeTest(parameters_));
213  // clientTag_.push_back(rpcdqm::CLUSTERSIZE);
214  } else if ( clientList_[i] == "RPCOccupancyTest" ){
215  clientHisto_.push_back("Occupancy");
216  clientModules_.push_back( new RPCOccupancyTest(parameters_));
217  // clientTag_.push_back(rpcdqm::OCCUPANCY);
218  } else if ( clientList_[i] == "RPCNoisyStripTest" ){
219  clientHisto_.push_back("Occupancy");
220  clientModules_.push_back( new RPCNoisyStripTest(parameters_));
221  //clientTag_.push_back(rpcdqm::OCCUPANCY);
222  }
223  }
224 
225  return;
226 
227 }
virtual std::string chambername()
Definition: RPCGeomServ.cc:120
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void beginJob()
Definition: RPCDqmClient.cc:62
MonitorElement * RPCEvents_
Definition: RPCDqmClient.h:42
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
std::string prefixDir_
Definition: RPCDqmClient.h:38
#define NULL
Definition: scimark2.h:8
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: RPCDqmClient.cc:75
std::vector< std::string > clientList_
Definition: RPCDqmClient.h:40
virtual std::string name()
Definition: RPCGeomServ.cc:20
void makeClientMap(const edm::ParameterSet &parameters_)
void getMonitorElements(DQMStore::IGetter &, const edm::EventSetup &)
std::vector< std::string > clientHisto_
Definition: RPCDqmClient.h:44
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:68
bool useRollInfo_
Definition: RPCDqmClient.h:37
std::string globalFolder_
Definition: RPCDqmClient.h:39
int minimumEvents_
Definition: RPCDqmClient.h:35
std::string folderStructure(RPCDetId detId)
const T & get() const
Definition: EventSetup.h:55
double getBinContent(int binx) const
get content of bin (1-D)
bool enableDQMClients_
Definition: RPCDqmClient.h:37
std::vector< RPCClient * > clientModules_
Definition: RPCDqmClient.h:45
RPCDqmClient(const edm::ParameterSet &ps)
Constructor.
Definition: RPCDqmClient.cc:22
virtual ~RPCDqmClient()
Destructor.
Definition: RPCDqmClient.cc:60
int prescaleGlobalFactor_
Definition: RPCDqmClient.h:35
bool offlineDQM_
Definition: RPCDqmClient.h:34