Project
Loading...
Searching...
No Matches
ErrorReaderSpec.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 "
MCHWorkflow/ErrorReaderSpec.h
"
13
14
#include <memory>
15
#include <string>
16
#include <vector>
17
18
#include "
Framework/ConfigParamRegistry.h
"
19
#include "
Framework/ConfigParamSpec.h
"
20
#include "
Framework/ControlService.h
"
21
#include "
Framework/InitContext.h
"
22
#include "
Framework/Lifetime.h
"
23
#include "
Framework/OutputSpec.h
"
24
#include "
Framework/ProcessingContext.h
"
25
#include "
Framework/Task.h
"
26
27
#include "
DPLUtils/RootTreeReader.h
"
28
#include "
CommonUtils/StringUtils.h
"
29
#include "
MCHBase/Error.h
"
30
31
using namespace
o2::framework
;
32
33
namespace
o2::mch
34
{
35
36
struct
ErrorReader
{
37
std::unique_ptr<RootTreeReader>
mTreeReader
;
38
39
void
init
(
InitContext
& ic)
40
{
41
auto
fileName =
o2::utils::Str::concat_string
(
o2::utils::Str::rectifyDirectory
(ic.
options
().
get
<std::string>(
"input-dir"
)), ic.
options
().
get
<std::string>(
"infile"
));
42
mTreeReader
= std::make_unique<RootTreeReader>(
43
"o2sim"
,
44
fileName.c_str(),
45
-1,
46
RootTreeReader::PublishingMode::Single
,
47
RootTreeReader::BranchDefinition
<std::vector<Error>>{Output{
"MCH"
,
"PROCERRORS"
, 0},
"errors"
});
48
}
49
50
void
run
(
ProcessingContext
& pc)
51
{
52
if
(mTreeReader->next()) {
53
(*mTreeReader)(pc);
54
}
else
{
55
pc.
services
().
get
<
ControlService
>().endOfStream();
56
}
57
}
58
};
59
60
DataProcessorSpec
getErrorReaderSpec
(
const
char
*
specName
)
61
{
62
return
DataProcessorSpec
{
63
specName
,
64
Inputs
{},
65
Outputs
{
OutputSpec
{{
"errors"
},
"MCH"
,
"PROCERRORS"
, 0, Lifetime::Timeframe}},
66
adaptFromTask<ErrorReader>(),
67
Options
{{
"infile"
, VariantType::String,
"mcherrors.root"
, {
"name of the input error file"
}},
68
{
"input-dir"
, VariantType::String,
"none"
, {
"Input directory"
}}}};
69
}
70
71
}
// namespace o2::mch
StringUtils.h
ConfigParamRegistry.h
ConfigParamSpec.h
ControlService.h
ErrorReaderSpec.h
Error.h
definition of the MCH processing errors
InitContext.h
Lifetime.h
OutputSpec.h
ProcessingContext.h
RootTreeReader.h
A generic reader for ROOT TTrees.
Task.h
specName
const char * specName
Definition
badchannel-calib-workflow.cxx:23
o2::framework::ConfigParamRegistry::get
T get(const char *key) const
Definition
ConfigParamRegistry.h:98
o2::framework::ControlService
Definition
ControlService.h:40
o2::framework::GenericRootTreeReader::PublishingMode::Single
@ Single
no more data after end of tree
o2::framework::InitContext
Definition
InitContext.h:25
o2::framework::InitContext::options
ConfigParamRegistry const & options()
Definition
InitContext.h:33
o2::framework::ProcessingContext
Definition
ProcessingContext.h:27
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
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::framework::Options
std::vector< ConfigParamSpec > Options
Definition
DataProcessorSpec.h:31
o2::framework::Inputs
std::vector< InputSpec > Inputs
Definition
DataProcessorSpec.h:29
o2::framework::Outputs
std::vector< OutputSpec > Outputs
Definition
DataProcessorSpec.h:30
o2::mch
Definition
SimTraits.h:155
o2::mch::getErrorReaderSpec
framework::DataProcessorSpec getErrorReaderSpec(const char *specName="mch-error-reader")
Definition
ErrorReaderSpec.cxx:60
o2::framework::DataProcessorSpec
Definition
DataProcessorSpec.h:41
o2::framework::GenericRootTreeReader::BranchDefinition
Definition
RootTreeReader.h:365
o2::framework::OutputSpec
Definition
OutputSpec.h:33
o2::mch::ErrorReader
Definition
ErrorReaderSpec.cxx:36
o2::mch::ErrorReader::mTreeReader
std::unique_ptr< RootTreeReader > mTreeReader
Definition
ErrorReaderSpec.cxx:37
o2::mch::ErrorReader::init
void init(InitContext &ic)
Definition
ErrorReaderSpec.cxx:39
o2::mch::ErrorReader::run
void run(ProcessingContext &pc)
Definition
ErrorReaderSpec.cxx:50
o2::utils::Str::rectifyDirectory
static std::string rectifyDirectory(const std::string_view p)
Definition
StringUtils.cxx:67
o2::utils::Str::concat_string
static std::string concat_string(Ts const &... ts)
Definition
StringUtils.h:142
Detectors
MUON
MCH
Workflow
src
ErrorReaderSpec.cxx
Generated on Tue Feb 25 2025 17:03:06 for Project by
1.9.8