forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDigitizer.h
More file actions
138 lines (109 loc) · 5.81 KB
/
Digitizer.h
File metadata and controls
138 lines (109 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file Digitizer.h
/// \brief Definition of the ITS digitizer
#ifndef ALICEO2_ITS3_DIGITIZER_H
#define ALICEO2_ITS3_DIGITIZER_H
#include <vector>
#include <deque>
#include <memory>
#include "Rtypes.h"
#include "TObject.h"
#include "ITSMFTSimulation/AlpideSimResponse.h"
#include "ITSMFTSimulation/Hit.h"
#include "ITSBase/GeometryTGeo.h"
#include "ITS3Base/SegmentationMosaix.h"
#include "ITS3Simulation/DigiParams.h"
#include "ITS3Simulation/ChipDigitsContainer.h"
#include "ITS3Simulation/ChipSimResponse.h"
#include "DataFormatsITSMFT/Digit.h"
#include "DataFormatsITSMFT/ROFRecord.h"
#include "CommonDataFormat/InteractionRecord.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "SimulationDataFormat/MCTruthContainer.h"
namespace o2::its3
{
class Digitizer : public TObject
{
using ExtraDig = std::vector<itsmft::PreDigitLabelRef>; ///< container for extra contributions to PreDigits
public:
~Digitizer() = default;
void setDigits(std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }
o2::its3::DigiParams& getParams() { return mParams; }
const o2::its3::DigiParams& getParams() const { return mParams; }
void init();
/// Steer conversion of hits to digits
void process(const std::vector<itsmft::Hit>* hits, int evID, int srcID);
void setEventTime(const o2::InteractionTimeRecord& irt);
double getEndTimeOfROFMax() const
{
///< return the time corresponding to end of the last reserved ROFrame : mROFrameMax
return mParams.getROFrameLength() * (mROFrameMax + 1) + mParams.getTimeOffset();
}
void setContinuous(bool v) { mParams.setContinuous(v); }
bool isContinuous() const { return mParams.isContinuous(); }
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);
// provide the common itsmft::GeometryTGeo to access matrices and segmentation
void setGeometry(const o2::its::GeometryTGeo* gm) { mGeometry = gm; }
uint32_t getEventROFrameMin() const { return mEventROFrameMin; }
uint32_t getEventROFrameMax() const { return mEventROFrameMax; }
void resetEventROFrames()
{
mEventROFrameMin = 0xffffffff;
mEventROFrameMax = 0;
}
void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }
private:
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);
void registerDigits(o2::its3::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl);
ExtraDig* getExtraDigBuffer(uint32_t roFrame)
{
if (mROFrameMin > roFrame) {
return nullptr; // nothing to do
}
int ind = roFrame - mROFrameMin;
while (ind >= int(mExtraBuff.size())) {
mExtraBuff.emplace_back(std::make_unique<ExtraDig>());
}
return mExtraBuff[ind].get();
}
static constexpr float sec2ns = 1e9;
o2::its3::DigiParams mParams; ///< digitization parameters
o2::InteractionTimeRecord mEventTime; ///< global event time and interaction record
o2::InteractionRecord mIRFirstSampledTF; ///< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
double mCollisionTimeWrtROF{};
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
static constexpr std::array<o2::its3::SegmentationMosaix, 3> mIBSegmentations{0, 1, 2};
const o2::its3::ChipSimResponse* mSimRespIB = nullptr; // simulated response for IB
const o2::itsmft::AlpideSimResponse* mSimRespOB = nullptr; // simulated response for OB
bool mSimRespIBOrientation{false}; // wether the orientation in the IB response function is flipped
float mSimRespIBShift{0.f}; // adjusting the Y-shift in the IB response function to match sensor local coord.
float mSimRespIBScaleX{1.f}; // scale x-local coordinate to response function x-coordinate
float mSimRespIBScaleZ{1.f}; // scale z-local coordinate to response function z-coordinate
float mSimRespOBShift{0.f}; // adjusting the Y-shift in the OB response function to match sensor local coord.
const o2::its::GeometryTGeo* mGeometry = nullptr; ///< ITS3 geometry
std::vector<o2::its3::ChipDigitsContainer> mChips; ///< Array of chips digits containers
std::deque<std::unique_ptr<ExtraDig>> mExtraBuff; ///< burrer (per roFrame) for extra digits
std::vector<o2::itsmft::Digit>* mDigits = nullptr; //! output digits
std::vector<o2::itsmft::ROFRecord>* mROFRecords = nullptr; //! output ROF records
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mMCLabels = nullptr; //! output labels
const o2::itsmft::NoiseMap* mDeadChanMap = nullptr;
ClassDef(Digitizer, 5);
};
} // namespace o2::its3
#endif /* ALICEO2_ITS3_DIGITIZER_H */