Project
Loading...
Searching...
No Matches
CompressedAnalysisTask.cxx
Go to the documentation of this file.
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
16
17
#include "
TOFWorkflowUtils/CompressedAnalysisTask.h
"
18
#include "
Framework/Task.h
"
19
#include "
Framework/ConfigParamRegistry.h
"
20
#include "
Framework/ControlService.h
"
21
#include "
Framework/CallbackService.h
"
22
#include "
Framework/ConcreteDataMatcher.h
"
23
#include "
Framework/RawDeviceService.h
"
24
#include "
Framework/DeviceSpec.h
"
25
26
using namespace
o2::framework
;
27
28
namespace
o2
29
{
30
namespace
tof
31
{
32
33
void
CompressedAnalysisTask::init
(
InitContext
& ic)
34
{
35
36
auto
conetmode = ic.
options
().
get
<
bool
>(
"tof-compressed-analysis-conet-mode"
);
37
auto
filename
= ic.
options
().
get
<std::string>(
"tof-compressed-analysis-filename"
);
38
auto
function = ic.
options
().
get
<std::string>(
"tof-compressed-analysis-function"
);
39
40
if
(
filename
.empty()) {
41
LOG
(error) <<
"No analysis filename defined"
;
42
mStatus =
true
;
43
return
;
44
}
45
46
if
(function.empty()) {
47
LOG
(error) <<
"No analysis function defined"
;
48
mStatus =
true
;
49
return
;
50
}
51
52
mAnalysis = GetFromMacro<CompressedAnalysis*>(
filename
, function,
"o2::tof::CompressedAnalysis*"
,
"compressed_analysis"
);
53
if
(!mAnalysis) {
54
LOG
(error) <<
"Could not retrieve analysis from file: "
<<
filename
;
55
mStatus =
true
;
56
return
;
57
}
58
59
mAnalysis->
setDecoderCONET
(conetmode);
60
mAnalysis->
initialize
();
61
62
auto
finishFunction = [
this
]() {
63
LOG
(
debug
) <<
"CompressedBaseTask finish"
;
64
mAnalysis->
finalize
();
65
};
66
ic.
services
().
get
<
CallbackService
>().set<CallbackService::Id::Stop>(finishFunction);
67
}
68
69
void
CompressedAnalysisTask::run
(
ProcessingContext
& pc)
70
{
71
73
if
(mStatus) {
74
pc.
services
().
get
<
ControlService
>().readyToQuit(QuitRequest::Me);
75
return
;
76
}
77
79
for
(
auto
iit = pc.
inputs
().
begin
(), iend = pc.
inputs
().
end
(); iit != iend; ++iit) {
80
if
(!iit.isValid()) {
81
continue
;
82
}
83
85
for
(
auto
const
&
ref
: iit) {
86
87
const
auto
* headerIn = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref
);
88
auto
payloadIn =
ref
.payload;
89
auto
payloadInSize =
DataRefUtils::getPayloadSize
(
ref
);
90
91
mAnalysis->
setDecoderBuffer
(payloadIn);
92
mAnalysis->
setDecoderBufferSize
(payloadInSize);
93
mAnalysis->
run
();
94
}
95
}
96
}
97
98
}
// namespace tof
99
}
// namespace o2
CallbackService.h
CompressedAnalysisTask.h
TOF compressed data analysis base class.
ConcreteDataMatcher.h
ConfigParamRegistry.h
ControlService.h
DeviceSpec.h
RawDeviceService.h
Task.h
debug
std::ostringstream debug
Definition
VariantJSONHelpers.h:307
int
o2::framework::CallbackService
Definition
CallbackService.h:35
o2::framework::ConfigParamRegistry::get
T get(const char *key) const
Definition
ConfigParamRegistry.h:98
o2::framework::ControlService
Definition
ControlService.h:40
o2::framework::InitContext
Definition
InitContext.h:25
o2::framework::InitContext::services
ServiceRegistryRef services()
Definition
InitContext.h:34
o2::framework::InitContext::options
ConfigParamRegistry const & options()
Definition
InitContext.h:33
o2::framework::InputRecord::begin
const_iterator begin() const
Definition
InputRecord.h:702
o2::framework::InputRecord::end
const_iterator end() const
Definition
InputRecord.h:707
o2::framework::ProcessingContext
Definition
ProcessingContext.h:27
o2::framework::ProcessingContext::inputs
InputRecord & inputs()
The inputs associated with this processing context.
Definition
ProcessingContext.h:37
o2::framework::ProcessingContext::services
ServiceRegistryRef services()
The services registry associated with this processing context.
Definition
ProcessingContext.h:39
o2::framework::ServiceRegistryRef::get
T & get() const
Definition
ServiceRegistryRef.h:85
o2::tof::CompressedAnalysisTask::run
void run(ProcessingContext &pc) final
Definition
CompressedAnalysisTask.cxx:69
o2::tof::CompressedAnalysisTask::init
void init(InitContext &ic) final
Definition
CompressedAnalysisTask.cxx:33
o2::tof::CompressedAnalysis::finalize
virtual bool finalize()=0
o2::tof::CompressedAnalysis::initialize
virtual bool initialize()=0
o2::tof::compressed::DecoderBaseT::setDecoderCONET
void setDecoderCONET(bool val)
Definition
DecoderBase.h:68
o2::tof::compressed::DecoderBaseT::run
bool run()
Definition
DecoderBase.h:42
o2::tof::compressed::DecoderBaseT::setDecoderBuffer
void setDecoderBuffer(const char *val)
Definition
DecoderBase.h:66
o2::tof::compressed::DecoderBaseT::setDecoderBufferSize
void setDecoderBufferSize(long val)
Definition
DecoderBase.h:67
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Definition
BitstreamReader.h:24
filename
std::string filename()
Definition
o2FairMQHeaderSizeTest.cxx:55
o2::framework::DataRefUtils::getPayloadSize
static o2::header::DataHeader::PayloadSizeType getPayloadSize(const DataRef &ref)
Definition
DataRefUtils.h:184
LOG
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
Detectors
TOF
workflow
src
CompressedAnalysisTask.cxx
Generated on Tue Feb 25 2025 23:16:26 for Project by
1.9.8