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

MCH: removed custom code for reference plots #2486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 1 addition & 4 deletions Modules/MUON/MCH/include/MCH/ClusterChargePlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace muonchambers
class ClusterChargePlotter : public HistPlotter
{
public:
ClusterChargePlotter(std::string path, TH2F* hRef, bool fullPlots = false);
ClusterChargePlotter(std::string path, bool fullPlots = false);

void update(TH2F* hCharge);

Expand All @@ -62,9 +62,6 @@ class ClusterChargePlotter : public HistPlotter
std::unique_ptr<ClusterChargeReductor> mChargeReductor;

std::unique_ptr<TH1F> mHistogramChargePerDE;
std::unique_ptr<TH1F> mHistogramChargePerDERef;
std::unique_ptr<TH1F> mHistogramChargeRefRatio;
std::unique_ptr<TCanvas> mCanvasChargePerDE;
std::array<std::unique_ptr<TH1F>, getNumDE()> mHistogramCharge;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace muonchambers
class ClusterChargeTrendsPlotter : public HistPlotter
{
public:
ClusterChargeTrendsPlotter(std::string path, TH2F* hRef, bool fullPlots = false);
ClusterChargeTrendsPlotter(std::string path, bool fullPlots = false);

void update(long time, TH2F* hEfficiency);

Expand Down
5 changes: 1 addition & 4 deletions Modules/MUON/MCH/include/MCH/ClusterSizePlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace muonchambers
class ClusterSizePlotter : public HistPlotter
{
public:
ClusterSizePlotter(std::string path, TH2F* hRef, bool fullPlots = false);
ClusterSizePlotter(std::string path, bool fullPlots = false);

void update(TH2F* hCharge);

Expand All @@ -52,9 +52,6 @@ class ClusterSizePlotter : public HistPlotter
std::unique_ptr<ClusterSizeReductor> mClusterSizeReductor;

std::array<std::unique_ptr<TH1F>, 3> mHistogramClusterSizePerDE;
std::array<std::unique_ptr<TH1F>, 3> mHistogramClusterSizePerDERef;
std::array<std::unique_ptr<TH1F>, 3> mHistogramClusterSizePerDERefRatio;
std::array<std::unique_ptr<TCanvas>, 3> mCanvasClusterSizePerDE;
std::array<std::unique_ptr<TH1F>, getNumDE() * 3> mHistogramClusterSize;
std::array<std::unique_ptr<TLegend>, getNumDE()> mLegendClusterSize;
std::array<std::unique_ptr<TCanvas>, getNumDE()> mCanvasClusterSize;
Expand Down
2 changes: 1 addition & 1 deletion Modules/MUON/MCH/include/MCH/ClusterSizeTrendsPlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace muonchambers
class ClusterSizeTrendsPlotter : public HistPlotter
{
public:
ClusterSizeTrendsPlotter(std::string path, TH2F* hRef, bool fullPlots = false);
ClusterSizeTrendsPlotter(std::string path, bool fullPlots = false);

void update(long time, TH2F* hEfficiency);

Expand Down
1 change: 0 additions & 1 deletion Modules/MUON/MCH/include/MCH/DigitsPostProcessing.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class DigitsPostProcessing : public PostProcessingInterface

// CCDB object accessors
std::map<std::string, CcdbObjectHelper> mCcdbObjects;
std::map<std::string, CcdbObjectHelper> mCcdbObjectsRef;

// Hit rate histograms ===============================================

Expand Down
5 changes: 1 addition & 4 deletions Modules/MUON/MCH/include/MCH/EfficiencyPlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace muonchambers
class EfficiencyPlotter : public HistPlotter
{
public:
EfficiencyPlotter(std::string path, TH2F* hRef, bool fullPlots = false);
EfficiencyPlotter(std::string path, bool fullPlots = false);

void update(TH2F* hEfficiency);

Expand Down Expand Up @@ -69,9 +69,6 @@ class EfficiencyPlotter : public HistPlotter
std::unique_ptr<TH2ElecMapReductor> mElecMapReductor;

std::array<std::unique_ptr<TH1F>, 2> mHistogramMeanEfficiencyPerDE;
std::array<std::unique_ptr<TH1F>, 2> mHistogramMeanEfficiencyPerDERef;
std::array<std::unique_ptr<TH1F>, 2> mHistogramMeanEfficiencyRefRatio;
std::array<std::unique_ptr<TCanvas>, 2> mCanvasMeanEfficiencyPerDE;

std::array<std::map<int, std::shared_ptr<DetectorHistogram>>, 2> mHistogramEfficiencyDE; // 2D hit rate map for each DE
std::array<std::unique_ptr<GlobalHistogram>, 2> mHistogramEfficiencyGlobal; // Efficiency histogram (global XY view)
Expand Down
2 changes: 1 addition & 1 deletion Modules/MUON/MCH/include/MCH/EfficiencyTrendsPlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace muonchambers
class EfficiencyTrendsPlotter : public HistPlotter
{
public:
EfficiencyTrendsPlotter(std::string path, TH2F* hRef, bool fullPlots = false);
EfficiencyTrendsPlotter(std::string path, bool fullPlots = false);

void update(long time, TH2F* hEfficiency);

Expand Down
3 changes: 0 additions & 3 deletions Modules/MUON/MCH/include/MCH/PreclustersPostProcessing.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,12 @@ class PreclustersPostProcessing : public PostProcessingInterface
static std::string clusterChargeSourceName() { return "clcharge"; }
static std::string clusterSizeSourceName() { return "clsize"; }

// PreclustersConfig mConfig;
int64_t mRefTimeStamp{ 0 };
bool mFullHistos{ false };

PostProcessingConfigMCH mConfig;

// CCDB object accessors
std::map<std::string, CcdbObjectHelper> mCcdbObjects;
std::map<std::string, CcdbObjectHelper> mCcdbObjectsRef;

// Hit rate histograms ===============================================

Expand Down
8 changes: 1 addition & 7 deletions Modules/MUON/MCH/include/MCH/RatesPlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace muonchambers
class RatesPlotter : public HistPlotter
{
public:
RatesPlotter(std::string path, TH2F* hRef, float rateMin, float rateMax, bool perStationPlots = false, bool fullPlots = false);
RatesPlotter(std::string path, float rateMin, float rateMax, bool perStationPlots = false, bool fullPlots = false);

void update(TH2F* hRates);

Expand Down Expand Up @@ -69,14 +69,8 @@ class RatesPlotter : public HistPlotter
std::unique_ptr<TH2F> mHistogramRatePerStation;

std::unique_ptr<TH1F> mHistogramMeanRatePerDE;
std::unique_ptr<TH1F> mHistogramMeanRatePerDERef;
std::unique_ptr<TH1F> mHistogramMeanRateRefRatio;
std::unique_ptr<TCanvas> mCanvasMeanRatePerDE;

std::unique_ptr<TH1F> mHistogramGoodChannelsFractionPerDE;
std::unique_ptr<TH1F> mHistogramGoodChannelsFractionPerDERef;
std::unique_ptr<TH1F> mHistogramGoodChannelsFractionRefRatio;
std::unique_ptr<TCanvas> mCanvasGoodChannelsFractionPerDE;

std::map<int, std::shared_ptr<DetectorHistogram>> mHistogramRateDE[2]; // 2D hit rate map for each DE
std::shared_ptr<GlobalHistogram> mHistogramRateGlobal[2]; // Rate histogram (global XY view)
Expand Down
4 changes: 1 addition & 3 deletions Modules/MUON/MCH/include/MCH/RatesTrendsPlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace muonchambers
class RatesTrendsPlotter : public HistPlotter
{
public:
RatesTrendsPlotter(std::string path, TH2F* hRef, bool fullPlots = false);
RatesTrendsPlotter(std::string path, bool fullPlots = false);

void update(long time, TH2F* hEfficiency);

Expand All @@ -51,11 +51,9 @@ class RatesTrendsPlotter : public HistPlotter

// Data reductor
std::unique_ptr<TH2ElecMapReductor> mReductor;
std::array<std::optional<float>, getNumDE()> mRefValues;
// Trend plots
std::unique_ptr<TrendGraph> mOrbits;
std::array<std::unique_ptr<TrendGraph>, getNumDE()> mTrendsDE;
std::array<std::unique_ptr<TrendGraph>, getNumDE()> mTrendsRefRatioDE;
std::array<std::unique_ptr<TrendGraph>, 10> mTrendsChamber;
std::unique_ptr<TrendMultiGraph> mTrends;
};
Expand Down
53 changes: 2 additions & 51 deletions Modules/MUON/MCH/src/ClusterChargePlotter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,17 @@ namespace quality_control_modules
namespace muonchambers
{

ClusterChargePlotter::ClusterChargePlotter(std::string path, TH2F* hRef, bool fullPlots)
ClusterChargePlotter::ClusterChargePlotter(std::string path, bool fullPlots)
{
mChargeReductor = std::make_unique<ClusterChargeReductor>();

//----------------------------------
// Reference charge MPV histogram
//----------------------------------
mHistogramChargePerDERef =
std::make_unique<TH1F>(TString::Format("%sChargeRef", path.c_str()),
TString::Format("Charge vs DE, reference"), getNumDE(), 0, getNumDE());
mHistogramChargePerDERef->SetLineColor(kRed);
mHistogramChargePerDERef->SetLineStyle(kDashed);
mHistogramChargePerDERef->SetLineWidth(2);

if (hRef) {
ClusterChargeReductor reductorRef;
reductorRef.update(hRef);

for (size_t de = 0; de < mHistogramChargePerDERef->GetXaxis()->GetNbins(); de++) {
mHistogramChargePerDERef->SetBinContent(de + 1, reductorRef.getDeValue(de));
mHistogramChargePerDERef->SetBinError(de + 1, 0);
}
}

//----------------------------------
// Charge MPV histograms
//----------------------------------

mHistogramChargePerDE = std::make_unique<TH1F>(TString::Format("%sClusterChargeMPVHist", path.c_str()),
TString::Format("Charge vs DE"), getNumDE(), 0, getNumDE());

mHistogramChargeRefRatio = std::make_unique<TH1F>(TString::Format("%sClusterChargeMPVRefRatio", path.c_str()),
TString::Format("Charge vs DE, ratio wrt reference"), getNumDE(), 0, getNumDE());
addHisto(mHistogramChargeRefRatio.get(), false, "histo", "");

mCanvasChargePerDE = std::make_unique<TCanvas>(TString::Format("%sClusterChargeMPV", path.c_str()),
TString::Format("Charge MPV vs DE"), 800, 600);
// mCanvasChargePerDE->SetLogy(kTRUE);
addCanvas(mCanvasChargePerDE.get(), mHistogramChargePerDE.get(), false, "", "");
addHisto(mHistogramChargePerDE.get(), false, "histo", "");

for (auto de : o2::mch::constants::deIdsForAllMCH) {
int deID = getDEindex(de);
Expand All @@ -88,27 +60,6 @@ void ClusterChargePlotter::update(TH2F* hCharge)
mHistogramChargePerDE->SetBinError(de + 1, 0.1);
}

mCanvasChargePerDE->Clear();
mCanvasChargePerDE->cd();
mHistogramChargePerDE->Draw();

if (mHistogramChargePerDERef) {
mHistogramChargePerDERef->Draw("histsame");

mHistogramChargeRefRatio->Reset();
mHistogramChargeRefRatio->Add(mHistogramChargePerDE.get());
mHistogramChargeRefRatio->Divide(mHistogramChargePerDERef.get());

// special handling of bins with zero rate in reference
int nbinsx = mHistogramChargePerDERef->GetXaxis()->GetNbins();
for (int b = 1; b <= nbinsx; b++) {
if (mHistogramChargePerDERef->GetBinContent(b) == 0) {
mHistogramChargeRefRatio->SetBinContent(b, 1);
mHistogramChargeRefRatio->SetBinError(b, 0);
}
}
}

for (int xbin = 1; xbin <= hCharge->GetXaxis()->GetNbins(); xbin++) {
if (xbin > getNumDE()) {
break;
Expand Down
19 changes: 2 additions & 17 deletions Modules/MUON/MCH/src/ClusterChargeTrendsPlotter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,10 @@ namespace quality_control_modules
namespace muonchambers
{

ClusterChargeTrendsPlotter::ClusterChargeTrendsPlotter(std::string path, TH2F* hRef, bool fullPlots)
ClusterChargeTrendsPlotter::ClusterChargeTrendsPlotter(std::string path, bool fullPlots)
{
mReductor = std::make_unique<ClusterChargeReductor>();

//--------------------------------------------------
// Cluster charge reference values
//--------------------------------------------------

std::unique_ptr<ClusterChargeReductor> reductorRef;
if (hRef) {
reductorRef = std::make_unique<ClusterChargeReductor>();
reductorRef->update(hRef);
}

//--------------------------------------------------
// Cluster charge trends
//--------------------------------------------------
Expand All @@ -49,13 +39,8 @@ ClusterChargeTrendsPlotter::ClusterChargeTrendsPlotter(std::string path, TH2F* h
continue;
}

std::optional<float> refVal;
if (reductorRef) {
refVal = reductorRef->getDeValue(deID);
}

mTrends[deID] = std::make_unique<TrendGraph>(fmt::format("{}{}/ClusterCharge_DE{}", path, getHistoPath(de), de),
fmt::format("DE{} Cluster Charge MPV", de), "charge (ADC)", refVal);
fmt::format("DE{} Cluster Charge MPV", de), "charge (ADC)");
// mTrends[deID]->setRange(0, 1.2);
if (fullPlots) {
addCanvas(mTrends[deID].get(), "");
Expand Down
59 changes: 3 additions & 56 deletions Modules/MUON/MCH/src/ClusterSizePlotter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,54 +29,22 @@ namespace quality_control_modules
namespace muonchambers
{

ClusterSizePlotter::ClusterSizePlotter(std::string path, TH2F* hRef, bool fullPlots) : mPath(path)
ClusterSizePlotter::ClusterSizePlotter(std::string path, bool fullPlots) : mPath(path)
{
mClusterSizeReductor = std::make_unique<ClusterSizeReductor>();

ClusterSizeReductor reductorRef;
if (hRef) {
reductorRef.update(hRef);
}

std::string sc[3] = { "B", "NB", "" };
std::string sc2[3] = { " (B)", " (NB)", "" };
int histColors[3] = { kRed, kBlue, kBlack };
for (int ci = 0; ci < 3; ci++) {

//----------------------------------
// Reference mean cluster size histogram
//----------------------------------
mHistogramClusterSizePerDERef[ci] =
std::make_unique<TH1F>(TString::Format("%sClusterSizeRef%s", mPath.c_str(), sc[ci].c_str()),
TString::Format("Cluster Size vs DE%s, reference", sc2[ci].c_str()),
getNumDE(), 0, getNumDE());
mHistogramClusterSizePerDERef[ci]->SetLineColor(kRed);
mHistogramClusterSizePerDERef[ci]->SetLineStyle(kDashed);
mHistogramClusterSizePerDERef[ci]->SetLineWidth(2);

if (hRef) {
for (size_t de = 0; de < mHistogramClusterSizePerDERef[ci]->GetXaxis()->GetNbins(); de++) {
mHistogramClusterSizePerDERef[ci]->SetBinContent(de + 1, reductorRef.getDeValue(de, ci));
mHistogramClusterSizePerDERef[ci]->SetBinError(de + 1, 0);
}
}

//----------------------------------
// Mean cluster size histograms
//----------------------------------

mHistogramClusterSizePerDE[ci] = std::make_unique<TH1F>(TString::Format("%sMeanClusterSize%sHist", mPath.c_str(), sc[ci].c_str()),
mHistogramClusterSizePerDE[ci] = std::make_unique<TH1F>(TString::Format("%sMeanClusterSize%s", mPath.c_str(), sc[ci].c_str()),
TString::Format("Cluster Size vs DE%s", sc2[ci].c_str()), getNumDE(), 0, getNumDE());

mHistogramClusterSizePerDERefRatio[ci] = std::make_unique<TH1F>(TString::Format("%sMeanClusterSizeRefRatio%s", mPath.c_str(), sc[ci].c_str()),
TString::Format("Cluster Size vs DE%s, ratio wrt reference", sc2[ci].c_str()),
getNumDE(), 0, getNumDE());
addHisto(mHistogramClusterSizePerDERefRatio[ci].get(), false, "histo", "");

mCanvasClusterSizePerDE[ci] = std::make_unique<TCanvas>(TString::Format("%sMeanClusterSize%s", mPath.c_str(), sc[ci].c_str()),
TString::Format("Cluster Size vs DE%s", sc2[ci].c_str()), 800, 600);
// mCanvasClusterSizePerDE->SetLogy(kTRUE);
addCanvas(mCanvasClusterSizePerDE[ci].get(), mHistogramClusterSizePerDE[ci].get(), false, "histo", "histo");
addHisto(mHistogramClusterSizePerDE[ci].get(), false, "histo", "");

for (auto de : o2::mch::constants::deIdsForAllMCH) {
int deID = getDEindex(de);
Expand Down Expand Up @@ -144,27 +112,6 @@ void ClusterSizePlotter::fillHistograms(TH2F* hSize)
mHistogramClusterSizePerDE[ci]->SetBinContent(de + 1, mClusterSizeReductor->getDeValue(de, ci));
mHistogramClusterSizePerDE[ci]->SetBinError(de + 1, 0.1);
}

mCanvasClusterSizePerDE[ci]->Clear();
mCanvasClusterSizePerDE[ci]->cd();
mHistogramClusterSizePerDE[ci]->Draw();

if (mHistogramClusterSizePerDERef[ci]) {
mHistogramClusterSizePerDERef[ci]->Draw("histsame");

mHistogramClusterSizePerDERefRatio[ci]->Reset();
mHistogramClusterSizePerDERefRatio[ci]->Add(mHistogramClusterSizePerDE[ci].get());
mHistogramClusterSizePerDERefRatio[ci]->Divide(mHistogramClusterSizePerDERef[ci].get());

// special handling of bins with zero rate in reference
int nbinsx = mHistogramClusterSizePerDERef[ci]->GetXaxis()->GetNbins();
for (int b = 1; b <= nbinsx; b++) {
if (mHistogramClusterSizePerDERef[ci]->GetBinContent(b) == 0) {
mHistogramClusterSizePerDERefRatio[ci]->SetBinContent(b, 1);
mHistogramClusterSizePerDERefRatio[ci]->SetBinError(b, 0);
}
}
}
}

for (int xbin = 1; xbin <= hSize->GetXaxis()->GetNbins(); xbin++) {
Expand Down
21 changes: 4 additions & 17 deletions Modules/MUON/MCH/src/ClusterSizeTrendsPlotter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,10 @@ namespace quality_control_modules
namespace muonchambers
{

ClusterSizeTrendsPlotter::ClusterSizeTrendsPlotter(std::string path, TH2F* hRef, bool fullPlots)
ClusterSizeTrendsPlotter::ClusterSizeTrendsPlotter(std::string path, bool fullPlots)
{
mReductor = std::make_unique<ClusterSizeReductor>();

std::unique_ptr<ClusterSizeReductor> reductorRef;
if (hRef) {
reductorRef = std::make_unique<ClusterSizeReductor>();
reductorRef->update(hRef);
}

//--------------------------------------------------
// Efficiency trends
//--------------------------------------------------
Expand All @@ -47,18 +41,11 @@ ClusterSizeTrendsPlotter::ClusterSizeTrendsPlotter(std::string path, TH2F* hRef,
continue;
}

std::optional<float> refB, refNB, refBNB;
if (reductorRef) {
refB = reductorRef->getDeValue(deID, 0);
refNB = reductorRef->getDeValue(deID, 1);
refBNB = reductorRef->getDeValue(deID, 2);
}

mTrends[deID] = std::make_unique<TrendMultiGraph>(fmt::format("{}{}/ClusterSize_DE{}", path, getHistoPath(de), de),
fmt::format("DE{} Cluster Size", de), "cluster size");
mTrends[deID]->addGraph("B", "bending ", refB);
mTrends[deID]->addGraph("NB", "non-bending", refNB);
mTrends[deID]->addGraph("BNB", "full ", refBNB);
mTrends[deID]->addGraph("B", "bending ");
mTrends[deID]->addGraph("NB", "non-bending");
mTrends[deID]->addGraph("BNB", "full ");
mTrends[deID]->addLegends();

if (fullPlots) {
Expand Down
Loading