Skip to content

Commit 4f83a78

Browse files
authored
Merge pull request #6 from JavierGarciadeCastro/dev_15_0_X-ScoutingDQM
Offline Scouting Muon DQM
2 parents 53f6025 + 2efc2d6 commit 4f83a78

9 files changed

+135
-183
lines changed

HLTriggerOffline/Scouting/plugins/BuildFile.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
<use name="TrackingTools/Records"/>
1212
<use name="HLTrigger/HLTcore"/>
1313
<use name="DataFormats/HLTReco"/>
14-
<flags EDM_PLUGIN="1"/>
14+
<flags EDM_PLUGIN="1"/>

HLTriggerOffline/Scouting/plugins/ScoutingMuonTagProbeAnalyzer.cc

Lines changed: 31 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1+
/*
2+
Scouting Muon DQM core implementation. This code does the following:
3+
1) Reads muon collection, scouting muon collection and scouting vertex collection
4+
2) Tag and Probe method: For each event, check whether one of the muons passes a tight ID
5+
(tag), and pair it with another muon in the event (probe). If this dimuon system is
6+
within the mass range of the J/Psi, monitor distributions of the probe and the efficiency
7+
of the probe to pass certain IDs. For now we are measuring the efficiency of the probe
8+
passing the tag ID (If the dimuon system is within J/Psi, add it to the denominator
9+
distributions, and if the probe passes the tag ID, add it to the numerator distributions
10+
as well.)
11+
3) Fills histograms
12+
Author: Javier Garcia de Castro, email:[email protected]
13+
*/
14+
15+
//Files to include
116
#include "ScoutingMuonTagProbeAnalyzer.h"
217
#include "FWCore/MessageLogger/interface/MessageLogger.h"
318
#include <iostream>
419
#include <cmath>
520

621
ScoutingMuonTagProbeAnalyzer::ScoutingMuonTagProbeAnalyzer(const edm::ParameterSet& iConfig)
722
: outputInternalPath_(iConfig.getParameter<std::string>("OutputInternalPath")),
8-
muonCollection_(consumes<std::vector<pat::Muon>>(iConfig.getParameter<edm::InputTag>("MuonCollection"))),
923
scoutingMuonCollection_(
1024
consumes<std::vector<Run3ScoutingMuon>>(iConfig.getParameter<edm::InputTag>("ScoutingMuonCollection"))),
1125
scoutingVtxCollection_(
@@ -17,33 +31,29 @@ ScoutingMuonTagProbeAnalyzer::~ScoutingMuonTagProbeAnalyzer() {}
1731
void ScoutingMuonTagProbeAnalyzer::dqmAnalyze(edm::Event const& iEvent,
1832
edm::EventSetup const& iSetup,
1933
kTagProbeMuonHistos const& histos) const {
20-
edm::Handle<std::vector<pat::Muon>> patMuons;
21-
iEvent.getByToken(muonCollection_, patMuons);
22-
if (patMuons.failedToGet()) {
23-
edm::LogWarning("ScoutingMonitoring") << "pat::Muon collection not found.";
24-
return;
25-
}
26-
34+
//Read scouting muon collection
2735
edm::Handle<std::vector<Run3ScoutingMuon>> sctMuons;
2836
iEvent.getByToken(scoutingMuonCollection_, sctMuons);
2937
if (sctMuons.failedToGet()) {
3038
edm::LogWarning("ScoutingMonitoring") << "Run3ScoutingMuon collection not found.";
3139
return;
3240
}
3341

42+
//Read scouting vertex collection
3443
edm::Handle<std::vector<Run3ScoutingVertex>> sctVertex;
3544
iEvent.getByToken(scoutingVtxCollection_, sctVertex);
3645
if (sctVertex.failedToGet()) {
3746
edm::LogWarning("ScoutingMonitoring") << "Run3ScoutingVertex collection not found.";
3847
return;
3948
}
4049

41-
edm::LogInfo("ScoutingMonitoring") << "Process pat::Muons: " << patMuons->size();
4250
edm::LogInfo("ScoutingMonitoring") << "Process Run3ScoutingMuons: " << sctMuons->size();
4351

4452
edm::LogInfo("ScoutingMonitoring") << "Process Run3ScoutingVertex: " << sctVertex->size();
4553

54+
//Core of Tag and Probe implementation
4655
bool foundTag = false;
56+
//First find the tag
4757
for (const auto& sct_mu : *sctMuons) {
4858
if (!scoutingMuonID(sct_mu))
4959
continue;
@@ -52,6 +62,7 @@ void ScoutingMuonTagProbeAnalyzer::dqmAnalyze(edm::Event const& iEvent,
5262
math::PtEtaPhiMLorentzVector tag_sct_mu(sct_mu.pt(), sct_mu.eta(), sct_mu.phi(), sct_mu.m());
5363
const std::vector<int> vtxIndx_tag = sct_mu.vtxIndx();
5464

65+
//Then pair the tag with the probe
5566
for (const auto& sct_mu_second : *sctMuons) {
5667
if (&sct_mu_second == &sct_mu)
5768
continue;
@@ -63,12 +74,16 @@ void ScoutingMuonTagProbeAnalyzer::dqmAnalyze(edm::Event const& iEvent,
6374

6475
float invMass = (tag_sct_mu + probe_sct_mu).mass();
6576
edm::LogInfo("ScoutingMonitoring") << "Inv Mass: " << invMass;
77+
//If dimuon system comes from J/Psi, process event
6678
if ((2.4 < invMass && invMass < 3.8)) {
79+
//Boolean added because hltScoutingMuonPackerVtx collection doesn't have vertices for the moment
6780
if (runWithoutVtx_) {
6881
Run3ScoutingVertex vertex;
82+
//If probe passes tag ID, add it to the numerator
6983
if (scoutingMuonID(sct_mu_second)) {
7084
fillHistograms_resonance(histos.resonanceJ_numerator, sct_mu_second, vertex, invMass, -99.);
7185
}
86+
//Add all events to the denominator
7287
fillHistograms_resonance(histos.resonanceJ_denominator, sct_mu_second, vertex, invMass, -99.);
7388
} else {
7489
if (vtxIndx_tag.empty() || vtxIndx_probe.empty())
@@ -84,14 +99,13 @@ void ScoutingMuonTagProbeAnalyzer::dqmAnalyze(edm::Event const& iEvent,
8499
}
85100
}
86101
}
87-
} else {
88-
//fillHistograms_resonance(histos.resonanceAll, sct_mu_second, invMass);
89102
}
90103
}
91104
foundTag = true;
92105
}
93106
}
94107

108+
//Tag ID
95109
bool ScoutingMuonTagProbeAnalyzer::scoutingMuonID(const Run3ScoutingMuon mu) const {
96110
math::PtEtaPhiMLorentzVector particle(mu.pt(), mu.eta(), mu.phi(), 0.10566);
97111
double normchisq_threshold = 3.0;
@@ -105,6 +119,8 @@ bool ScoutingMuonTagProbeAnalyzer::scoutingMuonID(const Run3ScoutingMuon mu) con
105119
}
106120
return false;
107121
}
122+
123+
//Fill histograms
108124
void ScoutingMuonTagProbeAnalyzer::fillHistograms_resonance(const kProbeKinematicMuonHistos histos,
109125
const Run3ScoutingMuon mu,
110126
const Run3ScoutingVertex vertex,
@@ -151,20 +167,7 @@ void ScoutingMuonTagProbeAnalyzer::fillHistograms_resonance(const kProbeKinemati
151167
histos.hnPixel->Fill(mu.nPixelLayersWithMeasurement());
152168
histos.hnTracker->Fill(mu.nTrackerLayersWithMeasurement());
153169
histos.htrk_qoverp->Fill(mu.trk_qoverp());
154-
//histos.htrk_phi->Fill(mu.trk_phi());
155-
//histos.hrecoMuonStationMask->Fill(mu.recoMuonStationMask());
156-
//histos.hnRecoMuonMatchedRPCLayers->Fill(mu.nRecoMuonMatchedRPCLayers());
157-
//histos.hrecoMuonRPClayerMask->Fill(mu.recoMuonRPClayerMask());
158-
//histos.htrk_qoverp_lambda_cov->Fill(mu.trk_qoverp_lambda_cov());
159-
//histos.htrk_qoverp_phi_cov->Fill(mu.trk_qoverp_phi_cov());
160-
//histos.htrk_qoverp_dxy_cov->Fill(mu.trk_qoverp_dxy_cov());
161-
//histos.htrk_qoverp_dsz_cov->Fill(mu.trk_qoverp_dsz_cov());
162-
//histos.htrk_lambda_phi_cov->Fill(mu.trk_lambda_phi_cov());
163-
//histos.htrk_lambda_dxy_cov->Fill(mu.trk_lambda_dxy_cov());
164-
//histos.htrk_lambda_dsz_cov->Fill(mu.trk_lambda_dsz_cov());
165-
//histos.htrk_phi_dxy_cov->Fill(mu.trk_phi_dxy_cov());
166-
//histos.htrk_phi_dsz_cov->Fill(mu.trk_phi_dsz_cov());
167-
//histos.htrk_dxy_dsz_cov->Fill(mu.trk_dxy_dsz_cov());
170+
168171
if (!runWithoutVtx_) {
169172
histos.hLxy->Fill(lxy);
170173
histos.hXError->Fill(vertex.xError());
@@ -175,23 +178,20 @@ void ScoutingMuonTagProbeAnalyzer::fillHistograms_resonance(const kProbeKinemati
175178
histos.hy->Fill(vertex.y());
176179
histos.hZerror->Fill(vertex.zError());
177180
histos.htracksSize->Fill(vertex.tracksSize());
178-
//histos.hndof->Fill(vertex.ndof());
179-
//histos.hxyCov->Fill(vertex.xyCov());
180-
//histos.hxzCov->Fill(vertex.xzCov());
181-
//histos.hyzCov->Fill(vertex.yzCov());
182181
}
183182
}
184183

184+
//Save histograms
185185
void ScoutingMuonTagProbeAnalyzer::bookHistograms(DQMStore::IBooker& ibook,
186186
edm::Run const& run,
187187
edm::EventSetup const& iSetup,
188188
kTagProbeMuonHistos& histos) const {
189189
ibook.setCurrentFolder(outputInternalPath_);
190190
bookHistograms_resonance(ibook, run, iSetup, histos.resonanceJ_numerator, "resonanceJ_numerator");
191191
bookHistograms_resonance(ibook, run, iSetup, histos.resonanceJ_denominator, "resonanceJ_denominator");
192-
//bookHistograms_resonance(ibook, run, iSetup, histos.resonanceAll, "resonanceAll");
193192
}
194193

194+
//Set axes labels and range
195195
void ScoutingMuonTagProbeAnalyzer::bookHistograms_resonance(DQMStore::IBooker& ibook,
196196
edm::Run const& run,
197197
edm::EventSetup const& iSetup,
@@ -322,37 +322,12 @@ void ScoutingMuonTagProbeAnalyzer::bookHistograms_resonance(DQMStore::IBooker& i
322322
histos.hZerror = ibook.book1D(name + "_Vertex_z error", name + "_Vertex_z_error; vertex z error; Muons", 60, 0, 3);
323323
histos.htracksSize =
324324
ibook.book1D(name + "_Vertex_tracksSize", name + "_Vertex_tracksSize; vertex tracksSize; Muons", 60, 0, 10);
325-
//histos.htrk_phi = ibook.book1D(name + "_Probe_sctMuon_trk_phi",name + "_Probe_sctMuon_trk_phi; trk_phi; Muons", 60, -3,3, 3.3);
326-
//histos.hrecoMuonStationMask = ibook.book1D(name + "_Probe_sctMuon_recoMuonStationMask",name + "_Probe_sctMuon_recoMuonStationMask; recoMuonStationMask; Muons", 60, 0, 60.0);
327-
//histos.hnRecoMuonMatchedRPCLayers = ibook.book1D(name + "_Probe_sctMuon_nRecoMuonMatchedRPCLayers",name + "_Probe_sctMuon_nRecoMuonMatchedRPCLayers; nRecoMuonMatchedRPCLayers; Muons", 5, 0, 5.0);
328-
//histos.hrecoMuonRPClayerMask = ibook.book1D(name + "_Probe_sctMuon_recoMuonRPClayerMask",name + "_Probe_sctMuon_recoMuonRPClayerMask; recoMuonRPClayerMask; Muons", 60, -5, 5);
329-
//histos.htrk_qoverp_lambda_cov = ibook.book1D(name + "_Probe_sctMuon_trk_qoverp_lambda_cov",name + "_Probe_sctMuon_trk_qoverp_lambda_cov; trk_qoverp_lambda_cov; Muons", 60, -1, 1);
330-
//histos.htrk_qoverp_phi_cov = ibook.book1D(name + "_Probe_sctMuon_trk_qoverp_phi_cov",name + "_Probe_sctMuon_trk_qoverp_phi_cov; trk_qoverp_phi_cov; Muons", 60, -1.0, 1.0);
331-
//histos.htrk_qoverp_dxy_cov = ibook.book1D(name + "_Probe_sctMuon_trk_qoverp_dxy_cov",name + "_Probe_sctMuon_trk_qoverp_dxy_cov; trk_qoverp_dxy_cov; Muons", 60, -1, 1);
332-
//histos.htrk_qoverp_dsz_cov = ibook.book1D(name + "_Probe_sctMuon_trk_qoverp_dsz_cov",name + "_Probe_sctMuon_trk_qoverp_dsz_cov; trk_qoverp_dsz_cov; Muons", 60, -1, 1);
333-
//histos.htrk_lambda_phi_cov = ibook.book1D(name + "_Probe_sctMuon_trk_lambda_phi_cov",name + "_Probe_sctMuon_trk_lambda_phi_cov; trk_lambda_phi_cov; Muons", 60, -0.1, 0.1);
334-
//histos.htrk_lambda_dxy_cov = ibook.book1D(name + "_Probe_sctMuon_trk_lambda_dxy_cov",name + "_Probe_sctMuon_trk_lambda_dxy_cov; trk_lambda_dxy_cov; Muons", 60, -1, 1);
335-
//histos.htrk_lambda_dsz_cov = ibook.book1D(name + "_Probe_sctMuon_trk_lambda_dsz_cov",name + "_Probe_sctMuon_trk_lambda_dsz_cov; trk_lambda_dsz_cov; Muons", 60, -0.1, 0.1);
336-
//histos.htrk_lambda_dxy_cov = ibook.book1D(name + "_Probe_sctMuon_trk_lambda_dxy_cov",name + "_Probe_sctMuon_trk_lambda_dxy_cov; trk_lambda_dxy_cov; Muons", 60, -0.1, 0.1);
337-
//histos.htrk_lambda_dsz_cov = ibook.book1D(name + "_Probe_sctMuon_trk_lambda_dsz_cov",name + "_Probe_sctMuon_trk_lambda_dsz_cov; trk_lambda_dsz_cov; Muons", 60, -0.1, 0.1);
338-
//histos.htrk_phi_dxy_cov = ibook.book1D(name + "_Probe_sctMuon_trk_phi_dxy_cov",name + "_Probe_sctMuon_trk_phi_dxy_cov; ; Muons", 60, -0.1, 0.1);
339-
//histos.htrk_phi_dsz_cov = ibook.book1D(name + "_Probe_sctMuon_trk_phi_dsz_cov",name + "_Probe_sctMuon_trk_phi_dsz_cov; trk_phi_dsz_cov; Muons", 60, -0.1, 0.1);
340-
//histos.htrk_dxy_dsz_cov = ibook.book1D(name + "_Probe_sctMuon_trk_dxy_dsz_cov",name + "_Probe_sctMuon_trk_dxy_dsz_cov; trk_dxy_dsz_cov; Muons", 60, -0.1, 0.1);
341-
//histos.hndof = ibook.book1D(name + "_Vertex_ndof",name + "_Vertex_ndof; vertex ndof; Muons", 60, 0, 5);
342-
//histos.hxyCov = ibook.book1D(name + "_Vertex_xyCov",name + "_Vertex_xyCov; vertex xyCov; Muons", 60, -0.5, 0.5);
343-
//histos.hxzCov = ibook.book1D(name + "_Vertex_xzCov",name + "_Vertex_xzCov; vertex xzCov; Muons", 60, -0.5, 0.5);
344-
//histos.hyzCov = ibook.book1D(name + "_Vertex_yzCov",name + "_Vertex_yzCov; vertex yzCov; Muons", 60, -0.5, 0.5);
345325
}
346326

347-
// ------------ method fills 'descriptions' with the allowed parameters for the
348-
// module ------------
327+
//Descriptions to read the collections
349328
void ScoutingMuonTagProbeAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
350-
// The following says we do not know what parameters are allowed so do no
351-
// validation Please change this to state exactly what you do use, even if it
352-
// is no parameters
353329
edm::ParameterSetDescription desc;
354330
desc.add<std::string>("OutputInternalPath", "MY_FOLDER");
355-
desc.add<edm::InputTag>("MuonCollection", edm::InputTag("slimmedMuons"));
356331
desc.add<edm::InputTag>("ScoutingMuonCollection", edm::InputTag("Run3ScoutingMuons"));
357332
desc.add<edm::InputTag>("ScoutingVtxCollection", edm::InputTag("hltScoutingMuonPackerNoVtx"));
358333
desc.add<bool>("runWithoutVertex", true);

HLTriggerOffline/Scouting/plugins/ScoutingMuonTagProbeAnalyzer.h

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/*
2+
Class definition for ScoutingMuonTagProbeAnalyzer.cc. Declares each
3+
histogram (MonitorElement), numerator and denominator histogram structure
4+
(kProbeKinematicMuonHistos), and any functions used in
5+
ScoutingMuonTagProbeAnalyzer.cc. Also declares the token to read the
6+
scouting muon and scouting vertex collections.
7+
8+
Author: Javier Garcia de Castro, email:[email protected]
9+
*/
10+
11+
//Files to include
112
#ifndef DQMOffline_Scouting_ScoutingMuonTagProbeAnalyzer_h
213
#define DQMOffline_Scouting_ScoutingMuonTagProbeAnalyzer_h
314
#include <string>
@@ -12,10 +23,6 @@
1223
#include "FWCore/Framework/interface/MakerMacros.h"
1324
#include "FWCore/ParameterSet/interface/ParameterSet.h"
1425

15-
/////////////////////////
16-
// Class declaration //
17-
/////////////////////////
18-
1926
struct kProbeKinematicMuonHistos {
2027
dqm::reco::MonitorElement* hPt;
2128
dqm::reco::MonitorElement* hEta;
@@ -68,24 +75,7 @@ struct kProbeKinematicMuonHistos {
6875
dqm::reco::MonitorElement* hy;
6976
dqm::reco::MonitorElement* hZerror;
7077
dqm::reco::MonitorElement* htracksSize;
71-
//dqm::reco::MonitorElement* hrecoMuonStationMask;
72-
//dqm::reco::MonitorElement* hnRecoMuonMatchedRPCLayers;
73-
//dqm::reco::MonitorElement* hrecoMuonRPClayerMask;
74-
//dqm::reco::MonitorElement* htrk_phi;
75-
//dqm::reco::MonitorElement* hndof;
76-
//dqm::reco::MonitorElement* htrk_qoverp_lambda_cov;
77-
//dqm::reco::MonitorElement* htrk_qoverp_phi_cov;
78-
//dqm::reco::MonitorElement* htrk_qoverp_dxy_cov;
79-
//dqm::reco::MonitorElement* htrk_qoverp_dsz_cov;
80-
//dqm::reco::MonitorElement* htrk_lambda_phi_cov;
81-
//dqm::reco::MonitorElement* htrk_lambda_dxy_cov;
82-
//dqm::reco::MonitorElement* htrk_lambda_dsz_cov;
83-
//dqm::reco::MonitorElement* htrk_phi_dxy_cov;
84-
//dqm::reco::MonitorElement* htrk_phi_dsz_cov;
85-
//dqm::reco::MonitorElement* htrk_dxy_dsz_cov;
86-
//dqm::reco::MonitorElement* hxyCov;
87-
//dqm::reco::MonitorElement* hxzCov;
88-
//dqm::reco::MonitorElement* hyzCov;
78+
8979
};
9080

9181
struct kTagProbeMuonHistos {
@@ -114,9 +104,7 @@ class ScoutingMuonTagProbeAnalyzer : public DQMGlobalEDAnalyzer<kTagProbeMuonHis
114104
const float lxy) const;
115105
bool scoutingMuonID(const Run3ScoutingMuon mu) const;
116106

117-
// --------------------- member data ----------------------
118107
std::string outputInternalPath_;
119-
edm::EDGetTokenT<std::vector<pat::Muon>> muonCollection_;
120108
edm::EDGetTokenT<std::vector<Run3ScoutingMuon>> scoutingMuonCollection_;
121109
edm::EDGetTokenT<std::vector<Run3ScoutingVertex>> scoutingVtxCollection_;
122110
Bool_t runWithoutVtx_;

0 commit comments

Comments
 (0)