Skip to content

Commit d8087e7

Browse files
committed
add some debug statements in DiMuonVertexMonitor
1 parent f78be7e commit d8087e7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

DQMOffline/Alignment/src/DiMuonVertexMonitor.cc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
142142
myTracks.emplace_back(&muonTrk);
143143
}
144144

145+
#ifdef EDM_ML_DEBUG
146+
for (const auto& track : myTracks) {
147+
edm::LogVerbatim("DiMuonVertexMonitor") << __PRETTY_FUNCTION__ << " pT: " << track->pt() << " GeV"
148+
<< " , pT error: " << track->ptError() << " GeV"
149+
<< " , eta: " << track->eta() << " , phi: " << track->phi() << std::endl;
150+
}
151+
#endif
152+
145153
const TransientTrackBuilder* theB = &iSetup.getData(ttbESToken_);
146154
TransientVertex mumuTransientVtx;
147155
std::vector<reco::TransientTrack> tks;
@@ -161,6 +169,17 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
161169
TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(), sqrt((tplus->p() * tplus->p()) + mumass2));
162170
TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(), sqrt((tminus->p() * tminus->p()) + mumass2));
163171

172+
#ifdef EDM_ML_DEBUG
173+
// Define a lambda function to convert TLorentzVector to a string
174+
auto tLorentzVectorToString = [](const TLorentzVector& vector) {
175+
return std::to_string(vector.Px()) + " " + std::to_string(vector.Py()) + " " + std::to_string(vector.Pz()) + " " +
176+
std::to_string(vector.E());
177+
};
178+
179+
edm::LogVerbatim("DiMuonVertexMonitor") << "mu+" << tLorentzVectorToString(p4_tplus) << std::endl;
180+
edm::LogVerbatim("DiMuonVertexMonitor") << "mu-" << tLorentzVectorToString(p4_tminus) << std::endl;
181+
#endif
182+
164183
const auto& Zp4 = p4_tplus + p4_tminus;
165184
float track_invMass = Zp4.M();
166185
hInvMass_->Fill(track_invMass);
@@ -212,6 +231,14 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
212231
const math::XYZPoint deltaVtx(
213232
theMainVtxPos.x() - myVertex.x(), theMainVtxPos.y() - myVertex.y(), theMainVtxPos.z() - myVertex.z());
214233

234+
#ifdef EDM_ML_DEBUG
235+
edm::LogVerbatim("DiMuonVertexMonitor") << "mm vertex position:" << aTransientVertex.position().x() << ","
236+
<< aTransientVertex.position().y() << "," << aTransientVertex.position().z();
237+
238+
edm::LogVerbatim("DiMuonVertexMonitor") << "main vertex position:" << TheMainVertex.position().x() << ","
239+
<< TheMainVertex.position().y() << "," << TheMainVertex.position().z();
240+
#endif
241+
215242
if (theMainVtx.isValid()) {
216243
// fill the impact parameter plots
217244
for (const auto& track : myTracks) {
@@ -289,6 +316,11 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
289316
hCosPhiInv_->Fill(-cosphi);
290317
hCosPhiInv3D_->Fill(-cosphi3D);
291318

319+
#ifdef EDM_ML_DEBUG
320+
edm::LogVerbatim("DiMuonVertexMonitor")
321+
<< "distance " << distance * cmToum << " cosphi3D:" << cosphi3D << std::endl;
322+
#endif
323+
292324
// unbalance
293325
hCosPhiUnbalance_->Fill(cosphi, 1.);
294326
hCosPhiUnbalance_->Fill(-cosphi, -1.);

0 commit comments

Comments
 (0)