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 Member Functions | Private Attributes
HLTMonBitSummary Class Reference

#include <HLTMonBitSummary.h>

Inheritance diagram for HLTMonBitSummary:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HLTMonBitSummary (const edm::ParameterSet &)
 
 ~HLTMonBitSummary ()
 
- 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 Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &r, const edm::EventSetup &)
 
virtual void configSelector (const std::vector< std::string > &selectTriggers, std::vector< std::string > &theSelectTriggers)
 
virtual void endJob ()
 

Private Attributes

bool configFlag_
 
std::vector< unsigned int > count_
 
DQMStoredbe_
 
std::string denominator_
 
std::string denominatorWild_
 
std::string directory_
 
std::vector< std::string > dummyFilters_
 
std::string esPathsKey_
 
bool filterFlag_
 
std::vector< std::string > filterTypes_
 
MonitorElementh1_
 
MonitorElementh2_
 
std::string histLabel_
 
bool hltchange_
 
HLTConfigProvider hltConfig_
 
std::vector< std::string > HLTPathDenomName_
 
std::vector< std::string > HLTPathDenomNamePreVal_
 
std::vector< std::string > HLTPathNamesConfig_
 
std::vector< std::string > HLTPathNamesConfigPreVal_
 
std::vector< std::string > HLTPathNamesKey_
 
std::vector< unsigned int > HLTPathsByIndex_
 
std::vector< std::string > HLTPathsByName_
 
std::vector< MonitorElement * > hSubFilterCount
 
std::vector< MonitorElement * > hSubFilterEff
 
edm::InputTag inputTag_
 
edm::EDGetTokenT
< edm::TriggerResults
inputToken_
 
unsigned int ndenomAccept_
 
unsigned int nValidConfigTriggers_
 
unsigned int nValidTriggers_
 
MonitorElementpf_
 
MonitorElementratio_
 
unsigned int total_
 
std::vector< std::vector< uint > > triggerFilterIndices_
 
std::vector< std::vector
< std::string > > 
triggerFilters_
 

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 29 of file HLTMonBitSummary.h.

Constructor & Destructor Documentation

HLTMonBitSummary::HLTMonBitSummary ( const edm::ParameterSet iConfig)
explicit

Definition at line 40 of file HLTMonBitSummary.cc.

References configFlag_, dbe_, denominator_, denominatorWild_, directory_, dummyFilters_, esPathsKey_, filterFlag_, filterTypes_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), histLabel_, hltchange_, inputToken_, NULL, cppFunctionSkipper::operator, DQMStore::setVerbose(), and AlCaHLTBitMon_QueryRunRegistry::string.

40  :
41  inputTag_ (iConfig.getParameter<edm::InputTag> ("TriggerResultsTag")),
42  HLTPathNamesConfigPreVal_(iConfig.getParameter<std::vector<std::string > >("HLTPaths")),
43  total_(0),
44  nValidTriggers_(0),
46  ndenomAccept_(0)
47 {
48  denominatorWild_ = iConfig.getUntrackedParameter<std::string>("denominatorWild","");
49  denominator_ = iConfig.getUntrackedParameter<std::string>("denominator");
50  directory_ = iConfig.getUntrackedParameter<std::string>("directory","HLT/Generic/Summary");
51  histLabel_ = iConfig.getUntrackedParameter<std::string>("histLabel","Generic");
52  // out_ = iConfig.getUntrackedParameter<std::string>("out","");
53  dummyFilters_.clear();
54  filterTypes_ = iConfig.getUntrackedParameter<std::vector<std::string > >("filterTypes",dummyFilters_);
55  esPathsKey_ = iConfig.getUntrackedParameter<std::string>("eventSetupPathsKey","");
56 
57  configFlag_ = false;
58  filterFlag_ = false;
59  hltchange_ = false;
60 
61  dbe_ = NULL;
63  dbe_->setVerbose(0);
64 
65  //set Token(-s)
66  inputToken_ = consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag> ("TriggerResultsTag"));
67 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string directory_
std::vector< std::string > dummyFilters_
std::string esPathsKey_
#define NULL
Definition: scimark2.h:8
std::string denominator_
edm::EDGetTokenT< edm::TriggerResults > inputToken_
edm::InputTag inputTag_
unsigned int ndenomAccept_
std::string histLabel_
void setVerbose(unsigned level)
Definition: DQMStore.cc:648
std::vector< std::string > HLTPathNamesConfigPreVal_
std::vector< std::string > filterTypes_
unsigned int nValidTriggers_
unsigned int total_
std::string denominatorWild_
unsigned int nValidConfigTriggers_
HLTMonBitSummary::~HLTMonBitSummary ( )

Definition at line 70 of file HLTMonBitSummary.cc.

70 {}

Member Function Documentation

void HLTMonBitSummary::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 295 of file HLTMonBitSummary.cc.

References plotTTrigFromHistos::binNumber(), configFlag_, count_, denominator_, edm::HandleBase::failedToGet(), MonitorElement::Fill(), filterFlag_, filterTypes_, MonitorElement::getBinContent(), edm::Event::getByToken(), h1_, h2_, HLTPathsByIndex_, HLTPathsByName_, hSubFilterCount, hSubFilterEff, i, inputTag_, inputToken_, align::invalid, j, LogDebug, ndenomAccept_, nValidConfigTriggers_, nValidTriggers_, pf_, ratio_, zeeHLT_cff::report, cmsHarvester::sep, MonitorElement::setBinContent(), MonitorElement::setBinError(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, total_, triggerFilterIndices_, triggerFilters_, edm::TriggerNames::triggerIndex(), and edm::Event::triggerNames().

296 {
297  if(configFlag_) return;
298 
299  total_++;
300  const std::string invalid("@@invalid@@");
301 
302  // get hold of TriggerResults Object
304  iEvent.getByToken(inputToken_, trh);
305 
306  if (trh.failedToGet()) {
307  edm::LogError("HLTMonBitSummary")<<" could not get: "<<inputTag_;
308  return;
309  }
310 
311  // get hold of trigger names - based on TriggerResults object!
312  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*trh);
313 
314  unsigned int lastModule = 0;
315 
316  //std::cout << " Was at least one path run? " << trh->wasrun() << std::endl;;
317  //std::cout << " Has at least one path accepted the event? " << trh->accept() << std::endl;
318  //std::cout << " Has any path encountered an error? " << trh->error() << std::endl;
319  //std::cout << " Number of paths stored = " << trh->size() << std::endl;
320 
321  for (unsigned int trig=0; trig < nValidTriggers_; trig++) {
322  //convert *all* trigger names (from config and key) to trigger index properly
323  HLTPathsByIndex_[trig]=triggerNames.triggerIndex(HLTPathsByName_[trig]);
324  }
325 
326  //get filter information for config triggers only
327  for (unsigned int trig=0; trig < nValidConfigTriggers_; trig++) {
328  //std::cout << "Trigger Name = " << HLTPathNamesConfig_[trig] << ", HLTPathsByIndex_ = " << HLTPathsByIndex_[trig] << std::endl;
329  //std::cout << "Trigger Name = " << HLTPathNamesConfig_[trig] << ", trh->index = " << lastModule << " " << trh->accept(HLTPathsByIndex_[trig]) << std::endl;
330 
331  //check if trigger exists in TriggerResults
332  if(!filterTypes_.empty() && !filterFlag_ && HLTPathsByIndex_[trig] < trh->size()) {
333  lastModule = trh->index(HLTPathsByIndex_[trig]);
334 
335  //go through the list of filters
336  for(unsigned int filt = 0; filt < triggerFilters_[trig].size()-1; filt++){
337  // cout << "triggerFilters_["<<trig<<"]["<<filt+1<<"] = " << triggerFilters_[trig][filt+1]
338  // << " , triggerFilterIndices = " << triggerFilterIndices_[trig][filt+1]
339  // << " , lastModule = " << lastModule << std::endl;
340 
341  int binNumber = hSubFilterCount[trig]->getTH1F()->GetXaxis()->FindBin(triggerFilters_[trig][filt+1].c_str());
342 
343  //check if filter passed
344  if(trh->accept(HLTPathsByIndex_[trig])){
345  hSubFilterCount[trig]->Fill(binNumber-1);//binNumber1 = 0 = first filter
346  }
347  //otherwise the module that issued the decision is the first fail
348  //so that all the ones before it passed
349  else if(triggerFilterIndices_[trig][filt+1] < lastModule){
350  hSubFilterCount[trig]->Fill(binNumber-1);
351  }
352 
353  //hSubFilterCount[trig]->Fill(-1);
354 
355  float eff = (float)hSubFilterCount[trig]->getBinContent(binNumber) / (float)total_ ;
356  float efferr = sqrt(eff*(1-eff)/ (float)total_);
357  hSubFilterEff[trig]->setBinContent(binNumber,eff);
358  hSubFilterEff[trig]->setBinError(binNumber,efferr);
359 
360  }//filt
361  }
362  }
363 
364  //and check validity name (should not be necessary)
365  std::vector<bool> validity(nValidTriggers_);
366  for (unsigned int i=0; i!=nValidTriggers_; i++) {
367  validity[i]=( (HLTPathsByIndex_[i]<trh->size()) && (HLTPathsByName_[i]!=invalid) );
368  }
369 
370 
371  //---------------------B i t P l o t t i n g S e c t i o n --------------------//
372  //---------------------------------------------------------------------------------//
373 
374  //convert also for the denominator and check validity
375  uint denominatorIndex = 0;
376  bool denominatorValidity= false;
377  if (denominator_!="") {
378  denominatorIndex=triggerNames.triggerIndex(denominator_);
379  denominatorValidity= (denominatorIndex <trh->size());
380  }
381 
382  std::stringstream report;
383  std::string sep=" ";
384  bool atLeastOne=false;
385 
386  //check whether the denominator fired
387  bool denomAccept=false;
388  if (ratio_ && denominatorValidity) {
389  denomAccept=trh->accept(denominatorIndex);
390  if(denomAccept) ndenomAccept_++;
391  }
392 
393  for (unsigned int i=0; i!=nValidTriggers_; i++) {
394  if (!validity[i]) continue;
395  bool iAccept=trh->accept(HLTPathsByIndex_[i]);
396  if (iAccept) {
397  report<<sep<<HLTPathsByName_[i];
398  count_[i]++;
399  sep=", ";
400  atLeastOne=true;
401  //trigger has fired. make an entry in both 1D and profile plots
402  h1_->Fill(i);
403  //make the entry in the 2D plot : UPPER diagonal terms = AND of the two triggers
404  for (unsigned int j=i; j!=nValidTriggers_; j++) {
405  if (!validity[j]) continue;
406  if (trh->accept(HLTPathsByIndex_[j]))
407  h2_->Fill(i,j);
408  }//loop on second trigger for AND terms
409  }//trigger[i]=true
410 
411  float pf_eff = (float)h1_->getBinContent(i+1) / (float)total_ ;
412  float pf_efferr = sqrt(pf_eff*(1-pf_eff) / (float)total_);
413  pf_->setBinContent(i+1,pf_eff);
414  pf_->setBinError(i+1,pf_efferr);
415 
416  //make proper entries in the ratio plot
417  if (ratio_ && denomAccept){
418  float ratio_eff = (float)h1_->getBinContent(i+1) / (float)ndenomAccept_ ;
419  float ratio_efferr = sqrt(ratio_eff*(1-ratio_eff) / (float)ndenomAccept_);
420  ratio_->setBinContent(i+1,ratio_eff);
421  ratio_->setBinError(i+1,ratio_efferr);
422  }
423 
424 
425  //make proper entry inthe 2D plot: LOWER diagonal terms = OR of the two triggers
426  for (unsigned int j=0; j!=i; j++) {
427  if (!validity[j]) continue;
428  bool jAccept=trh->accept(HLTPathsByIndex_[j]);
429  if (iAccept || jAccept)
430  h2_->Fill(i,j);
431  }//loop on second trigger for OR terms
432 
433  }//loop on first trigger
434 
435  if (atLeastOne){
436  LogDebug("BitPlotting|BitReport")<<report.str();
437  }
438 
439  // edm::LogError("BitPlotting")<<"# entries:"<<h1_->getTH1F()->GetEntries();
440 
441  //-----------------E n d o f B i t P l o t t i n g S e c t i o n-----------------//
442 
443 }
#define LogDebug(id)
std::vector< MonitorElement * > hSubFilterCount
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
std::vector< MonitorElement * > hSubFilterEff
void setBinContent(int binx, double content)
set content of bin (1-D)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::string denominator_
edm::EDGetTokenT< edm::TriggerResults > inputToken_
edm::InputTag inputTag_
void Fill(long long x)
unsigned int ndenomAccept_
tuple report
Definition: zeeHLT_cff.py:9
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
std::vector< unsigned int > HLTPathsByIndex_
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
std::vector< std::vector< uint > > triggerFilterIndices_
bool failedToGet() const
Definition: HandleBase.h:80
std::vector< unsigned int > count_
MonitorElement * ratio_
double getBinContent(int binx) const
get content of bin (1-D)
std::vector< std::string > filterTypes_
MonitorElement * h2_
unsigned int nValidTriggers_
std::vector< std::string > HLTPathsByName_
MonitorElement * pf_
unsigned int total_
MonitorElement * h1_
unsigned int nValidConfigTriggers_
std::vector< std::vector< std::string > > triggerFilters_
void HLTMonBitSummary::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 444 of file HLTMonBitSummary.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe_, denominator_, directory_, h1_, h2_, histLabel_, bookConverter::max, min(), pf_, ratio_, and DQMStore::setCurrentFolder().

444  {
445 
446  if(dbe_){
447  if (directory_ != "" && directory_.substr(directory_.length()-1,1) != "/" ) directory_ = directory_+"/" ;
448 
449  float min = -0.5;
450  float max = 400-0.5;
451  //uint nBin = HLTPathsByName_.size();
452  uint nBin = 400;
453 
455 
456  h1_ = dbe_->book1D("PassingBits_Summary_"+histLabel_,"PassingBits_Summary_"+histLabel_, nBin, min, max);
457  h2_ = dbe_->book2D("PassingBits_Correlation_"+histLabel_,"PassingBits_Correlation_"+histLabel_,nBin,min,max, nBin,min,max);
458  pf_ = dbe_->book1D("Efficiency_Summary_"+histLabel_,"Efficiency_Summary_"+histLabel_, nBin, min, max);
459  if (denominator_!="")
460  //ratio_ = dbe_->book1D(std::string("Ratio_"+denominator_),std::string("Ratio_"+denominator_),nBin,min,max);
461  ratio_ = dbe_->book1D("HLTRate_"+histLabel_,"HLTRate_"+histLabel_,nBin,min,max);
462  else
463  ratio_=0;
464 
465  }
466 
467 }
std::string directory_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:971
std::string denominator_
std::string histLabel_
T min(T a, T b)
Definition: MathUtil.h:58
MonitorElement * ratio_
MonitorElement * h2_
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:1099
MonitorElement * pf_
MonitorElement * h1_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:684
void HLTMonBitSummary::beginRun ( const edm::Run r,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file HLTMonBitSummary.cc.

References DQMStore::book1D(), configFlag_, configSelector(), count_, dbe_, denominator_, denominatorWild_, directory_, esPathsKey_, edm::hlt::Exception, filterFlag_, filterTypes_, edm::EventSetup::get(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), h1_, h2_, hltchange_, hltConfig_, HLTPathDenomName_, HLTPathDenomNamePreVal_, HLTPathNamesConfig_, HLTPathNamesConfigPreVal_, HLTPathNamesKey_, HLTPathsByIndex_, HLTPathsByName_, hSubFilterCount, hSubFilterEff, i, HLTConfigProvider::init(), inputTag_, j, roll_playback::k, LogDebug, HLTConfigProvider::moduleIndex(), HLTConfigProvider::moduleLabels(), edm::moduleName(), HLTConfigProvider::moduleType(), nValidConfigTriggers_, nValidTriggers_, pf_, edm::InputTag::process(), ratio_, edm::RunBase::run(), DQMStore::setCurrentFolder(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, total_, triggerFilterIndices_, and triggerFilters_.

76  {
77 
78  //initialize the hlt configuration from the process name if not blank
79  std::string processName = inputTag_.process();
80  if (processName != ""){
81 
82  //Grab paths from EventSetup via AlCaRecoTriggerBitsRcd if configured - copied from HLTHighLevel
83  if (esPathsKey_.size()) {
84  // Get map of strings to concatenated list of names of HLT paths from EventSetup:
86  iSetup.get<AlCaRecoTriggerBitsRcd>().get(triggerBits);
87  typedef std::map<std::string, std::string> TriggerMap;
88  const TriggerMap &triggerMap = triggerBits->m_alcarecoToTrig;
89 
90  TriggerMap::const_iterator listIter = triggerMap.find(esPathsKey_);
91 
92  if (listIter == triggerMap.end()) {
93  throw cms::Exception("Configuration")
94  //<< " HLTHighLevel [instance: " << *moduleLabel() << " - path: " << *pathName()
95  //<< "]: "
96  <<" No triggerList with key " << esPathsKey_ << " in AlCaRecoTriggerBitsRcd";
97  }
98 
99  // We must avoid a std::map<std::stringvector<std::string> > in DB for performance reason,
100  // so the paths are mapped into one string that we have to decompose:
101  HLTPathNamesKey_ = triggerBits->decompose(listIter->second);
102  }
103 
104  bool initOK = false;
105  initOK = hltConfig_.init(r, iSetup, processName, hltchange_);
106  //Otherwise read paths from configuration
107  HLTPathNamesConfig_.clear();
108  if(HLTPathNamesConfigPreVal_.size()){
109  //run trigger config selection
110  if (initOK) {
112  }
113  else{
114  edm::LogError("HLTMonBitSummary") << "HLTConfigProvider initialization with process name "
115  << processName << " failed." << std::endl;
116  }
117  }
118 
119  //check if the two vectors have any common elements
120  std::vector<int> removePaths;
121  for(size_t i=0; i<HLTPathNamesKey_.size(); ++i){
122  for(size_t j=0; j<HLTPathNamesConfig_.size(); ++j){
123  if(HLTPathNamesConfig_[j] == HLTPathNamesKey_[i]) removePaths.push_back(i);
124  }
125  }
126  reverse(removePaths.begin(),removePaths.end());
127  if(removePaths.size()){
128  for(unsigned int k=0; k<removePaths.size(); ++k)
129  HLTPathNamesKey_.erase(HLTPathNamesKey_.begin()+removePaths[k]);
130  }
131 
132 
133  //combine two vectors
134  HLTPathsByName_.clear();
135  HLTPathsByName_.reserve(HLTPathNamesConfig_.size() + HLTPathNamesKey_.size());
138 
139  count_.resize(HLTPathsByName_.size());
140  HLTPathsByIndex_.resize(HLTPathsByName_.size());
141 
142 
143  if( (nValidTriggers_ != HLTPathsByName_.size() || hltchange_) && total_!=0 ){
144  edm::LogWarning("HLTMonBitSummary") << "A change in the HLT configuration has been found."
145  << std::endl
146  << "BitSummary histograms do not support changing configurations."
147  << std::endl
148  << "Processing of events halted.";
149  configFlag_ = true;
150  }
151 
152  if(!configFlag_){
153 
156 
157  //get all the filters -
158  //only if filterTypes_ is nonempty and only on HLTPathNamesConfig_ paths
159  if(initOK){
160  if(!filterTypes_.empty()){
161  triggerFilters_.clear();
162  triggerFilterIndices_.clear();
163  for( size_t i = 0; i < nValidConfigTriggers_; i++) {
164  // create a row [triggername,filter1name, filter2name, etc.]
165  triggerFilters_.push_back(std::vector <std::string>());
166  // create a row [0, filter1index, filter2index, etc.]
167  triggerFilterIndices_.push_back(std::vector <uint>());
168 
169  std::vector<std::string> moduleNames = hltConfig_.moduleLabels( HLTPathNamesConfig_[i] );
170 
171  triggerFilters_[i].push_back(HLTPathNamesConfig_[i]);//first entry is trigger name
172  triggerFilterIndices_[i].push_back(0);
173 
174  int numModule = 0, numFilters = 0;
175  std::string moduleName, moduleType;
176  unsigned int moduleIndex;
177 
178  //print module name
179  std::vector<std::string>::const_iterator iDumpModName;
180  for (iDumpModName = moduleNames.begin();iDumpModName != moduleNames.end();iDumpModName++) {
181  moduleName = *iDumpModName;
182  moduleType = hltConfig_.moduleType(moduleName);
183  moduleIndex = hltConfig_.moduleIndex(HLTPathNamesConfig_[i], moduleName);
184  LogDebug ("HLTMonBitSummary") << "Module" << numModule
185  << " is called " << moduleName
186  << " , type = " << moduleType
187  << " , index = " << moduleIndex
188  << std::endl;
189  numModule++;
190  for(size_t k = 0; k < filterTypes_.size(); k++) {
191  if(moduleType == filterTypes_[k]) {
192  numFilters++;
193  triggerFilters_[i].push_back(moduleName);
194  triggerFilterIndices_[i].push_back(moduleIndex);
195  }
196  }
197  }//end for modulesName
198  }//end for nValidConfigTriggers_
199  }
200  }
201  else{
202  edm::LogError("HLTMonBitSummary") << "HLTConfigProvider initialization has failed."
203  << " Could not get filter names." << std::endl;
204  filterFlag_ = true;
205  }
206 
207  //check denominator
208  HLTPathDenomName_.clear();
209  HLTPathDenomNamePreVal_.clear();
210  if( denominatorWild_.size() != 0 ) HLTPathDenomNamePreVal_.push_back(denominatorWild_);
211  if(initOK){
213  }
214  //HLTriggerSelector denomSelect(r, iSetup, inputTag_,HLTPathDenomName_);
215  //HLTPathDenomName_.swap(denomSelect.theSelectTriggers);
216  //for (unsigned int i = 0; i < HLTPathDenomName_.size(); i++)
217  // std::cout << "testing denom: " << HLTPathDenomName_[i] << std::endl;
219  }
220  }//end if process
221 
222 
223  if(dbe_ && !configFlag_){
224 
225  int nbin = nValidConfigTriggers_;
226 
228 
229  //int nbin_sub = 5;
230  int nbin_sub = 8;
231 
232  // Count histos for efficiency plots
233  if(!filterTypes_.empty() && !filterFlag_){
234  dbe_->setCurrentFolder(directory_ + "Trigger_Filters/");
235  //hCountSummary = dbe_->book1D("hCountSummary", "Count Summary", nbin+1, -0.5, 0.5+(double)nbin);
236 
237  hSubFilterCount.clear();
238  hSubFilterEff.clear();
239 
240  for( int trig = 0; trig < nbin; trig++ ) {
241  // count plots for subfilter
242  //hSubFilterCount[trig] = dbe_->book1D("Filters_" + triggerFilters_[trig][0],
243  hSubFilterCount.push_back(dbe_->book1D("Filters_" + triggerFilters_[trig][0],
244  "Filters_" + triggerFilters_[trig][0],
245  nbin_sub+1, -0.5, 0.5+(double)nbin_sub));
246 
247  for(int filt = 0; filt < (int)triggerFilters_[trig].size()-1; filt++){
248  hSubFilterCount[trig]->setBinLabel(filt+1, triggerFilters_[trig][filt+1]);
249  }
250  }
251 
252  dbe_->setCurrentFolder(directory_ + "Trigger_Efficiencies/");
253  for( int trig = 0; trig < nbin; trig++ ) {
254  //hSubFilterEff[trig] = dbe_->book1D("Efficiency_" + triggerFilters_[trig][0],
255  hSubFilterEff.push_back(dbe_->book1D("Efficiency_" + triggerFilters_[trig][0],
256  "Efficiency_" + triggerFilters_[trig][0],
257  nbin_sub+1, -0.5, 0.5+(double)nbin_sub));
258 
259  for(int filt = 0; filt < (int)triggerFilters_[trig].size()-1; filt++){
260  hSubFilterEff[trig]->setBinLabel(filt+1,triggerFilters_[trig][filt+1]);
261  }
262  }
263  }
264 
265  //--------------B i t P l o t t i n g s e c t i o n ---------------//
266  //---------------------------------------------------------------------//
267 
268  std::stringstream rNs;
269  rNs<<r.run();
270  std::string rN = rNs.str();
271  LogDebug("HLTMonBitSummary")<<"this is the beginning of a NEW run: "<< r.run();
272 
273  //h1_->Reset();
274  // h2_->Reset();
275  //pf_->Reset();
276  //if (ratio_) ratio_->Reset();
277 
278  for (uint i=0; i < nValidTriggers_ && i < 400 ; ++i){
279  h1_->getTH1F()->GetXaxis()->SetBinLabel(i+1,HLTPathsByName_[i].c_str());
280  h2_->getTH2F()->GetXaxis()->SetBinLabel(i+1,HLTPathsByName_[i].c_str());
281  h2_->getTH2F()->GetYaxis()->SetBinLabel(i+1,HLTPathsByName_[i].c_str());
282  pf_->getTH1F()->GetXaxis()->SetBinLabel(i+1,HLTPathsByName_[i].c_str());
283  if (ratio_)
284  ratio_->getTH1F()->GetXaxis()->SetBinLabel(i+1,(HLTPathsByName_[i]+" & "+denominator_).c_str());
285  }
286 
287  //------------------------End Of BitPlotting section -------------------------//
288  }
289 
290 }
#define LogDebug(id)
std::vector< MonitorElement * > hSubFilterCount
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > HLTPathNamesConfig_
HLTConfigProvider hltConfig_
std::vector< MonitorElement * > hSubFilterEff
const std::string moduleType(const std::string &module) const
C++ class name of module.
std::string directory_
RunNumber_t run() const
Definition: RunBase.h:42
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:971
std::vector< std::string > HLTPathNamesKey_
std::string esPathsKey_
std::string denominator_
edm::InputTag inputTag_
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
unsigned int moduleIndex(unsigned int trigger, const std::string &module) const
slot position of module on trigger path (0 to size-1)
std::vector< unsigned int > HLTPathsByIndex_
int j
Definition: DBlmapReader.cc:9
std::vector< std::string > HLTPathDenomName_
std::vector< std::vector< uint > > triggerFilterIndices_
virtual void configSelector(const std::vector< std::string > &selectTriggers, std::vector< std::string > &theSelectTriggers)
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< unsigned int > count_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const T & get() const
Definition: EventSetup.h:55
TH1F * getTH1F(void) const
std::vector< std::string > HLTPathNamesConfigPreVal_
MonitorElement * ratio_
std::string const & process() const
Definition: InputTag.h:46
std::vector< std::string > filterTypes_
MonitorElement * h2_
std::vector< std::string > HLTPathDenomNamePreVal_
unsigned int nValidTriggers_
std::vector< std::string > HLTPathsByName_
TH2F * getTH2F(void) const
MonitorElement * pf_
unsigned int total_
tuple size
Write out results.
MonitorElement * h1_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:684
std::string denominatorWild_
unsigned int nValidConfigTriggers_
std::vector< std::vector< std::string > > triggerFilters_
void HLTMonBitSummary::configSelector ( const std::vector< std::string > &  selectTriggers,
std::vector< std::string > &  theSelectTriggers 
)
privatevirtual

Definition at line 489 of file HLTMonBitSummary.cc.

References spr::find(), hltConfig_, i, j, and HLTConfigProvider::triggerNames().

Referenced by beginRun().

489  {
490  //get the configuration
491  std::vector<std::string> validTriggerNames = hltConfig_.triggerNames();
492 
493  bool goodToGo = false;
494  //remove all path names that are not valid
495  while(!goodToGo && selectTriggers.size()!=0){
496  goodToGo=true;
497  for ( auto j=selectTriggers.begin();j!=selectTriggers.end();++j){
498  //bool goodOne = false;
499  //check if trigger name is valid
500  //use of wildcard
501  TPRegexp wildCard(*j);
502  //std::cout << "wildCard.GetPattern() = " << wildCard.GetPattern() << std::endl;
503  for (unsigned int i = 0; i != validTriggerNames.size(); ++i){
504  if (TString(validTriggerNames[i]).Contains(wildCard)){
505  //goodOne = true;
506  if (find(theSelectTriggers.begin(),
507  theSelectTriggers.end(),
508  validTriggerNames[i])==theSelectTriggers.end()){
509  //std::cout << "wildcard trigger = " << validTriggerNames[i] << std::endl;
510  theSelectTriggers.push_back( validTriggerNames[i] ); //add it after duplicate check.
511  }
512  }
513  }
514  }
515  }//while
516 }
int i
Definition: DBlmapReader.cc:9
HLTConfigProvider hltConfig_
const std::vector< std::string > & triggerNames() const
names of trigger paths
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int j
Definition: DBlmapReader.cc:9
void HLTMonBitSummary::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 470 of file HLTMonBitSummary.cc.

References count_, HLTPathsByName_, i, LogDebug, zeeHLT_cff::report, and total_.

470  {
471 
472  std::stringstream report;
473  report <<" out of: "<<total_<<" events.\n";
474  if(!count_.empty()){
475  for (uint i=0; i!=HLTPathsByName_.size();i++){
476  report<<HLTPathsByName_[i]<<" passed: "<<count_[i]<<" times.\n";
477  count_[i]=0;
478  }
479  }
480 
481  edm::LogInfo("HLTMonBitSummary|BitSummary")<<report.str();
482  LogDebug("HLTMonBitSummary|BitSummary")<<report.str();
483  total_=0;
484  // if( out_.size() != 0 ) edm::Service<DQMStore>()->save(out_);
485 
486 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
tuple report
Definition: zeeHLT_cff.py:9
std::vector< unsigned int > count_
std::vector< std::string > HLTPathsByName_
unsigned int total_

Member Data Documentation

bool HLTMonBitSummary::configFlag_
private

Definition at line 68 of file HLTMonBitSummary.h.

Referenced by analyze(), beginRun(), and HLTMonBitSummary().

std::vector<unsigned int> HLTMonBitSummary::count_
private

Definition at line 63 of file HLTMonBitSummary.h.

Referenced by analyze(), beginRun(), and endJob().

DQMStore* HLTMonBitSummary::dbe_
private

Definition at line 43 of file HLTMonBitSummary.h.

Referenced by beginJob(), beginRun(), and HLTMonBitSummary().

std::string HLTMonBitSummary::denominator_
private

Definition at line 57 of file HLTMonBitSummary.h.

Referenced by analyze(), beginJob(), beginRun(), and HLTMonBitSummary().

std::string HLTMonBitSummary::denominatorWild_
private

Definition at line 58 of file HLTMonBitSummary.h.

Referenced by beginRun(), and HLTMonBitSummary().

std::string HLTMonBitSummary::directory_
private

Definition at line 79 of file HLTMonBitSummary.h.

Referenced by beginJob(), beginRun(), and HLTMonBitSummary().

std::vector<std::string > HLTMonBitSummary::dummyFilters_
private

Definition at line 59 of file HLTMonBitSummary.h.

Referenced by HLTMonBitSummary().

std::string HLTMonBitSummary::esPathsKey_
private

Definition at line 60 of file HLTMonBitSummary.h.

Referenced by beginRun(), and HLTMonBitSummary().

bool HLTMonBitSummary::filterFlag_
private

Definition at line 69 of file HLTMonBitSummary.h.

Referenced by analyze(), beginRun(), and HLTMonBitSummary().

std::vector<std::string > HLTMonBitSummary::filterTypes_
private

Definition at line 55 of file HLTMonBitSummary.h.

Referenced by analyze(), beginRun(), and HLTMonBitSummary().

MonitorElement* HLTMonBitSummary::h1_
private

Definition at line 90 of file HLTMonBitSummary.h.

Referenced by analyze(), beginJob(), and beginRun().

MonitorElement* HLTMonBitSummary::h2_
private

Definition at line 91 of file HLTMonBitSummary.h.

Referenced by analyze(), beginJob(), and beginRun().

std::string HLTMonBitSummary::histLabel_
private

Definition at line 80 of file HLTMonBitSummary.h.

Referenced by beginJob(), and HLTMonBitSummary().

bool HLTMonBitSummary::hltchange_
private

Definition at line 46 of file HLTMonBitSummary.h.

Referenced by beginRun(), and HLTMonBitSummary().

HLTConfigProvider HLTMonBitSummary::hltConfig_
private

Definition at line 45 of file HLTMonBitSummary.h.

Referenced by beginRun(), and configSelector().

std::vector<std::string > HLTMonBitSummary::HLTPathDenomName_
private

Definition at line 53 of file HLTMonBitSummary.h.

Referenced by beginRun().

std::vector<std::string > HLTMonBitSummary::HLTPathDenomNamePreVal_
private

Definition at line 54 of file HLTMonBitSummary.h.

Referenced by beginRun().

std::vector<std::string > HLTMonBitSummary::HLTPathNamesConfig_
private

Definition at line 49 of file HLTMonBitSummary.h.

Referenced by beginRun().

std::vector<std::string > HLTMonBitSummary::HLTPathNamesConfigPreVal_
private

Definition at line 50 of file HLTMonBitSummary.h.

Referenced by beginRun().

std::vector<std::string > HLTMonBitSummary::HLTPathNamesKey_
private

Definition at line 51 of file HLTMonBitSummary.h.

Referenced by beginRun().

std::vector<unsigned int> HLTMonBitSummary::HLTPathsByIndex_
private

Definition at line 56 of file HLTMonBitSummary.h.

Referenced by analyze(), and beginRun().

std::vector<std::string > HLTMonBitSummary::HLTPathsByName_
private

Definition at line 48 of file HLTMonBitSummary.h.

Referenced by analyze(), beginRun(), and endJob().

std::vector<MonitorElement* > HLTMonBitSummary::hSubFilterCount
private

Definition at line 87 of file HLTMonBitSummary.h.

Referenced by analyze(), and beginRun().

std::vector<MonitorElement* > HLTMonBitSummary::hSubFilterEff
private

Definition at line 88 of file HLTMonBitSummary.h.

Referenced by analyze(), and beginRun().

edm::InputTag HLTMonBitSummary::inputTag_
private

Definition at line 42 of file HLTMonBitSummary.h.

Referenced by analyze(), and beginRun().

edm::EDGetTokenT<edm::TriggerResults> HLTMonBitSummary::inputToken_
private

Definition at line 96 of file HLTMonBitSummary.h.

Referenced by analyze(), and HLTMonBitSummary().

unsigned int HLTMonBitSummary::ndenomAccept_
private

Definition at line 77 of file HLTMonBitSummary.h.

Referenced by analyze().

unsigned int HLTMonBitSummary::nValidConfigTriggers_
private

Definition at line 73 of file HLTMonBitSummary.h.

Referenced by analyze(), and beginRun().

unsigned int HLTMonBitSummary::nValidTriggers_
private

Definition at line 72 of file HLTMonBitSummary.h.

Referenced by analyze(), and beginRun().

MonitorElement* HLTMonBitSummary::pf_
private

Definition at line 92 of file HLTMonBitSummary.h.

Referenced by analyze(), beginJob(), and beginRun().

MonitorElement* HLTMonBitSummary::ratio_
private

Definition at line 93 of file HLTMonBitSummary.h.

Referenced by analyze(), beginJob(), and beginRun().

unsigned int HLTMonBitSummary::total_
private

Definition at line 71 of file HLTMonBitSummary.h.

Referenced by analyze(), beginRun(), and endJob().

std::vector<std::vector <uint> > HLTMonBitSummary::triggerFilterIndices_
private

Definition at line 66 of file HLTMonBitSummary.h.

Referenced by analyze(), and beginRun().

std::vector<std::vector <std::string> > HLTMonBitSummary::triggerFilters_
private

Definition at line 65 of file HLTMonBitSummary.h.

Referenced by analyze(), and beginRun().