forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReconstructionSpec.cxx
More file actions
126 lines (112 loc) · 4.71 KB
/
ReconstructionSpec.cxx
File metadata and controls
126 lines (112 loc) · 4.71 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// 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 ReconstructionSpec.cxx
#include <vector>
#include "SimulationDataFormat/MCTruthContainer.h"
#include "Framework/ControlService.h"
#include "Framework/Logger.h"
#include "Framework/CCDBParamSpec.h"
#include "FV0Workflow/ReconstructionSpec.h"
#include "DataFormatsFV0/Digit.h"
#include "DataFormatsFV0/ChannelData.h"
#include "DataFormatsFV0/MCLabel.h"
#include "DataFormatsFV0/FV0ChannelTimeCalibrationObject.h"
#include "DataFormatsFIT/DeadChannelMap.h"
#include "Framework/CCDBParamSpec.h"
using namespace o2::framework;
namespace o2
{
namespace fv0
{
void ReconstructionDPL::init(InitContext& ic)
{
mTimer.Stop();
mTimer.Reset();
LOG(info) << "ReconstructionDPL::init";
}
void ReconstructionDPL::run(ProcessingContext& pc)
{
mTimer.Start(false);
mRecPoints.clear();
auto digits = pc.inputs().get<gsl::span<o2::fv0::Digit>>("digits");
auto digch = pc.inputs().get<gsl::span<o2::fv0::ChannelData>>("digch");
// RS: if we need to process MC truth, uncomment lines below
// std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>> labels;
// const o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>* lblPtr = nullptr;
if (mUseMC) {
LOG(info) << "Ignoring MC info";
}
if (mUpdateCCDB) {
auto caliboffsets = pc.inputs().get<o2::fv0::FV0ChannelTimeCalibrationObject*>("fv0offsets");
mReco.SetChannelOffset(caliboffsets.get());
}
if (mUseDeadChannelMap && mUpdateDeadChannelMap) {
auto deadChannelMap = pc.inputs().get<o2::fit::DeadChannelMap*>("deadChannelMap");
mReco.SetDeadChannelMap(deadChannelMap.get());
}
int nDig = digits.size();
LOG(debug) << " nDig " << nDig << " | ndigch " << digch.size();
mRecPoints.reserve(nDig);
for (int id = 0; id < nDig; id++) {
const auto& digit = digits[id];
LOG(debug) << " ndig " << id << " bc " << digit.getBC() << " orbit " << digit.getOrbit();
auto channels = digit.getBunchChannelData(digch);
mRecPoints.emplace_back(mReco.process(digit, channels, mRecChData));
}
LOG(debug) << "FV0 reconstruction pushes " << mRecPoints.size() << " RecPoints";
pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, mRecPoints);
pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, mRecChData);
mTimer.Stop();
}
//_______________________________________
void ReconstructionDPL::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
{
if (matcher == ConcreteDataMatcher("FT0", "TimeOffset", 0)) {
mUpdateCCDB = false;
return;
}
if (matcher == ConcreteDataMatcher(o2::header::gDataOriginFV0, "DeadChannelMap", 0)) {
mUpdateDeadChannelMap = false;
}
}
void ReconstructionDPL::endOfStream(EndOfStreamContext& ec)
{
LOGF(info, "FV0 reconstruction total timing: Cpu: %.3e Real: %.3e s in %d slots",
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
}
DataProcessorSpec getReconstructionSpec(bool useMC, bool useDeadChannelMap, const std::string ccdbpath)
{
std::vector<InputSpec> inputSpec;
std::vector<OutputSpec> outputSpec;
inputSpec.emplace_back("digits", o2::header::gDataOriginFV0, "DIGITSBC", 0, Lifetime::Timeframe);
inputSpec.emplace_back("digch", o2::header::gDataOriginFV0, "DIGITSCH", 0, Lifetime::Timeframe);
if (useMC) {
LOG(info) << "Currently Reconstruction does not consume and provide MC truth";
inputSpec.emplace_back("labels", o2::header::gDataOriginFV0, "DIGITSMCTR", 0, Lifetime::Timeframe);
}
if (useDeadChannelMap) {
LOG(info) << "Dead channel map will be applied during reconstruction";
inputSpec.emplace_back("deadChannelMap", o2::header::gDataOriginFV0, "DeadChannelMap", 0, Lifetime::Condition, ccdbParamSpec("FV0/Calib/DeadChannelMap"));
}
inputSpec.emplace_back("fv0offsets", "FV0", "TimeOffset", 0,
Lifetime::Condition,
ccdbParamSpec("FV0/Calib/ChannelTimeOffset"));
outputSpec.emplace_back(o2::header::gDataOriginFV0, "RECPOINTS", 0, Lifetime::Timeframe);
outputSpec.emplace_back(o2::header::gDataOriginFV0, "RECCHDATA", 0, Lifetime::Timeframe);
return DataProcessorSpec{
"fv0-reconstructor",
inputSpec,
outputSpec,
AlgorithmSpec{adaptFromTask<ReconstructionDPL>(useMC, useDeadChannelMap, ccdbpath)},
Options{}};
}
} // namespace fv0
} // namespace o2