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+ // / \file Digitizer.h
13+ // / \brief Definition of the TRK digitizer
14+ #ifndef ALICEO2_TRK_DIGITIZER_H
15+ #define ALICEO2_TRK_DIGITIZER_H
16+
17+ #include < vector>
18+ #include < deque>
19+ #include < memory>
20+
21+ #include " Rtypes.h" // for Digitizer::Class
22+ #include " TObject.h" // for TObject
23+
24+ #include " ITSMFTSimulation/ChipDigitsContainer.h"
25+ // #include "ITSMFTSimulation/AlpideSimResponse.h"
26+ #include " ITSMFTSimulation/DigiParams.h"
27+ #include " ITSMFTSimulation/Hit.h"
28+ #include " TRKBase/GeometryTGeo.h"
29+ // #include "ITS3Base/SegmentationSuperAlpide.h"
30+ #include " DataFormatsITSMFT/Digit.h"
31+ #include " DataFormatsITSMFT/ROFRecord.h"
32+ #include " CommonDataFormat/InteractionRecord.h"
33+ #include " SimulationDataFormat/MCCompLabel.h"
34+ #include " SimulationDataFormat/MCTruthContainer.h"
35+ #endif
36+
37+ namespace o2 ::trk
38+ {
39+
40+ class Digitizer : public TObject
41+ {
42+ using ExtraDig = std::vector<itsmft::PreDigitLabelRef>; // /< container for extra contributions to PreDigits
43+
44+ public:
45+ void setDigits (std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
46+ void setMCLabels (o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
47+ void setROFRecords (std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }
48+
49+ o2::itsmft::DigiParams& getParams () { return (o2::itsmft::DigiParams&)mParams ; }
50+ const o2::itsmft::DigiParams& getParams () const { return mParams ; }
51+
52+ void init ();
53+
54+ // / Steer conversion of hits to digits
55+ void process (const std::vector<itsmft::Hit>* hits, int evID, int srcID);
56+ void setEventTime (const o2::InteractionTimeRecord& irt);
57+ double getEndTimeOfROFMax () const
58+ {
59+ // /< return the time corresponding to end of the last reserved ROFrame : mROFrameMax
60+ return mParams .getROFrameLength () * (mROFrameMax + 1 ) + mParams .getTimeOffset ();
61+ }
62+
63+ void setContinuous (bool v) { mParams .setContinuous (v); }
64+ bool isContinuous () const { return mParams .isContinuous (); }
65+ void fillOutputContainer (uint32_t maxFrame = 0xffffffff );
66+
67+ void setDigiParams (const o2::itsmft::DigiParams& par) { mParams = par; }
68+ const o2::itsmft::DigiParams& getDigitParams () const { return mParams ; }
69+
70+ // provide the common itsmft::GeometryTGeo to access matrices and segmentation
71+ void setGeometry (const o2::trk::GeometryTGeo* gm) { mGeometry = gm; }
72+
73+ uint32_t getEventROFrameMin () const { return mEventROFrameMin ; }
74+ uint32_t getEventROFrameMax () const { return mEventROFrameMax ; }
75+ void resetEventROFrames ()
76+ {
77+ mEventROFrameMin = 0xffffffff ;
78+ mEventROFrameMax = 0 ;
79+ }
80+
81+ void setDeadChannelsMap (const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }
82+
83+ private:
84+ void processHit (const o2::itsmft::Hit& hit, uint32_t & maxFr, int evID, int srcID);
85+ void registerDigits (o2::itsmft::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
86+ uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl);
87+
88+ ExtraDig* getExtraDigBuffer (uint32_t roFrame)
89+ {
90+ if (mROFrameMin > roFrame) {
91+ return nullptr ; // nothing to do
92+ }
93+ int ind = roFrame - mROFrameMin ;
94+ while (ind >= int (mExtraBuff .size ())) {
95+ mExtraBuff .emplace_back (std::make_unique<ExtraDig>());
96+ }
97+ return mExtraBuff [ind].get ();
98+ }
99+
100+ static constexpr float sec2ns = 1e9 ;
101+
102+ o2::itsmft::DigiParams mParams ; // /< digitization parameters
103+ o2::InteractionTimeRecord mEventTime ; // /< global event time and interaction record
104+ o2::InteractionRecord mIRFirstSampledTF ; // /< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
105+ double mCollisionTimeWrtROF {};
106+ uint32_t mROFrameMin = 0 ; // /< lowest RO frame of current digits
107+ uint32_t mROFrameMax = 0 ; // /< highest RO frame of current digits
108+ uint32_t mNewROFrame = 0 ; // /< ROFrame corresponding to provided time
109+
110+ uint32_t mEventROFrameMin = 0xffffffff ; // /< lowest RO frame for processed events (w/o automatic noise ROFs)
111+ uint32_t mEventROFrameMax = 0 ; // /< highest RO frame forfor processed events (w/o automatic noise ROFs)
112+
113+ o2::itsmft::AlpideSimResponse* mAlpSimResp = nullptr ; // simulated response
114+
115+ const o2::trk::GeometryTGeo* mGeometry = nullptr ; // /< TRK geometry
116+
117+ std::vector<o2::itsmft::ChipDigitsContainer> mChips ; // /< Array of chips digits containers
118+ std::deque<std::unique_ptr<ExtraDig>> mExtraBuff ; // /< burrer (per roFrame) for extra digits
119+
120+ std::vector<o2::itsmft::Digit>* mDigits = nullptr ; // ! output digits
121+ std::vector<o2::itsmft::ROFRecord>* mROFRecords = nullptr ; // ! output ROF records
122+ o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mMCLabels = nullptr ; // ! output labels
123+
124+ const o2::itsmft::NoiseMap* mDeadChanMap = nullptr ;
125+
126+ ClassDef (Digitizer, 1 );
127+ };
128+ } // namespace o2::trk
0 commit comments