Skip to content

Commit

Permalink
add some debug statements in DiMuonVertexMonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed Oct 10, 2023
1 parent f78be7e commit d8087e7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions DQMOffline/Alignment/src/DiMuonVertexMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
myTracks.emplace_back(&muonTrk);
}

#ifdef EDM_ML_DEBUG
for (const auto& track : myTracks) {
edm::LogVerbatim("DiMuonVertexMonitor") << __PRETTY_FUNCTION__ << " pT: " << track->pt() << " GeV"
<< " , pT error: " << track->ptError() << " GeV"
<< " , eta: " << track->eta() << " , phi: " << track->phi() << std::endl;
}
#endif

const TransientTrackBuilder* theB = &iSetup.getData(ttbESToken_);
TransientVertex mumuTransientVtx;
std::vector<reco::TransientTrack> tks;
Expand All @@ -161,6 +169,17 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(), sqrt((tplus->p() * tplus->p()) + mumass2));
TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(), sqrt((tminus->p() * tminus->p()) + mumass2));

#ifdef EDM_ML_DEBUG
// Define a lambda function to convert TLorentzVector to a string
auto tLorentzVectorToString = [](const TLorentzVector& vector) {
return std::to_string(vector.Px()) + " " + std::to_string(vector.Py()) + " " + std::to_string(vector.Pz()) + " " +
std::to_string(vector.E());
};

edm::LogVerbatim("DiMuonVertexMonitor") << "mu+" << tLorentzVectorToString(p4_tplus) << std::endl;
edm::LogVerbatim("DiMuonVertexMonitor") << "mu-" << tLorentzVectorToString(p4_tminus) << std::endl;
#endif

const auto& Zp4 = p4_tplus + p4_tminus;
float track_invMass = Zp4.M();
hInvMass_->Fill(track_invMass);
Expand Down Expand Up @@ -212,6 +231,14 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
const math::XYZPoint deltaVtx(
theMainVtxPos.x() - myVertex.x(), theMainVtxPos.y() - myVertex.y(), theMainVtxPos.z() - myVertex.z());

#ifdef EDM_ML_DEBUG
edm::LogVerbatim("DiMuonVertexMonitor") << "mm vertex position:" << aTransientVertex.position().x() << ","
<< aTransientVertex.position().y() << "," << aTransientVertex.position().z();

edm::LogVerbatim("DiMuonVertexMonitor") << "main vertex position:" << TheMainVertex.position().x() << ","
<< TheMainVertex.position().y() << "," << TheMainVertex.position().z();
#endif

if (theMainVtx.isValid()) {
// fill the impact parameter plots
for (const auto& track : myTracks) {
Expand Down Expand Up @@ -289,6 +316,11 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
hCosPhiInv_->Fill(-cosphi);
hCosPhiInv3D_->Fill(-cosphi3D);

#ifdef EDM_ML_DEBUG
edm::LogVerbatim("DiMuonVertexMonitor")
<< "distance " << distance * cmToum << " cosphi3D:" << cosphi3D << std::endl;
#endif

// unbalance
hCosPhiUnbalance_->Fill(cosphi, 1.);
hCosPhiUnbalance_->Fill(-cosphi, -1.);
Expand Down

0 comments on commit d8087e7

Please sign in to comment.