21 #include "TLorentzVector.h" 25 constexpr
float mumass2 = 0.105658367 * 0.105658367;
32 MEFolderName_(iConfig.getParameter<
std::
string>(
"FolderName")),
33 maxSVdist_(iConfig.getParameter<double>(
"maxSVdist")) {}
37 hSVProb_ = iBooker.
book1D(
"VtxProb",
";ZV vertex probability;N(#mu#mu pairs)", 100, 0., 1.);
38 hSVDist_ = iBooker.
book1D(
"VtxDist",
";PV-ZV xy distance [#mum];N(#mu#mu pairs)", 100, 0., 300.);
39 hSVDistErr_ = iBooker.
book1D(
"VtxDistErr",
";PV-ZV xy distance error [#mum];N(#mu#mu pairs)", 100, 0., 1000.);
40 hSVDistSig_ = iBooker.
book1D(
"VtxDistSig",
";PV-ZV xy distance signficance;N(#mu#mu pairs)", 100, 0., 5.);
41 hSVDist3D_ = iBooker.
book1D(
"VtxDist3D",
";PV-ZV 3D distance [#mum];N(#mu#mu pairs)", 100, 0., 300.);
42 hSVDist3DErr_ = iBooker.
book1D(
"VtxDist3DErr",
";PV-ZV 3D distance error [#mum];N(#mu#mu pairs)", 100, 0., 1000.);
43 hSVDist3DSig_ = iBooker.
book1D(
"VtxDist3DSig",
";PV-ZV 3D distance signficance;N(#mu#mu pairs)", 100, 0., 5.);
44 hTrackInvMass_ = iBooker.
book1D(
"TkTkInvMass",
";M(tk,tk) [GeV];N(tk tk pairs)", 70., 50., 120.);
45 hCosPhi_ = iBooker.
book1D(
"CosPhi",
";cos(#phi_{xy});N(#mu#mu pairs)", 50, -1., 1.);
46 hCosPhi3D_ = iBooker.
book1D(
"CosPhi3D",
";cos(#phi_{3D});N(#mu#mu pairs)", 50, -1., 1.);
47 hCosPhiInv_ = iBooker.
book1D(
"CosPhiInv",
";inverted cos(#phi_{xy});N(#mu#mu pairs)", 50, -1., 1.);
48 hCosPhiInv3D_ = iBooker.
book1D(
"CosPhiInv3D",
";inverted cos(#phi_{3D});N(#mu#mu pairs)", 50, -1., 1.);
50 hdxy_ = iBooker.
book1D(
"dxy",
";muon track d_{xy}(PV) [#mum];muon tracks", 150, -300, 300);
51 hdz_ = iBooker.
book1D(
"dz",
";muon track d_{z}(PV) [#mum];muon tracks", 150, -300, 300);
52 hdxyErr_ = iBooker.
book1D(
"dxyErr",
";muon track err_{dxy} [#mum];muon tracks", 250, 0., 500.);
53 hdzErr_ = iBooker.
book1D(
"dzErr",
";muon track err_{dz} [#mum];muon tracks", 250, 0., 500.);
54 hIP2d_ = iBooker.
book1D(
"IP2d",
";muon track IP_{2D} [#mum];muon tracks", 150, -300, 300);
55 hIP3d_ = iBooker.
book1D(
"IP3d",
";muon track IP_{3D} [#mum];muon tracks", 150, -300, 300);
56 hIP2dsig_ = iBooker.
book1D(
"IP2Dsig",
";muon track IP_{2D} significance;muon tracks", 100, 0., 5.);
57 hIP3dsig_ = iBooker.
book1D(
"IP3Dsig",
";muon track IP_{3D} significance;muon tracks", 100, 0., 5.);
61 std::vector<const reco::Track*> myTracks;
63 if (!trackHandle.isValid()) {
64 edm::LogError(
"DiMuonVertexMonitor") <<
"invalid track collection encountered!";
68 for (
const auto& muonTrk : *trackHandle) {
69 myTracks.emplace_back(&muonTrk);
74 std::vector<reco::TransientTrack> tks;
76 if (myTracks.size() != 2) {
77 edm::LogWarning(
"DiMuonVertexMonitor") <<
"There are not enough tracks to monitor!";
81 const auto&
t1 = myTracks[1]->momentum();
82 const auto&
t0 = myTracks[0]->momentum();
83 const auto& ditrack =
t1 +
t0;
85 const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1];
86 const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1];
88 TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(),
sqrt((tplus->p() * tplus->p()) +
mumass2));
89 TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(),
sqrt((tminus->p() * tminus->p()) +
mumass2));
91 const auto& Zp4 = p4_tplus + p4_tminus;
92 float track_invMass = Zp4.M();
96 std::pair<TLorentzVector, TLorentzVector> tktk_p4 = std::make_pair(p4_tplus, p4_tminus);
101 for (
const auto&
track : myTracks) {
103 tks.push_back(trajectory);
107 mumuTransientVtx = kalman.
vertex(tks);
112 if (!mumuTransientVtx.
isValid())
124 auto theMainVtx = (*vertices)[0];
125 theMainVtxPos.SetXYZ(theMainVtx.position().x(), theMainVtx.position().y(), theMainVtx.position().z());
127 edm::LogWarning(
"DiMuonVertexMonitor") <<
"hardest primary vertex in the event is not valid!";
130 edm::LogWarning(
"DiMuonVertexMonitor") <<
"invalid vertex collection encountered!";
136 theMainVtxPos.x() - myVertex.x(), theMainVtxPos.y() - myVertex.y(), theMainVtxPos.z() - myVertex.z());
140 for (
const auto&
track : myTracks) {
160 double dist_err = vertTool.
distance(mumuTransientVtx, theMainVertex).
error();
168 double distance3D = vertTool3D.
distance(mumuTransientVtx, theMainVertex).
value();
169 double dist3D_err = vertTool3D.
distance(mumuTransientVtx, theMainVertex).
error();
177 double cosphi = (ZpT.x() * deltaVtx.x() + ZpT.y() * deltaVtx.y()) /
178 (
sqrt(ZpT.x() * ZpT.x() + ZpT.y() * ZpT.y()) *
179 sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y()));
181 double cosphi3D = (Zp.x() * deltaVtx.x() + Zp.y() * deltaVtx.y() + Zp.z() * deltaVtx.z()) /
182 (
sqrt(Zp.x() * Zp.x() + Zp.y() * Zp.y() + Zp.z() * Zp.z()) *
183 sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y() + deltaVtx.z() * deltaVtx.z()));
192 edm::LogWarning(
"DiMuonVertexMonitor") <<
"hardest primary vertex in the event is not valid!";
201 desc.add<
double>(
"maxSVdist", 50.);
MonitorElement * hdxyErr_
const std::string MEFolderName_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
float totalChiSquared() const
MonitorElement * hCosPhiInv_
GlobalPoint position() const
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
MonitorElement * hSVDist3DErr_
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * hIP2dsig_
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
MonitorElement * hSVProb_
static constexpr float mumass2
#define DEFINE_FWK_MODULE(type)
T const * product() const
std::vector< Track > TrackCollection
collection of Tracks
MonitorElement * hCosPhi_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Log< level::Error, false > LogError
std::vector< Vertex > VertexCollection
float degreesOfFreedom() const
MonitorElement * hIP3dsig_
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
MonitorElement * hCosPhiInv3D_
reco::TransientTrack build(const reco::Track *p) const
MonitorElement * hSVDist3D_
MonitorElement * hSVDist3DSig_
DiMuonVertexMonitor(const edm::ParameterSet &)
const edm::EDGetTokenT< reco::TrackCollection > tracksToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * hSVDistSig_
bool getData(T &iHolder) const
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
void analyze(const edm::Event &, const edm::EventSetup &) override
XYZPointD XYZPoint
point in space with cartesian internal representation
MonitorElement * hTrackInvMass_
MonitorElement * hSVDist_
const edm::EDGetTokenT< reco::VertexCollection > vertexToken_
MonitorElement * hSVDistErr_
MonitorElement * hCosPhi3D_
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
static constexpr float cmToum
bool isValid() const
Tells whether the vertex is valid.
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbESToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)