Skip to content

Commit 06b4780

Browse files
DawidSkoraknopers8
authored andcommitted
Fix the filling of the EventInGateTime hist
Add parametrization of both min and max gate time for EventInGateTime hist.
1 parent f4135c8 commit 06b4780

3 files changed

Lines changed: 28 additions & 9 deletions

File tree

Modules/FIT/FV0/include/FV0/DigitQcTask.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class DigitQcTask final : public TaskInterface
8181

8282
long mTFcreationTime = 0;
8383

84-
int mTimeGate = 192;
84+
int mMinTimeGate = -192;
85+
int mMaxTimeGate = 192;
8586

8687
template <typename Param_t,
8788
typename = typename std::enable_if<std::is_floating_point<Param_t>::value ||

Modules/FIT/FV0/src/DigitQcTask.cxx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
170170
mTrgChargeLevelHigh = getNumericalParameter("trgChargeLevelHigh", 4095);
171171
mTrgThresholdCharge = getNumericalParameter("trgThresholdCharge", 1);
172172
mTrgThresholdNChannels = getNumericalParameter("trgThresholdNChannels", 1);
173-
mTimeGate = getNumericalParameter("gateTimeForRatioHistogram", 192);
173+
mMinTimeGate = getNumericalParameter("minGateTimeForRatioHistogram", -192);
174+
mMaxTimeGate = getNumericalParameter("maxGateTimeForRatioHistogram", 192);
174175

175176
if (mTrgModeInnerOuterThresholdVar == TrgModeThresholdVar::kAmpl) {
176177
mTrgThresholdChargeInner = getNumericalParameter("trgThresholdChargeInner", 1);
@@ -280,7 +281,7 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
280281
mHistCycleDurationNTF = std::make_unique<TH1D>("CycleDurationNTF", "Cycle Duration;;time [TimeFrames]", 1, 0, 2);
281282
mHistCycleDurationRange = std::make_unique<TH1D>("CycleDurationRange", "Cycle Duration (total cycle range);;time [ns]", 1, 0, 2);
282283

283-
std::string gateTimeRatioTitle = "Ratio of events between time -" + std::to_string(mTimeGate) + " and " + std::to_string(mTimeGate);
284+
std::string gateTimeRatioTitle = "Ratio of events between time " + std::to_string(mMinTimeGate) + " and " + std::to_string(mMaxTimeGate);
284285
mHistGateTimeRatio2Ch = std::make_unique<TH1F>("EventsInGateTime", gateTimeRatioTitle.c_str(), sNCHANNELS_FV0_PLUSREF, 0, sNCHANNELS_FV0_PLUSREF);
285286

286287
std::vector<unsigned int> vecChannelIDs;
@@ -649,15 +650,19 @@ void DigitQcTask::endOfCycle()
649650
getObjectsManager()->getMonitorObject(mHistBCvsTrg->GetName())->addOrUpdateMetadata("TFcreationTime", std::to_string(mTFcreationTime));
650651

651652
for (int channel = 1; channel <= sNCHANNELS_FV0_PLUSREF - 1; channel++) {
652-
int events_in_range = 0;
653-
int events_per_channel = 0;
653+
float events_in_range = 0;
654+
float events_per_channel = 0;
654655
for (int bin_on_y_axis = 1; bin_on_y_axis <= mHistTime2Ch->GetNbinsY(); bin_on_y_axis++) {
655-
if (std::abs(mHistTime2Ch->GetYaxis()->GetBinLowEdge(bin_on_y_axis)) < mTimeGate) {
656+
if (mHistTime2Ch->GetYaxis()->GetBinLowEdge(bin_on_y_axis) > mMinTimeGate && mHistTime2Ch->GetYaxis()->GetBinLowEdge(bin_on_y_axis) < mMaxTimeGate) {
656657
events_in_range += mHistTime2Ch->GetBinContent(channel, bin_on_y_axis);
657658
}
658659
events_per_channel += mHistTime2Ch->GetBinContent(channel, bin_on_y_axis);
659660
}
660-
mHistGateTimeRatio2Ch->SetBinContent(channel, (float)events_in_range / (float)events_per_channel);
661+
if (events_per_channel) {
662+
mHistGateTimeRatio2Ch->SetBinContent(channel, events_in_range / events_per_channel);
663+
} else {
664+
mHistGateTimeRatio2Ch->SetBinContent(channel, 0);
665+
}
661666
}
662667

663668
// one has to set num. of entries manually because

Modules/FIT/FV0/src/TriggersSwVsTcmCheck.cxx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,15 @@ Quality TriggersSwVsTcmCheck::check(std::map<std::string, std::shared_ptr<Monito
7676
for (auto& [moName, mo] : *moMap) {
7777
(void)moName;
7878
if (mo->getName() == "TriggersSoftwareVsTCM") {
79-
auto* histogram = dynamic_cast<TH2F*>(mo->getObject());
79+
auto* histogram = dynamic_cast<TH2*>(mo->getObject());
80+
81+
if (!histogram) {
82+
ILOG(Error, Support) << "check(): MO TriggersSoftwareVsTCM not found" << ENDM;
83+
result.addReason(FlagReasonFactory::Unknown(), "MO TriggersSoftwareVsTCM not found");
84+
result.set(Quality::Null);
85+
return result;
86+
}
87+
8088
result = Quality::Good;
8189
int numberOfBinsX = histogram->GetNbinsX();
8290
for (int binId = 1; binId <= numberOfBinsX; binId++) {
@@ -99,7 +107,12 @@ std::string TriggersSwVsTcmCheck::getAcceptedType() { return "TH2"; }
99107
void TriggersSwVsTcmCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
100108
{
101109
if (mo->getName() == "TriggersSoftwareVsTCM") {
102-
auto* histogram = dynamic_cast<TH2F*>(mo->getObject());
110+
auto* histogram = dynamic_cast<TH2*>(mo->getObject());
111+
112+
if (!histogram) {
113+
ILOG(Error, Support) << "beautify(): MO TriggersSoftwareVsTCM not found" << ENDM;
114+
return;
115+
}
103116

104117
TPaveText* msg = new TPaveText(mPositionMsgBox[0], mPositionMsgBox[1], mPositionMsgBox[2], mPositionMsgBox[3], "NDC");
105118
histogram->GetListOfFunctions()->Add(msg);

0 commit comments

Comments
 (0)