Project
Loading...
Searching...
No Matches
KryptonClustererSpec.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
12#include <memory>
13
14#include "Framework/Task.h"
16#include "Framework/Logger.h"
18#include "Headers/DataHeader.h"
19
24
25using namespace o2::framework;
26using namespace o2::header;
28
29namespace o2
30{
31namespace tpc
32{
33
35{
36 public:
37 KrBoxClusterFinderDevice() : mClusterFinder{std::make_unique<KrBoxClusterFinder>()} {}
38
40 {
41 mClusterFinder->init();
42 }
43
45 {
46 for (auto const& inputRef : InputRecordWalker(pc.inputs())) {
47 auto const* sectorHeader = DataRefUtils::getHeader<TPCSectorHeader*>(inputRef);
48 if (sectorHeader == nullptr) {
49 LOGP(error, "sector header missing on header stack for input on ", inputRef.spec->binding);
50 continue;
51 }
52
53 const int sector = sectorHeader->sector();
54 auto inDigits = pc.inputs().get<gsl::span<o2::tpc::Digit>>(inputRef);
55
56 mClusterFinder->loopOverSector(inDigits, sector);
57
58 snapshotClusters(pc.outputs(), mClusterFinder->getClusters(), sector);
59
60 LOGP(info, "processed sector {} with {} digits and {} reconstructed clusters", sector, inDigits.size(), mClusterFinder->getClusters().size());
61
62 mClusterFinder->resetClusters();
63 }
64
65 ++mProcessedTFs;
66 LOGP(info, "Number of processed time frames: {}", mProcessedTFs);
67 }
68
69 private:
70 std::unique_ptr<KrBoxClusterFinder> mClusterFinder;
71 uint32_t mProcessedTFs{0};
72
73 //____________________________________________________________________________
74 void snapshotClusters(DataAllocator& output, const std::vector<o2::tpc::KrCluster>& clusters, int sector)
75 {
76 o2::tpc::TPCSectorHeader header{sector};
77 header.activeSectors = (0x1 << sector);
78 output.snapshot(Output{gDataOriginTPC, "KRCLUSTERS", static_cast<SubSpecificationType>(sector), header}, clusters);
79 }
80};
81
83{
85
86 std::vector<InputSpec> inputs{
87 InputSpec{"digits", gDataOriginTPC, "DIGITS", 0, Lifetime::Timeframe},
88 };
89
90 std::vector<OutputSpec> outputs;
91 outputs.emplace_back(gDataOriginTPC, "KRCLUSTERS", 0, Lifetime::Timeframe);
92
93 return DataProcessorSpec{
94 "tpc-krypton-clusterer",
95 inputs,
96 outputs,
97 AlgorithmSpec{adaptFromTask<device>()},
98 Options{} // end Options
99 }; // end DataProcessorSpec
100}
101} // namespace tpc
102} // namespace o2
o2::framework::DataAllocator::SubSpecificationType SubSpecificationType
A helper class to iteratate over all parts of all input routes.
Processor spec for running TPC Krypton cluster finder.
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
Struct for Krypton and X-ray clusters.
o2::header::DataHeader::SubSpecificationType SubSpecificationType
A helper class to iteratate over all parts of all input routes.
void run(o2::framework::ProcessingContext &pc) final
void init(o2::framework::InitContext &ic) final
constexpr o2::header::DataOrigin gDataOriginTPC
Definition DataHeader.h:576
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > Options
O2 data header classes and API, v0.1.
Definition DetID.h:49
o2::framework::DataProcessorSpec getKryptonClustererSpec()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
std::vector< Cluster > clusters