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

Public Member Functions

 HLTMonBitSummary (const edm::ParameterSet &)
 
 ~HLTMonBitSummary ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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 (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_
 
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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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::getUntrackedParameter(), histLabel_, hltchange_, NULL, cppFunctionSkipper::operator, and DQMStore::setVerbose().

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 }
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::InputTag inputTag_
unsigned int ndenomAccept_
std::string histLabel_
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
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 68 of file HLTMonBitSummary.cc.

68 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 293 of file HLTMonBitSummary.cc.

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

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

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 74 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, gen::k, LogDebug, HLTConfigProvider::moduleIndex(), HLTConfigProvider::moduleLabels(), HLTConfigProvider::moduleType(), nValidConfigTriggers_, nValidTriggers_, pf_, edm::InputTag::process(), ratio_, edm::RunBase::run(), DQMStore::setCurrentFolder(), findQualityFiles::size, total_, triggerFilterIndices_, and triggerFilters_.

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

Definition at line 487 of file HLTMonBitSummary.cc.

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

Referenced by beginRun().

487  {
488 
489  //get the configuration
490  std::vector<std::string> validTriggerNames = hltConfig_.triggerNames();
491 
492  bool goodToGo = false;
493  //remove all path names that are not valid
494  while(!goodToGo && selectTriggers.size()!=0){
495  goodToGo=true;
496  for (std::vector<std::string>::iterator j=selectTriggers.begin();j!=selectTriggers.end();++j){
497  //bool goodOne = false;
498  //check if trigger name is valid
499  //use of wildcard
500  TPRegexp wildCard(*j);
501  //std::cout << "wildCard.GetPattern() = " << wildCard.GetPattern() << std::endl;
502  for (unsigned int i = 0; i != validTriggerNames.size(); ++i){
503  if (TString(validTriggerNames[i]).Contains(wildCard)){
504  //goodOne = true;
505  if (find(theSelectTriggers.begin(),
506  theSelectTriggers.end(),
507  validTriggerNames[i])==theSelectTriggers.end()){
508  //std::cout << "wildcard trigger = " << validTriggerNames[i] << std::endl;
509  theSelectTriggers.push_back( validTriggerNames[i] ); //add it after duplicate check.
510  }
511  }
512  }
513  }
514  }//while
515 }
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 468 of file HLTMonBitSummary.cc.

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

468  {
469 
470  std::stringstream report;
471  report <<" out of: "<<total_<<" events.\n";
472  if(!count_.empty()){
473  for (uint i=0; i!=HLTPathsByName_.size();i++){
474  report<<HLTPathsByName_[i]<<" passed: "<<count_[i]<<" times.\n";
475  count_[i]=0;
476  }
477  }
478 
479  edm::LogInfo("HLTMonBitSummary|BitSummary")<<report.str();
480  LogDebug("HLTMonBitSummary|BitSummary")<<report.str();
481  total_=0;
482  // if( out_.size() != 0 ) edm::Service<DQMStore>()->save(out_);
483 
484 }
#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().

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().