1209 std::shared_ptr<fwlite::ChainEvent> old_events;
1210 std::shared_ptr<fwlite::ChainEvent> new_events;
1213 old_events = std::make_shared<fwlite::ChainEvent>(
old_files);
1218 new_events = old_events;
1220 new_events = std::make_shared<fwlite::ChainEvent>(new_files);
1231 json.configuration.o.extractFileBase();
1235 json.configuration.n.extractFileBase();
1238 std::unique_ptr<HLTConfigDataEx> old_config_data;
1239 std::unique_ptr<HLTConfigDataEx> new_config_data;
1240 std::unique_ptr<HLTCommonConfig> common_config;
1245 unsigned int skipped = 0;
1246 unsigned int affected = 0;
1247 bool new_run =
true;
1248 std::vector<TriggerDiff> differences;
1252 for (old_events->toBegin(); not old_events->atEnd(); ++(*old_events)) {
1254 if (counter%(nEvents/10) == 0) {
1255 printf(
"Processed events: %d out of %d (%d%%)\n", (
int)counter, (
int)nEvents, 10*counter/(nEvents/10));
1260 if (new_events != old_events and not new_events->to(
id)) {
1262 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": not found in the 'new' files, skipping." << std::endl;
1272 old_results = old_results_h.
product();
1275 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": 'old' TriggerResults not found, skipping." << std::endl;
1283 old_summary = old_summary_h.
product();
1289 new_results = new_results_h.
product();
1292 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": 'new' TriggerResults not found, skipping." << std::endl;
1300 new_summary = new_summary_h.
product();
1305 old_events->fillParameterSetRegistry();
1306 new_events->fillParameterSetRegistry();
1310 if (new_config_data->triggerNames() == old_config_data->triggerNames()) {
1311 old_config = old_config_data.get();
1312 new_config = new_config_data.get();
1314 common_config = std::unique_ptr<HLTCommonConfig>(
new HLTCommonConfig(*old_config_data, *new_config_data));
1317 std::cout <<
"Warning: old and new TriggerResults come from different HLT menus. Only the common " << old_config->size() <<
" triggers are compared.\n" << std::endl;
1320 differences.clear();
1321 differences.resize(old_config->size());
1324 std::vector<std::string> states_str;
1327 json.vars.state = states_str;
1328 for (
size_t triggerId = 0; triggerId < old_config->size(); ++triggerId) {
1329 json.vars.trigger.push_back(old_config->triggerName(triggerId));
1330 json.vars.trigger_passed_count.push_back(std::pair<int, int>(0,0));
1333 for (std::vector<std::string>::const_iterator it = old_config_data->triggerNames().begin(); it != old_config_data->triggerNames().end(); ++it) {
1334 if (
std::find(
json.vars.trigger.begin(),
json.vars.trigger.end(), *it) !=
json.vars.trigger.end())
continue;
1335 json.configuration.o.skipped_triggers.push_back(*it);
1338 for (std::vector<std::string>::const_iterator it = new_config_data->triggerNames().begin(); it != new_config_data->triggerNames().end(); ++it) {
1339 if (
std::find(
json.vars.trigger.begin(),
json.vars.trigger.end(), *it) !=
json.vars.trigger.end())
continue;
1340 json.configuration.n.skipped_triggers.push_back(*it);
1345 bool needs_header =
true;
1346 bool event_affected =
false;
1347 for (
unsigned int p = 0;
p < old_config->size(); ++
p) {
1349 unsigned int old_index = old_config->triggerIndex(
p);
1354 if (old_state ==
Pass) {
1355 ++differences[
p].count;
1357 if (old_state ==
Pass)
1358 ++
json.vars.trigger_passed_count.at(
p).first;
1359 if (new_state ==
Pass)
1360 ++
json.vars.trigger_passed_count.at(
p).second;
1362 bool trigger_affected =
false;
1364 if (old_state ==
Pass and new_state !=
Pass) {
1365 ++differences[
p].lost;
1366 trigger_affected =
true;
1367 }
else if (old_state !=
Pass and new_state ==
Pass) {
1368 ++differences[
p].gained;
1369 trigger_affected =
true;
1370 }
else if (old_results->
index(old_index) != new_results->
index(new_index)) {
1371 ++differences[
p].internal;
1372 trigger_affected =
true;
1376 if (not trigger_affected)
continue;
1378 event_affected =
true;
1379 const unsigned int old_moduleIndex = old_results->
index(old_index);
1380 const unsigned int new_moduleIndex = new_results->
index(new_index);
1384 state.
o =
json.eventState(old_state, old_moduleIndex, old_config->moduleLabel(
p, old_moduleIndex), old_config->moduleType(
p, old_moduleIndex));
1385 state.
n =
json.eventState(new_state, new_moduleIndex, new_config->
moduleLabel(
p, new_moduleIndex), new_config->
moduleType(
p, new_moduleIndex));
1389 needs_header =
false;
1390 std::cout <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": "
1396 std::cout <<
" Path " << old_config->triggerName(
p) <<
":\n"
1397 <<
" old state is ";
1400 <<
" new state is ";
1404 if (
verbose > 1 and old_summary and new_summary) {
1406 unsigned int module =
std::min(old_moduleIndex, new_moduleIndex);
1407 std::cout <<
" Filter " << old_config->moduleLabel(
p, module) <<
":\n";
1408 std::cout <<
" old trigger candidates:\n";
1410 std::cout <<
" new trigger candidates:\n";
1420 if (event_affected and
verbose > 2 and old_summary and new_summary) {
1421 std::map<std::string, std::pair<std::string, std::string>> collections;
1424 for (
auto const & new_collection: new_summary->collectionTags())
1429 std::cout <<
" old trigger candidates:\n";
1431 std::cout <<
" new trigger candidates:\n";
1438 if (nEvents and counter >= nEvents)
1445 std::cout <<
"There are no common events between the old and new files";
1447 std::cout <<
", " << skipped <<
" events were skipped";
1450 std::cout <<
"Found " << counter <<
" matching events, out of which " << affected <<
" have different HLT results";
1452 std::cout <<
", " << skipped <<
" events were skipped";
1453 std::cout <<
"\nSee more in the files listed below...\n" << std::endl;
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.