CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
RPCEventSummary Class Reference

#include <RPCEventSummary.h>

Inheritance diagram for RPCEventSummary:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 Begin Lumi block. More...
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 End Lumi Block. More...
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
 RPCEventSummary (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~RPCEventSummary ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

enum  RPCQualityFlags { DEAD = 6, PARTIALLY_DEAD =5 }
 

Private Member Functions

void clientOperation ()
 

Private Attributes

DQMStoredbe_
 
bool doEndcapCertification_
 
bool enableReportSummary_
 
std::string eventInfoPath_
 
std::pair< int, int > FEDRange_
 
std::string globalFolder_
 
bool init_
 
int lumiCounter_
 
int minimumEvents_
 
int numberDisk_
 
int NumberOfFeds_
 
bool offlineDQM_
 
std::string prefixDir_
 
std::string prefixFolder_
 
int prescaleFactor_
 
MonitorElementRPCEvents
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 14 of file RPCEventSummary.h.

Member Enumeration Documentation

Enumerator
DEAD 
PARTIALLY_DEAD 

Definition at line 61 of file RPCEventSummary.h.

Constructor & Destructor Documentation

RPCEventSummary::RPCEventSummary ( const edm::ParameterSet ps)

Constructor.

Definition at line 16 of file RPCEventSummary.cc.

References doEndcapCertification_, enableReportSummary_, eventInfoPath_, FEDRange_, edm::ParameterSet::getUntrackedParameter(), globalFolder_, minimumEvents_, numberDisk_, NumberOfFeds_, offlineDQM_, prefixFolder_, prescaleFactor_, and AlCaHLTBitMon_QueryRunRegistry::string.

16  {
17  edm::LogVerbatim ("rpceventsummary") << "[RPCEventSummary]: Constructor";
18 
19  enableReportSummary_ = ps.getUntrackedParameter<bool>("EnableSummaryReport",true);
20  prescaleFactor_ = ps.getUntrackedParameter<int>("PrescaleFactor", 1);
21  eventInfoPath_ = ps.getUntrackedParameter<std::string>("EventInfoPath", "RPC/EventInfo");
22 
23 
24  std::string subsystemFolder = ps.getUntrackedParameter<std::string>("RPCFolder", "RPC");
25  std::string recHitTypeFolder = ps.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
26  std::string summaryFolder = ps.getUntrackedParameter<std::string>("SummaryFolder", "SummaryHistograms");
27 
28  globalFolder_ = subsystemFolder +"/"+ recHitTypeFolder +"/"+ summaryFolder ;
29  prefixFolder_ = subsystemFolder +"/"+ recHitTypeFolder ;
30 
31  minimumEvents_= ps.getUntrackedParameter<int>("MinimumRPCEvents", 10000);
32  numberDisk_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
33  doEndcapCertification_ = ps.getUntrackedParameter<bool>("EnableEndcapSummary", false);
34 
35  FEDRange_.first = ps.getUntrackedParameter<unsigned int>("MinimumRPCFEDId", 790);
36  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumRPCFEDId", 792);
37 
38  NumberOfFeds_ =FEDRange_.second - FEDRange_.first +1;
39 
40  offlineDQM_ = ps.getUntrackedParameter<bool> ("OfflineDQM",true);
41 
42 
43 }
std::string eventInfoPath_
T getUntrackedParameter(std::string const &, T const &) const
std::string globalFolder_
std::pair< int, int > FEDRange_
std::string prefixFolder_
RPCEventSummary::~RPCEventSummary ( )
virtual

Destructor.

Definition at line 45 of file RPCEventSummary.cc.

References dbe_.

45  {
46  edm::LogVerbatim ("rpceventsummary") << "[RPCEventSummary]: Destructor ";
47  dbe_=0;
48 }

Member Function Documentation

void RPCEventSummary::analyze ( const edm::Event iEvent,
const edm::EventSetup c 
)
virtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 187 of file RPCEventSummary.cc.

187 {}
void RPCEventSummary::beginJob ( void  )
virtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 50 of file RPCEventSummary.cc.

References dbe_, and cppFunctionSkipper::operator.

50  {
51  edm::LogVerbatim ("rpceventsummary") << "[RPCEventSummary]: Begin job ";
53 }
void RPCEventSummary::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
virtual

Begin Lumi block.

Reimplemented from edm::EDAnalyzer.

Definition at line 185 of file RPCEventSummary.cc.

185 {}
void RPCEventSummary::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file RPCEventSummary.cc.

References DQMStore::book2D(), DQMStore::bookFloat(), dbe_, eventInfoPath_, f, FEDRange_, MonitorElement::Fill(), edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), archive::flag, edm::EventSetup::get(), DQMStore::get(), MonitorElement::getName(), i, init_, j, lumiCounter_, numberDisk_, prescaleFactor_, DQMStore::removeElement(), MonitorElement::setBinContent(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

55  {
56  edm::LogVerbatim ("rpceventsummary") << "[RPCEventSummary]: Begin run";
57 
58  init_ = false;
60 
62 
63  int defaultValue = 1;
64 
65  if(0 != setup.find( recordKey ) ) {
66  defaultValue = -1;
67  //get fed summary information
69  setup.get<RunInfoRcd>().get(sumFED);
70  std::vector<int> FedsInIds= sumFED->m_fed_in;
71  unsigned int f = 0;
72  bool flag = false;
73  while(!flag && f < FedsInIds.size()) {
74  int fedID=FedsInIds[f];
75  //make sure fed id is in allowed range
76  if(fedID>=FEDRange_.first && fedID<=FEDRange_.second) {
77  defaultValue = 1;
78  flag = true;
79  }
80  f++;
81  }
82  }
83 
84 
85  MonitorElement* me;
87 
88  //a global summary float [0,1] providing a global summary of the status
89  //and showing the goodness of the data taken by the the sub-system
90  std::string histoName="reportSummary";
91  me =0;
92  me = dbe_->get(eventInfoPath_ +"/"+ histoName);
93  if ( 0!=me) {
94  dbe_->removeElement(me->getName());
95  }
96 
97  me = dbe_->bookFloat(histoName);
98  me->Fill(defaultValue);
99 
100  //TH2F ME providing a mapof values[0-1] to show if problems are localized or distributed
101  me =0;
102  me = dbe_->get(eventInfoPath_ +"/reportSummaryMap");
103  if ( 0!=me) {
104  dbe_->removeElement(me->getName());
105  }
106 
107  me = dbe_->book2D("reportSummaryMap", "RPC Report Summary Map", 15, -7.5, 7.5, 12, 0.5 ,12.5);
108 
109  //customize the 2d histo
110  std::stringstream BinLabel;
111  for (int i= 1 ; i<=15; i++){
112  BinLabel.str("");
113  if(i<13){
114  BinLabel<<"Sec"<<i;
115  me->setBinLabel(i,BinLabel.str(),2);
116  }
117 
118  BinLabel.str("");
119  if(i<5)
120  BinLabel<<"Disk"<<i-5;
121  else if(i>11)
122  BinLabel<<"Disk"<<i-11;
123  else if(i==11 || i==5)
124  BinLabel.str("");
125  else
126  BinLabel<<"Wheel"<<i-8;
127 
128  me->setBinLabel(i,BinLabel.str(),1);
129  }
130 
131  //fill the histo with "1" --- just for the moment
132  for(int i=1; i<=15; i++){
133  for (int j=1; j<=12; j++ ){
134  if(i==5 || i==11 || (j>6 && (i<6 || i>10)))
135  me->setBinContent(i,j,-1);//bins that not correspond to subdetector parts
136  else
137  me->setBinContent(i,j,defaultValue);
138  }
139  }
140 
141  if(numberDisk_ < 4)
142  for (int j=1; j<=12; j++ ){
143  me->setBinContent(1,j,-1);//bins that not correspond to subdetector parts
144  me->setBinContent(15,j,-1);
145  }
146 
147  //the reportSummaryContents folder containins a collection of ME floats [0-1] (order of 5-10)
148  // which describe the behavior of the respective subsystem sub-components.
149  dbe_->setCurrentFolder(eventInfoPath_+ "/reportSummaryContents");
150 
151  std::stringstream segName;
152  std::vector<std::string> segmentNames;
153  for(int i=-4; i<=4; i++){
154  if(i>-3 && i<3) {
155  segName.str("");
156  segName<<"RPC_Wheel"<<i;
157  segmentNames.push_back(segName.str());
158  }
159  if(i==0) continue;
160  segName.str("");
161  segName<<"RPC_Disk"<<i;
162  segmentNames.push_back(segName.str());
163  }
164 
165 
166  for(unsigned int i=0; i<segmentNames.size(); i++){
167  me =0;
168  me = dbe_->get(eventInfoPath_ + "/reportSummaryContents/" +segmentNames[i]);
169  if ( 0!=me) {
170  dbe_->removeElement(me->getName());
171  }
172  me = dbe_->bookFloat(segmentNames[i]);
173  me->Fill(defaultValue);
174  }
175 
176  //excluded endcap parts
177  if(numberDisk_ < 4){
178  me=dbe_->get(eventInfoPath_ + "/reportSummaryContents/RPC_Disk4");
179  if(me) me->Fill(-1);
180  me=dbe_->get(eventInfoPath_ + "/reportSummaryContents/RPC_Disk-4");
181  if(me) me->Fill(-1);
182  }
183 }
std::string eventInfoPath_
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:891
void Fill(long long x)
void removeElement(const std::string &name)
Definition: DQMStore.cc:3143
int j
Definition: DBlmapReader.cc:9
double f[11][100]
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
std::pair< int, int > FEDRange_
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1082
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:125
void RPCEventSummary::clientOperation ( )
private

Definition at line 211 of file RPCEventSummary.cc.

References dbe_, DEAD, doEndcapCertification_, eventInfoPath_, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), globalFolder_, i, init_, minimumEvents_, numberDisk_, PARTIALLY_DEAD, prefixFolder_, alignCSCRings::r, RPCEvents, alignCSCRings::s, MonitorElement::setBinContent(), w(), and detailsBasic3DVector::y.

Referenced by endLuminosityBlock(), and endRun().

211  {
212 
213  float rpcevents = minimumEvents_;
214  RPCEvents = dbe_->get( prefixFolder_ +"/RPCEvents");
215 
216  if(RPCEvents) {
217  rpcevents = RPCEvents ->getBinContent(1);
218  }
219 
220 
221  if(rpcevents < minimumEvents_) return;
222  init_ = true;
223  std::stringstream meName;
224  MonitorElement * myMe;
225 
226  meName.str("");
227  meName<<eventInfoPath_ + "/reportSummaryMap";
228  MonitorElement * reportMe = dbe_->get(meName.str());
229 
230  MonitorElement * globalMe;
231 
232  //BARREL
233  float barrelFactor = 0;
234 
235  for(int w = -2 ; w<3; w++){
236 
237  meName.str("");
238  meName<<globalFolder_<<"/RPCChamberQuality_Roll_vs_Sector_Wheel"<<w;
239  myMe = dbe_->get(meName.str());
240 
241  if(myMe){
242  float wheelFactor = 0;
243 
244  for(int s = 1; s<=myMe->getNbinsX() ; s++){
245  float sectorFactor = 0;
246  int rollInSector = 0;
247 
248 
249  for(int r = 1;r<=myMe->getNbinsY(); r++){
250  if((s!=4 && r > 17 ) || ((s ==9 ||s ==10) && r >15 ) ) continue;
251  rollInSector++;
252 
253 
254  if(myMe->getBinContent(s,r) == PARTIALLY_DEAD) sectorFactor+=0.8;
255  else if(myMe->getBinContent(s,r) == DEAD )sectorFactor+=0;
256  else sectorFactor+=1;
257 
258  }
259  if(rollInSector!=0)
260  sectorFactor = sectorFactor/rollInSector;
261 
262  if(reportMe) reportMe->setBinContent(w+8, s, sectorFactor);
263  wheelFactor += sectorFactor;
264 
265  }//end loop on sectors
266 
267  wheelFactor = wheelFactor/myMe->getNbinsX();
268 
269  meName.str("");
270  meName<<eventInfoPath_ + "/reportSummaryContents/RPC_Wheel"<<w;
271  globalMe=dbe_->get(meName.str());
272  if(globalMe) globalMe->Fill(wheelFactor);
273 
274  barrelFactor += wheelFactor;
275  }//
276  }//end loop on wheel
277 
278  barrelFactor = barrelFactor/5;
279 
280 
281  float endcapFactor = 0;
282 
284 
285  //Endcap
286  for(int d = -numberDisk_ ; d<= numberDisk_; d++){
287  if (d==0) continue;
288 
289  meName.str("");
290  meName<<globalFolder_<<"/RPCChamberQuality_Ring_vs_Segment_Disk"<<d;
291  myMe = dbe_->get(meName.str());
292 
293  if(myMe){
294  float diskFactor = 0;
295 
296  float sectorFactor[6]= {0,0,0,0,0,0};
297 
298  for (int i = 0 ;i <6;i++){
299  int firstSeg = (i *6 )+1;
300  int lastSeg = firstSeg +6;
301  int rollInSector = 0;
302  for(int seg = firstSeg; seg< lastSeg ; seg++){
303 
304  for(int y = 1;y<=myMe->getNbinsY(); y++){
305  rollInSector++;
306  if(myMe->getBinContent(seg,y) == PARTIALLY_DEAD) sectorFactor[i]+=0.8;
307  else if(myMe->getBinContent(seg,y) == DEAD )sectorFactor[i]+=0;
308  else sectorFactor[i]+=1;
309 
310  }
311  }
312  sectorFactor[i] = sectorFactor[i]/rollInSector;
313  }//end loop on Sectors
314 
315 
316  for (int sec = 0 ; sec<6; sec++){
317  diskFactor += sectorFactor[sec];
318  if(reportMe) {
319  if (d<0) reportMe->setBinContent(d+5, sec+1 , sectorFactor[sec]);
320  else reportMe->setBinContent(d+11, sec+1 , sectorFactor[sec]);
321  }
322  }
323 
324  diskFactor = diskFactor/6;
325 
326  meName.str("");
327  meName<<eventInfoPath_ + "/reportSummaryContents/RPC_Disk"<<d;
328  globalMe=dbe_->get(meName.str());
329  if(globalMe) globalMe->Fill(diskFactor);
330 
331  endcapFactor += diskFactor;
332  }//end loop on disks
333 
334  }
335 
336  endcapFactor=endcapFactor/ (numberDisk_ * 2);
337 
338  }
339 
340  //Fill repor summary
341  float rpcFactor = barrelFactor;
342  if(doEndcapCertification_){ rpcFactor = ( barrelFactor + endcapFactor)/2; }
343 
344  globalMe = dbe_->get(eventInfoPath_ +"/reportSummary");
345  if(globalMe) globalMe->Fill(rpcFactor);
346 
347 
348 }
std::string eventInfoPath_
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
int getNbinsY(void) const
get # of bins in Y-axis
void Fill(long long x)
std::string globalFolder_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
MonitorElement * RPCEvents
double getBinContent(int binx) const
get content of bin (1-D)
std::string prefixFolder_
int getNbinsX(void) const
get # of bins in X-axis
T w() const
void RPCEventSummary::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
virtual

End Lumi Block.

Reimplemented from edm::EDAnalyzer.

Definition at line 189 of file RPCEventSummary.cc.

References clientOperation(), init_, lumiCounter_, offlineDQM_, and prescaleFactor_.

189  {
190  edm::LogVerbatim ("rpceventsummary") <<"[RPCEventSummary]: End of LS transition, performing DQM client operation";
191 
192  if(offlineDQM_) return;
193 
194  if(!init_){
195  this->clientOperation();
196  return;
197  }
198 
199  lumiCounter_++;
200  if(lumiCounter_%prescaleFactor_ != 0) return;
201 
202  this->clientOperation();
203 
204 }
void RPCEventSummary::endRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 206 of file RPCEventSummary.cc.

References clientOperation().

206  {
207 
208  this->clientOperation();
209 }

Member Data Documentation

DQMStore* RPCEventSummary::dbe_
private

Definition at line 51 of file RPCEventSummary.h.

Referenced by beginJob(), beginRun(), clientOperation(), and ~RPCEventSummary().

bool RPCEventSummary::doEndcapCertification_
private

Definition at line 57 of file RPCEventSummary.h.

Referenced by clientOperation(), and RPCEventSummary().

bool RPCEventSummary::enableReportSummary_
private

Definition at line 47 of file RPCEventSummary.h.

Referenced by RPCEventSummary().

std::string RPCEventSummary::eventInfoPath_
private

Definition at line 44 of file RPCEventSummary.h.

Referenced by beginRun(), clientOperation(), and RPCEventSummary().

std::pair<int, int> RPCEventSummary::FEDRange_
private

Definition at line 58 of file RPCEventSummary.h.

Referenced by beginRun(), and RPCEventSummary().

std::string RPCEventSummary::globalFolder_
private

Definition at line 54 of file RPCEventSummary.h.

Referenced by clientOperation(), and RPCEventSummary().

bool RPCEventSummary::init_
private

Definition at line 50 of file RPCEventSummary.h.

Referenced by beginRun(), clientOperation(), and endLuminosityBlock().

int RPCEventSummary::lumiCounter_
private

Definition at line 53 of file RPCEventSummary.h.

Referenced by beginRun(), and endLuminosityBlock().

int RPCEventSummary::minimumEvents_
private

Definition at line 48 of file RPCEventSummary.h.

Referenced by clientOperation(), and RPCEventSummary().

int RPCEventSummary::numberDisk_
private

Definition at line 56 of file RPCEventSummary.h.

Referenced by beginRun(), clientOperation(), and RPCEventSummary().

int RPCEventSummary::NumberOfFeds_
private

Definition at line 59 of file RPCEventSummary.h.

Referenced by RPCEventSummary().

bool RPCEventSummary::offlineDQM_
private

Definition at line 52 of file RPCEventSummary.h.

Referenced by endLuminosityBlock(), and RPCEventSummary().

std::string RPCEventSummary::prefixDir_
private

Definition at line 44 of file RPCEventSummary.h.

std::string RPCEventSummary::prefixFolder_
private

Definition at line 54 of file RPCEventSummary.h.

Referenced by clientOperation(), and RPCEventSummary().

int RPCEventSummary::prescaleFactor_
private

Definition at line 48 of file RPCEventSummary.h.

Referenced by beginRun(), endLuminosityBlock(), and RPCEventSummary().

MonitorElement* RPCEventSummary::RPCEvents
private

Definition at line 49 of file RPCEventSummary.h.

Referenced by clientOperation().