Skip to content

Commit 0cdcdf3

Browse files
authored
[EMCAL-528] First version of the TriggerTask (#2243)
Monitoring basic trigger-related observables based on trigger patches and TRU information (patch energy, time, fired TRU, position of patches and FastORs which fire the TRU, FastOR L0 timesums)
1 parent 962435f commit 0cdcdf3

4 files changed

Lines changed: 451 additions & 3 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/PedestalTask.cxx 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 src/CalibCheck.cxx)
5+
target_sources(O2QcEMCAL PRIVATE src/TriggerTask.cxx src/PedestalTask.cxx 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 src/CalibCheck.cxx)
66

77
target_include_directories(
88
O2QcEMCAL
@@ -32,6 +32,7 @@ add_root_dictionary(O2QcEMCAL
3232
include/EMCAL/SubdetectorProjectionReductor.h
3333
include/EMCAL/BCVisualization.h
3434
include/EMCAL/PedestalTask.h
35+
include/EMCAL/TriggerTask.h
3536
include/EMCAL/CalibCheck.h
3637
LINKDEF include/EMCAL/LinkDef.h)
3738

Modules/EMCAL/include/EMCAL/LinkDef.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
#pragma link C++ class o2::quality_control_modules::emcal::BCTask + ;
4040
#pragma link C++ class o2::quality_control_modules::emcal::BCVisualization + ;
4141

42-
#pragma link C++ class o2::quality_control_modules::emcal::PedestalTask+;
42+
#pragma link C++ class o2::quality_control_modules::emcal::PedestalTask + ;
4343

4444
#pragma link C++ class o2::quality_control_modules::emcal::CalibCheck + ;
45+
#pragma link C++ class o2::quality_control_modules::emcal::TriggerTask + ;
4546

46-
#endif
47+
#endif
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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 TriggerTask.h
14+
/// \author Markus Fasel
15+
///
16+
17+
#ifndef QC_MODULE_EMCAL_EMCALTRIGGERTASK_H
18+
#define QC_MODULE_EMCAL_EMCALTRIGGERTASK_H
19+
20+
#include "QualityControl/TaskInterface.h"
21+
#include "EMCALBase/TriggerMappingV2.h"
22+
#include <gsl/span>
23+
#include <memory>
24+
#include <vector>
25+
26+
class TH1;
27+
class TH2;
28+
class TProfile2D;
29+
30+
namespace o2
31+
{
32+
class InteractionRecord;
33+
}
34+
35+
namespace o2::emcal
36+
{
37+
class CompressedTRU;
38+
class CompressedTriggerPatch;
39+
class CompressedL0TimeSum;
40+
class TriggerRecord;
41+
}; // namespace o2::emcal
42+
43+
using namespace o2::quality_control::core;
44+
45+
namespace o2::quality_control_modules::emcal
46+
{
47+
48+
/// \class TriggerTask
49+
/// \brief Task monitoring EMCAL trigger observables
50+
/// \author Markus Fasel <markus.fasel@cern.ch>, Oak Ridge National Laboratory
51+
/// \since April 19, 2024
52+
///
53+
/// Task monitoring basic observables of the EMCAL trigger system. The task subscibes to:
54+
///
55+
/// || Binding || Channel || Information ||
56+
/// |---------------|-----------------|---------------------------------------|
57+
/// | truinfo | EMC/TRUS | TRU data |
58+
/// | trurecords | EMC/TRUSTRGR | Trigger records of TRU data |
59+
/// | patchinfos | EMC/PATCHES | Trigger patches |
60+
/// | patchrecords | EMC/PATCHESTRGR | Trigger records of trigger patches |
61+
/// | timesums | EMC/FASTORS | L0 FastOR timesums |
62+
/// |timesumrecords | EMC/FASTORSTRGR | Trigger records of L0 FastOR timesums |
63+
///
64+
/// Monitoring per timeframe is done in the function monitorData, which delegates
65+
/// the monitoring per trigger to an internal function processEvent.
66+
///
67+
/// The task defines the following task parameters:
68+
/// - None so far
69+
class TriggerTask final : public TaskInterface
70+
{
71+
public:
72+
/// \brief Constructor
73+
TriggerTask() = default;
74+
/// \brief Destructor
75+
~TriggerTask() override;
76+
77+
/// \brief Initialize task (histograms and trigger mapping)
78+
/// \param ctx InitContenxt
79+
void initialize(o2::framework::InitContext& ctx) override;
80+
81+
/// \brief Operations performed at the start of activity (start of run)
82+
/// \param activity Activity
83+
void startOfActivity(const Activity& activity) override;
84+
85+
/// \brief Operations at performed at the start of a new monitoring cycle
86+
void startOfCycle() override;
87+
88+
/// \brief Monitoring data for a given timeframe
89+
/// \param ctx Processing context with data
90+
///
91+
/// As the data in EMCAL is organized in triggers within the container the
92+
/// monitoring is delegated to the internal function processEvent. monitorData
93+
/// subscribes to the timeframe-based container of the TRU information, trigger
94+
/// patches and timesums, as well as their corresponding trigger records. Iteration
95+
/// over all BCs found in any of the containers via getAllBCs is performed, and
96+
/// for each trigger the TRU, patch and FastOR information is extracted from the
97+
/// timeframe-based containers.
98+
void monitorData(o2::framework::ProcessingContext& ctx) override;
99+
100+
/// \brief Operations performed at the end of the current monitoring cycle
101+
void endOfCycle() override;
102+
103+
/// \brief Operations performed at the end fo the activity (end of run)
104+
/// \param activity Activity
105+
void endOfActivity(const Activity& activity) override;
106+
107+
/// \brief Reset all histograms
108+
void reset() override;
109+
110+
private:
111+
/// \brief Fill monitoring histograms for a single event
112+
/// \param trudata TRU data for the event
113+
/// \param triggerpatches Trigger patches found in the event
114+
/// \param timesums L0 timesums found in the event
115+
void processEvent(const gsl::span<const o2::emcal::CompressedTRU> trudata, const gsl::span<const o2::emcal::CompressedTriggerPatch> triggerpatches, const gsl::span<const o2::emcal::CompressedL0TimeSum> timesums);
116+
117+
/// \brief Find all BCs with data in either of the components (or all)
118+
/// \param trurecords Trigger records for TRU data
119+
/// \param patchrecords Trigger records for trigger patches
120+
/// \param timesumrecords Trigger records for L0 timesums
121+
/// \return List of found BCs (sorted)
122+
std::vector<o2::InteractionRecord> getAllBCs(const gsl::span<const o2::emcal::TriggerRecord> trurecords, const gsl::span<const o2::emcal::TriggerRecord> patchrecords, const gsl::span<const o2::emcal::TriggerRecord> timesumrecords) const;
123+
124+
std::unique_ptr<o2::emcal::TriggerMappingV2> mTriggerMapping; ///< Trigger mapping
125+
TH1* mTRUFired = nullptr; ///< Histogram with counters per TRU fired
126+
TH1* mFastORFired = nullptr; ///< Histogram with counters per FastOR fired (in patches)
127+
TH2* mPositionFasORFired = nullptr; ///< Histogram with the position of fired FastORs (in patches)
128+
TH1* mNumberOfTRUsPerEvent = nullptr; ///< Counter histogram for number of fired TRUs per event
129+
TH1* mNumberOfPatchesPerEvent = nullptr; ///< Counter histogram for number of fired patches per event
130+
TH1* mPatchEnergySpectrumPerEvent = nullptr; ///< Histogram for integrated patch energy spectrum
131+
TH1* mLeadingPatchEnergySpectrumPerEvent = nullptr; ///< Histogram for integrated leading patch energy spectrum
132+
TH2* mPatchEnergyTRU = nullptr; ///< Histogram for patch energy spectrum per TRU
133+
TH2* mLeadingPatchEnergyTRU = nullptr; ///< Histogram for leading patch energy spectrum per TRU
134+
TH2* mNumberOfPatchesPerTRU = nullptr; ///< Counter histogram for number of patches per TRU
135+
TH2* mPatchIndexFired = nullptr; ///< Histogram with the fired patch index per TRU
136+
TH2* mPatchIndexLeading = nullptr; ///< Histogram with the leading fired patch index per TRU
137+
TH2* mTRUTime = nullptr; ///< Histogram with TRU time vs TRU index
138+
TH2* mPatchTime = nullptr; ///< Histogram with patch time vs. TRU index
139+
TH2* mLeadingPatchTime = nullptr; ///< Histogram with patch time of the leading patch vs. TRU index
140+
TH1* mNumberTimesumsEvent = nullptr; ///< Counter histogram with number of non-0 FastOR timesums per event
141+
TH1* mL0Timesums = nullptr; ///< ADC spectrum of the FastOR timesums
142+
TH2* mL0TimesumsTRU = nullptr; ///< ADC spectrum of the the FastOR timesums per TRU
143+
TH1* mADCMaxTimesum = nullptr; ///< ADC spectrum of the leading FastOR timesum per event
144+
TH1* mFastORIndexMaxTimesum = nullptr; ///< Index of the leading FastOR timesum per event
145+
TH2* mPositionMaxTimesum = nullptr; ///< Position of teh leading FastOR timsum per event
146+
TH2* mIntegratedTimesums = nullptr; ///< Integrated ADC timesum
147+
TProfile2D* mAverageTimesum = nullptr; ///< Average ADC timesum
148+
};
149+
150+
} // namespace o2::quality_control_modules::emcal
151+
152+
#endif // QC_MODULE_EMCAL_EMCALTRIGGERTASK_H

0 commit comments

Comments
 (0)