Skip to content

Commit 47b0656

Browse files
authored
[EMCAL-1037] Add visualization for BC shift (#1961)
1 parent 7d3ed8a commit 47b0656

4 files changed

Lines changed: 406 additions & 2 deletions

File tree

Modules/EMCAL/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
add_library(O2QcEMCAL)
44

5-
target_sources(O2QcEMCAL PRIVATE src/BCTask.cxx src/RawErrorCheck.cxx src/RawTask.cxx src/RawCheck.cxx src/CellTask.cxx src/CellCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx src/OccupancyReductor.cxx src/ClusterTask.cxx src/RawErrorTask.cxx src/CalibMonitoringTask.cxx src/SupermoduleProjectorTask.cxx src/BadChannelMapReductor.cxx src/TimeCalibParamReductor.cxx src/SupermoduleProjectionReductor.cxx src/SubdetectorProjectionReductor.cxx)
5+
target_sources(O2QcEMCAL PRIVATE src/BCTask.cxx src/RawErrorCheck.cxx src/RawTask.cxx src/RawCheck.cxx src/CellTask.cxx src/CellCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx src/OccupancyReductor.cxx src/ClusterTask.cxx src/RawErrorTask.cxx src/CalibMonitoringTask.cxx src/SupermoduleProjectorTask.cxx src/BadChannelMapReductor.cxx src/TimeCalibParamReductor.cxx src/SupermoduleProjectionReductor.cxx src/SubdetectorProjectionReductor.cxx src/BCVisualization.cxx)
66

77
target_include_directories(
88
O2QcEMCAL
@@ -30,6 +30,7 @@ add_root_dictionary(O2QcEMCAL
3030
include/EMCAL/TimeCalibParamReductor.h
3131
include/EMCAL/SupermoduleProjectionReductor.h
3232
include/EMCAL/SubdetectorProjectionReductor.h
33+
include/EMCAL/BCVisualization.h
3334
LINKDEF include/EMCAL/LinkDef.h)
3435

3536
install(TARGETS O2QcEMCAL
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
///
13+
/// \file BCVisualization.h
14+
/// \author Markus Fasel
15+
///
16+
17+
#ifndef QUALITYCONTROL_BCVISUALIZATION_H
18+
#define QUALITYCONTROL_BCVISUALIZATION_H
19+
20+
// QC includes
21+
#include "QualityControl/PostProcessingInterface.h"
22+
#include <map>
23+
#include <memory>
24+
#include <vector>
25+
#include <string>
26+
#include <tuple>
27+
#include <cfloat>
28+
29+
class TCanvas;
30+
class TH1;
31+
32+
namespace o2::quality_control_modules::emcal
33+
{
34+
35+
/// \brief Visualization of BC distributions and determination of Shift between EMCAL and CTP
36+
class BCVisualization final : public quality_control::postprocessing::PostProcessingInterface
37+
{
38+
public:
39+
enum class MethodBCShift_t {
40+
LEADING_BC,
41+
ISOLATED_BC,
42+
UNKNOWN
43+
};
44+
/// \brief Constructor
45+
BCVisualization() = default;
46+
/// \brief Destructor
47+
~BCVisualization() = default;
48+
49+
/// \brief Configuration of a post-processing task.
50+
/// Configuration of a post-processing task. Can be overridden if user wants to retrieve the configuration of the task.
51+
/// \param config ConfigurationInterface with prefix set to ""
52+
void configure(const boost::property_tree::ptree& config) override;
53+
/// \brief Initialization of a post-processing task.
54+
/// Initialization of a post-processing task. User receives a Trigger which caused the initialization and a service
55+
/// registry with singleton interfaces.
56+
/// \param trigger Trigger which caused the initialization, for example Trigger::SOR
57+
/// \param services Interface containing optional interfaces, for example DatabaseInterface
58+
void initialize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;
59+
/// \brief Update of a post-processing task.
60+
/// Update of a post-processing task. User receives a Trigger which caused the update and a service
61+
/// registry with singleton interfaces.
62+
/// \param trigger Trigger which caused the initialization, for example Trigger::Period
63+
/// \param services Interface containing optional interfaces, for example DatabaseInterface
64+
void update(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef services) override;
65+
/// \brief Finalization of a post-processing task.
66+
/// Finalization of a post-processing task. User receives a Trigger which caused the finalization and a service
67+
/// registry with singleton interfaces.
68+
/// \param trigger Trigger which caused the initialization, for example Trigger::EOR
69+
/// \param services Interface containing optional interfaces, for example DatabaseInterface
70+
void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override;
71+
72+
void reset();
73+
74+
private:
75+
std::tuple<bool, int> determineBCShift(const TH1* emchist, const TH1* ctphist, MethodBCShift_t method) const;
76+
std::tuple<bool, int> determineBCShiftIsolated(const TH1* emchist, const TH1* ctphist) const;
77+
std::tuple<bool, int> determineBCShiftLeading(const TH1* emchist, const TH1* ctphist) const;
78+
std::vector<int> getIsolatedBCs(const TH1* bchist) const;
79+
std::vector<int> getShifted(const std::vector<int>& bcEMC, int shift) const;
80+
int getNMatching(const std::vector<int>& bcShiftedEMC, const std::vector<int>& bcCTP) const;
81+
int getLeadingBC(const TH1* histogram) const;
82+
MethodBCShift_t getMethod(const std::string_view methodstring) const;
83+
std::string getMethodString(MethodBCShift_t method) const;
84+
TCanvas* mOutputCanvas = nullptr; ///< output plot
85+
TH1* mFrame = nullptr; ///< Frame for output canvas
86+
std::string mDataPath; ///< Path in QCDB with histos
87+
MethodBCShift_t mShiftEvaluation = MethodBCShift_t::ISOLATED_BC; ///< Method used to determine the BC shift
88+
int mMinNumberOfEntriesBCShift = 100; ///< Min. number of entries for BC shift calculation
89+
};
90+
91+
} // namespace o2::quality_control_modules::emcal
92+
93+
#endif // QUALITYCONTROL_BCVISUALIZATION_H

Modules/EMCAL/include/EMCAL/LinkDef.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@
3636
#pragma link C++ class o2::quality_control_modules::emcal::SupermoduleProjectionReductorY + ;
3737

3838
#pragma link C++ class o2::quality_control_modules::emcal::SubdetectorProjectionReductor + ;
39-
#pragma link C++ class o2::quality_control_modules::emcal::BCTask+;
39+
#pragma link C++ class o2::quality_control_modules::emcal::BCTask + ;
40+
#pragma link C++ class o2::quality_control_modules::emcal::BCVisualization + ;
41+
4042
#endif

0 commit comments

Comments
 (0)