Project
Loading...
Searching...
No Matches
RawWriterSpec.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
#include <fairlogger/Logger.h>
12
17
18
#include "
PHOSWorkflow/RawWriterSpec.h
"
19
#include "
Framework/RootSerializationSupport.h
"
20
#include "
DataFormatsPHOS/Digit.h
"
21
#include "
Framework/ControlService.h
"
22
#include "
CommonDataFormat/InteractionRecord.h
"
23
#include "
PHOSSimulation/RawWriter.h
"
24
#include "
DataFormatsPHOS/PHOSBlockHeader.h
"
25
#include "
Framework/ConfigParamRegistry.h
"
26
27
using namespace
o2::phos::reco_workflow
;
28
29
void
RawWriterSpec::init
(
framework::InitContext
& ctx)
30
{
31
32
auto
rawdir = ctx.
options
().
get
<std::string>(
"rawpath"
);
33
34
LOG
(info) <<
"[PHOSRawWriter - init] Initialize raw writer "
;
35
if
(!mRawWriter) {
36
mRawWriter =
new
o2::phos::RawWriter
();
37
mRawWriter->
setOutputLocation
(rawdir.data());
38
mRawWriter->
init
();
39
}
40
}
41
42
void
RawWriterSpec::run
(
framework::ProcessingContext
& ctx)
43
{
44
LOG
(
debug
) <<
"[PHOSRawWriter - run] called"
;
45
46
auto
digits
= ctx.
inputs
().
get
<std::vector<o2::phos::Digit>>(
"digits"
);
47
auto
digitsTR = ctx.
inputs
().
get
<std::vector<o2::phos::TriggerRecord>>(
"digitTriggerRecords"
);
48
LOG
(info) <<
"[PHOSRawWriter - run] Received "
<<
digits
.size() <<
" digits and "
<< digitsTR.size() <<
" TriggerRecords"
;
49
50
mRawWriter->
digitsToRaw
(
digits
, digitsTR);
51
LOG
(info) <<
"[PHOSRawWriter - run] Finished "
;
52
53
//flash and close output files
54
mRawWriter->
getWriter
().
close
();
55
ctx.
services
().
get
<
o2::framework::ControlService
>().readyToQuit(
framework::QuitRequest::Me
);
56
}
57
58
o2::framework::DataProcessorSpec
o2::phos::reco_workflow::getRawWriterSpec
()
59
{
60
std::vector<o2::framework::InputSpec> inputs;
61
std::vector<o2::framework::OutputSpec> outputs;
62
inputs.emplace_back(
"digits"
,
o2::header::gDataOriginPHS
,
"DIGITS"
, 0, o2::framework::Lifetime::Timeframe);
63
inputs.emplace_back(
"digitTriggerRecords"
,
o2::header::gDataOriginPHS
,
"DIGITTRIGREC"
, 0, o2::framework::Lifetime::Timeframe);
64
return
o2::framework::DataProcessorSpec
{
"PHOSRawWriterSpec"
,
65
inputs,
66
outputs,
67
o2::framework::adaptFromTask<o2::phos::reco_workflow::RawWriterSpec>(),
68
o2::framework::Options
{
69
{
"rawpath"
,
o2::framework::VariantType::String
,
"./"
, {
"path to write raw"
}},
70
}};
71
}
ConfigParamRegistry.h
ControlService.h
Digit.h
InteractionRecord.h
PHOSBlockHeader.h
RawWriter.h
RawWriterSpec.h
RootSerializationSupport.h
debug
std::ostringstream debug
Definition
VariantJSONHelpers.h:307
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::options
ConfigParamRegistry const & options()
Definition
InitContext.h:33
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::phos::RawWriter
Definition
RawWriter.h:54
o2::phos::RawWriter::init
void init()
Definition
RawWriter.cxx:28
o2::phos::RawWriter::getWriter
o2::raw::RawFileWriter & getWriter() const
Definition
RawWriter.h:65
o2::phos::RawWriter::setOutputLocation
void setOutputLocation(const char *outputdir)
Definition
RawWriter.h:67
o2::phos::RawWriter::digitsToRaw
void digitsToRaw(gsl::span< o2::phos::Digit > digits, gsl::span< o2::phos::TriggerRecord > triggers)
Definition
RawWriter.cxx:67
o2::phos::reco_workflow::RawWriterSpec::run
void run(framework::ProcessingContext &ctx) final
Run conversion of digits to cells.
Definition
RawWriterSpec.cxx:42
o2::phos::reco_workflow::RawWriterSpec::init
void init(framework::InitContext &ctx) final
Initializing the RawWriterSpec.
Definition
RawWriterSpec.cxx:29
o2::raw::RawFileWriter::close
void close()
Definition
RawFileWriter.cxx:38
o2::header::gDataOriginPHS
constexpr o2::header::DataOrigin gDataOriginPHS
Definition
DataHeader.h:574
o2::framework::VariantType::String
@ String
o2::framework::QuitRequest::Me
@ Me
Only quit this data processor.
o2::framework::Options
std::vector< ConfigParamSpec > Options
Definition
DataProcessorSpec.h:31
o2::phos::reco_workflow
Definition
CellConverterSpec.h:29
o2::phos::reco_workflow::getRawWriterSpec
framework::DataProcessorSpec getRawWriterSpec()
Creating DataProcessorSpec for the PHOS Cell Converter Spec.
Definition
RawWriterSpec.cxx:58
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
PHOS
workflow
src
RawWriterSpec.cxx
Generated on Tue Feb 25 2025 23:16:25 for Project by
1.9.8