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
97 uint16_t getSquashingDepth() { return mSquashOverflowsDepth; }
98 void setSquashingDepth(const int16_t v)
99 {
100 mSquashOverflowsDepth = v;
101 }
102
103 uint16_t getSquashingDist() { return mMaxSquashDist; }
104 void setSquashingDist(const int16_t v)
105 {
106 mMaxSquashDist = v;
107 }
108
109 int getMaxBCSeparationToSquash() const { return mMaxBCSeparationToSquash; }
111 {
112 mMaxBCSeparationToSquash = n;
113 }
114
115 void squashNeighbours(const uint16_t& iROF, const int& iDigit, const int& maxDigits, ChipPixelData& chipData);
116
117 private:
118 void addPixel(ChipPixelData& chipData, const Digit* dig)
119 {
120 // add new fired pixel
121 chipData.getData().emplace_back(dig);
122 }
123
124 // pointer for input containers in the self-managed mode: due to the requirements of the
125 // fairroot the externally settable pointers must be const...
126 std::vector<o2::itsmft::Digit>* mDigitsSelf = nullptr;
127 std::vector<o2::itsmft::ROFRecord>* mROFRecVecSelf = nullptr;
128 std::vector<o2::itsmft::MC2ROFRecord>* mMC2ROFRecVecSelf = nullptr;
129 const o2::dataformats::IOMCTruthContainerView* mDigitsMCTruthSelf = nullptr;
130
131 gsl::span<const o2::itsmft::Digit> mDigits;
132 gsl::span<const o2::itsmft::ROFRecord> mROFRecVec;
133 gsl::span<const o2::itsmft::MC2ROFRecord> mMC2ROFRecVec;
134
136 Int_t mIdDig = 0; // Digits slot read within ROF
137 Int_t mIdROF = 0; // ROFRecord being red
138
139 std::unique_ptr<TTree> mInputTree; // input tree for digits
140
141 // Squashing datamembers
142 int16_t mSquashOverflowsDepth = 0; // merge overflow pixels in next N ROF(s) into first ROF and mask them
143 std::vector<bool> mSquashedDigitsMask; // keep info of squashed pixels
144 uint16_t mMaxSquashDist = 1; // maximum pixel distance to allow for squashing
145 int mMaxBCSeparationToSquash; // frames can be separated by less than this amount of BCs
146 std::vector<int> mBookmarkNextROFs; // keep track of the position of the last processed digits in next rof
147 int mIdROFLast = 0; // ROFRecord red last iteration
148
149 ClassDefOverride(DigitPixelReader, 1);
150};
151
152} // namespace itsmft
153} // namespace o2
154
155#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 ...