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 <TFile.h>
#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, int quiet)
 
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 319 of file hltDiff.cc.

319  {
324  Prescaled,
325  Invalid
326 };
not [yet] run
Definition: HLTenums.h:18
Definition: hltDiff.cc:321
reject
Definition: HLTenums.h:20
accept
Definition: HLTenums.h:19
Definition: hltDiff.cc:322

Function Documentation

bool check_file ( std::string const &  file)

Definition at line 480 of file hltDiff.cc.

References f.

Referenced by check_files().

480  {
481  std::unique_ptr<TFile> f(TFile::Open(file.c_str()));
482  return (f and not f->IsZombie());
483 }
double f[11][100]
bool check_files ( std::vector< std::string > const &  files)

Definition at line 486 of file hltDiff.cc.

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

Referenced by compare().

486  {
487  bool flag = true;
488  for (auto const & file: files)
489  if (not check_file(file)) {
490  flag = false;
491  std::cerr << "hltDiff: error: file " << file << " does not exist, or is not a regular file." << std::endl;
492  }
493  return flag;
494 }
bool check_file(std::string const &file)
Definition: hltDiff.cc:480
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,
int  quiet 
)

Definition at line 497 of file hltDiff.cc.

References edm::HLTGlobalStatus::accept(), ecal_dqm_sourceclient-live_cfg::cerr, check_files(), runEdmFileComparison::collection, trigger::TriggerEvent::collectionTags(), counter, gather_cfg::cout, event_state(), HLTCommonConfig::First, fwlite::Handle< T >::getByLabel(), getHLTConfigData(), HLTCommonConfig::HLTCommonConfig(), i, edm::HLTGlobalStatus::index(), fwlite::Handle< T >::isValid(), 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(), fwlite::Handle< T >::product(), HLTCommonConfig::Second, HLTConfigInterface::size(), edm::HLTGlobalStatus::state(), 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().

499  {
500 
501  std::shared_ptr<fwlite::ChainEvent> old_events;
502  std::shared_ptr<fwlite::ChainEvent> new_events;
503 
504  if (check_files(old_files))
505  old_events = std::make_shared<fwlite::ChainEvent>(old_files);
506  else
507  return;
508 
509  if (new_files.size() == 1 and new_files[0] == "-")
510  new_events = old_events;
511  else if (check_files(new_files))
512  new_events = std::make_shared<fwlite::ChainEvent>(new_files);
513  else
514  return;
515 
516  std::unique_ptr<HLTConfigDataEx> old_config_data;
517  std::unique_ptr<HLTConfigDataEx> new_config_data;
518  std::unique_ptr<HLTCommonConfig> common_config;
519  HLTConfigInterface const * old_config = nullptr;
520  HLTConfigInterface const * new_config = nullptr;
521 
522  unsigned int counter = 0;
523  unsigned int skipped = 0;
524  unsigned int affected = 0;
525  bool new_run = true;
526  std::vector<TriggerDiff> differences;
527 
528  // loop over the reference events
529  for (old_events->toBegin(); not old_events->atEnd(); ++(*old_events)) {
530 
531  // seek the same event in the "new" files
532  edm::EventID const& id = old_events->id();
533  if (new_events != old_events and not new_events->to(id)) {
534  if (not quiet)
535  std::cerr << "run " << id.run() << ", lumi " << id.luminosityBlock() << ", event " << id.event() << ": not found in the 'new' files, skipping." << std::endl;
536  ++skipped;
537  continue;
538  }
539 
540  // read the TriggerResults and TriggerEvent
542  edm::TriggerResults const * old_results = nullptr;
543  old_results_h.getByLabel<fwlite::Event>(* old_events->event(), "TriggerResults", "", old_process.c_str());
544  if (old_results_h.isValid())
545  old_results = old_results_h.product();
546  else {
547  if (not quiet)
548  std::cerr << "run " << id.run() << ", lumi " << id.luminosityBlock() << ", event " << id.event() << ": 'old' TriggerResults not found, skipping." << std::endl;
549  continue;
550  }
551 
553  trigger::TriggerEvent const * old_summary = nullptr;
554  old_summary_h.getByLabel<fwlite::Event>(* old_events->event(), "hltTriggerSummaryAOD", "", old_process.c_str());
555  if (old_summary_h.isValid())
556  old_summary = old_summary_h.product();
557 
559  edm::TriggerResults const * new_results = nullptr;
560  new_results_h.getByLabel<fwlite::Event>(* new_events->event(), "TriggerResults", "", new_process.c_str());
561  if (new_results_h.isValid())
562  new_results = new_results_h.product();
563  else {
564  if (not quiet)
565  std::cerr << "run " << id.run() << ", lumi " << id.luminosityBlock() << ", event " << id.event() << ": 'new' TriggerResults not found, skipping." << std::endl;
566  continue;
567  }
568 
570  trigger::TriggerEvent const * new_summary = nullptr;
571  new_summary_h.getByLabel<fwlite::Event>(* new_events->event(), "hltTriggerSummaryAOD", "", new_process.c_str());
572  if (new_summary_h.isValid())
573  new_summary = new_summary_h.product();
574 
575  // initialise the trigger configuration
576  if (new_run) {
577  new_run = false;
578  old_events->fillParameterSetRegistry();
579  new_events->fillParameterSetRegistry();
580 
581  old_config_data = getHLTConfigData(* old_events->event(), old_process);
582  new_config_data = getHLTConfigData(* new_events->event(), new_process);
583  if (new_config_data->triggerNames() == old_config_data->triggerNames()) {
584  old_config = old_config_data.get();
585  new_config = new_config_data.get();
586  } else {
587  common_config = std::unique_ptr<HLTCommonConfig>(new HLTCommonConfig(*old_config_data, *new_config_data));
588  old_config = & common_config->getView(HLTCommonConfig::Index::First);
589  new_config = & common_config->getView(HLTCommonConfig::Index::Second);
590  std::cerr << "Warning: old and new TriggerResults come from different HLT menus. Only the common triggers will be compared:" << std::endl;
591  for (unsigned int i = 0; i < old_config->size(); ++i)
592  std::cerr << " " << old_config->triggerName(i) << std::endl;
593  std::cerr << std::endl;
594  }
595 
596  differences.clear();
597  differences.resize(old_config->size());
598  }
599 
600  // compare the TriggerResults
601  bool needs_header = true;
602  bool affected_event = false;
603  for (unsigned int p = 0; p < old_config->size(); ++p) {
604  // FIXME explicitly converting the indices is a hack, it should be properly encapsulated instead
605  unsigned int old_index = old_config->triggerIndex(p);
606  unsigned int new_index = new_config->triggerIndex(p);
607  State old_state = prescaled_state(old_results->state(old_index), p, old_results->index(old_index), * old_config);
608  State new_state = prescaled_state(new_results->state(new_index), p, new_results->index(new_index), * new_config);
609 
610  if (old_state == Pass)
611  ++differences[p].count;
612 
613  bool flag = false;
614  if (not ignore_prescales or (old_state != Prescaled and new_state != Prescaled)) {
615  if (old_state == Pass and new_state != Pass) {
616  ++differences[p].lost;
617  flag = true;
618  } else if (old_state != Pass and new_state == Pass) {
619  ++differences[p].gained;
620  flag = true;
621  } else if (old_results->index(old_index) != new_results->index(new_index)) {
622  ++differences[p].internal;
623  flag = true;
624  }
625  }
626 
627  if (flag) {
628  affected_event = true;
629 
630  if (verbose > 0) {
631  if (needs_header) {
632  needs_header = false;
633  std::cout << "run " << id.run() << ", lumi " << id.luminosityBlock() << ", event " << id.event() << ": "
634  << "old result is '" << event_state(old_results->accept()) << "', "
635  << "new result is '" << event_state(new_results->accept()) << "'"
636  << std::endl;
637  }
638  // print the Trigger path and filter responsible for the discrepancy
639  std::cout << " Path " << old_config->triggerName(p) << ":\n"
640  << " old state is ";
641  print_detailed_path_state(std::cout, old_state, p, old_results->index(old_index), * old_config);
642  std::cout << ",\n"
643  << " new state is ";
644  print_detailed_path_state(std::cout, new_state, p, new_results->index(new_index), * new_config);
645  std::cout << std::endl;
646  }
647  if (verbose > 1 and old_summary and new_summary) {
648  // print TriggerObjects for the filter responsible for the discrepancy
649  unsigned int module = std::min(old_results->index(old_index), new_results->index(new_index));
650  std::cout << " Filter " << old_config->moduleLabel(p, module) << ":\n";
651  std::cout << " old trigger candidates:\n";
652  print_trigger_candidates(std::cout, * old_summary, edm::InputTag(old_config->moduleLabel(p, module), "", old_config->processName()));
653  std::cout << " new trigger candidates:\n";
654  print_trigger_candidates(std::cout, * new_summary, edm::InputTag(new_config->moduleLabel(p, module), "", new_config->processName()));
655  }
656  if (verbose > 0)
657  std::cout << std::endl;
658  }
659  }
660  if (affected_event)
661  ++affected;
662 
663  // compare the TriggerEvent
664  if (affected_event and verbose > 2 and old_summary and new_summary) {
665  std::set<std::string> names;
666  names.insert(old_summary->collectionTags().begin(), old_summary->collectionTags().end());
667  names.insert(new_summary->collectionTags().begin(), new_summary->collectionTags().end());
668  for (auto const & collection: names) {
669  std::cout << " Collection " << collection << ":\n";
670  std::cout << " old trigger candidates:\n";
671  print_trigger_collection(std::cout, * old_summary, collection);
672  std::cout << " new trigger candidates:\n";
673  print_trigger_collection(std::cout, * new_summary, collection);
674  std::cout << std::endl;
675  }
676  }
677 
678  ++counter;
679  if (max_events and counter >= max_events)
680  break;
681  }
682 
683  if (not counter) {
684  std::cout << "There are no common events between the old and new files";
685  if (skipped)
686  std::cout << ", " << skipped << " events were skipped";
687  std::cout << "." << std::endl;
688  } else {
689  std::cout << "Found " << affected << " events out of " << counter << " with differences";
690  if (skipped)
691  std::cout << ", " << skipped << " events were skipped";
692  std::cout << ":\n" << std::endl;
693  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;
694  for (unsigned int p = 0; p < old_config->size(); ++p)
695  std::cout << std::setw(12) << counter << differences[p] << " " << old_config->triggerName(p) << std::endl;
696  }
697 }
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:486
const std::vector< std::string > & collectionTags() const
Definition: TriggerEvent.h:96
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
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:321
void print_trigger_candidates(std::ostream &out, trigger::TriggerEvent const &summary, edm::InputTag const &filter)
Definition: hltDiff.cc:355
bool isValid() const
Definition: Handle.h:61
bool accept() const
Has at least one path accepted the event?
void print_detailed_path_state(std::ostream &out, State state, int path, int module, HLTConfigInterface const &config)
Definition: hltDiff.cc:344
const char * event_state(bool state)
Definition: hltDiff.cc:167
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
Definition: Handle.h:91
State prescaled_state(int state, int path, int module, HLTConfigInterface const &config)
Definition: hltDiff.cc:338
std::unique_ptr< HLTConfigDataEx > getHLTConfigData(fwlite::EventBase const &event, std::string process)
Definition: hltDiff.cc:421
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
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:385
virtual std::string const & processName() const =0
static std::atomic< unsigned int > counter
State
Definition: hltDiff.cc:319
tuple cout
Definition: gather_cfg.py:145
T const * product() const
Definition: Handle.h:66
Definition: vlib.h:208
hlt::HLTState state(const unsigned int i) const
Get status of ith path.
void error ( std::ostream &  out)

Definition at line 77 of file hltDiff.cc.

77  {
78  out << "Try 'hltDiff --help' for more information." << std::endl;
79 }
void error ( std::ostream &  out,
const char *  message 
)

Definition at line 81 of file hltDiff.cc.

References relativeConstraints::error.

81  {
82  out << message << std::endl;
83  error(out);
84 }
void error ( std::ostream &  out,
const std::string &  message 
)

Definition at line 86 of file hltDiff.cc.

References relativeConstraints::error.

86  {
87  out << message << std::endl;
88  error(out);
89 }
const char* event_state ( bool  state)

Definition at line 167 of file hltDiff.cc.

Referenced by compare().

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

Definition at line 421 of file hltDiff.cc.

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

Referenced by compare().

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

Definition at line 415 of file hltDiff.cc.

References split.

Referenced by getHLTConfigData().

415  {
416  std::vector<boost::iterator_range<std::string::const_iterator>> tokens;
417  boost::split(tokens, branch, boost::is_any_of("_."), boost::token_compress_off);
418  return boost::copy_range<std::string>(tokens[3]);
419 }
double split
Definition: MVATrainer.cc:139
int main ( int  argc,
char **  argv 
)

Definition at line 700 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.

700  {
701  // options
702  const char optstring[] = "o:O:n:N:m:pqvh";
703  const option longopts[] = {
704  option{ "old-files", required_argument, nullptr, 'o' },
705  option{ "old-process", required_argument, nullptr, 'O' },
706  option{ "new-files", required_argument, nullptr, 'n' },
707  option{ "new-process", required_argument, nullptr, 'N' },
708  option{ "max-events", required_argument, nullptr, 'm' },
709  option{ "prescales", no_argument, nullptr, 'p' },
710  option{ "quet", no_argument, nullptr, 'q' },
711  option{ "verbose", no_argument, nullptr, 'v' },
712  option{ "help", no_argument, nullptr, 'h' },
713  };
714 
715  // default values
716  std::vector<std::string> old_files;
717  std::string old_process("");
718  std::vector<std::string> new_files;
719  std::string new_process("");
720  unsigned int max_events = 0;
721  bool ignore_prescales = true;
722  bool quiet = false;
723  unsigned int verbose = 0;
724 
725  // parse the command line options
726  int c = -1;
727  while ((c = getopt_long(argc, argv, optstring, longopts, nullptr)) != -1) {
728  switch (c) {
729  case 'o':
730  old_files.emplace_back(optarg);
731  while (optind < argc) {
732  if (argv[optind][0] == '-')
733  break;
734  old_files.emplace_back(argv[optind]);
735  ++optind;
736  }
737  break;
738 
739  case 'O':
740  old_process = optarg;
741  break;
742 
743  case 'n':
744  new_files.emplace_back(optarg);
745  while (optind < argc) {
746  if (argv[optind][0] == '-')
747  break;
748  new_files.emplace_back(argv[optind]);
749  ++optind;
750  }
751  break;
752 
753  case 'N':
754  new_process = optarg;
755  break;
756 
757  case 'm':
758  max_events = atoi(optarg);
759  break;
760 
761  case 'p':
762  ignore_prescales = false;
763  break;
764 
765  case 'q':
766  quiet = true;
767  break;
768 
769  case 'v':
770  ++verbose;
771  break;
772 
773  case 'h':
774  usage(std::cerr);
775  exit(0);
776  break;
777 
778  default:
779  error(std::cerr);
780  exit(1);
781  break;
782  }
783  }
784 
785  if (old_files.empty()) {
786  error(std::cerr, "hltDiff: please specify the 'old' file(s)");
787  exit(1);
788  }
789  if (new_files.empty()) {
790  error(std::cerr, "hltDiff: please specify the 'new' file(s)");
791  exit(1);
792  }
793 
794  compare(old_files, old_process, new_files, new_process, max_events, ignore_prescales, verbose, quiet);
795 
796  return 0;
797 }
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, int quiet)
Definition: hltDiff.cc:497
tuple argc
Definition: dir2webdir.py:38
std::ostream& operator<< ( std::ostream &  out,
TriggerDiff  diff 
)

Definition at line 471 of file hltDiff.cc.

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

471  {
472  out << std::setw(12) << diff.count
473  << std::setw(12) << TriggerDiff::format(diff.gained, '+')
474  << std::setw(12) << TriggerDiff::format(diff.lost, '-')
475  << std::setw(12) << TriggerDiff::format(diff.internal, '~');
476  return out;
477 }
unsigned int count
Definition: hltDiff.cc:446
unsigned int internal
Definition: hltDiff.cc:449
unsigned int lost
Definition: hltDiff.cc:448
static std::string format(unsigned int value, char sign= '+')
Definition: hltDiff.cc:452
unsigned int gained
Definition: hltDiff.cc:447
const char* path_state ( State  state)

Definition at line 328 of file hltDiff.cc.

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

Referenced by print_detailed_path_state().

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

Definition at line 338 of file hltDiff.cc.

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

Referenced by compare().

338  {
339  if (state == Fail and config.prescaler(path, module))
340  return Prescaled;
341  return (State) state;
342 }
Definition: hltDiff.cc:322
State
Definition: hltDiff.cc:319
Definition: vlib.h:208
void print_detailed_path_state ( std::ostream &  out,
State  state,
int  path,
int  module,
HLTConfigInterface const &  config 
)

Definition at line 344 of file hltDiff.cc.

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

Referenced by compare().

344  {
345  auto const & label = config.moduleLabel(path, module);
346  auto const & type = config.moduleType(path, module);
347 
348  out << "'" << path_state(state) << "'";
349  if (state == Fail)
350  out << " by module " << module << " '" << label << "' [" << type << "]";
351  else if (state == Exception)
352  out << " at module " << module << " '" << label << "' [" << type << "]";
353 }
type
Definition: HCALResponse.h:21
Definition: hltDiff.cc:322
const char * path_state(State state)
Definition: hltDiff.cc:328
Definition: vlib.h:208
void print_trigger_candidates ( std::ostream &  out,
trigger::TriggerEvent const &  summary,
edm::InputTag const &  filter 
)

Definition at line 355 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().

355  {
356  // find the index of the collection of trigger candidates corresponding to the filter
357  unsigned int index = summary.filterIndex(filter);
358 
359  if (index >= summary.sizeFilters()) {
360  // the collection of trigger candidates corresponding to the filter could not be found
361  out << " not found\n";
362  return;
363  }
364 
365  if (summary.filterKeys(index).empty()) {
366  // the collection of trigger candidates corresponding to the filter is empty
367  out << " none\n";
368  return;
369  }
370 
371  for (unsigned int i = 0; i < summary.filterKeys(index).size(); ++i) {
372  auto key = summary.filterKeys(index)[i];
373  auto id = summary.filterIds(index)[i];
374  trigger::TriggerObject const & candidate = summary.getObjects().at(key);
375  out << " "
376  << "filter id: " << id << ", "
377  << "object id: " << candidate.id() << ", "
378  << "pT: " << candidate.pt() << ", "
379  << "eta: " << candidate.eta() << ", "
380  << "phi: " << candidate.phi() << ", "
381  << "mass: " << candidate.mass() << "\n";
382  }
383 }
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.
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 385 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().

385  {
386  auto iterator = std::find(summary.collectionTags().begin(), summary.collectionTags().end(), tag);
387  if (iterator == summary.collectionTags().end()) {
388  // the collection of trigger candidates could not be found
389  out << " not found\n";
390  return;
391  }
392 
393  unsigned int index = iterator - summary.collectionTags().begin();
394  unsigned int begin = (index == 0) ? 0 : summary.collectionKey(index - 1);
395  unsigned int end = summary.collectionKey(index);
396 
397  if (end == begin) {
398  // the collection of trigger candidates is empty
399  out << " none\n";
400  return;
401  }
402 
403  for (unsigned int key = begin; key < end; ++key) {
404  trigger::TriggerObject const & candidate = summary.getObjects().at(key);
405  out << " "
406  << "object id: " << candidate.id() << ", "
407  << "pT: " << candidate.pt() << ", "
408  << "eta: " << candidate.eta() << ", "
409  << "phi: " << candidate.phi() << ", "
410  << "mass: " << candidate.mass() << "\n";
411  }
412 }
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.
#define begin
Definition: vmac.h:30
float mass() const
Definition: TriggerObject.h:59
void usage ( std::ostream &  out)

Definition at line 35 of file hltDiff.cc.

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