|
|
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");
66 if (
hltPath_.find(
"eta2p1") != string::npos)
71 TPRegexp ptRegexp(
"Mu([0-9]+)");
72 TObjArray *regexArray = ptRegexp.MatchS(
hltPath_);
73 if (regexArray->GetEntriesFast() == 2) {
74 threshold = atoi(((TObjString *)regexArray->At(1))->GetString());
84 string baseDir =
"HLT/Muon/Distributions/";
108 LogTrace(
"HLTMuonVal") <<
"In HLTMuonPlotter::analyze, "
109 <<
"Event: " <<
iEvent.id();
121 LogError(
"HLTMuonVal") <<
"No trigger summary found";
133 for (
size_t sourceNo = 0; sourceNo <
sources.size(); sourceNo++) {
149 for (
size_t i = 0;
i < recMuons->size();
i++)
156 const bool isDoubleMuonPath = (
hltPath_.find(
"Double") != string::npos);
159 const size_t nStepsHlt = nSteps - 2;
160 const int nObjectsToPassPath = (isDoubleMuonPath) ? 2 : 1;
162 vector<vector<RecoChargedCandidateRef>> refsHlt(nStepsHlt);
163 vector<vector<const RecoChargedCandidate *>> candsHlt(nStepsHlt);
165 for (
size_t i = 0;
i < nFilters;
i++) {
166 const int hltStep =
i - 1;
169 if (iFilter < rawTriggerEvent->
size()) {
175 LogTrace(
"HLTMuonVal") <<
"No collection with label " <<
tag;
177 for (
size_t i = 0;
i < nStepsHlt;
i++)
178 for (
size_t j = 0;
j < refsHlt[
i].size();
j++)
179 if (refsHlt[
i][
j].isAvailable()) {
180 candsHlt[
i].push_back(&*refsHlt[
i][
j]);
182 LogWarning(
"HLTMuonPlotter") <<
"Ref refsHlt[i][j]: product not available " <<
i <<
" " <<
j;
188 vector<size_t> matchesInEtaRange;
189 vector<bool> hasMatch(
matches.size(),
true);
192 size_t hltStep = (
step >= 2) ?
step - 2 : 0;
194 hltStep = hltStep - 1;
214 matchesInEtaRange.push_back(
j);
215 }
else if (
level == 1) {
218 }
else if (
level >= 2) {
219 if (
matches[
j].candHlt[hltStep] ==
nullptr)
221 else if (!hasMatch[
j]) {
222 LogTrace(
"HLTMuonVal") <<
"Match found for HLT step " << hltStep <<
" of " << nStepsHlt
223 <<
" without previous match!";
229 if (
std::count(hasMatch.begin(), hasMatch.end(),
true) < nObjectsToPassPath)
232 string pre =
source +
"Pass";
240 if (!matchesInEtaRange.empty() &&
j == matchesInEtaRange[0])
242 if (matchesInEtaRange.size() >= 2 &&
j == matchesInEtaRange[1])
256 std::tuple<edm::EDGetTokenT<trigger::TriggerEventWithRefs>,
267 std::tuple<edm::EDGetTokenT<trigger::TriggerEventWithRefs>,
270 myTuple(_hltTriggerSummaryRAW, _genParticleLabel, _recMuonLabel);
277 const std::vector<vector<const RecoChargedCandidate *>> &candsHlt) {
278 set<size_t>::iterator it;
280 set<size_t> indicesL1;
281 for (
size_t i = 0;
i < candsL1.size();
i++)
284 vector<set<size_t>> indicesHlt(candsHlt.size());
285 for (
size_t i = 0;
i < candsHlt.size();
i++)
286 for (
size_t j = 0;
j < candsHlt[
i].size();
j++)
292 double bestDeltaR =
cutsDr_[0];
294 for (it = indicesL1.begin(); it != indicesL1.end(); it++) {
295 if (candsL1[*it].isAvailable()) {
296 double dR =
deltaR(
cand->eta(),
cand->phi(), candsL1[*it]->eta(), candsL1[*it]->phi());
297 if (
dR < bestDeltaR) {
310 LogWarning(
"HLTMuonPlotter") <<
"Ref candsL1[*it]: product not available " << *it;
318 matches[
i].candHlt.assign(candsHlt.size(),
nullptr);
319 for (
size_t j = 0;
j < candsHlt.size();
j++) {
320 size_t level = (candsHlt.size() == 4) ? (
j < 2) ? 2 : 3 : (candsHlt.size() == 2) ? (
j < 1) ? 2 : 3 : 2;
323 for (it = indicesHlt[
j].begin(); it != indicesHlt[
j].end(); it++) {
324 double dR =
deltaR(
cand->eta(),
cand->phi(), candsHlt[
j][*it]->eta(), candsHlt[
j][*it]->phi());
325 if (
dR < bestDeltaR) {
346 string sourceUpper =
source;
347 sourceUpper[0] = toupper(sourceUpper[0]);
351 if (
type.find(
"MaxPt") != string::npos) {
352 string desc = (
type ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
353 string title =
"pT of " +
desc +
" " + sourceUpper +
" Muon " +
"matched to " +
label;
356 for (
size_t i = 0;
i <
nBins + 1;
i++)
362 string symbol = (
type ==
"Eta") ?
"#eta" :
"#phi";
363 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())
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
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)
Log< level::Warning, false > LogWarning
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_
Log< level::Error, false > LogError
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_