Skip to content
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
4 changes: 4 additions & 0 deletions Modules/FT0/include/FT0/BasicPPTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ class BasicPPTask final : public quality_control::postprocessing::PostProcessing
public:
BasicPPTask() = default;
~BasicPPTask() override;
void configure(std::string, const boost::property_tree::ptree&);
void initialize(quality_control::postprocessing::Trigger, framework::ServiceRegistry&) override;
void update(quality_control::postprocessing::Trigger, framework::ServiceRegistry&) override;
void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistry&) override;

private:
std::string mCycleDurationMoName;
int mNumOrbitsInTF;

o2::quality_control::repository::DatabaseInterface* mDatabase = nullptr;
std::unique_ptr<TGraph> mRateOrA;
std::unique_ptr<TGraph> mRateOrC;
Expand Down
41 changes: 35 additions & 6 deletions Modules/FT0/src/BasicPPTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "FT0/BasicPPTask.h"
#include "QualityControl/QcInfoLogger.h"
#include "CommonConstants/LHCConstants.h"

#include <TH1F.h>
#include <TH2F.h>
Expand All @@ -36,6 +37,29 @@ BasicPPTask::~BasicPPTask()
delete mTime;
}

void BasicPPTask::configure(std::string, const boost::property_tree::ptree& config)
{
const char* configPath = Form("qc.postprocessing.%s", getName().c_str());
ILOG(Info, Support) << "configPath = " << configPath << ENDM;
auto node = config.get_child_optional(Form("%s.custom.numOrbitsInTF", configPath));
if (node) {
mNumOrbitsInTF = std::stoi(node.get_ptr()->get_child("").get_value<std::string>());
ILOG(Info, Support) << "configure() : using numOrbitsInTF = " << mNumOrbitsInTF << ENDM;
} else {
mNumOrbitsInTF = 256;
ILOG(Info, Support) << "configure() : using default numOrbitsInTF = " << mNumOrbitsInTF << ENDM;
}

node = config.get_child_optional(Form("%s.custom.cycleDurationMoName", configPath));
if (node) {
mCycleDurationMoName = node.get_ptr()->get_child("").get_value<std::string>();
ILOG(Info, Support) << "configure() : using cycleDurationMoName = \"" << mCycleDurationMoName << "\"" << ENDM;
} else {
mCycleDurationMoName = "CycleDurationNTF";
ILOG(Info, Support) << "configure() : using default cycleDurationMoName = \"" << mCycleDurationMoName << "\"" << ENDM;
}
}

void BasicPPTask::initialize(Trigger, framework::ServiceRegistry& services)
{
mDatabase = &services.get<o2::quality_control::repository::DatabaseInterface>();
Expand Down Expand Up @@ -86,17 +110,22 @@ void BasicPPTask::update(Trigger, framework::ServiceRegistry&)
auto mo = mDatabase->retrieveMO("qc/FT0/MO/DigitQcTask/", "Triggers");
auto hTriggers = (TH1F*)mo->getObject();
if (!hTriggers) {
ILOG(Error) << "\nMO \"Triggers\" NOT retrieved!!!\n"
<< ENDM;
ILOG(Error) << "MO \"Triggers\" NOT retrieved!!!" << ENDM;
}

auto mo2 = mDatabase->retrieveMO("qc/FT0/MO/DigitQcTask/", "CycleDuration");
auto mo2 = mDatabase->retrieveMO("qc/FT0/MO/DigitQcTask/", mCycleDurationMoName);
auto hCycleDuration = (TH1D*)mo2->getObject();
if (!hCycleDuration) {
ILOG(Error) << "\nMO \"CycleDuration\" NOT retrieved!!!\n"
<< ENDM;
ILOG(Error) << "MO \"" << mCycleDurationMoName << "\" NOT retrieved!!!" << ENDM;
}
double cycleDurationMS = hCycleDuration->GetBinContent(1) / 1e6; // ns -> ms

double cycleDurationMS = 0;
if (mCycleDurationMoName == "CycleDuration" || mCycleDurationMoName == "CycleDurationRange")
// assume MO stores cycle duration in ns
cycleDurationMS = hCycleDuration->GetBinContent(1) / 1e6; // ns -> ms
else if (mCycleDurationMoName == "CycleDurationNTF")
// assume MO stores cycle duration in number of TF
cycleDurationMS = hCycleDuration->GetBinContent(1) * mNumOrbitsInTF * o2::constants::lhc::LHCOrbitNS / 1e6; // ns ->ms

int n = mRateOrA->GetN();

Expand Down
14 changes: 12 additions & 2 deletions Modules/FV0/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

add_library(O2QcFV0)

target_sources(O2QcFV0 PRIVATE src/DigitQcTask.cxx )
target_sources(O2QcFV0 PRIVATE src/DigitQcTask.cxx
src/CFDEffCheck.cxx
src/BasicPPTask.cxx
src/OutOfBunchCollTask.cxx
src/OutOfBunchCollCheck.cxx
#src/TriggerQcTask.cxx
)

target_include_directories(
O2QcFV0
Expand All @@ -21,6 +27,11 @@ add_root_dictionary(O2QcFV0
HEADERS
include/FV0/DigitQcTask.h
include/FV0/Helper.h
include/FV0/CFDEffCheck.h
include/FV0/BasicPPTask.h
include/FV0/OutOfBunchCollTask.h
include/FV0/OutOfBunchCollCheck.h
#include/FV0/TriggerQcTask.h
LINKDEF include/FV0/LinkDef.h
BASENAME O2QcFV0)

Expand All @@ -40,4 +51,3 @@ foreach(test ${TEST_SRCS})
PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests)
set_tests_properties(${test_name} PROPERTIES TIMEOUT 20)
endforeach()

66 changes: 66 additions & 0 deletions Modules/FV0/include/FV0/BasicPPTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// 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 BasicPPTask.h
/// \author Sebastian Bysiak sbysiak@cern.ch
///

#ifndef QC_MODULE_FV0_BASICPPTASK_H
#define QC_MODULE_FV0_BASICPPTASK_H

#include "QualityControl/PostProcessingInterface.h"
#include "QualityControl/DatabaseInterface.h"
#include "FV0Base/Constants.h"
#include <TGraph.h>
#include <TCanvas.h>

class TH1F;
class TGraph;
class TCanvas;
class TLegend;
class TProfile;

namespace o2::quality_control_modules::fv0
{

/// \brief Basic Postprocessing Task for FV0, computes among others the trigger rates
/// \author Sebastian Bysiak sbysiak@cern.ch
class BasicPPTask final : public quality_control::postprocessing::PostProcessingInterface
{
public:
BasicPPTask() = default;
~BasicPPTask() override;
void configure(std::string, const boost::property_tree::ptree&);
void initialize(quality_control::postprocessing::Trigger, framework::ServiceRegistry&) override;
void update(quality_control::postprocessing::Trigger, framework::ServiceRegistry&) override;
void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistry&) override;

constexpr static std::size_t sNCHANNELS_PM = 60; //48(for PM) + 12(just in case for possible PM-LCS)

private:
std::string mCycleDurationMoName;
int mNumOrbitsInTF;

o2::quality_control::repository::DatabaseInterface* mDatabase = nullptr;
std::unique_ptr<TGraph> mRateMinBias;
std::unique_ptr<TGraph> mRateOuterRing;
std::unique_ptr<TGraph> mRateNChannels;
std::unique_ptr<TGraph> mRateCharge;
std::unique_ptr<TGraph> mRateInnerRing;
std::unique_ptr<TCanvas> mRatesCanv;
TProfile* mAmpl = nullptr;
TProfile* mTime = nullptr;
};

} // namespace o2::quality_control_modules::fv0

#endif //QC_MODULE_FV0_BASICPPTASK_H
51 changes: 51 additions & 0 deletions Modules/FV0/include/FV0/CFDEffCheck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// 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 CFDEffCheck.h
/// \author Sebastian Bysiak sbysiak@cern.ch
///

#ifndef QC_MODULE_FV0_FV0CFDEFFCHECK_H
#define QC_MODULE_FV0_FV0CFDEFFCHECK_H

#include "QualityControl/CheckInterface.h"

namespace o2::quality_control_modules::fv0
{

/// \brief checks if CFD efficiency is below threshold
/// \author Sebastian Bysiak sbysiak@cern.ch
class CFDEffCheck : public o2::quality_control::checker::CheckInterface
{
public:
CFDEffCheck() = default;
~CFDEffCheck() override = default;

void configure(std::string name) 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;

constexpr static int sNCHANNELS_PM = 48; //48(for PM), nothing more

ClassDefOverride(CFDEffCheck, 1);

private:
float mThreshWarning;
float mThreshError;
int mNumWarnings;
int mNumErrors;
};

} // namespace o2::quality_control_modules::fv0

#endif // QC_MODULE_FV0_FV0CFDEFFCHECK_H
46 changes: 40 additions & 6 deletions Modules/FV0/include/FV0/DigitQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <memory>
#include <regex>
#include <type_traits>
#include <boost/algorithm/string.hpp>
#include "TH1.h"
#include "TH2.h"
#include "TList.h"
Expand Down Expand Up @@ -62,6 +63,18 @@ class DigitQcTask final : public TaskInterface
constexpr static uint8_t sLaserBitPos = 5;

private:
// three ways of computing cycle duration:
// 1) number of time frames
// 2) time in ns from InteractionRecord: total range (totalMax - totalMin)
// 3) time in ns from InteractionRecord: sum of each TF duration
// later on choose the best and remove others
double mTimeMinNS = 0.;
double mTimeMaxNS = 0.;
double mTimeCurNS = 0.;
int mTfCounter = 0;
double mTimeSum = 0.;
const float mCFDChannel2NS = 0.01302; // CFD channel width in ns

template <typename Param_t,
typename = typename std::enable_if<std::is_floating_point<Param_t>::value ||
std::is_same<std::string, Param_t>::value || (std::is_integral<Param_t>::value && !std::is_same<bool, Param_t>::value)>::type>
Expand All @@ -82,12 +95,31 @@ class DigitQcTask final : public TaskInterface
return vecResult;
}

void rebinFromConfig();

TList* mListHistGarbage;
std::set<unsigned int> mSetAllowedChIDs;
std::array<o2::InteractionRecord, sNCHANNELS_PM> mStateLastIR2Ch;
std::map<int, std::string> mMapDigitTrgNames;
std::map<int, std::string> mMapChTrgNames;
std::unique_ptr<TH1F> mHistNumADC;
std::unique_ptr<TH1F> mHistNumCFD;

// temp
enum ETrgMenu { kMinBias,
kOuterRing,
kNChannels,
kCharge,
kInnerRing
};

// Object which will be published
std::unique_ptr<TH2F> mHistAmp2Ch;
std::unique_ptr<TH2F> mHistTime2Ch;
std::unique_ptr<TH2F> mHistEventDensity2Ch;
std::unique_ptr<TH2F> mHistOrbit2BC;
std::unique_ptr<TH2F> mHistChDataBits;
std::unique_ptr<TH2F> mHistOrbit2BC;
std::unique_ptr<TH1F> mHistBC;
std::unique_ptr<TH1F> mHistTriggers;
std::unique_ptr<TH1F> mHistNchA;
std::unique_ptr<TH1F> mHistNchC;
Expand All @@ -96,15 +128,17 @@ class DigitQcTask final : public TaskInterface
std::unique_ptr<TH1F> mHistAverageTimeA;
std::unique_ptr<TH1F> mHistAverageTimeC;
std::unique_ptr<TH1F> mHistChannelID;
std::array<o2::InteractionRecord, sNCHANNELS_PM> mStateLastIR2Ch;
std::map<int, std::string> mMapChTrgNames;
std::map<int, std::string> mMapDigitTrgNames;
TList* mListHistGarbage;
std::unique_ptr<TH1F> mHistCFDEff;
// std::unique_ptr<TH2F> mHistTimeSum2Diff;
std::unique_ptr<TH2F> mHistTriggersCorrelation;
std::unique_ptr<TH1D> mHistCycleDuration;
std::unique_ptr<TH1D> mHistCycleDurationNTF;
std::unique_ptr<TH1D> mHistCycleDurationRange;
std::map<unsigned int, TH1F*> mMapHistAmp1D;
std::map<unsigned int, TH1F*> mMapHistTime1D;
std::map<unsigned int, TH1F*> mMapHistPMbits;
std::map<unsigned int, TH2F*> mMapHistAmpVsTime;
std::set<unsigned int> mSetAllowedChIDs;
std::map<unsigned int, TH2F*> mMapTrgBcOrbit;
};

} // namespace o2::quality_control_modules::fv0
Expand Down
8 changes: 7 additions & 1 deletion Modules/FV0/include/FV0/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class o2::quality_control_modules::fv0::DigitQcTask+;
#pragma link C++ class o2::quality_control_modules::fv0::DigitQcTask + ;
#pragma link C++ class o2::quality_control_modules::fv0::BasicPPTask + ;
#pragma link C++ class o2::quality_control_modules::fv0::OutOfBunchCollTask + ;
#pragma link C++ class o2::quality_control_modules::fv0::CFDEffCheck + ;
// #pragma link C++ class o2::quality_control_modules::fv0::TriggerQcTask + ;
#pragma link C++ class o2::quality_control_modules::fv0::OutOfBunchCollCheck + ;

#endif
53 changes: 53 additions & 0 deletions Modules/FV0/include/FV0/OutOfBunchCollCheck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// 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 OutOfBunchCollCheck.h
/// \author Sebastian Bysiak sbysiak@cern.ch
///

#ifndef QC_MODULE_FV0_FV0OUTOFBUNCHCOLLCHECK_H
#define QC_MODULE_FV0_FV0OUTOFBUNCHCOLLCHECK_H

#include "QualityControl/CheckInterface.h"

namespace o2::quality_control_modules::fv0
{

/// \brief Checks what fraction of collisions is out of bunch
/// \author Sebastian Bysiak sbysiak@cern.ch
class OutOfBunchCollCheck : public o2::quality_control::checker::CheckInterface
{
public:
/// Default constructor
OutOfBunchCollCheck() = default;
/// Destructor
~OutOfBunchCollCheck() override = default;

// Override interface
void configure(std::string name) 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;

ClassDefOverride(OutOfBunchCollCheck, 1);

private:
float mFractionOutOfBunchColl;
int mNumNonEmptyBins;
float mThreshWarning;
float mThreshError;
std::string mTrgName;
};

} // namespace o2::quality_control_modules::fv0

#endif // QC_MODULE_FV0_FV0OUTOFBUNCHCOLLCHECK_H
Loading