CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Enumerations | Functions
hltDiff.cc File Reference
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <memory>
#include <cstring>
#include <unistd.h>
#include <getopt.h>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include "FWCore/Common/interface/TriggerNames.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/ParameterSet/interface/Registry.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/HLTReco/interface/TriggerObject.h"
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
#include "DataFormats/FWLite/interface/Handle.h"
#include "DataFormats/FWLite/interface/Event.h"
#include "DataFormats/FWLite/interface/ChainEvent.h"
#include "HLTrigger/HLTcore/interface/HLTConfigData.h"

Go to the source code of this file.

Classes

class  HLTCommonConfig
 
class  HLTConfigDataEx
 
class  HLTConfigInterface
 
struct  TriggerDiff
 
class  HLTCommonConfig::View
 

Enumerations

enum  State {
  Ready = edm::hlt::Ready, Pass = edm::hlt::Pass, Fail = edm::hlt::Fail, Exception = edm::hlt::Exception,
  Prescaled, Invalid
}
 

Functions

bool check_file (std::string const &file)
 
bool check_files (std::vector< std::string > const &files)
 
void compare (std::vector< std::string > const &old_files, std::string const &old_process, std::vector< std::string > const &new_files, std::string const &new_process, unsigned int max_events, bool ignore_prescales, int verbose)
 
void error (std::ostream &out)
 
void error (std::ostream &out, const char *message)
 
void error (std::ostream &out, const std::string &message)
 
const char * event_state (bool state)
 
std::unique_ptr< HLTConfigDataExgetHLTConfigData (fwlite::EventBase const &event, std::string process)
 
std::string getProcessNameFromBranch (std::string const &branch)
 
int main (int argc, char **argv)
 
std::ostream & operator<< (std::ostream &out, TriggerDiff diff)
 
const char * path_state (State state)
 
State prescaled_state (int state, int path, int module, HLTConfigInterface const &config)
 
void print_detailed_path_state (std::ostream &out, State state, int path, int module, HLTConfigInterface const &config)
 
void print_trigger_candidates (std::ostream &out, trigger::TriggerEvent const &summary, edm::InputTag const &filter)
 
void print_trigger_collection (std::ostream &out, trigger::TriggerEvent const &summary, std::string const &tag)
 
void usage (std::ostream &out)
 

Enumeration Type Documentation

enum State
Enumerator
Ready 
Pass 
Fail 
Exception 
Prescaled 
Invalid 

Definition at line 314 of file hltDiff.cc.

314  {
319  Prescaled,
320  Invalid
321 };
not [yet] run
Definition: HLTenums.h:18
Definition: hltDiff.cc:316
reject
Definition: HLTenums.h:20
accept
Definition: HLTenums.h:19
Definition: hltDiff.cc:317

Function Documentation

bool check_file ( std::string const &  file)

Definition at line 475 of file hltDiff.cc.

References AlCaHLTBitMon_ParallelJobs::p, and cmsHarvester::path.

Referenced by check_files().

475  {
477 
478  // check if the file exists
479  if (not boost::filesystem::exists(p))
480  return false;
481 
482  // resolve the file name to canonical form
483  p = boost::filesystem::canonical(p);
484  if (not boost::filesystem::exists(p))
485  return false;
486 
487  // check for a regular file
488  if (not boost::filesystem::is_regular_file(p))
489  return false;
490 
491  return true;
492 }
tuple path
else: Piece not in the list, fine.
bool check_files ( std::vector< std::string > const &  files)

Definition at line 495 of file hltDiff.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, check_file(), and mergeVDriftHistosByStation::file.

Referenced by compare().

495  {
496  bool flag = true;
497  for (auto const & file: files)
498  if (not check_file(file)) {
499  flag = false;
500  std::cerr << "hltDiff: error: file " << file << " does not exist, or is not a regular file." << std::endl;
501  }
502  return flag;
503 }
bool check_file(std::string const &file)
Definition: hltDiff.cc:475
void compare ( std::vector< std::string > const &  old_files,
std::string const &  old_process,
std::vector< std::string > const &  new_files,
std::string const &  new_process,
unsigned int  max_events,
bool  ignore_prescales,
int  verbose 
)

Definition at line 506 of file hltDiff.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, check_files(), runEdmFileComparison::collection, counter, gather_cfg::cout, event_state(), HLTCommonConfig::First, fwlite::Handle< T >::getByLabel(), getHLTConfigData(), HLTCommonConfig::HLTCommonConfig(), i, min(), HLTConfigInterface::moduleLabel(), cscdqm::h::names, or, AlCaHLTBitMon_ParallelJobs::p, Pass, Prescaled, prescaled_state(), print_detailed_path_state(), print_trigger_candidates(), print_trigger_collection(), HLTConfigInterface::processName(), HLTCommonConfig::Second, HLTConfigInterface::size(), HLTConfigInterface::triggerIndex(), and HLTConfigInterface::triggerName().

Referenced by TTUTrackingAlg::alignTracks(), TrackingMonitor::bookHistograms(), l1t::ConditionEvaluation::checkRangeDeltaEta(), muonisolation::CaloExtractorByAssociator::deposits(), GeneralHLTOffline::dqmBeginRun(), PrintGeomMatInfo::dumpG4LVLeafWithMat(), main(), TrackingMonitor::setMaxMinBin(), and TrackingMonitor::setNclus().

508  {
509 
510  std::shared_ptr<fwlite::ChainEvent> old_events;
511  std::shared_ptr<fwlite::ChainEvent> new_events;
512 
513  if (check_files(old_files))
514  old_events = std::make_shared<fwlite::ChainEvent>(old_files);
515  else
516  return;
517 
518  if (new_files.size() == 1 and new_files[0] == "-")
519  new_events = old_events;
520  else if (check_files(new_files))
521  new_events = std::make_shared<fwlite::ChainEvent>(new_files);
522  else
523  return;
524 
525  std::unique_ptr<HLTConfigDataEx> old_config_data;
526  std::unique_ptr<HLTConfigDataEx> new_config_data;
527  std::unique_ptr<HLTCommonConfig> common_config;
528  HLTConfigInterface const * old_config = nullptr;
529  HLTConfigInterface const * new_config = nullptr;
530 
531  unsigned int counter = 0;
532  unsigned int affected = 0;
533  bool new_run = true;
534  std::vector<TriggerDiff> differences;
535 
536  // loop over the reference events
537  for (old_events->toBegin(); not old_events->atEnd(); ++(*old_events)) {
538 
539  // seek the same event in the "new" files
540  edm::EventID const& id = old_events->id();
541  if (new_events != old_events and not new_events->to(id)) {
542  std::cerr << "run " << id.run() << ", lumi " << id.luminosityBlock() << ", event " << id.event() << ": not found in the 'new' files, skipping." << std::endl;
543  continue;
544  }
545 
546  // read the TriggerResults and TriggerEvent
548  old_results_h.getByLabel<fwlite::Event>(* old_events->event(), "TriggerResults", "", old_process.c_str());
549  auto const & old_results = * old_results_h;
550 
552  old_summary_h.getByLabel<fwlite::Event>(* old_events->event(), "hltTriggerSummaryAOD", "", old_process.c_str());
553  auto const & old_summary = * old_summary_h;
554 
556  new_handle.getByLabel<fwlite::Event>(* new_events->event(), "TriggerResults", "", new_process.c_str());
557  auto const & new_results = * new_handle;
558 
560  new_summary_h.getByLabel<fwlite::Event>(* new_events->event(), "hltTriggerSummaryAOD", "", new_process.c_str());
561  auto const & new_summary = * new_summary_h;
562 
563  // initialise the trigger configuration
564  if (new_run) {
565  new_run = false;
566  old_events->fillParameterSetRegistry();
567  new_events->fillParameterSetRegistry();
568 
569  old_config_data = getHLTConfigData(* old_events->event(), old_process);
570  new_config_data = getHLTConfigData(* new_events->event(), new_process);
571  if (new_config_data->triggerNames() == old_config_data->triggerNames()) {
572  old_config = old_config_data.get();
573  new_config = new_config_data.get();
574  } else {
575  common_config = std::unique_ptr<HLTCommonConfig>(new HLTCommonConfig(*old_config_data, *new_config_data));
576  old_config = & common_config->getView(HLTCommonConfig::Index::First);
577  new_config = & common_config->getView(HLTCommonConfig::Index::Second);
578  std::cerr << "Warning: old and new TriggerResults come from different HLT menus. Only the common triggers will be compared:" << std::endl;
579  for (unsigned int i = 0; i < old_config->size(); ++i)
580  std::cerr << " " << old_config->triggerName(i) << std::endl;
581  std::cerr << std::endl;
582  }
583 
584  differences.clear();
585  differences.resize(old_config->size());
586  }
587 
588  // compare the TriggerResults
589  bool needs_header = true;
590  bool affected_event = false;
591  for (unsigned int p = 0; p < old_config->size(); ++p) {
592  // FIXME explicitly converting the indices is a hack, it should be properly encapsulated instead
593  unsigned int old_index = old_config->triggerIndex(p);
594  unsigned int new_index = new_config->triggerIndex(p);
595  State old_state = prescaled_state(old_results.state(old_index), p, old_results.index(old_index), * old_config);
596  State new_state = prescaled_state(new_results.state(new_index), p, new_results.index(new_index), * new_config);
597 
598  if (old_state == Pass)
599  ++differences[p].count;
600 
601  bool flag = false;
602  if (not ignore_prescales or (old_state != Prescaled and new_state != Prescaled)) {
603  if (old_state == Pass and new_state != Pass) {
604  ++differences[p].lost;
605  flag = true;
606  } else if (old_state != Pass and new_state == Pass) {
607  ++differences[p].gained;
608  flag = true;
609  } else if (old_results.index(old_index) != new_results.index(new_index)) {
610  ++differences[p].internal;
611  flag = true;
612  }
613  }
614 
615  if (flag) {
616  affected_event = true;
617 
618  if (verbose > 0) {
619  if (needs_header) {
620  needs_header = false;
621  std::cout << "run " << id.run() << ", lumi " << id.luminosityBlock() << ", event " << id.event() << ": "
622  << "old result is '" << event_state(old_results.accept()) << "', "
623  << "new result is '" << event_state(new_results.accept()) << "'"
624  << std::endl;
625  }
626  // print the Trigger path and filter responsible for the discrepancy
627  std::cout << " Path " << old_config->triggerName(p) << ":\n"
628  << " old state is ";
629  print_detailed_path_state(std::cout, old_state, p, old_results.index(old_index), * old_config);
630  std::cout << ",\n"
631  << " new state is ";
632  print_detailed_path_state(std::cout, new_state, p, new_results.index(new_index), * new_config);
633  std::cout << std::endl;
634  }
635  if (verbose > 1) {
636  // print TriggerObjects for the filter responsible for the discrepancy
637  unsigned int module = std::min(old_results.index(old_index), new_results.index(new_index));
638  std::cout << " Filter " << old_config->moduleLabel(p, module) << ":\n";
639  std::cout << " old trigger candidates:\n";
640  print_trigger_candidates(std::cout, old_summary, edm::InputTag(old_config->moduleLabel(p, module), "", old_config->processName()));
641  std::cout << " new trigger candidates:\n";
642  print_trigger_candidates(std::cout, new_summary, edm::InputTag(new_config->moduleLabel(p, module), "", new_config->processName()));
643  }
644  if (verbose > 0)
645  std::cout << std::endl;
646  }
647  }
648  if (affected_event)
649  ++affected;
650 
651  // compare the TriggerEvent
652  if (affected_event and verbose > 2) {
653  std::set<std::string> names;
654  names.insert(old_summary.collectionTags().begin(), old_summary.collectionTags().end());
655  names.insert(new_summary.collectionTags().begin(), new_summary.collectionTags().end());
656  for (auto const & collection: names) {
657  std::cout << " Collection " << collection << ":\n";
658  std::cout << " old trigger candidates:\n";
659  print_trigger_collection(std::cout, old_summary, collection);
660  std::cout << " new trigger candidates:\n";
661  print_trigger_collection(std::cout, new_summary, collection);
662  std::cout << std::endl;
663  }
664  }
665 
666  ++counter;
667  if (max_events and counter >= max_events)
668  break;
669  }
670 
671  if (not counter) {
672  std::cout << "There are no common events between the old and new files." << std::endl;
673  } else {
674  std::cout << "Found " << affected << " events out of " << counter << " with differences:\n" << std::endl;
675  std::cout << std::setw(12) << "Events" << std::setw(12) << "Accepted" << std::setw(12) << "Gained" << std::setw(12) << "Lost" << std::setw(12) << "Other" << " " << "Trigger" << std::endl;
676  for (unsigned int p = 0; p < old_config->size(); ++p)
677  std::cout << std::setw(12) << counter << differences[p] << " " << old_config->triggerName(p) << std::endl;
678  }
679 }
virtual std::string const & moduleLabel(unsigned int trigger, unsigned int module) const =0
int i
Definition: DBlmapReader.cc:9
bool check_files(std::vector< std::string > const &files)
Definition: hltDiff.cc:495
static const HistoName names[]
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Definition: hltDiff.cc:316
void print_trigger_candidates(std::ostream &out, trigger::TriggerEvent const &summary, edm::InputTag const &filter)
Definition: hltDiff.cc:350
void print_detailed_path_state(std::ostream &out, State state, int path, int module, HLTConfigInterface const &config)
Definition: hltDiff.cc:339
const char * event_state(bool state)
Definition: hltDiff.cc:162
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
Definition: Handle.h:94
State prescaled_state(int state, int path, int module, HLTConfigInterface const &config)
Definition: hltDiff.cc:333
std::unique_ptr< HLTConfigDataEx > getHLTConfigData(fwlite::EventBase const &event, std::string process)
Definition: hltDiff.cc:416
T min(T a, T b)
Definition: MathUtil.h:58
virtual unsigned int triggerIndex(unsigned int trigger) const =0
void print_trigger_collection(std::ostream &out, trigger::TriggerEvent const &summary, std::string const &tag)
Definition: hltDiff.cc:380
virtual std::string const & processName() const =0
static std::atomic< unsigned int > counter
State
Definition: hltDiff.cc:314
tuple cout
Definition: gather_cfg.py:121
Definition: vlib.h:208
void error ( std::ostream &  out)

Definition at line 72 of file hltDiff.cc.

72  {
73  out << "Try 'hltDiff --help' for more information." << std::endl;
74 }
tuple out
Definition: dbtoconf.py:99
void error ( std::ostream &  out,
const char *  message 
)

Definition at line 76 of file hltDiff.cc.

References relativeConstraints::error.

76  {
77  out << message << std::endl;
78  error(out);
79 }
tuple out
Definition: dbtoconf.py:99
void error ( std::ostream &  out,
const std::string &  message 
)

Definition at line 81 of file hltDiff.cc.

References relativeConstraints::error.

81  {
82  out << message << std::endl;
83  error(out);
84 }
tuple out
Definition: dbtoconf.py:99
const char* event_state ( bool  state)

Definition at line 162 of file hltDiff.cc.

Referenced by compare().

162  {
163  return state ? "accepted" : "rejected";
164 }
std::unique_ptr<HLTConfigDataEx> getHLTConfigData ( fwlite::EventBase const &  event,
std::string  process 
)

Definition at line 416 of file hltDiff.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, HDQMDatabaseProducer::config, cmsRelvalreport::exit, edm::pset::Registry::getMapped(), getProcessNameFromBranch(), edm::pset::Registry::instance(), and edm::ProcessConfiguration::parameterSetID().

Referenced by compare().

416  {
417  auto const & history = event.processHistory();
418  if (process.empty()) {
419  // determine the process name from the most recent "TriggerResults" object
420  auto const & branch = event.getBranchNameFor( edm::Wrapper<edm::TriggerResults>::typeInfo(), "TriggerResults", "", process.c_str() );
421  process = getProcessNameFromBranch( branch );
422  }
423 
425  if (not history.getConfigurationForProcess(process, config)) {
426  std::cerr << "error: the process " << process << " is not in the Process History" << std::endl;
427  exit(1);
428  }
430  if (pset == nullptr) {
431  std::cerr << "error: the configuration for the process " << process << " is not available in the Provenance" << std::endl;
432  exit(1);
433  }
434  return std::unique_ptr<HLTConfigDataEx>(new HLTConfigDataEx(HLTConfigData(pset)));
435 }
ParameterSetID const & parameterSetID() const
std::string getProcessNameFromBranch(std::string const &branch)
Definition: hltDiff.cc:410
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:22
tuple process
Definition: LaserDQM_cfg.py:3
static Registry * instance()
Definition: Registry.cc:16
std::string getProcessNameFromBranch ( std::string const &  branch)

Definition at line 410 of file hltDiff.cc.

References split.

Referenced by getHLTConfigData().

410  {
411  std::vector<boost::iterator_range<std::string::const_iterator>> tokens;
412  boost::split(tokens, branch, boost::is_any_of("_."), boost::token_compress_off);
413  return boost::copy_range<std::string>(tokens[3]);
414 }
double split
Definition: MVATrainer.cc:139
int main ( int  argc,
char **  argv 
)

Definition at line 682 of file hltDiff.cc.

References EnergyCorrector::c, ecal_dqm_sourceclient-live_cfg::cerr, compare(), relativeConstraints::error, cmsRelvalreport::exit, AlCaHLTBitMon_QueryRunRegistry::string, geometryDiff::usage, and verbose.

682  {
683  // options
684  const char optstring[] = "o:O:n:N:m:pvh";
685  const option longopts[] = {
686  option{ "old-files", required_argument, nullptr, 'o' },
687  option{ "old-process", required_argument, nullptr, 'O' },
688  option{ "new-files", required_argument, nullptr, 'n' },
689  option{ "new-process", required_argument, nullptr, 'N' },
690  option{ "max-events", required_argument, nullptr, 'm' },
691  option{ "prescales", no_argument, nullptr, 'p' },
692  option{ "verbose", no_argument, nullptr, 'v' },
693  option{ "help", no_argument, nullptr, 'h' },
694  };
695 
696  // default values
697  std::vector<std::string> old_files;
698  std::string old_process("");
699  std::vector<std::string> new_files;
700  std::string new_process("");
701  unsigned int max_events = 0;
702  bool ignore_prescales = true;
703  unsigned int verbose = 0;
704 
705  // parse the command line options
706  int c = -1;
707  while ((c = getopt_long(argc, argv, optstring, longopts, nullptr)) != -1) {
708  switch (c) {
709  case 'o':
710  old_files.emplace_back(optarg);
711  while (optind < argc) {
712  if (argv[optind][0] == '-')
713  break;
714  old_files.emplace_back(argv[optind]);
715  ++optind;
716  }
717  break;
718 
719  case 'O':
720  old_process = optarg;
721  break;
722 
723  case 'n':
724  new_files.emplace_back(optarg);
725  while (optind < argc) {
726  if (argv[optind][0] == '-')
727  break;
728  new_files.emplace_back(argv[optind]);
729  ++optind;
730  }
731  break;
732 
733  case 'N':
734  new_process = optarg;
735  break;
736 
737  case 'm':
738  max_events = atoi(optarg);
739  break;
740 
741  case 'p':
742  ignore_prescales = false;
743  break;
744 
745  case 'v':
746  ++verbose;
747  break;
748 
749  case 'h':
750  usage(std::cerr);
751  exit(0);
752  break;
753 
754  default:
755  error(std::cerr);
756  exit(1);
757  break;
758  }
759  }
760 
761  if (old_files.empty()) {
762  error(std::cerr, "hltDiff: please specify the 'old' file(s)");
763  exit(1);
764  }
765  if (new_files.empty()) {
766  error(std::cerr, "hltDiff: please specify the 'new' file(s)");
767  exit(1);
768  }
769 
770  compare(old_files, old_process, new_files, new_process, max_events, ignore_prescales, verbose);
771 
772  return 0;
773 }
bool verbose
string usage
Definition: geometryDiff.py:6
void compare(std::vector< std::string > const &old_files, std::string const &old_process, std::vector< std::string > const &new_files, std::string const &new_process, unsigned int max_events, bool ignore_prescales, int verbose)
Definition: hltDiff.cc:506
tuple argc
Definition: dir2webdir.py:38
std::ostream& operator<< ( std::ostream &  out,
TriggerDiff  diff 
)

Definition at line 466 of file hltDiff.cc.

References TriggerDiff::count, TriggerDiff::format(), TriggerDiff::gained, TriggerDiff::internal, TriggerDiff::lost, and dbtoconf::out.

466  {
467  out << std::setw(12) << diff.count
468  << std::setw(12) << TriggerDiff::format(diff.gained, '+')
469  << std::setw(12) << TriggerDiff::format(diff.lost, '-')
470  << std::setw(12) << TriggerDiff::format(diff.internal, '~');
471  return out;
472 }
unsigned int count
Definition: hltDiff.cc:441
unsigned int internal
Definition: hltDiff.cc:444
unsigned int lost
Definition: hltDiff.cc:443
static std::string format(unsigned int value, char sign= '+')
Definition: hltDiff.cc:447
unsigned int gained
Definition: hltDiff.cc:442
tuple out
Definition: dbtoconf.py:99
const char* path_state ( State  state)

Definition at line 323 of file hltDiff.cc.

References Invalid, and python.rootplot.argparse::message.

Referenced by print_detailed_path_state().

323  {
324  static const char * message[] = { "not run", "accepted", "rejected", "exception", "prescaled", "invalid" };
325 
326  if (state > 0 and state < Invalid)
327  return message[state];
328  else
329  return message[Invalid];
330 }
State prescaled_state ( int  state,
int  path,
int  module,
HLTConfigInterface const &  config 
)
inline

Definition at line 333 of file hltDiff.cc.

References Fail, Prescaled, and HLTConfigInterface::prescaler().

Referenced by compare().

333  {
334  if (state == Fail and config.prescaler(path, module))
335  return Prescaled;
336  return (State) state;
337 }
tuple path
else: Piece not in the list, fine.
Definition: hltDiff.cc:317
State
Definition: hltDiff.cc:314
Definition: vlib.h:208
void print_detailed_path_state ( std::ostream &  out,
State  state,
int  path,
int  module,
HLTConfigInterface const &  config 
)

Definition at line 339 of file hltDiff.cc.

References Fail, diffTwoXMLs::label, HLTConfigInterface::moduleLabel(), HLTConfigInterface::moduleType(), and path_state().

Referenced by compare().

339  {
340  auto const & label = config.moduleLabel(path, module);
341  auto const & type = config.moduleType(path, module);
342 
343  out << "'" << path_state(state) << "'";
344  if (state == Fail)
345  out << " by module " << module << " '" << label << "' [" << type << "]";
346  else if (state == Exception)
347  out << " at module " << module << " '" << label << "' [" << type << "]";
348 }
type
Definition: HCALResponse.h:21
tuple path
else: Piece not in the list, fine.
tuple out
Definition: dbtoconf.py:99
Definition: hltDiff.cc:317
const char * path_state(State state)
Definition: hltDiff.cc:323
Definition: vlib.h:208
void print_trigger_candidates ( std::ostream &  out,
trigger::TriggerEvent const &  summary,
edm::InputTag const &  filter 
)

Definition at line 350 of file hltDiff.cc.

References trigger::TriggerObject::eta(), trigger::TriggerEvent::filterIds(), trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), trigger::TriggerEvent::getObjects(), i, trigger::TriggerObject::id(), cmsHarvester::index, relval_steps::key, trigger::TriggerObject::mass(), trigger::TriggerObject::phi(), trigger::TriggerObject::pt(), and trigger::TriggerEvent::sizeFilters().

Referenced by compare().

350  {
351  // find the index of the collection of trigger candidates corresponding to the filter
352  unsigned int index = summary.filterIndex(filter);
353 
354  if (index >= summary.sizeFilters()) {
355  // the collection of trigger candidates corresponding to the filter could not be found
356  out << " not found\n";
357  return;
358  }
359 
360  if (summary.filterKeys(index).empty()) {
361  // the collection of trigger candidates corresponding to the filter is empty
362  out << " none\n";
363  return;
364  }
365 
366  for (unsigned int i = 0; i < summary.filterKeys(index).size(); ++i) {
367  auto key = summary.filterKeys(index)[i];
368  auto id = summary.filterIds(index)[i];
369  trigger::TriggerObject const & candidate = summary.getObjects().at(key);
370  out << " "
371  << "filter id: " << id << ", "
372  << "object id: " << candidate.id() << ", "
373  << "pT: " << candidate.pt() << ", "
374  << "eta: " << candidate.eta() << ", "
375  << "phi: " << candidate.phi() << ", "
376  << "mass: " << candidate.mass() << "\n";
377  }
378 }
int i
Definition: DBlmapReader.cc:9
int id() const
getters
Definition: TriggerObject.h:55
float phi() const
Definition: TriggerObject.h:58
float eta() const
Definition: TriggerObject.h:57
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
tuple out
Definition: dbtoconf.py:99
float mass() const
Definition: TriggerObject.h:59
void print_trigger_collection ( std::ostream &  out,
trigger::TriggerEvent const &  summary,
std::string const &  tag 
)

Definition at line 380 of file hltDiff.cc.

References begin, trigger::TriggerEvent::collectionKey(), trigger::TriggerEvent::collectionTags(), end, trigger::TriggerObject::eta(), spr::find(), trigger::TriggerEvent::getObjects(), trigger::TriggerObject::id(), cmsHarvester::index, relval_steps::key, trigger::TriggerObject::mass(), trigger::TriggerObject::phi(), trigger::TriggerObject::pt(), and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by compare().

380  {
381  auto iterator = std::find(summary.collectionTags().begin(), summary.collectionTags().end(), tag);
382  if (iterator == summary.collectionTags().end()) {
383  // the collection of trigger candidates could not be found
384  out << " not found\n";
385  return;
386  }
387 
388  unsigned int index = iterator - summary.collectionTags().begin();
389  unsigned int begin = (index == 0) ? 0 : summary.collectionKey(index - 1);
390  unsigned int end = summary.collectionKey(index);
391 
392  if (end == begin) {
393  // the collection of trigger candidates is empty
394  out << " none\n";
395  return;
396  }
397 
398  for (unsigned int key = begin; key < end; ++key) {
399  trigger::TriggerObject const & candidate = summary.getObjects().at(key);
400  out << " "
401  << "object id: " << candidate.id() << ", "
402  << "pT: " << candidate.pt() << ", "
403  << "eta: " << candidate.eta() << ", "
404  << "phi: " << candidate.phi() << ", "
405  << "mass: " << candidate.mass() << "\n";
406  }
407 }
int id() const
getters
Definition: TriggerObject.h:55
float phi() const
Definition: TriggerObject.h:58
float eta() const
Definition: TriggerObject.h:57
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
#define end
Definition: vmac.h:37
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
tuple out
Definition: dbtoconf.py:99
#define begin
Definition: vmac.h:30
float mass() const
Definition: TriggerObject.h:59
void usage ( std::ostream &  out)

Definition at line 33 of file hltDiff.cc.

33  {
34  out << "\
35 usage: hltDiff -o|--old-files FILE1.ROOT [FILE2.ROOT ...] [-O|--old-process LABEL[:INSTANCE[:PROCESS]]]\n\
36  -n|--new-files FILE1.ROOT [FILE2.ROOT ...] [-N|--new-process LABEL[:INSTANCE[:PROCESS]]]\n\
37  [-m|--max-events MAXEVENTS] [-p|--prescales] [-v|--verbose] [-h|--help]\n\
38 \n\
39  -o|--old-files FILE1.ROOT [FILE2.ROOT ...]\n\
40  input file(s) with the old (reference) trigger results.\n\
41 \n\
42  -O|--old-process PROCESS\n\
43  process name of the collection with the old (reference) trigger results;\n\
44  the default is to take the 'TriggerResults' from the last process.\n\
45 \n\
46  -n|--new-files FILE1.ROOT [FILE2.ROOT ...]\n\
47  input file(s) with the new trigger results to be compared with the reference;\n\
48  to read these from a different collection in the same files as\n\
49  the reference, use '-n -' and specify the collection with -N (see below).\n\
50 \n\
51  -N|--new-process PROCESS\n\
52  process name of the collection with the new (reference) trigger results;\n\
53  the default is to take the 'TriggerResults' from the last process.\n\
54 \n\
55  -m|--max-events MAXEVENTS\n\
56  compare only the first MAXEVENTS events;\n\
57  the default is to compare all the events in the original (reference) files.\n\
58 \n\
59  -p|--prescales\n\
60  do not ignore differences caused by HLTPrescaler modules.\n\
61 \n\
62  -v|--verbose\n\
63  be (more) verbose:\n\
64  use once to print event-by-event comparison results;\n\
65  use twice to print the trigger candidates of the affected filters;\n\
66  use three times to print all the trigger candidates for the affected events.\n\
67 \n\
68  -h|--help\n\
69  print this help message, and exit." << std::endl;
70 }
tuple out
Definition: dbtoconf.py:99