-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Check on TrackletsPerTimeFrame and Warniig for Timeframe witho…
…utytracklets
- Loading branch information
1 parent
46497dc
commit 0bf3350
Showing
4 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
/// | ||
/// \file TrackletsPerTimeFrameCheck.h | ||
/// \author My Name | ||
/// | ||
|
||
#ifndef QC_MODULE_TRD_TRDTRACKLETSPERTIMEFRAMECHECK_H | ||
#define QC_MODULE_TRD_TRDTRACKLETSPERTIMEFRAMECHECK_H | ||
|
||
#include "QualityControl/CheckInterface.h" | ||
|
||
namespace o2::quality_control_modules::trd | ||
{ | ||
|
||
/// \brief TrackletsPerTimeFrameCheck QC Check | ||
/// \author My Name | ||
class TrackletsPerTimeFrameCheck : public o2::quality_control::checker::CheckInterface | ||
{ | ||
public: | ||
/// Default constructor | ||
TrackletsPerTimeFrameCheck() = default; | ||
/// Destructor | ||
~TrackletsPerTimeFrameCheck() override = default; | ||
|
||
// Override interface | ||
void configure() override; | ||
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override; | ||
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override; | ||
std::string getAcceptedType() override; | ||
float mThresholdMeanLow, mThresholdMeanHigh; | ||
|
||
ClassDefOverride(TrackletsPerTimeFrameCheck, 2); | ||
}; | ||
|
||
} // namespace o2::quality_control_modules::trd | ||
|
||
#endif // QC_MODULE_TRD_TRDTRACKLETSPERTIMEFRAMECHECK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
/// | ||
/// \file TrackletsPerTimeFrameCheck.cxx | ||
/// \author My Name | ||
/// | ||
|
||
#include "TRD/TrackletsPerTimeFrameCheck.h" | ||
#include "QualityControl/MonitorObject.h" | ||
#include "QualityControl/Quality.h" | ||
#include "QualityControl/QcInfoLogger.h" | ||
#include "Common/Utils.h" | ||
// ROOT | ||
#include <TH1.h> | ||
#include <TPaveText.h> | ||
|
||
#include <DataFormatsQualityControl/FlagReasons.h> | ||
|
||
using namespace std; | ||
using namespace o2::quality_control; | ||
using namespace o2::quality_control_modules::common; | ||
|
||
namespace o2::quality_control_modules::trd | ||
{ | ||
|
||
void TrackletsPerTimeFrameCheck::configure() | ||
{ | ||
ILOG(Debug, Devel) << "initialize TrackletsPerTimeFrameCheck" << ENDM; | ||
|
||
mThresholdMeanHigh = getFromConfig<float>(mCustomParameters, "Upperthreshold", 520.f); | ||
ILOG(Debug, Support) << "using Upperthreshold = " << mThresholdMeanHigh << ENDM; | ||
|
||
mThresholdMeanLow = getFromConfig<float>(mCustomParameters, "Lowerthreshold", 600.f); | ||
ILOG(Debug, Support) << "using Lowerthreshold = " << mThresholdMeanLow << ENDM; | ||
} | ||
|
||
Quality TrackletsPerTimeFrameCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) | ||
{ | ||
Quality result = Quality::Null; | ||
|
||
for (auto& [moName, mo] : *moMap) { | ||
|
||
(void)moName; | ||
if (mo->getName() == "trackletspertimeframe") { | ||
auto* h = dynamic_cast<TH1F*>(mo->getObject()); | ||
if (h == nullptr) { | ||
// ILOG(Debug, Support) << "Requested Histogram type does not match with the Histogram in source" << ENDM; | ||
continue; | ||
} | ||
|
||
TPaveText* msg1 = new TPaveText(0.3, 0.7, 0.7, 0.9, "NDC"); // check option "br","NDC" | ||
h->GetListOfFunctions()->Add(msg1); | ||
msg1->SetTextSize(10); | ||
|
||
// Warning about TimeFrame without any tracklets | ||
int UnderFlowTracklets = h->GetBinContent(0); | ||
if(UnderFlowTracklets>0.){ | ||
msg1->AddText(TString::Format("TimeFrame without Tracklets: %d",UnderFlowTracklets)); | ||
} | ||
|
||
// applying check | ||
float MeanTracletPerTimeFrame = h->GetMean(); | ||
if(MeanTracletPerTimeFrame > mThresholdMeanLow && MeanTracletPerTimeFrame < mThresholdMeanHigh){ | ||
TText* Checkmsg = msg1->AddText("Mean is found in bound region: ok"); | ||
Checkmsg->SetTextColor(kGreen); | ||
result = Quality::Good; | ||
}else { | ||
result = Quality::Bad; | ||
TText* Checkmsg = msg1->AddText("Mean is not found in bound region: not ok"); | ||
Checkmsg->SetTextColor(kRed); | ||
result.addReason(FlagReasonFactory::Unknown(), "MeanTracletPerTimeFrame is not in bound region"); | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
std::string TrackletsPerTimeFrameCheck::getAcceptedType() { return "TH1"; } | ||
|
||
void TrackletsPerTimeFrameCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) | ||
{ | ||
if (mo->getName() == "trackletspertimeframe") { | ||
auto* h = dynamic_cast<TH1F*>(mo->getObject()); | ||
if (h == nullptr) { | ||
// ILOG(Debug, Support) << "Requested Histogram type does not match with the Histogram in source" << ENDM; | ||
return; | ||
} | ||
if (checkResult == Quality::Good) { | ||
h->SetFillColor(kGreen); | ||
} else if (checkResult == Quality::Bad) { | ||
ILOG(Debug, Devel) << "Quality::Bad, setting to red" << ENDM; | ||
h->SetFillColor(kRed); | ||
} else if (checkResult == Quality::Medium) { | ||
ILOG(Debug, Devel) << "Quality::medium, setting to orange" << ENDM; | ||
h->SetFillColor(kOrange); | ||
} | ||
h->SetLineColor(kBlack); | ||
} | ||
} | ||
|
||
} // namespace o2::quality_control_modules::trd |