1273 std::shared_ptr<fwlite::ChainEvent> old_events;
1274 std::shared_ptr<fwlite::ChainEvent> new_events;
1277 old_events = std::make_shared<fwlite::ChainEvent>(
old_files);
1282 new_events = old_events;
1284 new_events = std::make_shared<fwlite::ChainEvent>(
new_files);
1295 json.configuration.o.extractFileBase();
1299 json.configuration.n.extractFileBase();
1302 std::unique_ptr<HLTConfigDataEx> old_config_data;
1303 std::unique_ptr<HLTConfigDataEx> new_config_data;
1304 std::unique_ptr<HLTCommonConfig> common_config;
1310 unsigned int affected = 0;
1311 bool new_run =
true;
1312 std::vector<TriggerDiff> differences;
1316 const unsigned int counter_denominator =
std::max(1,
int(
nEvents / 10));
1317 for (old_events->toBegin(); not old_events->atEnd(); ++(*old_events)) {
1319 if (
counter % (counter_denominator) == 0) {
1321 << 10 *
counter / (counter_denominator) <<
"%)" << std::endl;
1326 if (new_events != old_events and not new_events->to(
id)) {
1328 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event()
1329 <<
": not found in the 'new' files, skipping." << std::endl;
1339 old_results = old_results_h.
product();
1342 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event()
1343 <<
": 'old' TriggerResults not found, skipping." << std::endl;
1351 old_summary = old_summary_h.
product();
1357 new_results = new_results_h.
product();
1360 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event()
1361 <<
": 'new' TriggerResults not found, skipping." << std::endl;
1369 new_summary = new_summary_h.
product();
1374 old_events->fillParameterSetRegistry();
1375 new_events->fillParameterSetRegistry();
1379 if (new_config_data->triggerNames() == old_config_data->triggerNames()) {
1380 old_config = old_config_data.get();
1381 new_config = new_config_data.get();
1383 common_config = std::make_unique<HLTCommonConfig>(*old_config_data, *new_config_data);
1386 std::cout <<
"Warning: old and new TriggerResults come from different HLT menus. Only the common " 1387 << old_config->size() <<
" triggers are compared.\n" 1391 differences.clear();
1392 differences.resize(old_config->size());
1395 std::vector<std::string> states_str;
1398 json.vars.state = states_str;
1399 for (
size_t triggerId = 0; triggerId < old_config->size(); ++triggerId) {
1400 json.vars.trigger.push_back(old_config->triggerName(triggerId));
1401 json.vars.trigger_passed_count.push_back(std::pair<int, int>(0, 0));
1404 for (
auto const& it : old_config_data->triggerNames()) {
1407 json.configuration.o.skipped_triggers.push_back(it);
1410 for (
auto const& it : new_config_data->triggerNames()) {
1413 json.configuration.n.skipped_triggers.push_back(it);
1418 bool needs_header =
true;
1419 bool event_affected =
false;
1420 for (
unsigned int p = 0;
p < old_config->size(); ++
p) {
1422 unsigned int old_index = old_config->triggerIndex(
p);
1427 if (old_state ==
Pass) {
1428 ++differences.at(
p).count;
1430 if (old_state ==
Pass)
1431 ++
json.vars.trigger_passed_count.at(
p).first;
1432 if (new_state ==
Pass)
1433 ++
json.vars.trigger_passed_count.at(
p).second;
1435 bool trigger_affected =
false;
1437 if (old_state ==
Pass and new_state !=
Pass) {
1438 ++differences.at(
p).lost;
1439 trigger_affected =
true;
1440 }
else if (old_state !=
Pass and new_state ==
Pass) {
1441 ++differences.at(
p).gained;
1442 trigger_affected =
true;
1443 }
else if (old_results->
index(old_index) != new_results->
index(new_index)) {
1444 ++differences.at(
p).internal;
1445 trigger_affected =
true;
1449 if (not trigger_affected)
1452 event_affected =
true;
1453 const unsigned int old_moduleIndex = old_results->
index(old_index);
1454 const unsigned int new_moduleIndex = new_results->
index(new_index);
1460 old_config->moduleLabel(
p, old_moduleIndex),
1461 old_config->moduleType(
p, old_moduleIndex));
1469 needs_header =
false;
1470 std::cout <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": " 1475 std::cout <<
" Path " << old_config->triggerName(
p) <<
":\n" 1476 <<
" old state is ";
1479 <<
" new state is ";
1483 if (
verbose > 1 and old_summary and new_summary) {
1485 unsigned int module =
std::min(old_moduleIndex, new_moduleIndex);
1487 std::cout <<
" old trigger candidates:\n";
1491 std::cout <<
" new trigger candidates:\n";
1503 if (event_affected and
verbose > 2 and old_summary and new_summary) {
1504 std::map<std::string, std::pair<std::string, std::string>>
collections;
1507 for (
auto const& new_collection : new_summary->collectionTags())
1512 std::cout <<
" old trigger candidates:\n";
1514 std::cout <<
" new trigger candidates:\n";
1528 std::cout <<
"There are no common events between the old and new files";
1533 std::cout <<
"Found " <<
counter <<
" matching events, out of which " << affected
1534 <<
" have different HLT results";
1540 if (!
quiet and old_config) {
1541 bool summaryHeaderPrinted =
false;
1542 for (
size_t p = 0;
p < old_config->size(); ++
p) {
1543 if (differences.at(
p).total() < 1)
1545 if (!summaryHeaderPrinted)
1546 std::cout << std::setw(12) <<
"Events" << std::setw(12) <<
"Accepted" << std::setw(12) <<
"Gained" 1547 << std::setw(12) <<
"Lost" << std::setw(12) <<
"Other" 1549 <<
"Trigger" << std::endl;
1550 std::cout << std::setw(12) <<
counter << differences.at(
p) <<
" " << old_config->triggerName(
p) << std::endl;
1551 summaryHeaderPrinted =
true;
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
virtual std::string const & moduleLabel(unsigned int trigger, unsigned int module) const =0
bool accept() const
Has at least one path accepted the event?
hlt::HLTState state(const unsigned int i) const
Get status of ith path.
const std::vector< std::string > & collectionTags() const
bool check_files(std::vector< std::string > const &files)
The single EDProduct to be saved for each event (AOD case)
void print_trigger_candidates(std::ostream &out, trigger::TriggerEvent const &summary, edm::InputTag const &filter)
T const * product() const
void print_detailed_path_state(std::ostream &out, State state, int path, int module, HLTConfigInterface const &config)
const char * event_state(bool state)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::string > old_files
State prescaled_state(int state, int path, int module, HLTConfigInterface const &config)
std::unique_ptr< HLTConfigDataEx > getHLTConfigData(fwlite::EventBase const &event, std::string process)
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::vector< std::string > new_files
virtual std::string const & moduleType(unsigned int trigger, unsigned int module) const =0
std::string strip_process_name(std::string const &s)
virtual unsigned int triggerIndex(unsigned int trigger) const =0
void print_trigger_collection(std::ostream &out, trigger::TriggerEvent const &summary, std::string const &tag)
virtual std::string const & processName() const =0
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=nullptr, const char *iProcessLabel=nullptr)
const char * path_state(State state)
static std::atomic< unsigned int > counter