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}
48
50{
51 mTimer.Start(false);
52 mRecPoints.clear();
53 mRecChData.clear();
54 auto digits = pc.inputs().get<gsl::span<o2::ft0::Digit>>("digits");
55 auto channels = pc.inputs().get<gsl::span<o2::ft0::ChannelData>>("digch");
56 // RS: if we need to process MC truth, uncomment lines below
57 // std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>> labels;
58 // const o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>* lblPtr = nullptr;
59 if (mUseMC) {
60 LOG(info) << "Ignoring MC info";
61 }
62 if (mUseTimeOffsetCalib) {
63 auto timeOffsetCalibObject = pc.inputs().get<o2::ft0::TimeSpectraInfoObject*>("ft0_timespectra");
64 mReco.SetTimeCalibObject(timeOffsetCalibObject.get());
65 }
66
67 if (mUseSlewingCalib) {
68 auto slewingCalibObject = pc.inputs().get<o2::ft0::SlewingCoef*>("ft0_slewing_coef");
69 mReco.SetSlewingCalibObject(slewingCalibObject.get());
70 }
71
72 mRecPoints.reserve(digits.size());
73 mRecChData.reserve(channels.size());
74 mReco.processTF(digits, channels, mRecPoints, mRecChData);
75 // do we ignore MC in this task?
76 LOG(debug) << "FT0 reconstruction pushes " << mRecPoints.size() << " RecPoints";
77 pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, mRecPoints);
78 pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, mRecChData);
79
80 mTimer.Stop();
81}
82//_______________________________________
84{
85 if (matcher == ConcreteDataMatcher("FT0", "TimeSpectraInfo", 0)) {
86 LOG(debug) << "New TimeSpectraInfo is uploaded";
87 return;
88 }
89 if (matcher == ConcreteDataMatcher("FT0", "SlewingCoef", 0)) {
90 LOG(debug) << "New SlewingCoef is uploaded";
91 mUseSlewingCalib = false; // upload only once, slewing should be stable during the run
92 return;
93 }
94}
95
97{
98 LOGF(info, "FT0 reconstruction total timing: Cpu: %.3e Real: %.3e s in %d slots",
99 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
100}
101
102DataProcessorSpec getReconstructionSpec(bool useMC, const std::string ccdbpath, bool useTimeOffsetCalib, bool useSlewingCalib)
103{
104 std::vector<InputSpec> inputSpec;
105 std::vector<OutputSpec> outputSpec;
106 inputSpec.emplace_back("digits", o2::header::gDataOriginFT0, "DIGITSBC", 0, Lifetime::Timeframe);
107 inputSpec.emplace_back("digch", o2::header::gDataOriginFT0, "DIGITSCH", 0, Lifetime::Timeframe);
108 if (useMC) {
109 LOG(info) << "Currently Reconstruction does not consume and provide MC truth";
110 inputSpec.emplace_back("labels", o2::header::gDataOriginFT0, "DIGITSMCTR", 0, Lifetime::Timeframe);
111 }
112 if (useTimeOffsetCalib) {
113 inputSpec.emplace_back("ft0_timespectra", "FT0", "TimeSpectraInfo", 0,
114 Lifetime::Condition,
115 ccdbParamSpec("FT0/Calib/TimeSpectraInfo", {}, 1));
116 }
117
118 if (useSlewingCalib) {
119 inputSpec.emplace_back("ft0_slewing_coef", "FT0", "SlewingCoef", 0,
120 Lifetime::Condition,
121 ccdbParamSpec("FT0/Calib/SlewingCoef"));
122 }
123
124 outputSpec.emplace_back(o2::header::gDataOriginFT0, "RECPOINTS", 0, Lifetime::Timeframe);
125 outputSpec.emplace_back(o2::header::gDataOriginFT0, "RECCHDATA", 0, Lifetime::Timeframe);
126
127 return DataProcessorSpec{
128 "ft0-reconstructor",
129 inputSpec,
130 outputSpec,
131 AlgorithmSpec{adaptFromTask<ReconstructionDPL>(useMC, ccdbpath, useTimeOffsetCalib, useSlewingCalib)},
132 Options{}};
133}
134
135} // namespace ft0
136} // namespace o2
Configurable digit filtering.
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.
std::ostringstream debug
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 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.
Definition TFIDInfo.h:20
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)
create a processor spec
struct o2::upgrades_utils::@462 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