Project
Loading...
Searching...
No Matches
DigitPixelReader.h
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
14
15#ifndef ALICEO2_ITSMFT_DIGITPIXELREADER_H
16#define ALICEO2_ITSMFT_DIGITPIXELREADER_H
17
26#include <TTree.h>
27#include <vector>
28#include <memory>
29#include <gsl/span>
30
31namespace o2
32{
33namespace itsmft
34{
35
37{
38 public:
39 DigitPixelReader() = default;
40 ~DigitPixelReader() override;
41
42 const auto getMC2ROFRecords() const
43 {
44 return mMC2ROFRecVec;
45 }
46
47 void setMC2ROFRecords(const gsl::span<const o2::itsmft::MC2ROFRecord> a)
48 {
49 mMC2ROFRecVec = a;
50 }
51
52 void setROFRecords(const gsl::span<const o2::itsmft::ROFRecord> a)
53 {
54 mROFRecVec = a;
55 mIdROF = -1;
56 }
57
58 void setDigits(const gsl::span<const o2::itsmft::Digit> a)
59 {
60 mDigits = a;
61 mIdDig = 0;
62 if (mSquashOverflowsDepth) {
63 mSquashedDigitsMask.resize(a.size(), false);
64 mBookmarkNextROFs.resize(mSquashOverflowsDepth, 0);
65 mIdROFLast = 0;
66 }
67 }
68
73
75 {
76 return mDigitsMCTruth;
77 }
78
79 bool getNextChipData(ChipPixelData& chipData) override;
80 ChipPixelData* getNextChipData(std::vector<ChipPixelData>& chipDataVec) override;
81
82 void init() override
83 {
84 mIdDig = 0;
85 mIdROF = -1;
86 }
87
88 // prepare next trigger
89 int decodeNextTrigger() override;
90
91 // methods for standalone reading
92 void openInput(const std::string rawInput, o2::detectors::DetID det);
93 bool readNextEntry();
94
95 void clear();
96 void reset();
97
98 uint16_t getSquashingDepth() { return mSquashOverflowsDepth; }
99 void setSquashingDepth(const int16_t v)
100 {
101 mSquashOverflowsDepth = v;
102 }
103
104 uint16_t getSquashingDist() { return mMaxSquashDist; }
105 void setSquashingDist(const int16_t v)
106 {
107 mMaxSquashDist = v;
108 }
109
110 int getMaxBCSeparationToSquash() const { return mMaxBCSeparationToSquash; }
112 {
113 mMaxBCSeparationToSquash = n;
114 }
115
116 void squashNeighbours(const uint16_t& iROF, const int& iDigit, const int& maxDigits, ChipPixelData& chipData);
117
118 private:
119 void addPixel(ChipPixelData& chipData, const Digit* dig)
120 {
121 // add new fired pixel
122 chipData.getData().emplace_back(dig);
123 }
124
125 // pointer for input containers in the self-managed mode: due to the requirements of the
126 // fairroot the externally settable pointers must be const...
127 std::vector<o2::itsmft::Digit>* mDigitsSelf = nullptr;
128 std::vector<o2::itsmft::ROFRecord>* mROFRecVecSelf = nullptr;
129 std::vector<o2::itsmft::MC2ROFRecord>* mMC2ROFRecVecSelf = nullptr;
130 const o2::dataformats::IOMCTruthContainerView* mDigitsMCTruthSelf = nullptr;
131
132 gsl::span<const o2::itsmft::Digit> mDigits;
133 gsl::span<const o2::itsmft::ROFRecord> mROFRecVec;
134 gsl::span<const o2::itsmft::MC2ROFRecord> mMC2ROFRecVec;
135
137 Int_t mIdDig = 0; // Digits slot read within ROF
138 Int_t mIdROF = 0; // ROFRecord being red
139
140 std::unique_ptr<TTree> mInputTree; // input tree for digits
141
142 // Squashing datamembers
143 int16_t mSquashOverflowsDepth = 0; // merge overflow pixels in next N ROF(s) into first ROF and mask them
144 std::vector<bool> mSquashedDigitsMask; // keep info of squashed pixels
145 uint16_t mMaxSquashDist = 1; // maximum pixel distance to allow for squashing
146 int mMaxBCSeparationToSquash; // frames can be separated by less than this amount of BCs
147 std::vector<int> mBookmarkNextROFs; // keep track of the position of the last processed digits in next rof
148 int mIdROFLast = 0; // ROFRecord red last iteration
149
150 ClassDefOverride(DigitPixelReader, 1);
151};
152
153} // namespace itsmft
154} // namespace o2
155
156#endif /* ALICEO2_ITS_DIGITPIXELREADER_H */
A const (ready only) version of MCTruthContainer.
Definition of the ITSMFT digit.
A special IO container - splitting a given vector to enable ROOT IO.
Definition of the ITSMFT ROFrame (trigger) record.
Transient data classes for single pixel and set of pixels from current chip.
Abstract class for Alpide data reader class.
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
const std::vector< PixelData > & getData() const
Definition PixelData.h:115
void squashNeighbours(const uint16_t &iROF, const int &iDigit, const int &maxDigits, ChipPixelData &chipData)
void setDigitsMCTruth(const o2::dataformats::ConstMCTruthContainerView< o2::MCCompLabel > *m)
bool getNextChipData(ChipPixelData &chipData) override
const auto getMC2ROFRecords() const
void openInput(const std::string rawInput, o2::detectors::DetID det)
void setDigits(const gsl::span< const o2::itsmft::Digit > a)
void setSquashingDist(const int16_t v)
const o2::dataformats::ConstMCTruthContainerView< o2::MCCompLabel > * getDigitsMCTruth() const override
void setMC2ROFRecords(const gsl::span< const o2::itsmft::MC2ROFRecord > a)
void setROFRecords(const gsl::span< const o2::itsmft::ROFRecord > a)
void setSquashingDepth(const int16_t v)
Digit class for the ITS.
Definition Digit.h:30
PixelReader class for the ITSMFT.
Definition PixelReader.h:34
GLdouble n
Definition glcorearb.h:1982
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...