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"
25
26using namespace o2::framework;
27
28namespace o2
29{
30namespace fv0
31{
32
34{
35 mTimer.Stop();
36 mTimer.Reset();
37 LOG(info) << "ReconstructionDPL::init";
38}
39
41{
42 mTimer.Start(false);
43 mRecPoints.clear();
44 auto digits = pc.inputs().get<gsl::span<o2::fv0::Digit>>("digits");
45 auto digch = pc.inputs().get<gsl::span<o2::fv0::ChannelData>>("digch");
46 // RS: if we need to process MC truth, uncomment lines below
47 // std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>> labels;
48 // const o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>* lblPtr = nullptr;
49 if (mUseMC) {
50 LOG(info) << "Ignoring MC info";
51 }
52 if (mUpdateCCDB) {
53 auto caliboffsets = pc.inputs().get<o2::fv0::FV0ChannelTimeCalibrationObject*>("fv0offsets");
54 mReco.SetChannelOffset(caliboffsets.get());
55 }
56
57 int nDig = digits.size();
58 LOG(debug) << " nDig " << nDig << " | ndigch " << digch.size();
59 mRecPoints.reserve(nDig);
60 mRecChData.resize(digch.size());
61 for (int id = 0; id < nDig; id++) {
62 const auto& digit = digits[id];
63 LOG(debug) << " ndig " << id << " bc " << digit.getBC() << " orbit " << digit.getOrbit();
64 auto channels = digit.getBunchChannelData(digch);
65 gsl::span<o2::fv0::ChannelDataFloat> out_ch(mRecChData);
66 out_ch = out_ch.subspan(digit.ref.getFirstEntry(), digit.ref.getEntries());
67 mRecPoints.emplace_back(mReco.process(digit, channels, out_ch));
68 }
69
70 LOG(debug) << "FV0 reconstruction pushes " << mRecPoints.size() << " RecPoints";
71 pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, mRecPoints);
72 pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, mRecChData);
73
74 mTimer.Stop();
75}
76//_______________________________________
78{
79 if (matcher == ConcreteDataMatcher("FT0", "TimeOffset", 0)) {
80 mUpdateCCDB = false;
81 return;
82 }
83}
84
86{
87 LOGF(info, "FV0 reconstruction total timing: Cpu: %.3e Real: %.3e s in %d slots",
88 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
89}
90
91DataProcessorSpec getReconstructionSpec(bool useMC, const std::string ccdbpath)
92{
93 std::vector<InputSpec> inputSpec;
94 std::vector<OutputSpec> outputSpec;
95 inputSpec.emplace_back("digits", o2::header::gDataOriginFV0, "DIGITSBC", 0, Lifetime::Timeframe);
96 inputSpec.emplace_back("digch", o2::header::gDataOriginFV0, "DIGITSCH", 0, Lifetime::Timeframe);
97 if (useMC) {
98 LOG(info) << "Currently Reconstruction does not consume and provide MC truth";
99 inputSpec.emplace_back("labels", o2::header::gDataOriginFV0, "DIGITSMCTR", 0, Lifetime::Timeframe);
100 }
101 inputSpec.emplace_back("fv0offsets", "FV0", "TimeOffset", 0,
102 Lifetime::Condition,
103 ccdbParamSpec("FV0/Calib/ChannelTimeOffset"));
104
105 outputSpec.emplace_back(o2::header::gDataOriginFV0, "RECPOINTS", 0, Lifetime::Timeframe);
106 outputSpec.emplace_back(o2::header::gDataOriginFV0, "RECCHDATA", 0, Lifetime::Timeframe);
107
108 return DataProcessorSpec{
109 "fv0-reconstructor",
110 inputSpec,
111 outputSpec,
112 AlgorithmSpec{adaptFromTask<ReconstructionDPL>(useMC, ccdbpath)},
113 Options{}};
114}
115
116} // namespace fv0
117} // namespace o2
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
Container class to store time and charge values of single FV0 channel.
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.
o2::fv0::RecPoints process(o2::fv0::Digit const &bcd, gsl::span< const o2::fv0::ChannelData > inChData, gsl::span< o2::fv0::ChannelDataFloat > outChData)
void SetChannelOffset(o2::fv0::FV0ChannelTimeCalibrationObject const *caliboffsets)
void run(ProcessingContext &pc) final
void endOfStream(framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj) final
void init(InitContext &ic) final
GLuint id
Definition glcorearb.h:650
constexpr o2::header::DataOrigin gDataOriginFV0
Definition DataHeader.h:567
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")
create a processor spec
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