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 StuckPixelData.h
13+ // / @brief CCDB-serializable container for stuck (repeating) pixel error records.
14+ // /
15+ // / Design rationale
16+ // / ----------------
17+ // / TTree-based storage is intentionally avoided for CCDB objects because TTree
18+ // / branches hold internal file-pointer state; serialising an in-memory TTree
19+ // / via CcdbApi::createObjectImage() can silently drop the last unflushed basket.
20+ // / A plain std::vector<StuckPixelEntry> has no such issue: ROOT's TClass
21+ // / machinery serialises it correctly via the generated dictionary, exactly as
22+ // / it does for TimeDeadMap.
23+
24+ #ifndef ITSMFT_STUCKPIXELDATA_H
25+ #define ITSMFT_STUCKPIXELDATA_H
26+
27+ #include < vector>
28+ #include < cstdint>
29+ #include < Rtypes.h> // ClassDefNV
30+
31+ namespace o2
32+ {
33+ namespace itsmft
34+ {
35+
36+ // / One stuck-pixel (RepeatingPixel error) record.
37+ struct StuckPixelEntry {
38+ Long64_t orbit{0 }; // /< first orbit of the TF in which the error was seen
39+ uint16_t chipID{0 }; // /< global chip ID (ITS only)
40+ uint16_t row{0 }; // /< pixel row
41+ uint16_t col{0 }; // /< pixel column
42+
43+ StuckPixelEntry () = default ;
44+ StuckPixelEntry (Long64_t o, uint16_t c, uint16_t r, uint16_t col_)
45+ : orbit(o), chipID(c), row(r), col(col_) {}
46+
47+ ClassDefNV (StuckPixelEntry, 1 );
48+ };
49+
50+ // / CCDB payload object: a run-level collection of stuck-pixel records.
51+ class StuckPixelData
52+ {
53+ public:
54+ StuckPixelData () = default ;
55+ ~StuckPixelData () = default ;
56+
57+ void addEntry (Long64_t orbit, uint16_t chipID, uint16_t row, uint16_t col)
58+ {
59+ mEntries .emplace_back (orbit, chipID, row, col);
60+ }
61+
62+ void clear () { mEntries .clear (); }
63+
64+ const std::vector<StuckPixelEntry>& getEntries () const { return mEntries ; }
65+ std::size_t size () const { return mEntries .size (); }
66+ bool empty () const { return mEntries .empty (); }
67+
68+ private:
69+ std::vector<StuckPixelEntry> mEntries ;
70+
71+ ClassDefNV (StuckPixelData, 1 );
72+ };
73+
74+ } // namespace itsmft
75+ } // namespace o2
76+
77+ #endif // ITSMFT_STUCKPIXELDATA_H
0 commit comments