Project
Loading...
Searching...
No Matches
ReconstructorSpec.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
13
14#include <vector>
17#include "Framework/Logger.h"
22
23using namespace o2::framework;
24
25namespace o2
26{
27namespace fdd
28{
29
33
35{
36 mRecPoints.clear();
37 mRecChData.clear();
38 auto digitsBC = pc.inputs().get<gsl::span<o2::fdd::Digit>>("digitsBC");
39 auto digitsCh = pc.inputs().get<gsl::span<o2::fdd::ChannelData>>("digitsCh");
40 // RS: if we need to process MC truth, uncomment lines below
41 // std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::fdd::MCLabel>> labels;
42 // const o2::dataformats::MCTruthContainer<o2::fdd::MCLabel>* lblPtr = nullptr;
43 if (mUseMC) {
44 // labels = pc.inputs().get<const o2::dataformats::MCTruthContainer<o2::fdd::MCLabel>*>("labels");
45 // lblPtr = labels.get();
46 LOG(info) << "Ignoring MC info";
47 }
48 if (mUseDeadChannelMap && mUpdateDeadChannelMap) {
49 LOG(info) << "Populating reconsturctor object with Dead Channel Map object";
50 auto deadChannelMap = pc.inputs().get<o2::fit::DeadChannelMap*>("deadChannelMap");
51 mReco.setDeadChannelMap(deadChannelMap.get());
52 }
53 int nDig = digitsBC.size();
54 mRecPoints.reserve(nDig);
55 mRecChData.reserve(digitsCh.size());
56 for (int id = 0; id < nDig; id++) {
57 const auto& digit = digitsBC[id];
58 auto channels = digit.getBunchChannelData(digitsCh);
59 mReco.process(digit, channels, mRecPoints, mRecChData);
60 }
61 // do we ignore MC in this task?
62 LOG(debug) << "FDD reconstruction pushes " << mRecPoints.size() << " RecPoints";
63 pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, mRecPoints);
64 pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, mRecChData);
65}
66
68{
69 if (matcher == ConcreteDataMatcher("FDD", "DeadChannelMap", 0)) {
70 mUpdateDeadChannelMap = false;
71 return;
72 }
73}
74
75DataProcessorSpec getFDDReconstructorSpec(bool useMC, bool useDeadChannelMap)
76{
77 std::vector<InputSpec> inputSpec;
78 std::vector<OutputSpec> outputSpec;
79 inputSpec.emplace_back("digitsBC", o2::header::gDataOriginFDD, "DIGITSBC", 0, Lifetime::Timeframe);
80 inputSpec.emplace_back("digitsCh", o2::header::gDataOriginFDD, "DIGITSCH", 0, Lifetime::Timeframe);
81
82 if (useMC) {
83 LOG(info) << "Currently FDDReconstructor does not consume and provide MC truth";
84 // inputSpec.emplace_back("labels", o2::header::gDataOriginFDD, "DIGITSMCTR", 0, Lifetime::Timeframe);
85 }
86 if (useDeadChannelMap) {
87 LOG(info) << "Dead channel map will be applied during reconstruction";
88 inputSpec.emplace_back("deadChannelMap", o2::header::gDataOriginFDD, "DeadChannelMap", 0, Lifetime::Condition, ccdbParamSpec("FDD/Calib/DeadChannelMap"));
89 }
90 outputSpec.emplace_back(o2::header::gDataOriginFDD, "RECPOINTS", 0, Lifetime::Timeframe);
91 outputSpec.emplace_back(o2::header::gDataOriginFDD, "RECCHDATA", 0, Lifetime::Timeframe);
92
93 return DataProcessorSpec{
94 "fdd-reconstructor",
95 inputSpec,
96 outputSpec,
97 AlgorithmSpec{adaptFromTask<FDDReconstructorDPL>(useMC, useDeadChannelMap)},
98 Options{}};
99}
100
101} // namespace fdd
102} // namespace o2
std::ostringstream debug
Definition of a container to keep Monte Carlo truth external to simulation objects.
void run(ProcessingContext &pc) final
void init(InitContext &ic) final
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj) final
void setDeadChannelMap(o2::fit::DeadChannelMap const *deadChannelMap)
void process(o2::fdd::Digit const &digitBC, gsl::span< const o2::fdd::ChannelData > inChData, std::vector< o2::fdd::RecPoint > &RecPoints, std::vector< o2::fdd::ChannelDataFloat > &outChData)
void snapshot(const Output &spec, T const &object)
decltype(auto) get(R binding, int part=0) const
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
GLuint id
Definition glcorearb.h:650
constexpr o2::header::DataOrigin gDataOriginFDD
Definition DataHeader.h:568
framework::DataProcessorSpec getFDDReconstructorSpec(bool useMC=true, bool useDeadChannelMap=true)
create a processor spec
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
struct o2::upgrades_utils::@458 fdd
Collision labels.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< ChannelData > channels