Skip to content

Commit

Permalink
improve DiMuonVertexMonitor histogram titles: make them configurable …
Browse files Browse the repository at this point in the history
…for different resonances
  • Loading branch information
mmusich committed Sep 2, 2022
1 parent 6487174 commit d469041
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 32 deletions.
3 changes: 3 additions & 0 deletions DQMOffline/Alignment/interface/DiMuonVertexMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ class DiMuonVertexMonitor : public DQMEDAnalyzer {
//used to select what vertices to read from configuration file
const edm::EDGetTokenT<reco::VertexCollection> vertexToken_;

const std::string motherName_;
const std::string MEFolderName_; // Top-level folder name
const bool useClosestVertex_;

std::pair<float, float> massLimits_; /* for the mass plot x-range */
const float maxSVdist_;

// vertex quantities
Expand Down
2 changes: 2 additions & 0 deletions DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@

ALCARECOTkAlJpsiMuMuVtxDQM = DQMOffline.Alignment.DiMuonVertexMonitor_cfi.DiMuonVertexMonitor.clone(
muonTracks = 'ALCARECO'+__selectionName,
decayMotherName = "J/#psi",
vertices = 'offlinePrimaryVertices',
FolderName = "AlCaReco/"+__selectionName,
maxSVdist = 50
Expand Down Expand Up @@ -229,6 +230,7 @@

ALCARECOTkAlUpsilonMuMuVtxDQM = DQMOffline.Alignment.DiMuonVertexMonitor_cfi.DiMuonVertexMonitor.clone(
muonTracks = 'ALCARECO'+__selectionName,
decayMotherName = "#Upsilon",
vertices = 'offlinePrimaryVertices',
FolderName = "AlCaReco/"+__selectionName,
maxSVdist = 50
Expand Down
1 change: 1 addition & 0 deletions DQMOffline/Alignment/python/DiMuonVertexMonitor_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
DiMuonVertexMonitor = DQMEDAnalyzer('DiMuonVertexMonitor',
muonTracks = cms.InputTag('ALCARECOTkAlDiMuon'),
decayMotherName = cms.string('Z'),
vertices = cms.InputTag('offlinePrimaryVertices'),
FolderName = cms.string('DiMuonVertexMonitor'),
maxSVdist = cms.double(50))
106 changes: 74 additions & 32 deletions DQMOffline/Alignment/src/DiMuonVertexMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
*/

#include <fmt/printf.h>

#include "DQMOffline/Alignment/interface/DiMuonVertexMonitor.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/Math/interface/deltaR.h"
Expand All @@ -28,43 +30,82 @@ DiMuonVertexMonitor::DiMuonVertexMonitor(const edm::ParameterSet& iConfig)
: ttbESToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))),
tracksToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("muonTracks"))),
vertexToken_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"))),
motherName_(iConfig.getParameter<std::string>("decayMotherName")),
MEFolderName_(iConfig.getParameter<std::string>("FolderName")),
useClosestVertex_(iConfig.getParameter<bool>("useClosestVertex")),
maxSVdist_(iConfig.getParameter<double>("maxSVdist")) {}
maxSVdist_(iConfig.getParameter<double>("maxSVdist")) {
if (motherName_.find('Z') != std::string::npos) {
massLimits_ = std::make_pair(50., 120);
} else if (motherName_.find("J/#psi") != std::string::npos) {
massLimits_ = std::make_pair(2.7, 3.4);
} else if (motherName_.find("#Upsilon") != std::string::npos) {
massLimits_ = std::make_pair(8.9, 9.9);
} else {
edm::LogError("DiMuonVertexMonitor") << " unrecognized decay mother particle: " << motherName_
<< " setting the default for the Z->mm (50.,120.)" << std::endl;
massLimits_ = std::make_pair(50., 120);
}
}

void DiMuonVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&, edm::EventSetup const&) {
iBooker.setCurrentFolder(MEFolderName_ + "/DiMuonVertexMonitor");
hSVProb_ = iBooker.book1D("VtxProb", ";ZV vertex probability;N(#mu#mu pairs)", 100, 0., 1.);
hSVChi2_ =
iBooker.book1D("VtxChi2", "#chi^{2} of the Z vertex; #chi^{2} of the Z vertex; N(#mu#mu pairs)", 200, 0., 200.);
hSVNormChi2_ = iBooker.book1D(
"VtxNormChi2", "#chi^{2}/ndf of the Z vertex; #chi^{2}/ndf of Z vertex; N(#mu#mu pairs)", 100, 0., 20.);
hSVDist_ = iBooker.book1D("VtxDist", ";PV-ZV xy distance [#mum];N(#mu#mu pairs)", 100, 0., 300.);
hSVDistErr_ = iBooker.book1D("VtxDistErr", ";PV-ZV xy distance error [#mum];N(#mu#mu pairs)", 100, 0., 1000.);
hSVDistSig_ = iBooker.book1D("VtxDistSig", ";PV-ZV xy distance signficance;N(#mu#mu pairs)", 100, 0., 5.);
hSVCompatibility_ = iBooker.book1D(
"VtxCompatibility", "compatibility of Z vertex; compatibility of Z vertex; N(#mu#mu pairs)", 100, 0., 100.);

hSVDist3D_ = iBooker.book1D("VtxDist3D", ";PV-ZV 3D distance [#mum];N(#mu#mu pairs)", 100, 0., 300.);
hSVDist3DErr_ = iBooker.book1D("VtxDist3DErr", ";PV-ZV 3D distance error [#mum];N(#mu#mu pairs)", 100, 0., 1000.);
hSVDist3DSig_ = iBooker.book1D("VtxDist3DSig", ";PV-ZV 3D distance signficance;N(#mu#mu pairs)", 100, 0., 5.);
hSVCompatibility3D_ = iBooker.book1D(
"VtxCompatibility3D", "3D compatibility of Z vertex;3D compatibility of Z vertex; N(#mu#mu pairs)", 100, 0., 100.);

hTrackInvMass_ = iBooker.book1D("TkTkInvMass", ";M(tk,tk) [GeV];N(tk tk pairs)", 70., 50., 120.);
hCosPhi_ = iBooker.book1D("CosPhi", ";cos(#phi_{xy});N(#mu#mu pairs)", 50, -1., 1.);
hCosPhi3D_ = iBooker.book1D("CosPhi3D", ";cos(#phi_{3D});N(#mu#mu pairs)", 50, -1., 1.);
hCosPhiInv_ = iBooker.book1D("CosPhiInv", ";inverted cos(#phi_{xy});N(#mu#mu pairs)", 50, -1., 1.);
hCosPhiInv3D_ = iBooker.book1D("CosPhiInv3D", ";inverted cos(#phi_{3D});N(#mu#mu pairs)", 50, -1., 1.);

hdxy_ = iBooker.book1D("dxy", ";muon track d_{xy}(PV) [#mum];muon tracks", 150, -300, 300);
hdz_ = iBooker.book1D("dz", ";muon track d_{z}(PV) [#mum];muon tracks", 150, -300, 300);
hdxyErr_ = iBooker.book1D("dxyErr", ";muon track err_{dxy} [#mum];muon tracks", 250, 0., 500.);
hdzErr_ = iBooker.book1D("dzErr", ";muon track err_{dz} [#mum];muon tracks", 250, 0., 500.);
hIP2d_ = iBooker.book1D("IP2d", ";muon track IP_{2D} [#mum];muon tracks", 150, -300, 300);
hIP3d_ = iBooker.book1D("IP3d", ";muon track IP_{3D} [#mum];muon tracks", 150, -300, 300);
hIP2dsig_ = iBooker.book1D("IP2Dsig", ";muon track IP_{2D} significance;muon tracks", 100, 0., 5.);
hIP3dsig_ = iBooker.book1D("IP3Dsig", ";muon track IP_{3D} significance;muon tracks", 100, 0., 5.);

const char* ts = fmt::sprintf(";%s vertex probability;N(#mu#mu pairs)", motherName_).c_str();
const char* ps = "N(#mu#mu pairs)";
hSVProb_ = iBooker.book1D("VtxProb", ts, 100, 0., 1.);

ts = fmt::sprintf("#chi^{2} of the %s vertex; #chi^{2} of the %s vertex; %s", motherName_, motherName_, ps).c_str();
hSVChi2_ = iBooker.book1D("VtxChi2", ts, 200, 0., 200.);

ts =
fmt::sprintf("#chi^{2}/ndf of the %s vertex; #chi^{2}/ndf of %s vertex; %s", motherName_, motherName_, ps).c_str();
hSVNormChi2_ = iBooker.book1D("VtxNormChi2", ts, 100, 0., 20.);

std::string histTit = motherName_ + " #rightarrow #mu^{+}#mu^{-}";
ts = fmt::sprintf("%s;PV- %sV xy distance [#mum];%s", histTit, motherName_, ps).c_str();
hSVDist_ = iBooker.book1D("VtxDist", ts, 100, 0., 300.);

ts = fmt::sprintf("%s;PV-%sV xy distance error [#mum];%s", histTit, motherName_, ps).c_str();
hSVDistErr_ = iBooker.book1D("VtxDistErr", ts, 100, 0., 1000.);

ts = fmt::sprintf("%s;PV-%sV xy distance signficance;%s", histTit, motherName_, ps).c_str();
hSVDistSig_ = iBooker.book1D("VtxDistSig", ts, 100, 0., 5.);

ts = fmt::sprintf("compatibility of %s vertex; compatibility of %s vertex; %s", motherName_, motherName_, ps).c_str();
hSVCompatibility_ = iBooker.book1D("VtxCompatibility", ts, 100, 0., 100.);

ts = fmt::sprintf("%s;PV-%sV 3D distance [#mum];%s", histTit, motherName_, ps).c_str();
hSVDist3D_ = iBooker.book1D("VtxDist3D", ts, 100, 0., 300.);

ts = fmt::sprintf("%s;PV-%sV 3D distance error [#mum];%s", histTit, motherName_, ps).c_str();
hSVDist3DErr_ = iBooker.book1D("VtxDist3DErr", ts, 100, 0., 1000.);

ts = fmt::sprintf("%s;PV-%sV 3D distance signficance;%s", histTit, motherName_, ps).c_str();
hSVDist3DSig_ = iBooker.book1D("VtxDist3DSig", ts, 100, 0., 5.);

ts = fmt::sprintf("3D compatibility of %s vertex;3D compatibility of %s vertex; %s", motherName_, motherName_, ps)
.c_str();
hSVCompatibility3D_ = iBooker.book1D("VtxCompatibility3D", ts, 100, 0., 100.);

hTrackInvMass_ = iBooker.book1D(
"TkTkInvMass", fmt::sprintf("%s;M(#mu,#mu) [GeV];%s", histTit, ps), 70., massLimits_.first, massLimits_.second);
hCosPhi_ = iBooker.book1D("CosPhi", fmt::sprintf("%s;cos(#phi_{xy});%s", histTit, ps), 50, -1., 1.);
hCosPhi3D_ = iBooker.book1D("CosPhi3D", fmt::sprintf("%s;cos(#phi_{3D});%s", histTit, ps), 50, -1., 1.);
hCosPhiInv_ = iBooker.book1D("CosPhiInv", fmt::sprintf("%s;inverted cos(#phi_{xy});%s", histTit, ps), 50, -1., 1.);
hCosPhiInv3D_ =
iBooker.book1D("CosPhiInv3D", fmt::sprintf("%s;inverted cos(#phi_{3D});%s", histTit, ps), 50, -1., 1.);

hdxy_ = iBooker.book1D("dxy", fmt::sprintf("%s;muon track d_{xy}(PV) [#mum];muon tracks", histTit), 150, -300, 300);
hdz_ = iBooker.book1D("dz", fmt::sprintf("%s;muon track d_{z}(PV) [#mum];muon tracks", histTit), 150, -300, 300);
hdxyErr_ =
iBooker.book1D("dxyErr", fmt::sprintf("%s;muon track err_{dxy} [#mum];muon tracks", histTit), 250, 0., 500.);
hdzErr_ = iBooker.book1D("dzErr", fmt::sprintf("%s;muon track err_{dz} [#mum];muon tracks", histTit), 250, 0., 500.);
hIP2d_ = iBooker.book1D("IP2d", fmt::sprintf("%s;muon track IP_{2D} [#mum];muon tracks", histTit), 150, -300, 300);
hIP3d_ = iBooker.book1D("IP3d", fmt::sprintf("%s;muon track IP_{3D} [#mum];muon tracks", histTit), 150, -300, 300);
hIP2dsig_ =
iBooker.book1D("IP2Dsig", fmt::sprintf("%s;muon track IP_{2D} significance;muon tracks", histTit), 100, 0., 5.);
hIP3dsig_ =
iBooker.book1D("IP3Dsig", fmt::sprintf("%s;muon track IP_{3D} significance;muon tracks", histTit), 100, 0., 5.);
}

void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
Expand Down Expand Up @@ -256,6 +297,7 @@ void DiMuonVertexMonitor::fillDescriptions(edm::ConfigurationDescriptions& descr
desc.add<edm::InputTag>("muonTracks", edm::InputTag("ALCARECOTkAlDiMuon"));
desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
desc.add<std::string>("FolderName", "DiMuonVertexMonitor");
desc.add<std::string>("decayMotherName", "Z");
desc.add<bool>("useClosestVertex", true);
desc.add<double>("maxSVdist", 50.);
descriptions.addWithDefaultLabel(desc);
Expand Down

0 comments on commit d469041

Please sign in to comment.