Project
Loading...
Searching...
No Matches
StatusMapReaderSpec.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 "
StatusMapReaderSpec.h
"
13
14
#include <memory>
15
#include <string>
16
17
#include "
Framework/ConfigParamRegistry.h
"
18
#include "
Framework/ConfigParamSpec.h
"
19
#include "
Framework/ControlService.h
"
20
#include "
Framework/InitContext.h
"
21
#include "
Framework/Lifetime.h
"
22
#include "
Framework/OutputSpec.h
"
23
#include "
Framework/ProcessingContext.h
"
24
#include "
Framework/Task.h
"
25
26
#include "
DPLUtils/RootTreeReader.h
"
27
#include "
CommonUtils/StringUtils.h
"
28
#include "
MCHStatus/StatusMap.h
"
29
30
using namespace
o2::framework
;
31
32
namespace
o2::mch
33
{
34
35
struct
StatusMapReader
{
36
std::unique_ptr<RootTreeReader>
mTreeReader
;
37
38
void
init
(
InitContext
& ic)
39
{
40
auto
fileName =
o2::utils::Str::concat_string
(
o2::utils::Str::rectifyDirectory
(ic.
options
().
get
<std::string>(
"input-dir"
)), ic.
options
().
get
<std::string>(
"infile"
));
41
mTreeReader
= std::make_unique<RootTreeReader>(
42
"o2sim"
,
43
fileName.c_str(),
44
-1,
45
RootTreeReader::PublishingMode::Single
,
46
RootTreeReader::BranchDefinition<StatusMap>
{Output{
"MCH"
,
"STATUSMAP"
, 0},
"statusmaps"
});
47
}
48
49
void
run
(
ProcessingContext
& pc)
50
{
51
if
(mTreeReader->next()) {
52
(*mTreeReader)(pc);
53
}
else
{
54
pc.
services
().
get
<
ControlService
>().endOfStream();
55
}
56
}
57
};
58
59
DataProcessorSpec
getStatusMapReaderSpec
(
const
char
*
specName
)
60
{
61
return
DataProcessorSpec
{
62
specName
,
63
Inputs
{},
64
Outputs
{
OutputSpec
{{
"statusmaps"
},
"MCH"
,
"STATUSMAP"
, 0, Lifetime::Timeframe}},
65
adaptFromTask<StatusMapReader>(),
66
Options
{{
"infile"
, VariantType::String,
"mchstatusmaps.root"
, {
"name of the input status map file"
}},
67
{
"input-dir"
, VariantType::String,
"none"
, {
"Input directory"
}}}};
68
}
69
70
}
// namespace o2::mch
StringUtils.h
ConfigParamRegistry.h
ConfigParamSpec.h
ControlService.h
InitContext.h
Lifetime.h
OutputSpec.h
ProcessingContext.h
RootTreeReader.h
A generic reader for ROOT TTrees.
StatusMapReaderSpec.h
StatusMap.h
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::getStatusMapReaderSpec
DataProcessorSpec getStatusMapReaderSpec(const char *specName)
Definition
StatusMapReaderSpec.cxx:59
o2::framework::DataProcessorSpec
Definition
DataProcessorSpec.h:41
o2::framework::GenericRootTreeReader::BranchDefinition
Definition
RootTreeReader.h:365
o2::framework::OutputSpec
Definition
OutputSpec.h:33
o2::mch::StatusMapReader
Definition
StatusMapReaderSpec.cxx:35
o2::mch::StatusMapReader::run
void run(ProcessingContext &pc)
Definition
StatusMapReaderSpec.cxx:49
o2::mch::StatusMapReader::init
void init(InitContext &ic)
Definition
StatusMapReaderSpec.cxx:38
o2::mch::StatusMapReader::mTreeReader
std::unique_ptr< RootTreeReader > mTreeReader
Definition
StatusMapReaderSpec.cxx:36
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
IO
src
StatusMapReaderSpec.cxx
Generated on Tue Feb 25 2025 17:03:05 for Project by
1.9.8