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"
26
27using namespace o2::framework;
28
29namespace o2
30{
31namespace fv0
32{
33
35{
36 mTimer.Stop();
37 mTimer.Reset();
38 LOG(info) << "ReconstructionDPL::init";
39}
40
42{
43 mTimer.Start(false);
44 mRecPoints.clear();
45 mRecChData.clear();
46 auto digits = pc.inputs().get<gsl::span<o2::fv0::Digit>>("digits");
47 auto digch = pc.inputs().get<gsl::span<o2::fv0::ChannelData>>("digch");
48 // RS: if we need to process MC truth, uncomment lines below
49 // std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>> labels;
50 // const o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>* lblPtr = nullptr;
51 if (mUseMC) {
52 LOG(info) << "Ignoring MC info";
53 }
54 if (mUpdateCCDB) {
55 auto caliboffsets = pc.inputs().get<o2::fv0::FV0ChannelTimeCalibrationObject*>("fv0offsets");
56 mReco.SetChannelOffset(caliboffsets.get());
57 }
58 if (mUseDeadChannelMap && mUpdateDeadChannelMap) {
59 auto deadChannelMap = pc.inputs().get<o2::fit::DeadChannelMap*>("deadChannelMap");
60 mReco.SetDeadChannelMap(deadChannelMap.get());
61 }
62
63 int nDig = digits.size();
64 LOG(debug) << " nDig " << nDig << " | ndigch " << digch.size();
65 mRecPoints.reserve(nDig);
66 for (int id = 0; id < nDig; id++) {
67 const auto& digit = digits[id];
68 LOG(debug) << " ndig " << id << " bc " << digit.getBC() << " orbit " << digit.getOrbit();
69 auto channels = digit.getBunchChannelData(digch);
70 mRecPoints.emplace_back(mReco.process(digit, channels, mRecChData));
71 }
72
73 LOG(debug) << "FV0 reconstruction pushes " << mRecPoints.size() << " RecPoints";
74 pc.outputs().snapshot(Output{mOrigin, "RECPOINTS", 0}, mRecPoints);
75 pc.outputs().snapshot(Output{mOrigin, "RECCHDATA", 0}, mRecChData);
76
77 mTimer.Stop();
78}
79//_______________________________________
81{
82 if (matcher == ConcreteDataMatcher("FT0", "TimeOffset", 0)) {
83 mUpdateCCDB = false;
84 return;
85 }
86 if (matcher == ConcreteDataMatcher(o2::header::gDataOriginFV0, "DeadChannelMap", 0)) {
87 mUpdateDeadChannelMap = false;
88 }
89}
90
92{
93 LOGF(info, "FV0 reconstruction total timing: Cpu: %.3e Real: %.3e s in %d slots",
94 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
95}
96
97DataProcessorSpec getReconstructionSpec(bool useMC, bool useDeadChannelMap, const std::string ccdbpath)
98{
99 std::vector<InputSpec> inputSpec;
100 std::vector<OutputSpec> outputSpec;
101 inputSpec.emplace_back("digits", o2::header::gDataOriginFV0, "DIGITSBC", 0, Lifetime::Timeframe);
102 inputSpec.emplace_back("digch", o2::header::gDataOriginFV0, "DIGITSCH", 0, Lifetime::Timeframe);
103 if (useMC) {
104 LOG(info) << "Currently Reconstruction does not consume and provide MC truth";
105 inputSpec.emplace_back("labels", o2::header::gDataOriginFV0, "DIGITSMCTR", 0, Lifetime::Timeframe);
106 }
107 if (useDeadChannelMap) {
108 LOG(info) << "Dead channel map will be applied during reconstruction";
109 inputSpec.emplace_back("deadChannelMap", o2::header::gDataOriginFV0, "DeadChannelMap", 0, Lifetime::Condition, ccdbParamSpec("FV0/Calib/DeadChannelMap"));
110 }
111 inputSpec.emplace_back("fv0offsets", "FV0", "TimeOffset", 0,
112 Lifetime::Condition,
113 ccdbParamSpec("FV0/Calib/ChannelTimeOffset"));
114
115 outputSpec.emplace_back(o2::header::gDataOriginFV0, "RECPOINTS", 0, Lifetime::Timeframe);
116 outputSpec.emplace_back(o2::header::gDataOriginFV0, "RECCHDATA", 0, Lifetime::Timeframe);
117
118 return DataProcessorSpec{
119 "fv0-reconstructor",
120 inputSpec,
121 outputSpec,
122 AlgorithmSpec{adaptFromTask<ReconstructionDPL>(useMC, useDeadChannelMap, ccdbpath)},
123 Options{}};
124}
125
126} // namespace fv0
127} // namespace o2
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
Dead channel map for FIT.
std::ostringstream debug
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.
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, std::vector< o2::fv0::ChannelDataFloat > &outChData)
void SetChannelOffset(o2::fv0::FV0ChannelTimeCalibrationObject const *caliboffsets)
void SetDeadChannelMap(o2::fit::DeadChannelMap const *deadChannelMap)
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.
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, bool useDeadChannelMap=true, 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