1226 std::shared_ptr<fwlite::ChainEvent> old_events;
1227 std::shared_ptr<fwlite::ChainEvent> new_events;
1230 old_events = std::make_shared<fwlite::ChainEvent>(
old_files);
1235 new_events = old_events;
1237 new_events = std::make_shared<fwlite::ChainEvent>(new_files);
1248 json.configuration.o.extractFileBase();
1252 json.configuration.n.extractFileBase();
1255 std::unique_ptr<HLTConfigDataEx> old_config_data;
1256 std::unique_ptr<HLTConfigDataEx> new_config_data;
1257 std::unique_ptr<HLTCommonConfig> common_config;
1263 unsigned int affected = 0;
1264 bool new_run =
true;
1265 std::vector<TriggerDiff> differences;
1269 const unsigned int counter_denominator =
std::max(1,
int(nEvents / 10));
1270 for (old_events->toBegin(); not old_events->atEnd(); ++(*old_events)) {
1272 if (counter % (counter_denominator) == 0) {
1273 std::cout <<
"Processed events: " << counter <<
" out of " << nEvents <<
" (" 1274 << 10 * counter / (counter_denominator) <<
"%)" << std::endl;
1279 if (new_events != old_events and not new_events->to(
id)) {
1281 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event()
1282 <<
": not found in the 'new' files, skipping." << std::endl;
1292 old_results = old_results_h.
product();
1295 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event()
1296 <<
": 'old' TriggerResults not found, skipping." << std::endl;
1304 old_summary = old_summary_h.
product();
1310 new_results = new_results_h.
product();
1313 std::cerr <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event()
1314 <<
": 'new' TriggerResults not found, skipping." << std::endl;
1322 new_summary = new_summary_h.
product();
1327 old_events->fillParameterSetRegistry();
1328 new_events->fillParameterSetRegistry();
1332 if (new_config_data->triggerNames() == old_config_data->triggerNames()) {
1333 old_config = old_config_data.get();
1334 new_config = new_config_data.get();
1336 common_config = std::make_unique<HLTCommonConfig>(*old_config_data, *new_config_data);
1339 std::cout <<
"Warning: old and new TriggerResults come from different HLT menus. Only the common " 1340 << old_config->size() <<
" triggers are compared.\n" 1344 differences.clear();
1345 differences.resize(old_config->size());
1348 std::vector<std::string> states_str;
1351 json.vars.state = states_str;
1352 for (
size_t triggerId = 0; triggerId < old_config->size(); ++triggerId) {
1353 json.vars.trigger.push_back(old_config->triggerName(triggerId));
1354 json.vars.trigger_passed_count.push_back(std::pair<int, int>(0, 0));
1357 for (
auto const& it : old_config_data->triggerNames()) {
1360 json.configuration.o.skipped_triggers.push_back(it);
1363 for (
auto const& it : new_config_data->triggerNames()) {
1366 json.configuration.n.skipped_triggers.push_back(it);
1371 bool needs_header =
true;
1372 bool event_affected =
false;
1373 for (
unsigned int p = 0;
p < old_config->size(); ++
p) {
1375 unsigned int old_index = old_config->triggerIndex(
p);
1380 if (old_state ==
Pass) {
1381 ++differences.at(
p).count;
1383 if (old_state ==
Pass)
1384 ++
json.vars.trigger_passed_count.at(
p).first;
1385 if (new_state ==
Pass)
1386 ++
json.vars.trigger_passed_count.at(
p).second;
1388 bool trigger_affected =
false;
1390 if (old_state ==
Pass and new_state !=
Pass) {
1391 ++differences.at(
p).lost;
1392 trigger_affected =
true;
1393 }
else if (old_state !=
Pass and new_state ==
Pass) {
1394 ++differences.at(
p).gained;
1395 trigger_affected =
true;
1396 }
else if (old_results->
index(old_index) != new_results->
index(new_index)) {
1397 ++differences.at(
p).internal;
1398 trigger_affected =
true;
1402 if (not trigger_affected)
1405 event_affected =
true;
1406 const unsigned int old_moduleIndex = old_results->
index(old_index);
1407 const unsigned int new_moduleIndex = new_results->
index(new_index);
1411 state.
o =
json.eventState(old_state,
1413 old_config->moduleLabel(
p, old_moduleIndex),
1414 old_config->moduleType(
p, old_moduleIndex));
1415 state.
n =
json.eventState(new_state,
1422 needs_header =
false;
1423 std::cout <<
"run " <<
id.run() <<
", lumi " <<
id.luminosityBlock() <<
", event " <<
id.event() <<
": " 1428 std::cout <<
" Path " << old_config->triggerName(
p) <<
":\n" 1429 <<
" old state is ";
1432 <<
" new state is ";
1436 if (
verbose > 1 and old_summary and new_summary) {
1438 unsigned int module =
std::min(old_moduleIndex, new_moduleIndex);
1439 std::cout <<
" Filter " << old_config->moduleLabel(
p, module) <<
":\n";
1440 std::cout <<
" old trigger candidates:\n";
1443 edm::InputTag(old_config->moduleLabel(
p, module),
"", old_config->processName()));
1444 std::cout <<
" new trigger candidates:\n";
1456 if (event_affected and
verbose > 2 and old_summary and new_summary) {
1457 std::map<std::string, std::pair<std::string, std::string>>
collections;
1460 for (
auto const& new_collection : new_summary->collectionTags())
1465 std::cout <<
" old trigger candidates:\n";
1467 std::cout <<
" new trigger candidates:\n";
1474 if (nEvents and counter >= nEvents)
1481 std::cout <<
"There are no common events between the old and new files";
1483 std::cout <<
", " << skipped <<
" events were skipped";
1486 std::cout <<
"Found " << counter <<
" matching events, out of which " << affected
1487 <<
" have different HLT results";
1489 std::cout <<
", " << skipped <<
" events were skipped";
1494 bool summaryHeaderPrinted =
false;
1495 for (
size_t p = 0;
p < old_config->size(); ++
p) {
1496 if (differences.at(
p).total() < 1)
1498 if (!summaryHeaderPrinted)
1499 std::cout << std::setw(12) <<
"Events" << std::setw(12) <<
"Accepted" << std::setw(12) <<
"Gained" 1500 << std::setw(12) <<
"Lost" << std::setw(12) <<
"Other" 1502 <<
"Trigger" << std::endl;
1503 std::cout << std::setw(12) << counter << differences.at(
p) <<
" " << old_config->triggerName(
p) << std::endl;
1504 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.