Skip to content

Commit

Permalink
Adding Check on TrackletsPerTimeFrame and Warniig for Timeframe witho…
Browse files Browse the repository at this point in the history
…utytracklets
  • Loading branch information
deependra170598 committed Oct 12, 2023
1 parent 46497dc commit 0bf3350
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Modules/TRD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

add_library(O2QcTRD)

target_sources(O2QcTRD PRIVATE src/TrackletPerTriggerCheck.cxx src/TRDReductor.cxx src/PulsePositionCheck.cxx src/TrackingTask.cxx src/PulseHeightTrackMatch.cxx src/TrackletsCheck.cxx src/TrackletsTask.cxx src/PulseHeightCheck.cxx src/PulseHeight.cxx src/RawData.cxx src/DigitsTask.cxx
target_sources(O2QcTRD PRIVATE src/TrackletsPerTimeFrameCheck.cxx src/TrackletPerTriggerCheck.cxx src/TRDReductor.cxx src/PulsePositionCheck.cxx src/TrackingTask.cxx src/PulseHeightTrackMatch.cxx src/TrackletsCheck.cxx src/TrackletsTask.cxx src/PulseHeightCheck.cxx src/PulseHeight.cxx src/RawData.cxx src/DigitsTask.cxx
src/DigitsCheck.cxx src/TRDTrending.cxx src/TrendingTaskConfigTRD.cxx src/PulseHeightPostProcessing.cxx)

target_include_directories(
Expand All @@ -20,6 +20,7 @@ install(TARGETS O2QcTRD

add_root_dictionary(O2QcTRD
HEADERS
include/TRD/TrackletsPerTimeFrameCheck.h
include/TRD/TrackletPerTriggerCheck.h
include/TRD/TRDReductor.h
include/TRD/PulsePositionCheck.h
Expand Down
1 change: 1 addition & 0 deletions Modules/TRD/include/TRD/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
#pragma link C++ class o2::quality_control_modules::trd::PulsePositionCheck + ;
#pragma link C++ class o2::quality_control_modules::trd::TRDReductor + ;
#pragma link C++ class o2::quality_control_modules::trd::TrackletPerTriggerCheck + ;
#pragma link C++ class o2::quality_control_modules::trd::TrackletsPerTimeFrameCheck+;
#endif
47 changes: 47 additions & 0 deletions Modules/TRD/include/TRD/TrackletsPerTimeFrameCheck.h
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
110 changes: 110 additions & 0 deletions Modules/TRD/src/TrackletsPerTimeFrameCheck.cxx
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

0 comments on commit 0bf3350

Please sign in to comment.