Project
Loading...
Searching...
No Matches
DigitsPrinterSpec.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
12
#include <vector>
13
#include <iostream>
14
15
#include <fairlogger/Logger.h>
16
17
#include "
Framework/RootSerializationSupport.h
"
18
#include "
Framework/ControlService.h
"
19
#include "
Framework/DataRefUtils.h
"
20
#include "
DataFormatsCPV/CPVBlockHeader.h
"
21
#include "
DataFormatsCPV/Digit.h
"
22
#include "
CPVWorkflow/DigitsPrinterSpec.h
"
23
24
using namespace
o2::cpv::reco_workflow
;
25
26
void
DigitsPrinterSpec::init
(
framework::InitContext
& ctx)
27
{
28
}
29
30
void
DigitsPrinterSpec::run
(
framework::ProcessingContext
& pc)
31
{
32
// Get the CPV block header and check whether it contains digits
33
LOG
(
debug
) <<
"[CPVDigitsPrinter - process] called"
;
34
auto
dataref = pc.
inputs
().
get
(
"digits"
);
35
auto
const
* cpvheader = o2::framework::DataRefUtils::getHeader<o2::cpv::CPVBlockHeader*>(dataref);
36
if
(!cpvheader->mHasPayload) {
37
LOG
(
debug
) <<
"[CPVDigitsPrinter - process] No more digits"
<< std::endl;
38
pc.
services
().
get
<
o2::framework::ControlService
>().
endOfStream
();
39
pc.
services
().
get
<
o2::framework::ControlService
>().readyToQuit(
framework::QuitRequest::Me
);
40
return
;
41
}
42
43
auto
digits
= pc.
inputs
().
get
<std::vector<o2::cpv::Digit>>(
"digits"
);
44
std::cout <<
"[CPVDigitsPrinter - process] receiveed "
<<
digits
.size() <<
" digits ..."
<< std::endl;
45
if
(
digits
.size()) {
46
for
(
const
auto
& d :
digits
) {
47
std::cout <<
"[CPVDigitsPrinter - process] Channel("
<< d.getAbsId() <<
") energy: "
<< d.getAmplitude() << std::endl;
48
}
49
}
50
}
51
52
o2::framework::DataProcessorSpec
o2::cpv::reco_workflow::getPhosDigitsPrinterSpec
()
53
{
54
55
return
o2::framework::DataProcessorSpec
{
"CPVDigitsPrinter"
,
56
{{
"digits"
,
o2::header::gDataOriginCPV
,
"DIGITS"
, 0, o2::framework::Lifetime::Timeframe}},
57
{},
58
o2::framework::adaptFromTask<o2::cpv::reco_workflow::DigitsPrinterSpec>()};
59
}
CPVBlockHeader.h
DigitsPrinterSpec.h
ControlService.h
Digit.h
DataRefUtils.h
RootSerializationSupport.h
debug
std::ostringstream debug
Definition
VariantJSONHelpers.h:307
o2::cpv::reco_workflow::DigitsPrinterSpec::run
void run(framework::ProcessingContext &ctx) final
Printing digit-related information.
Definition
DigitsPrinterSpec.cxx:30
o2::cpv::reco_workflow::DigitsPrinterSpec::init
void init(framework::InitContext &ctx) final
Initializing the digits printer task.
Definition
DigitsPrinterSpec.cxx:26
o2::framework::ControlService
Definition
ControlService.h:40
o2::framework::InitContext
Definition
InitContext.h:25
o2::framework::InputRecord::get
decltype(auto) get(R binding, int part=0) const
Definition
InputRecord.h:248
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::framework::Task::endOfStream
virtual void endOfStream(EndOfStreamContext &context)
This is invoked whenever we have an EndOfStream event.
Definition
Task.h:43
o2::header::gDataOriginCPV
constexpr o2::header::DataOrigin gDataOriginCPV
Definition
DataHeader.h:563
o2::cpv::reco_workflow
Definition
ClusterizerSpec.h:31
o2::cpv::reco_workflow::getPhosDigitsPrinterSpec
o2::framework::DataProcessorSpec getPhosDigitsPrinterSpec()
Creating digits printer spec.
Definition
DigitsPrinterSpec.cxx:52
o2::framework::QuitRequest::Me
@ Me
Only quit this data processor.
o2::framework::DataProcessorSpec
Definition
DataProcessorSpec.h:41
LOG
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
digits
std::vector< Digit > digits
Definition
test_ctf_io_hmpid.cxx:40
Detectors
CPV
workflow
src
DigitsPrinterSpec.cxx
Generated on Tue Feb 25 2025 23:16:25 for Project by
1.9.8