forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReconstructorSpec.cxx
More file actions
102 lines (91 loc) · 3.84 KB
/
ReconstructorSpec.cxx
File metadata and controls
102 lines (91 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// @file ReconstructorSpec.cxx
#include <vector>
#include "SimulationDataFormat/MCTruthContainer.h"
#include "Framework/ControlService.h"
#include "Framework/Logger.h"
#include "FDDWorkflow/ReconstructorSpec.h"
#include "DataFormatsFDD/Digit.h"
#include "DataFormatsFDD/MCLabel.h"
#include "Framework/CCDBParamSpec.h"
using namespace o2::framework;
namespace o2
{
namespace fdd
{
void FDDReconstructorDPL::init(InitContext& ic)
{
}
void FDDReconstructorDPL::run(ProcessingContext& pc)
{
mRecPoints.clear();
mRecChData.clear();
auto digitsBC = pc.inputs().get<gsl::span<o2::fdd::Digit>>("digitsBC");
auto digitsCh = pc.inputs().get<gsl::span<o2::fdd::ChannelData>>("digitsCh");
// RS: if we need to process MC truth, uncomment lines below
// std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::fdd::MCLabel>> labels;
// const o2::dataformats::MCTruthContainer<o2::fdd::MCLabel>* lblPtr = nullptr;
if (mUseMC) {
// labels = pc.inputs().get<const o2::dataformats::MCTruthContainer<o2::fdd::MCLabel>*>("labels");
// lblPtr = labels.get();
LOG(info) << "Ignoring MC info";
}
if (mUseDeadChannelMap && mUpdateDeadChannelMap) {
LOG(info) << "Populating reconsturctor object with Dead Channel Map object";
auto deadChannelMap = pc.inputs().get<o2::fit::DeadChannelMap*>("deadChannelMap");
mReco.setDeadChannelMap(deadChannelMap.get());
}
int nDig = digitsBC.size();
mRecPoints.reserve(nDig);
mRecChData.reserve(digitsCh.size());
for (int id = 0; id < nDig; id++) {
const auto& digit = digitsBC[id];
auto channels = digit.getBunchChannelData(digitsCh);
mReco.process(digit, channels, mRecPoints, mRecChData);
}
// do we ignore MC in this task?
LOG(debug) << "FDD reconstruction pushes " << mRecPoints.size() << " RecPoints";
pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, mRecPoints);
pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, mRecChData);
}
void FDDReconstructorDPL::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
{
if (matcher == ConcreteDataMatcher("FDD", "DeadChannelMap", 0)) {
mUpdateDeadChannelMap = false;
return;
}
}
DataProcessorSpec getFDDReconstructorSpec(bool useMC, bool useDeadChannelMap)
{
std::vector<InputSpec> inputSpec;
std::vector<OutputSpec> outputSpec;
inputSpec.emplace_back("digitsBC", o2::header::gDataOriginFDD, "DIGITSBC", 0, Lifetime::Timeframe);
inputSpec.emplace_back("digitsCh", o2::header::gDataOriginFDD, "DIGITSCH", 0, Lifetime::Timeframe);
if (useMC) {
LOG(info) << "Currently FDDReconstructor does not consume and provide MC truth";
// inputSpec.emplace_back("labels", o2::header::gDataOriginFDD, "DIGITSMCTR", 0, Lifetime::Timeframe);
}
if (useDeadChannelMap) {
LOG(info) << "Dead channel map will be applied during reconstruction";
inputSpec.emplace_back("deadChannelMap", o2::header::gDataOriginFDD, "DeadChannelMap", 0, Lifetime::Condition, ccdbParamSpec("FDD/Calib/DeadChannelMap"));
}
outputSpec.emplace_back(o2::header::gDataOriginFDD, "RECPOINTS", 0, Lifetime::Timeframe);
outputSpec.emplace_back(o2::header::gDataOriginFDD, "RECCHDATA", 0, Lifetime::Timeframe);
return DataProcessorSpec{
"fdd-reconstructor",
inputSpec,
outputSpec,
AlgorithmSpec{adaptFromTask<FDDReconstructorDPL>(useMC, useDeadChannelMap)},
Options{}};
}
} // namespace fdd
} // namespace o2