Project
Loading...
Searching...
No Matches
digits-r23-workflow.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
15
#include "
Framework/CallbackService.h
"
16
#include "
Framework/ConfigParamRegistry.h
"
17
#include "
Framework/ControlService.h
"
18
#include "
Framework/DataProcessorSpec.h
"
19
#include "
Framework/DataProcessorSpec.h
"
20
#include "
Framework/Lifetime.h
"
21
#include "
Framework/Output.h
"
22
#include "
Framework/Task.h
"
23
#include "
Framework/WorkflowSpec.h
"
24
#include "
Framework/DataProcessorSpec.h
"
25
#include "
DataFormatsMCH/Digit.h
"
26
#include "
MCHMappingInterface/Segmentation.h
"
27
#include <fmt/format.h>
28
#include "
Framework/Logger.h
"
29
30
using namespace
o2::framework
;
31
32
#include "
Framework/runDataProcessing.h
"
33
34
struct
DigitConverter
{
35
bool
mVerbose
{
false
};
36
37
void
init
(
InitContext
& ic)
38
{
39
mVerbose
= ic.
options
().
get
<
bool
>(
"verbose"
);
40
fair::Logger::SetConsoleColor(
true
);
41
}
42
43
void
run
(
ProcessingContext
& pc)
44
{
45
auto
digitsR2 = pc.
inputs
().
get
<gsl::span<o2::mch::Digit>>(
"digits"
);
46
auto
& digitsR3 = pc.
outputs
().
make
<std::vector<o2::mch::Digit>>(
OutputRef
{
"digits"
});
47
for
(
const
auto
d2 : digitsR2) {
48
auto
digit = d2;
49
int
deID = digit.getDetID();
50
int
digitID = digit.getPadID();
51
int
manuID = (digitID & 0xFFF000) >> 12;
52
int
manuCh = (digitID & 0x3F000000) >> 24;
53
54
int
padID =
o2::mch::mapping::segmentation
(deID).
findPadByFEE
(manuID, manuCh);
55
if
(
mVerbose
) {
56
LOGP(warn,
"DEID {:4d} DIGITID {:10d} MANUID {:4d} CH {:2} PADIDÂ {:10d}"
,
57
deID, digitID, manuID, manuCh, padID);
58
}
59
if
(padID < 0) {
60
throw
std::runtime_error(fmt::format(
"digitID {} does not exist in the mapping"
, digitID));
61
}
62
digit.setPadID(padID);
63
digitsR3.push_back(digit);
64
}
65
}
66
};
67
68
WorkflowSpec
defineDataProcessing
(
const
ConfigContext
&
cc
)
69
{
70
WorkflowSpec
specs;
71
72
std::string inputConfig = fmt::format(
"digits:MCH/DIGITSR2/0"
);
73
inputConfig +=
";rofs:MCH/DIGITROFS/0"
;
74
75
DataProcessorSpec
padIdConverter{
76
"mch-digits-r23"
,
77
Inputs
{
o2::framework::select
(inputConfig.c_str())},
78
Outputs
{
OutputSpec
{{
"digits"
},
"MCH"
,
"DIGITS"
, 0, Lifetime::Timeframe}},
79
AlgorithmSpec
{adaptFromTask<DigitConverter>()},
80
Options
{
81
{
"verbose"
, VariantType::Bool,
false
, {
"print ids being converted"
}}}};
82
specs.push_back(padIdConverter);
83
return
specs;
84
}
CallbackService.h
ConfigParamRegistry.h
ControlService.h
Digit.h
DataProcessorSpec.h
Lifetime.h
Logger.h
Segmentation.h
Output.h
Task.h
WorkflowSpec.h
o2::framework::ConfigContext
Definition
ConfigContext.h:24
o2::framework::ConfigParamRegistry::get
T get(const char *key) const
Definition
ConfigParamRegistry.h:98
o2::framework::DataAllocator::make
decltype(auto) make(const Output &spec, Args... args)
Definition
DataAllocator.h:166
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::outputs
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
Definition
ProcessingContext.h:41
o2::framework::ProcessingContext::inputs
InputRecord & inputs()
The inputs associated with this processing context.
Definition
ProcessingContext.h:37
o2::mch::mapping::Segmentation::findPadByFEE
int findPadByFEE(int dualSampaId, int dualSampaChannel) const
Definition
Segmentation.inl:49
defineDataProcessing
WorkflowSpec defineDataProcessing(const ConfigContext &cc)
Definition
digits-r23-workflow.cxx:68
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::framework::WorkflowSpec
std::vector< DataProcessorSpec > WorkflowSpec
Definition
HBFUtilsInitializer.h:39
o2::framework::select
std::vector< InputSpec > select(char const *matcher="")
Definition
WorkflowSpec.cxx:152
o2::framework::Inputs
std::vector< InputSpec > Inputs
Definition
DataProcessorSpec.h:29
o2::framework::Outputs
std::vector< OutputSpec > Outputs
Definition
DataProcessorSpec.h:30
o2::mch::mapping::segmentation
O2MCHMAPPINGIMPL3_EXPORT const Segmentation & segmentation(int detElemId)
Definition
CreateSegmentation.cxx:217
runDataProcessing.h
DigitConverter
Definition
digits-r23-workflow.cxx:34
DigitConverter::mVerbose
bool mVerbose
Definition
digits-r23-workflow.cxx:35
DigitConverter::init
void init(InitContext &ic)
Definition
digits-r23-workflow.cxx:37
DigitConverter::run
void run(ProcessingContext &pc)
Definition
digits-r23-workflow.cxx:43
Options
Definition
TreeMergerTool.cxx:26
o2::framework::AlgorithmSpec
Definition
AlgorithmSpec.h:43
o2::framework::DataProcessorSpec
Definition
DataProcessorSpec.h:41
o2::framework::OutputRef
Definition
OutputRef.h:29
o2::framework::OutputSpec
Definition
OutputSpec.h:33
cc
std::vector< o2::mch::ChannelCode > cc
Definition
testStatusMap.cxx:37
Detectors
MUON
MCH
DevIO
Digits
digits-r23-workflow.cxx
Generated on Tue Feb 25 2025 23:16:22 for Project by
1.9.8