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

TOF: Add protection when no object in MO is found + reduce logs #2120

Merged
merged 2 commits into from
Feb 1, 2024
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
14 changes: 8 additions & 6 deletions Modules/TOF/src/TrendingRate.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,23 @@ void TrendingRate::computeTOFRates(TH2F* h, std::vector<int>& bcInt, std::vector
}
const float overall = hs->Integral();
if (overall <= 0.f) {
ILOG(Info, Support) << "no signal for BC index " << ibc << ENDM;
ILOG(Warning, Support) << "no signal for BC index " << ibc << ENDM;
delete hb;
delete hs;

continue;
}
const float background = hb->Integral();
if (background <= 0.f) {
ILOG(Info, Support) << "no background for BC index " << ibc << ENDM;
ILOG(Warning, Support) << "no background for BC index " << ibc << ENDM;
delete hb;
delete hs;

continue;
}
const float prob = (overall - background) / overall;
if ((1.f - prob) < 0.f) {
ILOG(Info, Support) << "Probability is 1, can't comute mu" << ENDM;
ILOG(Warning, Support) << "Probability is 1, can't comute mu" << ENDM;
delete hb;
delete hs;

Expand All @@ -180,7 +180,7 @@ void TrendingRate::computeTOFRates(TH2F* h, std::vector<int>& bcInt, std::vector
sumw += rate;
pilup += mu / prob * rate;
ratetot += rate;
ILOG(Info, Support) << "interaction prob = " << mu << ", rate=" << rate << " Hz, mu=" << mu / prob << ENDM;
//ILOG(Info, Support) << "interaction prob = " << mu << ", rate=" << rate << " Hz, mu=" << mu / prob << ENDM;
delete hb;
delete hs;
}
Expand Down Expand Up @@ -251,13 +251,15 @@ void TrendingRate::trendValues(const Trigger& t, repository::DatabaseInterface&

for (auto& dataSource : mConfig.dataSources) {
auto mo = qcdb.retrieveMO(dataSource.path, dataSource.name, t.timestamp, t.activity);
if (!mo) {
TObject* obj = mo ? mo->getObject() : nullptr;
if (!obj) {
ILOG(Error, Support) << "No MO retrieved from qcdb, name: " << dataSource.name << " - path:" << dataSource.path << " - timestamp" << t.timestamp << ENDM;
continue;
}
ILOG(Debug, Support) << "Got MO " << mo << ENDM;
if (dataSource.name == "HitMap") {
foundHitMap = true;
TH2F* hmap = dynamic_cast<TH2F*>(mo->getObject());
TH2F* hmap = dynamic_cast<TH2F*>(obj);
if (hmap) {
TH2F hcopy(*hmap);
hcopy.Divide(hmap);
Expand Down
Loading