Project
Loading...
Searching...
No Matches
Digitizer.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#ifndef ALICEO2_TRKFT3_DIGITIZER_H
15#define ALICEO2_TRKFT3_DIGITIZER_H
16
17#include <vector>
18#include <deque>
19#include <memory>
20#include <type_traits>
21
22#include "Rtypes.h" // for Digitizer::Class
23#include "TObject.h" // for TObject
24
27
38
39namespace o2::trkft3
40{
41
42template <int DetID>
44{
45 static_assert(DetID == o2::detectors::DetID::TRK || DetID == o2::detectors::DetID::FT3, "only TRK and FT3 digitizers are supported");
46 using GeometryTGeo = std::conditional_t<DetID == o2::detectors::DetID::TRK, o2::trk::GeometryTGeo, o2::ft3::GeometryTGeo>;
47 using ExtraDig = std::vector<itsmft::PreDigitLabelRef>;
48
49 public:
50 void setDigits(std::vector<o2::trkft3::Digit>* dig) { mDigits = dig; }
52 void setROFRecords(std::vector<o2::trkft3::ROFRecord>* rec) { mROFRecords = rec; }
53 void setResponseName(const std::string& name) { mRespName = name; }
54
56 const o2::trkft3::DigiParams<DetID>& getParams() const { return mParams; }
57
58 void init();
59
61
63 void process(const std::vector<o2::trkft3::Hit>* hits, int evID, int srcID, int layer);
65
66 void fillOutputContainer(uint32_t maxFrame, int layer);
67
69 {
70 mROFrameMin = 0;
71 mROFrameMax = 0;
72 mNewROFrame = 0;
73 mROFsWrtFirstRO = 0;
74 mExtraBuff.clear();
75 }
76
77 const o2::trkft3::DigiParams<DetID>& getDigitParams() const { return mParams; }
78
79 void setGeometry(const GeometryTGeo* gm)
80 {
81 LOG(info) << "trkft3::Digitizer set geom";
82 mGeometry = gm;
83 }
84
85 uint32_t getEventROFrameMin() const { return mEventROFrameMin; }
86 uint32_t getEventROFrameMax() const { return mEventROFrameMax; }
88 {
89 mEventROFrameMin = 0xffffffff;
90 mEventROFrameMax = 0;
91 }
92
93 void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }
94
95 private:
96 void processHit(const o2::trkft3::Hit& hit, uint32_t& maxFr, int evID, int srcID, int rofLayer);
97 void registerDigits(o2::trkft3::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
98 uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl, int layer);
99
100 ExtraDig* getExtraDigBuffer(uint32_t roFrame)
101 {
102 if (mROFrameMin > roFrame) {
103 return nullptr; // nothing to do
104 }
105 int ind = roFrame - mROFrameMin;
106 while (ind >= int(mExtraBuff.size())) {
107 mExtraBuff.emplace_back(std::make_unique<ExtraDig>());
108 }
109 return mExtraBuff[ind].get();
110 }
111
116 int getNCols(int subDetID, int layer)
117 {
118 if (subDetID == 0) { // VD
120 } else if (subDetID == 1 || subDetID == 2) { // ML/OT: the smallest element is a chip of 470 rows and 640 cols
122 }
123 return 0;
124 }
125
130 int getNRows(int subDetID, int layer)
131 {
132 if (subDetID == 0) { // VD
134 } else if (subDetID == 1 || subDetID == 2) { // ML/OT
136 }
137 return 0;
138 }
139
140 int getROFLayer(int chipID) const
141 {
142 if constexpr (DetID == o2::detectors::DetID::TRK) {
143 return mGeometry->getLayerTRK(chipID);
144 } else {
145 return mGeometry->getLayer(chipID);
146 }
147 }
148
149 int getDisk(int chipID) const
150 {
151 if constexpr (DetID == o2::detectors::DetID::TRK) {
152 return mGeometry->getDisk(chipID);
153 } else {
154 return -1;
155 }
156 }
157
158 static constexpr float sec2ns = 1e9;
159
161 o2::InteractionTimeRecord mEventTime;
162 o2::InteractionRecord mIRFirstSampledTF;
163 double mCollisionTimeWrtROF{};
164 uint32_t mROFrameMin = 0;
165 uint32_t mROFrameMax = 0;
166 uint32_t mNewROFrame = 0;
167
168 int mROFsWrtFirstRO = 0;
169
170 uint32_t mEventROFrameMin = 0xffffffff;
171 uint32_t mEventROFrameMax = 0;
172
173 int mNumberOfChips = 0;
174
175 const o2::trkft3::ChipSimResponse* mChipSimResp = nullptr; // simulated response
176 const o2::trkft3::ChipSimResponse* mChipSimRespVD = nullptr; // simulated response for VD chips
177 const o2::trkft3::ChipSimResponse* mChipSimRespMLOT = nullptr; // simulated response for ML/OT chips
178
179 std::string mRespName;
180
181 bool mSimRespOrientation{false}; // wether the orientation in the response function is flipped
182 float mSimRespVDShift{0.f}; // adjusting the Y-shift in the APTS response function to match sensor local coord.
183 float mSimRespVDScaleX{1.f}; // scale x-local coordinate to response function x-coordinate
184 float mSimRespVDScaleZ{1.f}; // scale z-local coordinate to response function z-coordinate
185 float mSimRespMLOTShift{0.f}; // adjusting the Y-shift in the APTS response function to match sensor local coord.
186 float mSimRespMLOTScaleX{1.f}; // scale x-local coordinate to response function x-coordinate
187 float mSimRespMLOTScaleZ{1.f}; // scale z-local coordinate to response function z-coordinate
188 float mSimRespVDScaleDepth{1.f}; // scale depth-local coordinate to response function depth-coordinate
189 float mSimRespMLOTScaleDepth{1.f}; // scale depth-local coordinate to response function depth-coordinate
190
191 const GeometryTGeo* mGeometry = nullptr;
192
193 std::vector<o2::trkft3::ChipDigitsContainer> mChips;
194 std::deque<std::unique_ptr<ExtraDig>> mExtraBuff;
195
196 std::vector<o2::trkft3::Digit>* mDigits = nullptr;
197 std::vector<o2::trkft3::ROFRecord>* mROFRecords = nullptr;
199
200 const o2::itsmft::NoiseMap* mDeadChanMap = nullptr;
201 const o2::itsmft::NoiseMap* mNoiseMap = nullptr;
202};
203} // namespace o2::trkft3
204
207
208#endif
Simulation parameters for the TRK digitizer. Based on the ITS2 and ITS3 digitizer parameters.
Definition of a container to keep Monte Carlo truth external to simulation objects.
uint32_t col
Definition RawData.h:4
Definition of the GeometryTGeo class.
A container to hold and manage MC truth information/labels.
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
NoiseMap class for the ITS and MFT.
Definition NoiseMap.h:39
void setROFRecords(std::vector< o2::trkft3::ROFRecord > *rec)
Definition Digitizer.h:52
void setGeometry(const GeometryTGeo *gm)
Definition Digitizer.h:79
void setEventTime(const o2::InteractionTimeRecord &irt, int layer)
const o2::trkft3::DigiParams< DetID > & getParams() const
Definition Digitizer.h:56
void process(const std::vector< o2::trkft3::Hit > *hits, int evID, int srcID, int layer)
Steer conversion of hits to digits.
void setResponseName(const std::string &name)
Definition Digitizer.h:53
void setMCLabels(o2::dataformats::MCTruthContainer< o2::MCCompLabel > *mclb)
Definition Digitizer.h:51
void fillOutputContainer(uint32_t maxFrame, int layer)
o2::trkft3::DigiParams< DetID > & getParams()
Definition Digitizer.h:55
void setDigits(std::vector< o2::trkft3::Digit > *dig)
Definition Digitizer.h:50
uint32_t getEventROFrameMin() const
Definition Digitizer.h:85
void setDeadChannelsMap(const o2::itsmft::NoiseMap *mp)
Definition Digitizer.h:93
const o2::trkft3::DigiParams< DetID > & getDigitParams() const
Definition Digitizer.h:77
uint32_t getEventROFrameMax() const
Definition Digitizer.h:86
const o2::trkft3::ChipSimResponse * getChipResponse(int chipID)
GLuint const GLchar * name
Definition glcorearb.h:781
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
constexpr std::array< int, nLayers > nRows
Definition Specs.h:59
GPUReconstruction * rec
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< int > row