Project
Loading...
Searching...
No Matches
Event.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#ifndef ALICEO2_FOCAL_EVENT_H
12#define ALICEO2_FOCAL_EVENT_H
13
14#include <array>
15#include <cstdint>
16#include <gsl/span>
17#include "Rtypes.h"
22
23namespace o2::focal
24{
25
27{
28 public:
29 struct Header {
30 uint8_t mHeader;
31 uint8_t mBC;
32 uint8_t mWADD;
33 uint8_t mFourbits;
34 uint8_t mTrailer;
35 };
36 struct Channel {
37 uint16_t mADC;
38 uint16_t mTOA;
39 uint16_t mTOT;
40 };
42 uint32_t mHeader0;
43 uint32_t mHeader1;
44 std::array<uint8_t, 8> mTriggers;
45 };
46
47 void setHeader(unsigned int half, uint8_t header, uint8_t bc, uint8_t wadd, uint8_t fourbits, uint8_t trialer);
48 void setChannel(unsigned int channel, uint16_t adc, uint16_t toa, uint16_t tot);
49 void setCMN(unsigned int half, uint16_t adc, uint16_t toa, uint16_t tot);
50 void setCalib(unsigned int half, uint16_t adc, uint16_t toa, uint16_t tot);
51 void setTrigger(unsigned int window, uint32_t header0, uint32_t header1, const gsl::span<uint8_t> triggers);
52
53 const Header& getHeader(unsigned int half) const;
54 const Channel& getChannel(unsigned int channel) const;
55 const Channel& getCMN(unsigned int half) const;
56 const Channel& getCalib(unsigned int half) const;
57 const TriggerWindow& getTrigger(unsigned int window) const;
58
59 std::array<uint16_t, constants::PADLAYER_MODULE_NCHANNELS> getADCs() const;
60 std::array<uint16_t, constants::PADLAYER_MODULE_NCHANNELS> getTOAs() const;
61 std::array<uint16_t, constants::PADLAYER_MODULE_NCHANNELS> getTOTs() const;
62
63 void reset();
64
65 private:
66 void check_halfs(unsigned int half) const;
67 void check_channel(unsigned int channel) const;
68
69 std::array<Header, constants::PADLAYER_MODULE_NHALVES> mHeaders;
70 std::array<Channel, constants::PADLAYER_MODULE_NCHANNELS> mChannels;
71 std::array<Channel, constants::PADLAYER_MODULE_NHALVES> mCMN;
72 std::array<Channel, constants::PADLAYER_MODULE_NHALVES> mCalib;
73 std::array<TriggerWindow, constants::PADLAYER_WINDOW_LENGTH> mTriggers;
74 ClassDefNV(PadLayerEvent, 1);
75};
76
78{
79 public:
80 PixelLayerEvent() = default;
81 ~PixelLayerEvent() = default;
82
83 void addChip(const PixelChip& chip);
84 void addChip(int feeID, int laneID, int chipID, uint16_t statusCode, gsl::span<const PixelHit> hits);
85 const std::vector<PixelChip>& getChips() const { return mChips; }
86
87 void reset();
88
89 private:
90 std::vector<PixelChip> mChips;
91 ClassDefNV(PixelLayerEvent, 1);
92};
93
94class Event
95{
96 public:
97 Event() = default;
98 ~Event() = default;
99
100 PadLayerEvent& getPadLayer(unsigned int index);
101 const PadLayerEvent& getPadLayer(unsigned int index) const;
102 void setPadLayer(unsigned int layer, const PadLayerEvent& event);
103
104 PixelLayerEvent& getPixelLayer(unsigned int index);
105 const PixelLayerEvent& getPixelLayer(unsigned int index) const;
106 void setPixelLayerEvent(unsigned int layer, const PixelLayerEvent& event);
107
108 const InteractionRecord& getInteractionRecord() const { return mInteractionRecord; }
109 void setInteractionRecord(const InteractionRecord& ir) { mInteractionRecord = ir; }
110
111 void reset();
112
113 void construct(const o2::InteractionRecord& interaction, gsl::span<const PadLayerEvent> pads, gsl::span<const PixelChipRecord> eventPixels, gsl::span<const PixelHit> pixelHits);
114
115 bool isInitialized() const { return mInitialized; }
116
117 private:
118 void check_pad_layers(unsigned int index) const;
119 void check_pixel_layers(unsigned int index) const;
120
121 InteractionRecord mInteractionRecord;
122 std::array<PadLayerEvent, constants::PADS_NLAYERS> mPadLayers;
123 std::array<PixelLayerEvent, constants::PIXELS_NLAYERS> mPixelLayers;
124 bool mInitialized = false;
125
126 ClassDefNV(Event, 1);
127};
128
129} // namespace o2::focal
130
131#endif // ALICEO2_FOCAL_EVENT_H
uint64_t bc
Definition RawEventData.h:5
void setInteractionRecord(const InteractionRecord &ir)
Definition Event.h:109
const InteractionRecord & getInteractionRecord() const
Definition Event.h:108
void setPadLayer(unsigned int layer, const PadLayerEvent &event)
Definition Event.cxx:41
bool isInitialized() const
Definition Event.h:115
~Event()=default
PadLayerEvent & getPadLayer(unsigned int index)
Definition Event.cxx:18
PixelLayerEvent & getPixelLayer(unsigned int index)
Definition Event.cxx:30
void construct(const o2::InteractionRecord &interaction, gsl::span< const PadLayerEvent > pads, gsl::span< const PixelChipRecord > eventPixels, gsl::span< const PixelHit > pixelHits)
Definition Event.cxx:64
void setPixelLayerEvent(unsigned int layer, const PixelLayerEvent &event)
Definition Event.cxx:47
std::array< uint16_t, constants::PADLAYER_MODULE_NCHANNELS > getADCs() const
Definition Event.cxx:192
const Channel & getCMN(unsigned int half) const
Definition Event.cxx:173
const TriggerWindow & getTrigger(unsigned int window) const
Definition Event.cxx:184
const Header & getHeader(unsigned int half) const
Definition Event.cxx:162
std::array< uint16_t, constants::PADLAYER_MODULE_NCHANNELS > getTOAs() const
Definition Event.cxx:200
const Channel & getChannel(unsigned int channel) const
Definition Event.cxx:168
void setCalib(unsigned int half, uint16_t adc, uint16_t toa, uint16_t tot)
Definition Event.cxx:142
std::array< uint16_t, constants::PADLAYER_MODULE_NCHANNELS > getTOTs() const
Definition Event.cxx:208
void setHeader(unsigned int half, uint8_t header, uint8_t bc, uint8_t wadd, uint8_t fourbits, uint8_t trialer)
Definition Event.cxx:113
const Channel & getCalib(unsigned int half) const
Definition Event.cxx:178
void setTrigger(unsigned int window, uint32_t header0, uint32_t header1, const gsl::span< uint8_t > triggers)
Definition Event.cxx:151
void setChannel(unsigned int channel, uint16_t adc, uint16_t toa, uint16_t tot)
Definition Event.cxx:124
void setCMN(unsigned int half, uint16_t adc, uint16_t toa, uint16_t tot)
Definition Event.cxx:133
const std::vector< PixelChip > & getChips() const
Definition Event.h:85
void addChip(const PixelChip &chip)
Definition Event.cxx:262
struct _cl_event * event
Definition glcorearb.h:2982
GLuint index
Definition glcorearb.h:781
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
std::array< uint8_t, 8 > mTriggers
Definition Event.h:44
o2::InteractionRecord ir(0, 0)
ArrayADC adc