Project
Loading...
Searching...
No Matches
RecoWorkflow.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 <algorithm>
13#include <unordered_map>
14#include <vector>
15
16#include <fairlogger/Logger.h>
17
32//#include "CPVWorkflow/RawWriterSpec.h"
35
36using namespace o2::dataformats;
37
38namespace o2
39{
40
41template <typename T>
43
44namespace cpv
45{
46
47namespace reco_workflow
48{
49
50const std::unordered_map<std::string, InputType> InputMap{
51 {"raw", InputType::Raw},
52 {"hits", InputType::Hits},
53 {"digits", InputType::Digits}};
54
55const std::unordered_map<std::string, OutputType> OutputMap{
56 {"digits", OutputType::Digits},
57 {"clusters", OutputType::Clusters}};
58
60 bool disableRootOut,
61 bool propagateMC,
62 bool askSTFDist,
63 bool isPedestal,
64 bool useBadChannelMap,
65 bool useGainCalibration,
66 std::string const& cfgInput,
67 std::string const& cfgOutput)
68{
69 InputType inputType;
70
71 try {
72 inputType = InputMap.at(cfgInput);
73 } catch (std::out_of_range&) {
74 throw std::invalid_argument(std::string("invalid input type: ") + cfgInput);
75 }
76 std::vector<OutputType> outputTypes;
77 try {
78 outputTypes = RangeTokenizer::tokenize<OutputType>(cfgOutput, [](std::string const& token) { return OutputMap.at(token); });
79 } catch (std::out_of_range&) {
80 throw std::invalid_argument(std::string("invalid output type: ") + cfgOutput);
81 }
82 auto isEnabled = [&outputTypes](OutputType type) {
83 return std::find(outputTypes.begin(), outputTypes.end(), type) != outputTypes.end();
84 };
85
87
88 // //Raw to ....
89 if (inputType == InputType::Raw) {
90 // no explicit raw reader
91
92 if (isEnabled(OutputType::Digits)) {
93 specs.emplace_back(o2::cpv::reco_workflow::getRawToDigitConverterSpec(askSTFDist, isPedestal, useBadChannelMap, useGainCalibration));
94 if (!disableRootOut) {
95 specs.emplace_back(o2::cpv::getDigitWriterSpec(false));
96 }
97 }
98 if (isEnabled(OutputType::Clusters)) {
99 // add clusterizer
100 specs.emplace_back(o2::cpv::reco_workflow::getRawToDigitConverterSpec(askSTFDist, isPedestal, useBadChannelMap, useGainCalibration));
101 specs.emplace_back(o2::cpv::reco_workflow::getClusterizerSpec(false));
102 if (!disableRootOut) {
103 specs.emplace_back(o2::cpv::getClusterWriterSpec(false));
104 }
105 }
106 }
107
108 // Digits to ....
109 if (inputType == InputType::Digits) {
110 if (!disableRootInp) {
111 specs.emplace_back(o2::cpv::getCPVDigitReaderSpec(propagateMC));
112 // specs.emplace_back(o2::cpv::getDigitsReaderSpec(propagateMC));
113 }
114
115 if (isEnabled(OutputType::Clusters)) {
116 // add clusterizer
117 specs.emplace_back(o2::cpv::reco_workflow::getClusterizerSpec(propagateMC));
118 if (!disableRootOut) {
119 specs.emplace_back(o2::cpv::getClusterWriterSpec(propagateMC));
120 }
121 }
122 }
123
124 return specs;
125}
126
127} // namespace reco_workflow
128
129} // namespace cpv
130
131} // namespace o2
Definition of a container to keep Monte Carlo truth external to simulation objects.
Configurable generator for RootTreeWriter processor spec.
Helper function to tokenize sequences and ranges of integral numbers.
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
framework::DataProcessorSpec getClusterizerSpec(bool propagateMC)
Creating DataProcessorSpec for the CPV Clusterizer Spec.
const std::unordered_map< std::string, OutputType > OutputMap
framework::WorkflowSpec getWorkflow(bool disableRootInp, bool disableRootOut, bool propagateMC=true, bool askSTFDist=true, bool isPedestal=false, bool useBadChannelMap=true, bool useGainCalibration=true, std::string const &cfgInput="digits", std::string const &cfgOutput="clusters")
create the workflow for CPV reconstruction
InputType
define input and output types of the workflow
const std::unordered_map< std::string, InputType > InputMap
o2::framework::DataProcessorSpec getRawToDigitConverterSpec(bool askDISTSTF=true, bool isPedestal=false, bool useBadChannelMap=true, bool useGainCalibration=true)
Creating DataProcessorSpec for the CPV Digit Converter Spec.
framework::DataProcessorSpec getClusterWriterSpec(bool useMC)
framework::DataProcessorSpec getDigitWriterSpec(bool useMC)
framework::DataProcessorSpec getCPVDigitReaderSpec(bool useMC=true)
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
std::vector< DataProcessorSpec > WorkflowSpec
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...