38 std::vector<FilterIndex> interestingFilters(
const HLTConfigProvider& HLTCP,
bool doRefAnalysis) {
39 const std::vector<std::string>& moduleLabels = HLTCP.
moduleLabels(name_);
40 std::vector<std::string> leptonTauFilters;
41 allInterestingFilters_.clear();
45 LogTrace(
"HLTTauDQMOffline") <<
"Path " << name_
46 <<
", list of all filters (preceded by the module index in the path)";
47 for (
auto iLabel = moduleLabels.begin(); iLabel != moduleLabels.end(); ++iLabel) {
51 LogTrace(
"HLTTauDQMOffline") <<
" " <<
std::distance(moduleLabels.begin(), iLabel) <<
" " << *iLabel <<
" " 53 if (
type.find(
"Selector") != std::string::npos)
55 if (
type ==
"HLTTriggerTypeFilter" ||
type ==
"HLTBool")
57 if (iLabel->find(
'-') == 0)
59 if (
type ==
"HLT2PhotonPFTau" ||
type ==
"HLT2ElectronPFTau" ||
type ==
"HLT2MuonPFTau" ||
60 type ==
"HLT2PhotonTau" ||
type ==
"HLT2ElectronTau" ||
type ==
"HLT2MuonTau")
61 leptonTauFilters.emplace_back(*iLabel);
64 allInterestingFilters_.emplace_back(*iLabel,
type, iLabel - moduleLabels.begin(), HLTCP.
saveTags(*iLabel));
68 for (
const std::string& leptonTauLabel : leptonTauFilters) {
76 auto func = [&](
const FilterIndexSave&
a,
unsigned idxb) {
return std::get<kModuleIndex>(
a) < idxb; };
79 if (
found == allInterestingFilters_.end() || std::get<kModuleIndex>(*found) != idx1)
82 if (
found == allInterestingFilters_.end() || std::get<kModuleIndex>(*found) != idx2)
86 std::vector<FilterIndex> selectedFilters;
90 for (
const auto&
item : allInterestingFilters_) {
91 if (!doRefAnalysis || (doRefAnalysis && std::get<kSaveTags>(
item))) {
92 selectedFilters.emplace_back(std::get<kName>(
item), std::get<kType>(
item), std::get<kModuleIndex>(
item));
96 return selectedFilters;
101 if (
type ==
"PFRecoTauProducer" ||
type ==
"RecoTauPiZeroUnembedder") {
102 LogDebug(
"HLTTauDQMOffline") <<
"Found tau producer " <<
type <<
" with label " << producerLabel
103 <<
" from path " << name_;
111 if (
type ==
"EgammaHLTPixelMatchElectronProducers") {
112 LogDebug(
"HLTTauDQMOffline") <<
"Found electron producer " <<
type <<
" with label " << producerLabel
113 <<
" from path " << name_;
121 if (
type ==
"L3MuonCandidateProducer" ||
type ==
"L3MuonCombinedRelativeIsolationProducer") {
122 LogDebug(
"HLTTauDQMOffline") <<
"Found muon producer " <<
type <<
" with label " << producerLabel
123 <<
" from path " << name_;
131 if (
pset.exists(
"inputTag"))
133 if (
pset.exists(
"inputTag1"))
135 if (
pset.exists(
"inputTag2"))
142 if (
pset.exists(
"inputTag"))
144 if (
pset.exists(
"inputTag1"))
146 if (
pset.exists(
"inputTag2"))
153 if (
pset.exists(
"inputTag"))
155 if (
pset.exists(
"inputTag1"))
157 if (
pset.exists(
"inputTag2"))
165 for (
const auto&
filter : allInterestingFilters_) {
166 if (isL3TauFilter(HLTCP, std::get<kName>(
filter)))
167 return std::get<kModuleIndex>(
filter);
175 for (
const auto&
filter : allInterestingFilters_) {
176 if (isL3ElectronFilter(HLTCP, std::get<kName>(
filter)))
177 return std::get<kModuleIndex>(
filter);
185 for (
const auto&
filter : allInterestingFilters_) {
186 if (isL3MuonFilter(HLTCP, std::get<kName>(
filter)))
187 return std::get<kModuleIndex>(
filter);
197 std::vector<FilterIndexSave> allInterestingFilters_;
204 if (
pset.existsAs<
int>(parameterName))
205 return pset.getParameter<
int>(parameterName);
207 edm::LogWarning(
"HLTTauDQMOfflineSource") <<
"No parameter '" << parameterName <<
"' in configuration of filter " 213 struct TauLeptonMultiplicity {
225 TauLeptonMultiplicity
n;
227 if (moduleType ==
"HLTL1TSeed") {
229 if (
filterName.find(
"Single") != std::string::npos) {
230 if (
filterName.find(
"Mu") != std::string::npos) {
232 }
else if (
filterName.find(
"EG") != std::string::npos) {
235 }
else if (
filterName.find(
"Double") != std::string::npos &&
filterName.find(
"Tau") != std::string::npos) {
239 if (
filterName.find(
"Mu") != std::string::npos) {
243 if (
filterName.find(
"EG") != std::string::npos &&
filterName.find(
"Tau") != std::string::npos) {
247 if (
filterName.find(
"ETM") != std::string::npos) {
250 }
else if (moduleType ==
"HLT1CaloMET") {
255 }
else if (moduleType ==
"HLT1CaloJet") {
258 n.tau = getParameterSafe(HLTCP,
filterName,
"MinN");
260 }
else if (moduleType ==
"HLT1PFJet") {
266 n.tau = getParameterSafe(HLTCP,
filterName,
"MinN");
268 }
else if (moduleType ==
"HLTCaloJetTag") {
274 n.tau = getParameterSafe(HLTCP,
filterName,
"MinJets");
276 }
else if (moduleType ==
"HLT1Tau" || moduleType ==
"HLT1PFTau") {
279 n.tau = getParameterSafe(HLTCP,
filterName,
"MinN");
280 }
else if (moduleType ==
"HLTPFTauPairDzMatchFilter") {
283 }
else if (moduleType ==
"HLTEgammaGenericFilter") {
285 n.electron = getParameterSafe(HLTCP,
filterName,
"ncandcut");
286 }
else if (moduleType ==
"HLTElectronGenericFilter") {
289 n.electron = getParameterSafe(HLTCP,
filterName,
"ncandcut");
290 }
else if (moduleType ==
"HLTMuonL2PreFilter") {
293 n.muon = getParameterSafe(HLTCP,
filterName,
"MinN");
294 }
else if (moduleType ==
"HLTMuonIsoFilter" || moduleType ==
"HLTMuonL3PreFilter") {
296 n.muon = getParameterSafe(HLTCP,
filterName,
"MinN");
297 }
else if (moduleType ==
"HLTMuonGenericFilter") {
300 }
else if (moduleType ==
"HLT2ElectronTau" || moduleType ==
"HLT2ElectronPFTau" || moduleType ==
"HLT2PhotonTau" ||
301 moduleType ==
"HLT2PhotonPFTau") {
307 }
else if (moduleType ==
"HLT2MuonTau" || moduleType ==
"HLT2MuonPFTau") {
313 }
else if (moduleType ==
"HLTPrescaler") {
317 <<
"HLTTauDQMPath.cc, inferTauLeptonMultiplicity(): module type '" << moduleType
319 <<
"' will be ignored for offline matching." << std::endl;
324 template <
typename T1,
typename T2>
325 bool deltaRmatch(
const T1&
obj,
326 const std::vector<T2>& refColl,
328 std::vector<bool>& refMask,
329 std::vector<T2>& matchedRefs) {
330 double minDr = 2 *
dR;
331 size_t found = refColl.size();
333 for (
size_t i = 0;
i < refColl.size(); ++
i) {
344 if (
found < refColl.size()) {
345 matchedRefs.emplace_back(refColl[
found]);
346 refMask[
found] =
false;
358 doRefAnalysis_(doRefAnalysis),
360 pathIndex_(HLTCP.triggerIndex(pathName_)),
361 lastFilterBeforeL2TauIndex_(0),
362 lastL2TauFilterIndex_(0),
363 lastFilterBeforeL3TauIndex_(0),
364 lastL3TauFilterIndex_(0),
365 lastFilterBeforeL2ElectronIndex_(0),
366 lastL2ElectronFilterIndex_(0),
367 lastFilterBeforeL2MuonIndex_(0),
368 lastL2MuonFilterIndex_(0),
369 lastFilterBeforeL2METIndex_(0),
370 lastL2METFilterIndex_(0),
371 firstFilterBeforeL2METIndex_(0),
372 firstL2METFilterIndex_(0),
374 isFirstL1Seed_(
false),
377 std::stringstream
ss;
384 edm::LogInfo(
"HLTTauDQMOffline") <<
"HLTTauDQMPath: " <<
pathName_ <<
" no interesting filters found";
389 ss <<
" Interesting filters (preceded by the module index in the path)";
416 ss <<
"\n " <<
i <<
" " << std::get<kModuleIndex>(filterIndice) <<
" " <<
filterName <<
" " << moduleType
417 <<
" ntau " <<
n.tau <<
" nele " <<
n.electron <<
" nmu " <<
n.muon;
431 const size_t firstL3TauFilterIndex = thePath.firstL3TauFilterIndex(HLTCP);
433 edm::LogInfo(
"HLTTauDQMOffline") <<
"Did not find a filter with L3 tau producer as input in path " <<
pathName_;
435 const size_t firstL3ElectronFilterIndex = thePath.firstL3ElectronFilterIndex(HLTCP);
437 edm::LogInfo(
"HLTTauDQMOffline") <<
"Did not find a filter with L3 electron producer as input in path " 440 const size_t firstL3MuonFilterIndex = thePath.firstL3MuonFilterIndex(HLTCP);
442 edm::LogInfo(
"HLTTauDQMOffline") <<
"Did not find a filter with L3 muon producer as input in path " <<
pathName_;
569 std::vector<Object>& retval)
const {
575 for (
size_t i = 0;
i <
keys.size(); ++
i) {
586 std::vector<Object>& matchedTriggerObjects,
589 std::vector<bool> offlineMask;
591 int matchedObjects = 0;
592 offlineMask.resize(offlineObjects.
taus.size());
593 std::fill(offlineMask.begin(), offlineMask.end(),
true);
598 if (deltaRmatch(trgObj.object, offlineObjects.
taus,
dR, offlineMask, matchedOfflineObjects.
taus)) {
600 matchedTriggerObjects.emplace_back(trgObj);
608 int matchedObjects = 0;
609 offlineMask.resize(offlineObjects.
electrons.size());
610 std::fill(offlineMask.begin(), offlineMask.end(),
true);
616 if (deltaRmatch(trgObj.object, offlineObjects.
electrons,
dR, offlineMask, matchedOfflineObjects.
electrons)) {
618 matchedTriggerObjects.emplace_back(trgObj);
625 int matchedObjects = 0;
626 offlineMask.resize(offlineObjects.
muons.size());
627 std::fill(offlineMask.begin(), offlineMask.end(),
true);
632 if (deltaRmatch(trgObj.object, offlineObjects.
muons,
dR, offlineMask, matchedOfflineObjects.
muons)) {
634 matchedTriggerObjects.emplace_back(trgObj);
641 int matchedObjects = 0;
642 offlineMask.resize(offlineObjects.
met.size());
643 std::fill(offlineMask.begin(), offlineMask.end(),
true);
649 matchedTriggerObjects.emplace_back(trgObj);
658 return a.pt() >
b.pt();
662 [](
const LV&
a,
const LV&
b) {
return a.pt() >
b.pt(); });
664 return a.pt() >
b.pt();
666 matchedOfflineObjects.
met = offlineObjects.
met;
const std::string pathName_
bool isValid_(value_type const &hash)
size_t lastL3ElectronFilterIndex_
std::vector< LV > electrons
The single EDProduct to be saved for each event (AOD case)
std::vector< int > filterMET_
int getFilterNElectrons(size_t i) const
enum start value shifted to 81 so as to avoid clashes with PDG codes
size_t lastFilterBeforeL2METIndex_
std::tuple< std::string, std::string, size_t > FilterIndex
const std::string moduleType(const std::string &module) const
C++ class name of module.
size_t lastFilterBeforeL3ElectronIndex_
math::XYZTLorentzVectorD LV
static const std::string kType("type")
size_t lastFilterBeforeL3MuonIndex_
std::vector< int > filterLevel_
const std::string hltProcess_
Single trigger physics object (e.g., an isolated muon)
const unsigned int pathIndex_
bool saveTags(const std::string &module) const
Is module an L3 filter (ie, tracked saveTags=true)
size_t lastFilterBeforeL2TauIndex_
const edm::ParameterSet & modulePSet(const std::string &module) const
ParameterSet of module.
static constexpr size_t kName
size_t filtersSize() const
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
int getFilterMET(size_t i) const
size_t lastFilterBeforeL3TauIndex_
int getFilterNMuons(size_t i) const
static std::string const triggerResults
int getFilterLevel(size_t i) const
size_t lastFilterBeforeL2ElectronIndex_
std::vector< int > filterTauN_
size_t lastL2MuonFilterIndex_
std::vector< FilterIndex > filterIndices_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const std::string moduleEDMType(const std::string &module) const
C++ base class name of module.
HLTTauDQMPath(std::string pathName, std::string hltProcess, bool doRefAnalysis, const HLTConfigProvider &HLTCP)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Log< level::Info, false > LogInfo
const bool doRefAnalysis_
std::vector< size_type > Keys
int getFilterNTaus(size_t i) const
size_t lastL3TauFilterIndex_
void getFilterObjects(const trigger::TriggerEvent &triggerEvent, size_t i, std::vector< Object > &retval) const
static constexpr size_t kType
size_t lastL2TauFilterIndex_
bool goodOfflineEvent(size_t i, const HLTTauDQMOfflineObjects &offlineObjects) const
std::vector< int > filterElectronN_
size_t lastL3MuonFilterIndex_
size_t lastL2ElectronFilterIndex_
size_t firstFilterBeforeL2METIndex_
unsigned int moduleIndex(unsigned int trigger, const std::string &module) const
slot position of module on trigger path (0 to size-1)
Log< level::Warning, false > LogWarning
int lastPassedFilter(const edm::TriggerResults &triggerResults) const
const std::string & getFilterName(size_t i) const
std::vector< int > filterMuonN_
static constexpr size_t kModuleIndex
bool fired(const edm::TriggerResults &triggerResults) const
static constexpr size_t kInvalidIndex
size_t lastL2METFilterIndex_
bool offlineMatching(size_t i, const std::vector< Object > &triggerObjects, const HLTTauDQMOfflineObjects &offlineObjects, double dR, std::vector< Object > &matchedTriggerObjects, HLTTauDQMOfflineObjects &matchedOfflineObjects) const
size_t lastFilterBeforeL2MuonIndex_
size_t firstL2METFilterIndex_