1261 std::shared_ptr<fwlite::ChainEvent> old_events;
1262 std::shared_ptr<fwlite::ChainEvent> new_events;
1265 old_events = std::make_shared<fwlite::ChainEvent>(
old_files);
1270 new_events = old_events;
1272 new_events = std::make_shared<fwlite::ChainEvent>(new_files);
1283 json.configuration.o.extractFileBase();
1287 json.configuration.n.extractFileBase();
1290 std::unique_ptr<HLTConfigDataEx> old_config_data;
1291 std::unique_ptr<HLTConfigDataEx> new_config_data;
1292 std::unique_ptr<HLTCommonConfig> common_config;
1297 unsigned int skipped = 0;
1298 unsigned int affected = 0;
1299 bool new_run =
true;
1300 std::vector<TriggerDiff> differences;
1304 const unsigned int counter_denominator =
std::max(1,
int(nEvents/10));
1305 for (old_events->toBegin(); not old_events->atEnd(); ++(*old_events)) {
1307 if (counter%(counter_denominator) == 0) {
1308 std::cout <<
"Processed events: " << counter <<
" out of " << nEvents
1309 <<
" (" << 10*counter/(counter_denominator) <<
"%)" << std::endl;
1314 if (new_events != old_events and not new_events->to(
id)) {
1316 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": not found in the 'new' files, skipping." << std::endl;
1326 old_results = old_results_h.
product();
1329 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": 'old' TriggerResults not found, skipping." << std::endl;
1337 old_summary = old_summary_h.
product();
1343 new_results = new_results_h.
product();
1346 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": 'new' TriggerResults not found, skipping." << std::endl;
1354 new_summary = new_summary_h.
product();
1359 old_events->fillParameterSetRegistry();
1360 new_events->fillParameterSetRegistry();
1364 if (new_config_data->triggerNames() == old_config_data->triggerNames()) {
1365 old_config = old_config_data.get();
1366 new_config = new_config_data.get();
1368 common_config = std::unique_ptr<HLTCommonConfig>(
new HLTCommonConfig(*old_config_data, *new_config_data));
1371 std::cout <<
"Warning: old and new TriggerResults come from different HLT menus. Only the common " << old_config->size() <<
" triggers are compared.\n" << std::endl;
1374 differences.clear();
1375 differences.resize(old_config->size());
1378 std::vector<std::string> states_str;
1381 json.vars.state = states_str;
1382 for (
size_t triggerId = 0; triggerId < old_config->size(); ++triggerId) {
1383 json.vars.trigger.push_back(old_config->triggerName(triggerId));
1384 json.vars.trigger_passed_count.push_back(std::pair<int, int>(0,0));
1387 for (std::vector<std::string>::const_iterator it = old_config_data->triggerNames().begin(); it != old_config_data->triggerNames().end(); ++it) {
1388 if (
std::find(
json.vars.trigger.begin(),
json.vars.trigger.end(), *it) !=
json.vars.trigger.end())
continue;
1389 json.configuration.o.skipped_triggers.push_back(*it);
1392 for (std::vector<std::string>::const_iterator it = new_config_data->triggerNames().begin(); it != new_config_data->triggerNames().end(); ++it) {
1393 if (
std::find(
json.vars.trigger.begin(),
json.vars.trigger.end(), *it) !=
json.vars.trigger.end())
continue;
1394 json.configuration.n.skipped_triggers.push_back(*it);
1399 bool needs_header =
true;
1400 bool event_affected =
false;
1401 for (
unsigned int p = 0;
p < old_config->size(); ++
p) {
1403 unsigned int old_index = old_config->triggerIndex(
p);
1408 if (old_state ==
Pass) {
1409 ++differences.at(
p).count;
1411 if (old_state ==
Pass)
1412 ++
json.vars.trigger_passed_count.at(
p).first;
1413 if (new_state ==
Pass)
1414 ++
json.vars.trigger_passed_count.at(
p).second;
1416 bool trigger_affected =
false;
1418 if (old_state ==
Pass and new_state !=
Pass) {
1419 ++differences.at(
p).lost;
1420 trigger_affected =
true;
1421 }
else if (old_state !=
Pass and new_state ==
Pass) {
1422 ++differences.at(
p).gained;
1423 trigger_affected =
true;
1424 }
else if (old_results->
index(old_index) != new_results->
index(new_index)) {
1425 ++differences.at(
p).internal;
1426 trigger_affected =
true;
1430 if (not trigger_affected)
continue;
1432 event_affected =
true;
1433 const unsigned int old_moduleIndex = old_results->
index(old_index);
1434 const unsigned int new_moduleIndex = new_results->
index(new_index);
1438 state.
o =
json.eventState(old_state, old_moduleIndex, old_config->moduleLabel(
p, old_moduleIndex), old_config->moduleType(
p, old_moduleIndex));
1439 state.
n =
json.eventState(new_state, new_moduleIndex, new_config->
moduleLabel(
p, new_moduleIndex), new_config->
moduleType(
p, new_moduleIndex));
1443 needs_header =
false;
1444 std::cout <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": "
1450 std::cout <<
" Path " << old_config->triggerName(
p) <<
":\n"
1451 <<
" old state is ";
1454 <<
" new state is ";
1458 if (
verbose > 1 and old_summary and new_summary) {
1460 unsigned int module =
std::min(old_moduleIndex, new_moduleIndex);
1461 std::cout <<
" Filter " << old_config->moduleLabel(
p, module) <<
":\n";
1462 std::cout <<
" old trigger candidates:\n";
1464 std::cout <<
" new trigger candidates:\n";
1474 if (event_affected and
verbose > 2 and old_summary and new_summary) {
1475 std::map<std::string, std::pair<std::string, std::string>> collections;
1478 for (
auto const & new_collection: new_summary->collectionTags())
1483 std::cout <<
" old trigger candidates:\n";
1485 std::cout <<
" new trigger candidates:\n";
1492 if (nEvents and counter >= nEvents)
1499 std::cout <<
"There are no common events between the old and new files";
1501 std::cout <<
", " << skipped <<
" events were skipped";
1504 std::cout <<
"Found " << counter <<
" matching events, out of which " << affected <<
" have different HLT results";
1506 std::cout <<
", " << skipped <<
" events were skipped";
1511 bool summaryHeaderPrinted =
false;
1512 for (
size_t p = 0;
p < old_config->size(); ++
p) {
1513 if (differences.at(
p).total() < 1)
continue;
1514 if (!summaryHeaderPrinted)
1515 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;
1516 std::cout << std::setw(12) << counter << differences.at(
p) <<
" " << old_config->triggerName(
p) << std::endl;
1517 summaryHeaderPrinted =
true;
virtual std::string const & moduleLabel(unsigned int trigger, unsigned int module) const =0
bool check_files(std::vector< std::string > const &files)
const std::vector< std::string > & collectionTags() const
The single EDProduct to be saved for each event (AOD case)
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
void print_trigger_candidates(std::ostream &out, trigger::TriggerEvent const &summary, edm::InputTag const &filter)
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)
const char * event_state(bool state)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
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)
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
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)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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
const char * path_state(State state)
static std::atomic< unsigned int > counter
T const * product() const
hlt::HLTState state(const unsigned int i) const
Get status of ith path.