36 constexpr
static size_t kSaveTags = 3;
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 (
type ==
"HLT2PhotonPFTau" ||
type ==
"HLT2ElectronPFTau" ||
type ==
"HLT2MuonPFTau" ||
58 type ==
"HLT2PhotonTau" ||
type ==
"HLT2ElectronTau" ||
type ==
"HLT2MuonTau")
59 leptonTauFilters.emplace_back(*iLabel);
62 allInterestingFilters_.emplace_back(*iLabel,
type, iLabel - moduleLabels.begin(), HLTCP.
saveTags(*iLabel));
66 for (
const std::string& leptonTauLabel : leptonTauFilters) {
74 auto func = [&](
const FilterIndexSave&
a,
unsigned idxb) {
return std::get<kModuleIndex>(
a) < idxb; };
77 if (
found == allInterestingFilters_.end() || std::get<kModuleIndex>(*
found) != idx1)
80 if (
found == allInterestingFilters_.end() || std::get<kModuleIndex>(*
found) != idx2)
84 std::vector<FilterIndex> selectedFilters;
88 for (
const auto&
item : allInterestingFilters_) {
89 if (!doRefAnalysis || (doRefAnalysis && std::get<kSaveTags>(
item))) {
90 selectedFilters.emplace_back(std::get<kName>(
item), std::get<kType>(
item), std::get<kModuleIndex>(
item));
94 return selectedFilters;
99 if (
type ==
"PFRecoTauProducer" ||
type ==
"RecoTauPiZeroUnembedder") {
100 LogDebug(
"HLTTauDQMOffline") <<
"Found tau producer " <<
type <<
" with label " << producerLabel
101 <<
" from path " << name_;
109 if (
type ==
"EgammaHLTPixelMatchElectronProducers") {
110 LogDebug(
"HLTTauDQMOffline") <<
"Found electron producer " <<
type <<
" with label " << producerLabel
111 <<
" from path " << name_;
119 if (
type ==
"L3MuonCandidateProducer" ||
type ==
"L3MuonCombinedRelativeIsolationProducer") {
120 LogDebug(
"HLTTauDQMOffline") <<
"Found muon producer " <<
type <<
" with label " << producerLabel
121 <<
" from path " << name_;
129 if (
pset.exists(
"inputTag"))
131 if (
pset.exists(
"inputTag1"))
133 if (
pset.exists(
"inputTag2"))
140 if (
pset.exists(
"inputTag"))
142 if (
pset.exists(
"inputTag1"))
144 if (
pset.exists(
"inputTag2"))
151 if (
pset.exists(
"inputTag"))
153 if (
pset.exists(
"inputTag1"))
155 if (
pset.exists(
"inputTag2"))
163 for (
const auto&
filter : allInterestingFilters_) {
164 if (isL3TauFilter(HLTCP, std::get<kName>(
filter)))
165 return std::get<kModuleIndex>(
filter);
173 for (
const auto&
filter : allInterestingFilters_) {
174 if (isL3ElectronFilter(HLTCP, std::get<kName>(
filter)))
175 return std::get<kModuleIndex>(
filter);
183 for (
const auto&
filter : allInterestingFilters_) {
184 if (isL3MuonFilter(HLTCP, std::get<kName>(
filter)))
185 return std::get<kModuleIndex>(
filter);
195 std::vector<FilterIndexSave> allInterestingFilters_;
202 if (
pset.existsAs<
int>(parameterName))
203 return pset.getParameter<
int>(parameterName);
205 edm::LogWarning(
"HLTTauDQMOfflineSource") <<
"No parameter '" << parameterName <<
"' in configuration of filter "
211 struct TauLeptonMultiplicity {
223 TauLeptonMultiplicity
n;
225 if (moduleType ==
"HLTL1TSeed") {
227 if (
filterName.find(
"Single") != std::string::npos) {
228 if (
filterName.find(
"Mu") != std::string::npos) {
230 }
else if (
filterName.find(
"EG") != std::string::npos) {
233 }
else if (
filterName.find(
"Double") != std::string::npos &&
filterName.find(
"Tau") != std::string::npos) {
237 if (
filterName.find(
"Mu") != std::string::npos) {
241 if (
filterName.find(
"EG") != std::string::npos &&
filterName.find(
"Tau") != std::string::npos) {
245 if (
filterName.find(
"ETM") != std::string::npos) {
248 }
else if (moduleType ==
"HLT1CaloMET") {
253 }
else if (moduleType ==
"HLT1CaloJet") {
256 n.tau = getParameterSafe(HLTCP,
filterName,
"MinN");
258 }
else if (moduleType ==
"HLT1PFJet") {
264 n.tau = getParameterSafe(HLTCP,
filterName,
"MinN");
266 }
else if (moduleType ==
"HLTCaloJetTag") {
272 n.tau = getParameterSafe(HLTCP,
filterName,
"MinJets");
274 }
else if (moduleType ==
"HLT1Tau" || moduleType ==
"HLT1PFTau") {
277 n.tau = getParameterSafe(HLTCP,
filterName,
"MinN");
278 }
else if (moduleType ==
"HLTPFTauPairDzMatchFilter") {
281 }
else if (moduleType ==
"HLTEgammaGenericFilter") {
283 n.electron = getParameterSafe(HLTCP,
filterName,
"ncandcut");
284 }
else if (moduleType ==
"HLTElectronGenericFilter") {
287 n.electron = getParameterSafe(HLTCP,
filterName,
"ncandcut");
288 }
else if (moduleType ==
"HLTMuonL2PreFilter") {
291 n.muon = getParameterSafe(HLTCP,
filterName,
"MinN");
292 }
else if (moduleType ==
"HLTMuonIsoFilter" || moduleType ==
"HLTMuonL3PreFilter") {
294 n.muon = getParameterSafe(HLTCP,
filterName,
"MinN");
295 }
else if (moduleType ==
"HLTMuonGenericFilter") {
298 }
else if (moduleType ==
"HLT2ElectronTau" || moduleType ==
"HLT2ElectronPFTau" || moduleType ==
"HLT2PhotonTau" ||
299 moduleType ==
"HLT2PhotonPFTau") {
305 }
else if (moduleType ==
"HLT2MuonTau" || moduleType ==
"HLT2MuonPFTau") {
311 }
else if (moduleType ==
"HLTPrescaler") {
315 <<
"HLTTauDQMPath.cc, inferTauLeptonMultiplicity(): module type '" << moduleType
317 <<
"' will be ignored for offline matching." << std::endl;
322 template <
typename T1,
typename T2>
323 bool deltaRmatch(
const T1&
obj,
324 const std::vector<T2>& refColl,
326 std::vector<bool>& refMask,
327 std::vector<T2>& matchedRefs) {
328 double minDr = 2 *
dR;
329 size_t found = refColl.size();
331 for (
size_t i = 0;
i < refColl.size(); ++
i) {
342 if (
found < refColl.size()) {
343 matchedRefs.emplace_back(refColl[
found]);
344 refMask[
found] =
false;
356 doRefAnalysis_(doRefAnalysis),
358 pathIndex_(HLTCP.triggerIndex(pathName_)),
359 lastFilterBeforeL2TauIndex_(0),
360 lastL2TauFilterIndex_(0),
361 lastFilterBeforeL3TauIndex_(0),
362 lastL3TauFilterIndex_(0),
363 lastFilterBeforeL2ElectronIndex_(0),
364 lastL2ElectronFilterIndex_(0),
365 lastFilterBeforeL2MuonIndex_(0),
366 lastL2MuonFilterIndex_(0),
367 lastFilterBeforeL2METIndex_(0),
368 lastL2METFilterIndex_(0),
369 firstFilterBeforeL2METIndex_(0),
370 firstL2METFilterIndex_(0),
372 isFirstL1Seed_(
false),
375 std::stringstream
ss;
382 edm::LogInfo(
"HLTTauDQMOffline") <<
"HLTTauDQMPath: " <<
pathName_ <<
" no interesting filters found";
387 ss <<
" Interesting filters (preceded by the module index in the path)";
414 ss <<
"\n " <<
i <<
" " << std::get<kModuleIndex>(filterIndice) <<
" " <<
filterName <<
" " << moduleType
415 <<
" ntau " <<
n.tau <<
" nele " <<
n.electron <<
" nmu " <<
n.muon;
429 const size_t firstL3TauFilterIndex = thePath.firstL3TauFilterIndex(HLTCP);
431 edm::LogInfo(
"HLTTauDQMOffline") <<
"Did not find a filter with L3 tau producer as input in path " <<
pathName_;
433 const size_t firstL3ElectronFilterIndex = thePath.firstL3ElectronFilterIndex(HLTCP);
435 edm::LogInfo(
"HLTTauDQMOffline") <<
"Did not find a filter with L3 electron producer as input in path "
438 const size_t firstL3MuonFilterIndex = thePath.firstL3MuonFilterIndex(HLTCP);
440 edm::LogInfo(
"HLTTauDQMOffline") <<
"Did not find a filter with L3 muon producer as input in path " <<
pathName_;
567 std::vector<Object>& retval)
const {
573 for (
size_t i = 0;
i <
keys.size(); ++
i) {
584 std::vector<Object>& matchedTriggerObjects,
587 std::vector<bool> offlineMask;
589 int matchedObjects = 0;
590 offlineMask.resize(offlineObjects.
taus.size());
591 std::fill(offlineMask.begin(), offlineMask.end(),
true);
596 if (deltaRmatch(trgObj.object, offlineObjects.
taus,
dR, offlineMask, matchedOfflineObjects.
taus)) {
598 matchedTriggerObjects.emplace_back(trgObj);
606 int matchedObjects = 0;
607 offlineMask.resize(offlineObjects.
electrons.size());
608 std::fill(offlineMask.begin(), offlineMask.end(),
true);
614 if (deltaRmatch(trgObj.object, offlineObjects.
electrons,
dR, offlineMask, matchedOfflineObjects.
electrons)) {
616 matchedTriggerObjects.emplace_back(trgObj);
623 int matchedObjects = 0;
624 offlineMask.resize(offlineObjects.
muons.size());
625 std::fill(offlineMask.begin(), offlineMask.end(),
true);
630 if (deltaRmatch(trgObj.object, offlineObjects.
muons,
dR, offlineMask, matchedOfflineObjects.
muons)) {
632 matchedTriggerObjects.emplace_back(trgObj);
639 int matchedObjects = 0;
640 offlineMask.resize(offlineObjects.
met.size());
641 std::fill(offlineMask.begin(), offlineMask.end(),
true);
647 matchedTriggerObjects.emplace_back(trgObj);
655 std::sort(matchedOfflineObjects.
taus.begin(), matchedOfflineObjects.
taus.end(), [](
const LV&
a,
const LV&
b) {
656 return a.pt() >
b.pt();
658 std::sort(matchedOfflineObjects.
electrons.begin(),
660 [](
const LV&
a,
const LV&
b) {
return a.pt() >
b.pt(); });
661 std::sort(matchedOfflineObjects.
muons.begin(), matchedOfflineObjects.
muons.end(), [](
const LV&
a,
const LV&
b) {
662 return a.pt() >
b.pt();
664 matchedOfflineObjects.
met = offlineObjects.
met;