26 const unsigned int kNull = (
unsigned int)-1;
33 const std::vector<string> &moduleLabels,
34 const std::vector<string> &stepLabels,
39 : l1Matcher_(l1Matcher) {
45 cutsDr_ =
pset.getParameter<vector<double>>(
"cutsDr");
68 if (
hltPath_.find(
"eta2p1") != string::npos)
73 TPRegexp ptRegexp(
"Mu([0-9]+)");
74 TObjArray *regexArray = ptRegexp.MatchS(
hltPath_);
75 if (regexArray->GetEntriesFast() == 2) {
76 threshold = atoi(((TObjString *)regexArray->At(1))->GetString());
86 string baseDir =
"HLT/Muon/Distributions/";
110 LogTrace(
"HLTMuonVal") <<
"In HLTMuonPlotter::analyze, " 111 <<
"Event: " <<
iEvent.id();
123 LogError(
"HLTMuonVal") <<
"No trigger summary found";
135 for (
size_t sourceNo = 0; sourceNo <
sources.size(); sourceNo++) {
151 for (
size_t i = 0;
i < recMuons->size();
i++)
158 const bool isDoubleMuonPath = (
hltPath_.find(
"Double") != string::npos);
161 const size_t nStepsHlt = nSteps - 2;
162 const int nObjectsToPassPath = (isDoubleMuonPath) ? 2 : 1;
164 vector<vector<RecoChargedCandidateRef>> refsHlt(nStepsHlt);
165 vector<vector<const RecoChargedCandidate *>> candsHlt(nStepsHlt);
167 for (
size_t i = 0;
i < nFilters;
i++) {
168 const int hltStep =
i - 1;
171 if (iFilter < rawTriggerEvent->
size()) {
177 LogTrace(
"HLTMuonVal") <<
"No collection with label " <<
tag;
179 for (
size_t i = 0;
i < nStepsHlt;
i++)
180 for (
size_t j = 0;
j < refsHlt[
i].size();
j++)
181 if (refsHlt[
i][
j].isAvailable()) {
182 candsHlt[
i].push_back(&*refsHlt[
i][
j]);
184 LogWarning(
"HLTMuonPlotter") <<
"Ref refsHlt[i][j]: product not available " <<
i <<
" " <<
j;
190 vector<size_t> matchesInEtaRange;
191 vector<bool> hasMatch(
matches.size(),
true);
194 size_t hltStep = (
step >= 2) ?
step - 2 : 0;
196 hltStep = hltStep - 1;
216 matchesInEtaRange.push_back(
j);
217 }
else if (
level == 1) {
220 }
else if (
level >= 2) {
221 if (
matches[
j].candHlt[hltStep] ==
nullptr)
223 else if (!hasMatch[
j]) {
224 LogTrace(
"HLTMuonVal") <<
"Match found for HLT step " << hltStep <<
" of " << nStepsHlt
225 <<
" without previous match!";
231 if (
std::count(hasMatch.begin(), hasMatch.end(),
true) < nObjectsToPassPath)
234 string pre =
source +
"Pass";
242 if (!matchesInEtaRange.empty() &&
j == matchesInEtaRange[0])
244 if (matchesInEtaRange.size() >= 2 &&
j == matchesInEtaRange[1])
260 const std::vector<vector<const RecoChargedCandidate *>> &candsHlt) {
261 set<size_t>::iterator it;
263 set<size_t> indicesL1;
264 for (
size_t i = 0;
i < candsL1.size();
i++)
267 vector<set<size_t>> indicesHlt(candsHlt.size());
268 for (
size_t i = 0;
i < candsHlt.size();
i++)
269 for (
size_t j = 0;
j < candsHlt[
i].size();
j++)
275 double bestDeltaR =
cutsDr_[0];
277 for (it = indicesL1.begin(); it != indicesL1.end(); it++) {
278 if (candsL1[*it].isAvailable()) {
279 double dR =
deltaR(
cand->eta(),
cand->phi(), candsL1[*it]->eta(), candsL1[*it]->phi());
280 if (
dR < bestDeltaR) {
293 LogWarning(
"HLTMuonPlotter") <<
"Ref candsL1[*it]: product not available " << *it;
301 matches[
i].candHlt.assign(candsHlt.size(),
nullptr);
302 for (
size_t j = 0;
j < candsHlt.size();
j++) {
303 size_t level = (candsHlt.size() == 4) ? (
j < 2) ? 2 : 3 : (candsHlt.size() == 2) ? (
j < 1) ? 2 : 3 : 2;
306 for (it = indicesHlt[
j].begin(); it != indicesHlt[
j].end(); it++) {
307 double dR =
deltaR(
cand->eta(),
cand->phi(), candsHlt[
j][*it]->eta(), candsHlt[
j][*it]->phi());
308 if (
dR < bestDeltaR) {
329 string sourceUpper =
source;
330 sourceUpper[0] = toupper(sourceUpper[0]);
334 if (
type.find(
"MaxPt") != string::npos) {
335 string desc = (
type ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
336 string title =
"pT of " +
desc +
" " + sourceUpper +
" Muon " +
"matched to " +
label;
339 for (
size_t i = 0;
i <
nBins + 1;
i++)
345 string symbol = (
type ==
"Eta") ?
"#eta" :
"#phi";
346 string title = symbol +
" of " + sourceUpper +
" Muons " +
"matched to " +
label;
constexpr int32_t ceil(float num)
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
virtual void setCurrentFolder(std::string const &fullpath)
enum start value shifted to 81 so as to avoid clashes with PDG codes
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
std::vector< double > parametersEta_
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
HLTMuonPlotter(const edm::ParameterSet &, std::string, const std::vector< std::string > &, const std::vector< std::string > &, const edm::EDGetTokenT< trigger::TriggerEventWithRefs > &, const edm::EDGetTokenT< reco::GenParticleCollection > &, const edm::EDGetTokenT< reco::MuonCollection > &, const L1MuonMatcherAlgoForDQM &)
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
std::vector< std::string > moduleLabels_
void findMatches(std::vector< MatchStruct > &, const l1t::MuonVectorRef &candsL1, const std::vector< std::vector< const reco::RecoChargedCandidate *>> &)
std::vector< MuonRef > MuonVectorRef
vector< ParameterSet > Parameters
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
std::vector< double > cutsDr_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
edm::EDGetTokenT< reco::MuonCollection > recMuonLabel_
void analyze(const edm::Event &, const edm::EventSetup &)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
StringCutObjectSelector< reco::GenParticle > * genMuonSelector_
std::vector< std::string > stepLabels_
void bookHist(DQMStore::IBooker &, std::string, std::string, std::string, std::string)
def bestMatch(object, matchCollection)
L1MuonMatcherAlgoForDQM l1Matcher_
StringCutObjectSelector< reco::Muon > * recMuonSelector_
std::vector< double > parametersPhi_
std::map< std::string, MonitorElement * > elements_
std::string hltProcessName_
Log< level::Warning, false > LogWarning
edm::EDGetTokenT< reco::GenParticleCollection > genParticleLabel_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
edm::EDGetTokenT< trigger::TriggerEventWithRefs > hltTriggerSummaryRAW_
std::vector< double > parametersTurnOn_
static std::string const source
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type