Project
Loading...
Searching...
No Matches
ReconstructionSpec.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"
27
28using namespace o2::framework;
29
30namespace o2
31{
32namespace ft0
33{
34
36{
37 mTimer.Stop();
38 mTimer.Reset();
40 o2::ft0::TimeFilterParam::Instance().printKeyValues();
41 // Parameters which are used in reco, too many will be printed if use printKeyValues()
42 LOG(info) << "FT0 param mMinEntriesThreshold: " << CalibParam::Instance().mMinEntriesThreshold;
43 LOG(info) << "FT0 param mMaxEntriesThreshold:" << CalibParam::Instance().mMaxEntriesThreshold;
44 LOG(info) << "FT0 param mMinRMS: " << CalibParam::Instance().mMinRMS;
45 LOG(info) << "FT0 param mMaxSigma: " << CalibParam::Instance().mMaxSigma;
46 LOG(info) << "FT0 param mMaxDiffMean: " << CalibParam::Instance().mMaxDiffMean;
47 LOG(info) << "FT0 dead channel map will be applied " << mUseDeadChannelMap;
48}
49
51{
52 mTimer.Start(false);
53 mRecPoints.clear();
54 mRecChData.clear();
55 auto digits = pc.inputs().get<gsl::span<o2::ft0::Digit>>("digits");
56 auto channels = pc.inputs().get<gsl::span<o2::ft0::ChannelData>>("digch");
57 // RS: if we need to process MC truth, uncomment lines below
58 // std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>> labels;
59 // const o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>* lblPtr = nullptr;
60 if (mUseMC) {
61 LOG(info) << "Ignoring MC info";
62 }
63 if (mUseTimeOffsetCalib) {
64 auto timeOffsetCalibObject = pc.inputs().get<o2::ft0::TimeSpectraInfoObject*>("ft0_timespectra");
65 mReco.SetTimeCalibObject(timeOffsetCalibObject.get());
66 }
67
68 if (mUseSlewingCalib) {
69 auto slewingCalibObject = pc.inputs().get<o2::ft0::SlewingCoef*>("ft0_slewing_coef");
70 mReco.SetSlewingCalibObject(slewingCalibObject.get());
71 }
72
73 if (mUseDeadChannelMap && mUpdateDeadChannelMap) {
74 LOG(debug) << "Applying dead channel map";
75 auto deadChannelMap = pc.inputs().get<o2::fit::DeadChannelMap*>("deadChannelMap");
76 mReco.SetDeadChannelMap(deadChannelMap.get());
77 }
78
79 mRecPoints.reserve(digits.size());
80 mRecChData.reserve(channels.size());
81 mReco.processTF(digits, channels, mRecPoints, mRecChData);
82 // do we ignore MC in this task?
83 LOG(debug) << "FT0 reconstruction pushes " << mRecPoints.size() << " RecPoints";
84 pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, mRecPoints);
85 pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, mRecChData);
86
87 mTimer.Stop();
88}
89//_______________________________________
91{
92 if (matcher == ConcreteDataMatcher("FT0", "TimeSpectraInfo", 0)) {
93 LOG(debug) << "New TimeSpectraInfo is uploaded";
94 return;
95 }
96 if (matcher == ConcreteDataMatcher("FT0", "SlewingCoef", 0)) {
97 LOG(debug) << "New SlewingCoef is uploaded";
98 mUseSlewingCalib = false; // upload only once, slewing should be stable during the run
99 return;
100 }
101 if (matcher == ConcreteDataMatcher("FT0", "DeadChannelMap", 0)) {
102 LOG(debug) << "New DeadChannelMap is uploaded";
103 mUpdateDeadChannelMap = false;
104 return;
105 }
106}
107
109{
110 LOGF(info, "FT0 reconstruction total timing: Cpu: %.3e Real: %.3e s in %d slots",
111 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
112}
113
114DataProcessorSpec getReconstructionSpec(bool useMC, const std::string ccdbpath, bool useTimeOffsetCalib, bool useSlewingCalib, bool useDeadChannelMap)
115{
116 std::vector<InputSpec> inputSpec;
117 std::vector<OutputSpec> outputSpec;
118 inputSpec.emplace_back("digits", o2::header::gDataOriginFT0, "DIGITSBC", 0, Lifetime::Timeframe);
119 inputSpec.emplace_back("digch", o2::header::gDataOriginFT0, "DIGITSCH", 0, Lifetime::Timeframe);
120
121 if (useMC) {
122 LOG(info) << "Currently Reconstruction does not consume and provide MC truth";
123 inputSpec.emplace_back("labels", o2::header::gDataOriginFT0, "DIGITSMCTR", 0, Lifetime::Timeframe);
124 }
125 if (useTimeOffsetCalib) {
126 inputSpec.emplace_back("ft0_timespectra", "FT0", "TimeSpectraInfo", 0,
127 Lifetime::Condition,
128 ccdbParamSpec("FT0/Calib/TimeSpectraInfo", {}, 1));
129 }
130
131 if (useSlewingCalib) {
132 inputSpec.emplace_back("ft0_slewing_coef", "FT0", "SlewingCoef", 0,
133 Lifetime::Condition,
134 ccdbParamSpec("FT0/Calib/SlewingCoef"));
135 }
136
137 if (useDeadChannelMap) {
138 LOG(info) << "Dead channel map will be applied during reconstruction";
139 inputSpec.emplace_back("deadChannelMap", o2::header::gDataOriginFT0, "DeadChannelMap", 0, Lifetime::Condition, ccdbParamSpec("FT0/Calib/DeadChannelMap"));
140 }
141
142 outputSpec.emplace_back(o2::header::gDataOriginFT0, "RECPOINTS", 0, Lifetime::Timeframe);
143 outputSpec.emplace_back(o2::header::gDataOriginFT0, "RECCHDATA", 0, Lifetime::Timeframe);
144
145 return DataProcessorSpec{
146 "ft0-reconstructor",
147 inputSpec,
148 outputSpec,
149 AlgorithmSpec{adaptFromTask<ReconstructionDPL>(useMC, ccdbpath, useTimeOffsetCalib, useSlewingCalib, useDeadChannelMap)},
150 Options{}};
151}
152
153} // namespace ft0
154} // namespace o2
Configurable digit filtering.
std::ostringstream debug
Class to describe fired and stored channels for the BC and to refer to channel data.
Definition of a container to keep Monte Carlo truth external to simulation objects.
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.
void SetSlewingCalibObject(o2::ft0::SlewingCoef const *calibSlew)
void SetDeadChannelMap(const o2::fit::DeadChannelMap *deadChannelMap)
void SetTimeCalibObject(o2::ft0::TimeSpectraInfoObject const *timeCalibObject)
void processTF(const gsl::span< const o2::ft0::Digit > &digits, const gsl::span< const o2::ft0::ChannelData > &channels, std::vector< o2::ft0::RecPoints > &vecRecPoints, std::vector< o2::ft0::ChannelDataFloat > &vecChData)
void init(InitContext &ic) final
void endOfStream(framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void run(ProcessingContext &pc) final
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj) final
constexpr o2::header::DataOrigin gDataOriginFT0
Definition DataHeader.h:566
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
framework::DataProcessorSpec getReconstructionSpec(bool useMC=false, const std::string ccdbpath="http://alice-ccdb.cern.ch", bool useTimeOffsetCalib=true, bool useSlewingCalib=true, bool useDeadChannelMap=true)
create a processor spec
struct o2::upgrades_utils::@461 ft0
structure to keep V0C information
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
std::vector< Digit > digits