1262 std::shared_ptr<fwlite::ChainEvent> old_events;
1263 std::shared_ptr<fwlite::ChainEvent> new_events;
1266 old_events = std::make_shared<fwlite::ChainEvent>(
old_files);
1271 new_events = old_events;
1273 new_events = std::make_shared<fwlite::ChainEvent>(new_files);
1284 json.configuration.o.extractFileBase();
1288 json.configuration.n.extractFileBase();
1291 std::unique_ptr<HLTConfigDataEx> old_config_data;
1292 std::unique_ptr<HLTConfigDataEx> new_config_data;
1293 std::unique_ptr<HLTCommonConfig> common_config;
1299 unsigned int affected = 0;
1300 bool new_run =
true;
1301 std::vector<TriggerDiff> differences;
1305 const unsigned int counter_denominator =
std::max(1,
int(nEvents/10));
1306 for (old_events->toBegin(); not old_events->atEnd(); ++(*old_events)) {
1308 if (counter%(counter_denominator) == 0) {
1309 std::cout <<
"Processed events: " << counter <<
" out of " << nEvents
1310 <<
" (" << 10*counter/(counter_denominator) <<
"%)" << std::endl;
1315 if (new_events != old_events and not new_events->to(
id)) {
1317 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": not found in the 'new' files, skipping." << std::endl;
1327 old_results = old_results_h.
product();
1330 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": 'old' TriggerResults not found, skipping." << std::endl;
1338 old_summary = old_summary_h.
product();
1344 new_results = new_results_h.
product();
1347 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": 'new' TriggerResults not found, skipping." << std::endl;
1355 new_summary = new_summary_h.
product();
1360 old_events->fillParameterSetRegistry();
1361 new_events->fillParameterSetRegistry();
1365 if (new_config_data->triggerNames() == old_config_data->triggerNames()) {
1366 old_config = old_config_data.get();
1367 new_config = new_config_data.get();
1369 common_config = std::make_unique<HLTCommonConfig>(*old_config_data, *new_config_data);
1372 std::cout <<
"Warning: old and new TriggerResults come from different HLT menus. Only the common " << old_config->size() <<
" triggers are compared.\n" << std::endl;
1375 differences.clear();
1376 differences.resize(old_config->size());
1379 std::vector<std::string> states_str;
1382 json.vars.state = states_str;
1383 for (
size_t triggerId = 0; triggerId < old_config->size(); ++triggerId) {
1384 json.vars.trigger.push_back(old_config->triggerName(triggerId));
1385 json.vars.trigger_passed_count.push_back(std::pair<int, int>(0,0));
1388 for (
auto const & it : old_config_data->triggerNames()) {
1389 if (
std::find(
json.vars.trigger.begin(),
json.vars.trigger.end(), it) !=
json.vars.trigger.end())
continue;
1390 json.configuration.o.skipped_triggers.push_back(it);
1393 for (
auto const & it : new_config_data->triggerNames()) {
1394 if (
std::find(
json.vars.trigger.begin(),
json.vars.trigger.end(), it) !=
json.vars.trigger.end())
continue;
1395 json.configuration.n.skipped_triggers.push_back(it);
1400 bool needs_header =
true;
1401 bool event_affected =
false;
1402 for (
unsigned int p = 0;
p < old_config->size(); ++
p) {
1404 unsigned int old_index = old_config->triggerIndex(
p);
1409 if (old_state ==
Pass) {
1410 ++differences.at(
p).count;
1412 if (old_state ==
Pass)
1413 ++
json.vars.trigger_passed_count.at(
p).first;
1414 if (new_state ==
Pass)
1415 ++
json.vars.trigger_passed_count.at(
p).second;
1417 bool trigger_affected =
false;
1419 if (old_state ==
Pass and new_state !=
Pass) {
1420 ++differences.at(
p).lost;
1421 trigger_affected =
true;
1422 }
else if (old_state !=
Pass and new_state ==
Pass) {
1423 ++differences.at(
p).gained;
1424 trigger_affected =
true;
1425 }
else if (old_results->
index(old_index) != new_results->
index(new_index)) {
1426 ++differences.at(
p).internal;
1427 trigger_affected =
true;
1431 if (not trigger_affected)
continue;
1433 event_affected =
true;
1434 const unsigned int old_moduleIndex = old_results->
index(old_index);
1435 const unsigned int new_moduleIndex = new_results->
index(new_index);
1439 state.
o =
json.eventState(old_state, old_moduleIndex, old_config->moduleLabel(
p, old_moduleIndex), old_config->moduleType(
p, old_moduleIndex));
1440 state.
n =
json.eventState(new_state, new_moduleIndex, new_config->
moduleLabel(
p, new_moduleIndex), new_config->
moduleType(
p, new_moduleIndex));
1444 needs_header =
false;
1445 std::cout <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": " 1451 std::cout <<
" Path " << old_config->triggerName(
p) <<
":\n" 1452 <<
" old state is ";
1455 <<
" new state is ";
1459 if (
verbose > 1 and old_summary and new_summary) {
1461 unsigned int module =
std::min(old_moduleIndex, new_moduleIndex);
1462 std::cout <<
" Filter " << old_config->moduleLabel(
p, module) <<
":\n";
1463 std::cout <<
" old trigger candidates:\n";
1465 std::cout <<
" new trigger candidates:\n";
1475 if (event_affected and
verbose > 2 and old_summary and new_summary) {
1476 std::map<std::string, std::pair<std::string, std::string>> collections;
1479 for (
auto const & new_collection: new_summary->collectionTags())
1484 std::cout <<
" old trigger candidates:\n";
1486 std::cout <<
" new trigger candidates:\n";
1493 if (nEvents and counter >= nEvents)
1500 std::cout <<
"There are no common events between the old and new files";
1502 std::cout <<
", " << skipped <<
" events were skipped";
1505 std::cout <<
"Found " << counter <<
" matching events, out of which " << affected <<
" have different HLT results";
1507 std::cout <<
", " << skipped <<
" events were skipped";
1512 bool summaryHeaderPrinted =
false;
1513 for (
size_t p = 0;
p < old_config->size(); ++
p) {
1514 if (differences.at(
p).total() < 1)
continue;
1515 if (!summaryHeaderPrinted)
1516 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;
1517 std::cout << std::setw(12) << counter << differences.at(
p) <<
" " << old_config->triggerName(
p) << std::endl;
1518 summaryHeaderPrinted =
true;
virtual unsigned int triggerIndex(unsigned int trigger) 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)
virtual std::string const & processName() const =0
void print_trigger_candidates(std::ostream &out, trigger::TriggerEvent const &summary, edm::InputTag const &filter)
virtual std::string const & moduleLabel(unsigned int trigger, unsigned int module) const =0
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)
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
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
void print_trigger_collection(std::ostream &out, trigger::TriggerEvent const &summary, std::string const &tag)
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.