|
|
Go to the documentation of this file.
29 const std::vector<string> &moduleLabels,
30 const std::vector<string> &stepLabels,
42 cutsDr_ =
pset.getParameter<vector<double>>(
"cutsDr");
69 if (
hltPath_.find(
"eta2p1") != string::npos)
74 TPRegexp ptRegexp(
"Mu([0-9]+)");
75 TObjArray *regexArray = ptRegexp.MatchS(
hltPath_);
76 if (regexArray->GetEntriesFast() == 2) {
77 threshold = atoi(((TObjString *)regexArray->At(1))->GetString());
87 string baseDir =
"HLT/Muon/Distributions/";
111 static int eventNumber = 0;
113 LogTrace(
"HLTMuonVal") <<
"In HLTMuonPlotter::analyze, "
114 <<
"Event: " << eventNumber;
126 LogError(
"HLTMuonVal") <<
"No trigger summary found";
138 for (
size_t sourceNo = 0; sourceNo <
sources.size(); sourceNo++) {
154 for (
size_t i = 0;
i < recMuons->size();
i++)
161 const bool isDoubleMuonPath = (
hltPath_.find(
"Double") != string::npos);
164 const size_t nStepsHlt = nSteps - 2;
165 const int nObjectsToPassPath = (isDoubleMuonPath) ? 2 : 1;
167 vector<vector<RecoChargedCandidateRef>> refsHlt(nStepsHlt);
168 vector<vector<const RecoChargedCandidate *>> candsHlt(nStepsHlt);
170 for (
size_t i = 0;
i < nFilters;
i++) {
171 const int hltStep =
i - 1;
174 if (iFilter < rawTriggerEvent->
size()) {
180 LogTrace(
"HLTMuonVal") <<
"No collection with label " <<
tag;
182 for (
size_t i = 0;
i < nStepsHlt;
i++)
183 for (
size_t j = 0;
j < refsHlt[
i].size();
j++)
184 if (refsHlt[
i][
j].isAvailable()) {
185 candsHlt[
i].push_back(&*refsHlt[
i][
j]);
187 LogWarning(
"HLTMuonPlotter") <<
"Ref refsHlt[i][j]: product not available " <<
i <<
" " <<
j;
193 vector<size_t> matchesInEtaRange;
194 vector<bool> hasMatch(
matches.size(),
true);
197 size_t hltStep = (
step >= 2) ?
step - 2 : 0;
199 hltStep = hltStep - 1;
219 matchesInEtaRange.push_back(
j);
220 }
else if (
level == 1) {
223 }
else if (
level >= 2) {
224 if (
matches[
j].candHlt[hltStep] ==
nullptr)
226 else if (!hasMatch[
j]) {
227 LogTrace(
"HLTMuonVal") <<
"Match found for HLT step " << hltStep <<
" of " << nStepsHlt
228 <<
" without previous match!";
234 if (
std::count(hasMatch.begin(), hasMatch.end(),
true) < nObjectsToPassPath)
237 string pre =
source +
"Pass";
245 if (!matchesInEtaRange.empty() &&
j == matchesInEtaRange[0])
247 if (matchesInEtaRange.size() >= 2 &&
j == matchesInEtaRange[1])
261 std::tuple<edm::EDGetTokenT<trigger::TriggerEventWithRefs>,
272 std::tuple<edm::EDGetTokenT<trigger::TriggerEventWithRefs>,
275 myTuple(_hltTriggerSummaryRAW, _genParticleLabel, _recMuonLabel);
282 const std::vector<vector<const RecoChargedCandidate *>> &candsHlt) {
283 set<size_t>::iterator it;
285 set<size_t> indicesL1;
286 for (
size_t i = 0;
i < candsL1.size();
i++)
289 vector<set<size_t>> indicesHlt(candsHlt.size());
290 for (
size_t i = 0;
i < candsHlt.size();
i++)
291 for (
size_t j = 0;
j < candsHlt[
i].size();
j++)
297 double bestDeltaR =
cutsDr_[0];
299 for (it = indicesL1.begin(); it != indicesL1.end(); it++) {
300 if (candsL1[*it].isAvailable()) {
301 double dR =
deltaR(
cand->eta(),
cand->phi(), candsL1[*it]->eta(), candsL1[*it]->phi());
302 if (
dR < bestDeltaR) {
315 LogWarning(
"HLTMuonPlotter") <<
"Ref candsL1[*it]: product not available " << *it;
323 matches[
i].candHlt.assign(candsHlt.size(),
nullptr);
324 for (
size_t j = 0;
j < candsHlt.size();
j++) {
325 size_t level = (candsHlt.size() == 4) ? (
j < 2) ? 2 : 3 : (candsHlt.size() == 2) ? (
j < 1) ? 2 : 3 : 2;
328 for (it = indicesHlt[
j].
begin(); it != indicesHlt[
j].end(); it++) {
329 double dR =
deltaR(
cand->eta(),
cand->phi(), candsHlt[
j][*it]->eta(), candsHlt[
j][*it]->phi());
330 if (
dR < bestDeltaR) {
351 string sourceUpper =
source;
352 sourceUpper[0] = toupper(sourceUpper[0]);
356 if (
type.find(
"MaxPt") != string::npos) {
357 string desc = (
type ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
358 string title =
"pT of " + desc +
" " + sourceUpper +
" Muon " +
"matched to " +
label;
361 for (
size_t i = 0;
i <
nBins + 1;
i++)
367 string symbol = (
type ==
"Eta") ?
"#eta" :
"#phi";
368 string title = symbol +
" of " + sourceUpper +
" Muons " +
"matched to " +
label;
std::vector< double > parametersEta_
HLTMuonPlotter(const edm::ParameterSet &, std::string, const std::vector< std::string > &, const std::vector< std::string > &, const std::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection >> &)
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< std::string > moduleLabels_
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
virtual void setCurrentFolder(std::string const &fullpath)
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
edm::EDGetTokenT< trigger::TriggerEventWithRefs > hltTriggerSummaryRAW_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
def bestMatch(object, matchCollection)
static std::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection > > getTokens(const edm::ParameterSet &, edm::ConsumesCollector &&)
constexpr int32_t ceil(float num)
std::vector< Muon > MuonCollection
collection of Muon objects
static const std::string source
std::vector< std::string > stepLabels_
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
std::string hltProcessName_
enum start value shifted to 81 so as to avoid clashes with PDG codes
StringCutObjectSelector< reco::Muon > * recMuonSelector_
StringCutObjectSelector< reco::GenParticle > * genMuonSelector_
edm::EDGetTokenT< reco::GenParticleCollection > genParticleLabel_
edm::EDGetTokenT< reco::MuonCollection > recMuonLabel_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
L1MuonMatcherAlgo l1Matcher_
std::vector< double > cutsDr_
std::map< std::string, MonitorElement * > elements_
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
std::vector< MuonRef > MuonVectorRef
void analyze(const edm::Event &, const edm::EventSetup &)
void bookHist(DQMStore::IBooker &, std::string, std::string, std::string, std::string)
void findMatches(std::vector< MatchStruct > &, const l1t::MuonVectorRef &candsL1, const std::vector< std::vector< const reco::RecoChargedCandidate * >> &)
vector< ParameterSet > Parameters
void init(const edm::EventSetup &iSetup)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::vector< double > parametersPhi_
std::vector< double > parametersTurnOn_