37 const std::vector<string>& moduleLabels,
38 const std::vector<string>& stepLabels,
92 if (
hltPath_.find(
"eta2p1") != string::npos)
97 TPRegexp ptRegexp(
"Mu([0-9]+)");
98 TObjArray * regexArray = ptRegexp.MatchS(
hltPath_);
99 if (regexArray->GetEntriesFast() == 2) {
100 threshold = atoi(((TObjString *)regexArray->At(1))->GetString());
106 cutMinPt_ = ceil(threshold * 1.1) - 0.01;
109 string baseDir =
"HLT/Muon/Distributions/";
112 vector<string> sources(2);
121 for (
size_t i = 0;
i < sources.size();
i++) {
139 static int eventNumber = 0;
141 LogTrace(
"HLTMuonVal") <<
"In HLTMuonPlotter::analyze, " 142 <<
"Event: " << eventNumber;
154 {
LogError(
"HLTMuonVal") <<
"No trigger summary found";
return;}
158 vector<string> sources;
159 if (genParticles.
isValid()) sources.push_back(
"gen");
160 if ( recMuons.
isValid()) sources.push_back(
"rec");
162 for (
size_t sourceNo = 0; sourceNo < sources.size(); sourceNo++) {
164 string source = sources[sourceNo];
174 if (source ==
"gen" && genParticles.
isValid())
175 for (
size_t i = 0;
i < genParticles->size();
i++)
178 if (source ==
"rec" && recMuons.
isValid())
179 for (
size_t i = 0;
i < recMuons->size();
i++)
186 const bool isDoubleMuonPath = (
hltPath_.find(
"Double") != string::npos);
189 const size_t nStepsHlt = nSteps - 2;
190 const int nObjectsToPassPath = (isDoubleMuonPath) ? 2 : 1;
192 vector< vector< RecoChargedCandidateRef > > refsHlt(nStepsHlt);
193 vector< vector< const RecoChargedCandidate * > > candsHlt(nStepsHlt);
195 for (
size_t i = 0;
i < nFilters;
i++) {
196 const int hltStep =
i - 1;
198 size_t iFilter = rawTriggerEvent->
filterIndex(tag);
199 if (iFilter < rawTriggerEvent->
size()) {
206 else LogTrace(
"HLTMuonVal") <<
"No collection with label " <<
tag;
208 for (
size_t i = 0;
i < nStepsHlt;
i++)
209 for (
size_t j = 0; j < refsHlt[
i].size(); j++)
210 if (refsHlt[
i][j].isAvailable()) {
211 candsHlt[
i].push_back(& * refsHlt[
i][j]);
214 <<
"Ref refsHlt[i][j]: product not available " 221 vector<size_t> matchesInEtaRange;
222 vector<bool> hasMatch(matches.size(),
true);
226 size_t hltStep = (
step >= 2) ?
step - 2 : 0;
227 if (nSteps == 6) hltStep=hltStep-1;
236 for (
size_t j = 0; j < matches.size(); j++) {
238 if (fabs(matches[j].candBase->eta()) <
cutMaxEta_)
239 matchesInEtaRange.push_back(j);
241 else if (level == 1) {
242 if (matches[j].candL1 == 0)
245 else if (level >= 2) {
246 if (matches[j].candHlt[hltStep] == 0)
248 else if (!hasMatch[j]) {
249 LogTrace(
"HLTMuonVal") <<
"Match found for HLT step " << hltStep
250 <<
" of " << nStepsHlt
251 <<
" without previous match!";
257 if (
std::count(hasMatch.begin(), hasMatch.end(),
true) <
261 string pre = source +
"Pass";
264 for (
size_t j = 0; j < matches.size(); j++) {
265 float pt = matches[j].candBase->pt();
266 float eta = matches[j].candBase->eta();
267 float phi = matches[j].candBase->phi();
269 if (matchesInEtaRange.size() >= 1 && j == matchesInEtaRange[0])
271 if (matchesInEtaRange.size() >= 2 && j == matchesInEtaRange[1])
274 elements_[pre +
"Eta" + post]->Fill(eta);
276 elements_[pre +
"Phi" + post]->Fill(phi);
315 const std::vector< vector< const RecoChargedCandidate *> >& candsHlt)
318 set<size_t>::iterator it;
320 set<size_t> indicesL1;
321 for (
size_t i = 0;
i < candsL1.size();
i++)
324 vector< set<size_t> > indicesHlt(candsHlt.size());
325 for (
size_t i = 0;
i < candsHlt.size();
i++)
326 for (
size_t j = 0; j < candsHlt[
i].size(); j++)
329 for (
size_t i = 0;
i < matches.size();
i++) {
333 double bestDeltaR =
cutsDr_[0];
335 for (it = indicesL1.begin(); it != indicesL1.end(); it++) {
336 if (candsL1[*it].isAvailable()) {
338 candsL1[*it]->eta(), candsL1[*it]->phi());
339 if (dR < bestDeltaR) {
353 <<
"Ref candsL1[*it]: product not available " 359 if (bestMatch !=
kNull)
361 indicesL1.erase(bestMatch);
363 matches[
i].candHlt.assign(candsHlt.size(), 0);
364 for (
size_t j = 0; j < candsHlt.size(); j++) {
365 size_t level = (candsHlt.size() == 4) ? (j < 2) ? 2 : 3 :
366 (candsHlt.size() == 2) ? (j < 1) ? 2 : 3 :
368 bestDeltaR =
cutsDr_[level - 2];
370 for (it = indicesHlt[j].
begin(); it != indicesHlt[j].end(); it++) {
372 candsHlt[j][*it]->eta(), candsHlt[j][*it]->phi());
373 if (dR < bestDeltaR) {
378 if (bestMatch !=
kNull)
379 matches[
i].candHlt[j] = candsHlt[j][
bestMatch];
380 indicesHlt[j].erase(bestMatch);
404 string sourceUpper =
source;
405 sourceUpper[0] = toupper(sourceUpper[0]);
406 string name = source +
"Pass" + type +
"_" +
label;
409 if (type.find(
"MaxPt") != string::npos) {
410 string desc = (type ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
411 string title =
"pT of " + desc +
" " + sourceUpper +
" Muon "+
412 "matched to " +
label;
414 float * edges =
new float[nBins + 1];
416 h =
new TH1F(name.c_str(), title.c_str(), nBins, edges);
420 string symbol = (type ==
"Eta") ?
"#eta" :
"#phi";
421 string title = symbol +
" of " + sourceUpper +
" Muons " +
422 "matched to " +
label;
424 int nBins = (
int)params[0];
425 double min = params[1];
426 double max = params[2];
427 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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_
L1MuonMatcherAlgo l1Matcher_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::string > moduleLabels_
std::vector< MuonRef > MuonVectorRef
std::vector< Muon > MuonCollection
collection of Muon objects
static boost::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection > > getTokens(const edm::ParameterSet &, edm::ConsumesCollector &&)
vector< ParameterSet > Parameters
StringCutObjectSelector< reco::Muon > * recMuonSelector_
std::vector< double > cutsDr_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
edm::EDGetTokenT< reco::MuonCollection > recMuonLabel_
MonitorElement * book1D(Args &&...args)
void analyze(const edm::Event &, const edm::EventSetup &)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
StringCutObjectSelector< reco::GenParticle > * genMuonSelector_
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< std::string > stepLabels_
virtual double eta() const =0
momentum pseudorapidity
void setCurrentFolder(const std::string &fullpath)
void bookHist(DQMStore::IBooker &, std::string, std::string, std::string, std::string)
def bestMatch(object, matchCollection)
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
std::vector< double > parametersPhi_
MonitorElement * bookFloat(Args &&...args)
std::map< std::string, MonitorElement * > elements_
std::string hltProcessName_
edm::EDGetTokenT< reco::GenParticleCollection > genParticleLabel_
void findMatches(std::vector< MatchStruct > &, const l1t::MuonVectorRef &candsL1, const std::vector< std::vector< const reco::RecoChargedCandidate * > > &)
HLTMuonPlotter(const edm::ParameterSet &, std::string, const std::vector< std::string > &, const std::vector< std::string > &, const boost::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection > > &)
edm::EDGetTokenT< trigger::TriggerEventWithRefs > hltTriggerSummaryRAW_
std::vector< double > parametersTurnOn_
virtual double phi() const =0
momentum azimuthal angle
static std::string const source