Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.2.X] Add 2D comparison histograms to SiStripMonitorApproximateCluster #42853

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@
//

#include <string>
// for string manipulations
#include <fmt/printf.h>

// user include files
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DataFormats/Common/interface/DetSet.h"
#include "DataFormats/Common/interface/DetSetVectorNew.h"
#include "DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h"
#include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h"
#include "DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h"
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
#include "DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down Expand Up @@ -102,6 +105,12 @@ class SiStripMonitorApproximateCluster : public DQMEDAnalyzer {
MonitorElement* h_deltaFirstStrip_{nullptr};
MonitorElement* h_deltaEndStrip_{nullptr};

MonitorElement* h2_CompareBarycenter_{nullptr};
MonitorElement* h2_CompareSize_{nullptr};
MonitorElement* h2_CompareCharge_{nullptr};
MonitorElement* h2_CompareFirstStrip_{nullptr};
MonitorElement* h2_CompareEndStrip_{nullptr};

// Event Data
edm::EDGetTokenT<SiStripApproximateClusterCollection> approxClustersToken_;
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster>> stripClustersToken_;
Expand Down Expand Up @@ -222,6 +231,13 @@ void SiStripMonitorApproximateCluster::analyze(const edm::Event& iEvent, const e
h_deltaCharge_->Fill(closestCluster->charge() - convertedCluster.charge());
h_deltaFirstStrip_->Fill(closestCluster->firstStrip() - convertedCluster.firstStrip());
h_deltaEndStrip_->Fill(closestCluster->endStrip() - convertedCluster.endStrip());

h2_CompareBarycenter_->Fill(closestCluster->barycenter(), convertedCluster.barycenter());
h2_CompareSize_->Fill(closestCluster->size(), convertedCluster.size());
h2_CompareCharge_->Fill(closestCluster->charge(), convertedCluster.charge());
h2_CompareFirstStrip_->Fill(closestCluster->firstStrip(), convertedCluster.firstStrip());
h2_CompareEndStrip_->Fill(closestCluster->endStrip(), convertedCluster.endStrip());

// monitoring plots
matchedClusters.fill(cluster);
h_isMatched_->Fill(1);
Expand Down Expand Up @@ -251,6 +267,7 @@ void SiStripMonitorApproximateCluster::bookHistograms(DQMStore::IBooker& ibook,
matchedClusters.book(ibook, fmt::format("{}/MatchedClusters", folder_));
unMatchedClusters.book(ibook, fmt::format("{}/UnmatchedClusters", folder_));

// 1D histograms
ibook.setCurrentFolder(fmt::format("{}/ClusterComparisons", folder_));
h_deltaBarycenter_ =
ibook.book1D("deltaBarycenter", "#Delta barycenter;#Delta barycenter;cluster pairs", 101, -50.5, 50.5);
Expand All @@ -262,6 +279,66 @@ void SiStripMonitorApproximateCluster::bookHistograms(DQMStore::IBooker& ibook,
h_deltaEndStrip_ =
ibook.book1D("deltaEndStrip", "#Delta EndStrip; #Delta endStrip; cluster pairs", 101, -50.5, 50.5);

// geometric constants
constexpr int maxNStrips = 6 * sistrip::STRIPS_PER_APV;
constexpr float minStrip = -0.5f;
constexpr float maxStrip = maxNStrips - 0.5f;

// cluster constants
constexpr float maxCluSize = 50;
constexpr float maxCluCharge = 700;

// 2D histograms (use TH2I for counts to limit memory allocation)
std::string toRep = "SiStrip Cluster Barycenter";
h2_CompareBarycenter_ = ibook.book2I("compareBarycenter",
fmt::sprintf("; %s;Approx %s", toRep, toRep),
maxNStrips,
minStrip,
maxStrip,
maxNStrips,
minStrip,
maxStrip);

toRep = "SiStrip Cluster Size";
h2_CompareSize_ = ibook.book2I("compareSize",
fmt::sprintf("; %s;Approx %s", toRep, toRep),
maxCluSize,
-0.5f,
maxCluSize - 0.5f,
maxCluSize,
-0.5f,
maxCluSize - 0.5f);

toRep = "SiStrip Cluster Charge";
h2_CompareCharge_ = ibook.book2I("compareCharge",
fmt::sprintf("; %s;Approx %s", toRep, toRep),
maxCluCharge,
-0.5f,
maxCluCharge - 0.5f,
maxCluCharge,
-0.5f,
maxCluCharge - 0.5f);

toRep = "SiStrip Cluster First Strip number";
h2_CompareFirstStrip_ = ibook.book2I("compareFirstStrip",
fmt::sprintf("; %s;Approx %s", toRep, toRep),
maxNStrips,
minStrip,
maxStrip,
maxNStrips,
minStrip,
maxStrip);

toRep = "SiStrip Cluster Last Strip number";
h2_CompareEndStrip_ = ibook.book2I("compareLastStrip",
fmt::sprintf("; %s;Approx %s", toRep, toRep),
maxNStrips,
minStrip,
maxStrip,
maxNStrips,
minStrip,
maxStrip);

h_isMatched_ = ibook.book1D("isClusterMatched", "cluster matching;is matched?;#clusters", 3, -1.5, 1.5);
h_isMatched_->getTH1F()->GetXaxis()->SetBinLabel(1, "Not matched");
h_isMatched_->getTH1F()->GetXaxis()->SetBinLabel(3, "Matched");
Expand Down