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

DiMuonMassBiasClient: add protection for empty input histogram in the fitting function #39173

Merged
Merged
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: 4 additions & 1 deletion DQMOffline/Alignment/interface/DiMuonMassBiasClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ namespace diMuonMassBias {
assert(v.size() == 3);
std::copy(std::begin(v), std::end(v), x);
}

static constexpr int minimumHits = 10;

} // namespace diMuonMassBias

class DiMuonMassBiasClient : public DQMEDHarvester {
Expand Down Expand Up @@ -83,7 +86,7 @@ class DiMuonMassBiasClient : public DQMEDHarvester {

float meanConfig_[3]; /* parmaeters for the fit: mean */
float widthConfig_[3]; /* parameters for the fit: width */
float sigmaConfig_[3]; /* parmaeters for the fit: sigma */
float sigmaConfig_[3]; /* parameters for the fit: sigma */

// list of histograms to harvest
std::vector<std::string> MEtoHarvest_;
Expand Down
3 changes: 2 additions & 1 deletion DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
FolderName = "AlCaReco/"+__selectionName
)

ALCARECOTkAlDiMuonAndVertexDQM = cms.Sequence(ALCARECOTkAlDiMuonAndVertexTkAlDQM + ALCARECOTkAlDiMuonAndVertexVtxDQM + ALCARECOTkAlDiMuonMassBiasDQM + ALCARECOTkAlDiMuonMassBiasClient)
ALCARECOTkAlDiMuonAndVertexDQM = cms.Sequence(ALCARECOTkAlDiMuonAndVertexTkAlDQM + ALCARECOTkAlDiMuonAndVertexVtxDQM + ALCARECOTkAlDiMuonMassBiasDQM)
# comment for now, doesn't support concurrent lumis + ALCARECOTkAlDiMuonMassBiasClient)

#########################################################
#############--- TkAlZMuMuHI ---########################
Expand Down
14 changes: 11 additions & 3 deletions DQMOffline/Alignment/src/DiMuonMassBiasClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ void DiMuonMassBiasClient::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGett
diMuonMassBias::fitOutputs DiMuonMassBiasClient::fitVoigt(TH1* hist, const bool& fitBackground) const
//-----------------------------------------------------------------------------------
{
if (hist->GetEntries() < diMuonMassBias::minimumHits) {
edm::LogWarning("DiMuonMassBiasClient") << " Input histogram:" << hist->GetName() << " has not enough entries ("
<< hist->GetEntries() << ") for a meaningful Voigtian fit!\n"
<< "Skipping!";

return diMuonMassBias::fitOutputs(Measurement1D(0., 0.), Measurement1D(0., 0.));
}

TCanvas* c1 = new TCanvas();
if (debugMode_) {
c1->Clear();
Expand All @@ -168,9 +176,9 @@ diMuonMassBias::fitOutputs DiMuonMassBiasClient::fitVoigt(TH1* hist, const bool&
RooDataHist datahist("datahist", "datahist", InvMass, RooFit::Import(*hist));
datahist.plotOn(frame);

RooRealVar mean("#mu", "mean", meanConfig_[0], meanConfig_[1], meanConfig_[2]); //90.0, 60.0, 120.0
RooRealVar width("width", "width", widthConfig_[0], widthConfig_[1], widthConfig_[2]); // 5.0, 0.0, 120.0
RooRealVar sigma("#sigma", "sigma", sigmaConfig_[0], sigmaConfig_[1], sigmaConfig_[2]); // 5.0, 0.0, 120.0
RooRealVar mean("#mu", "mean", meanConfig_[0], meanConfig_[1], meanConfig_[2]); //90.0, 60.0, 120.0 (for Z)
RooRealVar width("width", "width", widthConfig_[0], widthConfig_[1], widthConfig_[2]); // 5.0, 0.0, 120.0 (for Z)
RooRealVar sigma("#sigma", "sigma", sigmaConfig_[0], sigmaConfig_[1], sigmaConfig_[2]); // 5.0, 0.0, 120.0 (for Z)
RooVoigtian voigt("voigt", "voigt", InvMass, mean, width, sigma);

RooRealVar lambda("#lambda", "slope", -0.01, -100., 1.);
Expand Down