CbmRoot
Loading...
Searching...
No Matches
CbmTrdRawMessageSpadic.h
Go to the documentation of this file.
1/* Copyright (C) 2020-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Dennis Spicker, Florian Uhlig [committer] */
4
10
11#ifndef CbmTrdRawMessageSpadic_H
12#define CbmTrdRawMessageSpadic_H
13
14#include <boost/serialization/access.hpp>
15#include <boost/serialization/vector.hpp>
16
17#include <cstdint>
18#include <vector> // for vector
19
20namespace Spadic
21{
26 enum class MsMessageType : uint8_t
27 {
28 kSOM = 0x20,
29 kEOM = 0x30,
30 kEPO = 0x40,
31 kRDA = 0x80,
32 kINF = 0x10,
33 kNUL = 0x00,
34 kUNK = 0x01
35 };
36
38 enum class eTriggerType : uint8_t
39 {
40 kGlobal = 0,
41 kSelf = 1,
42 kNeigh = 2,
43 kSandN = 3
44 };
45
64} // namespace Spadic
65
66
73private:
75
76 uint8_t fChannelID;
77 uint8_t fElinkID;
78 uint8_t fCrobId;
79 uint16_t fCriId;
80 uint8_t fHitType;
81 uint8_t fNrSamples;
83 uint64_t fFullTime;
84 std::vector<int16_t> fSamples;
85
86 public:
89
91 CbmTrdRawMessageSpadic(uint8_t channelId, uint8_t elinkId, uint8_t crobId, uint16_t criId, uint8_t hitType,
92 uint8_t nrSamples, bool multiHi, uint64_t fullTime, std::vector<int16_t> samples);
93
96
99
101 // CbmTrdRawMessageSpadic operator=(const CbmTrdRawMessageSpadic&);
103
104 // ----------------- Getters -----------------------------
105 static const char* GetBranchName() { return "CbmTrdRawMessageSpadic"; }
106
107 uint8_t GetChannelId() const { return fChannelID; }
108 uint8_t GetElinkId() const { return fElinkID; }
109 uint8_t GetCrobId() const { return fCrobId; }
110 uint16_t GetCriId() const { return fCriId; }
111 uint8_t GetHitType() const { return fHitType; }
112 uint8_t GetNrSamples() const { return fNrSamples; }
113 bool GetMultiHit() const { return fMultiHit; }
114 uint64_t GetFullTime() const { return fFullTime; }
115 const std::vector<int16_t>* GetSamples() const { return &fSamples; }
116
118 double GetTime() const { return (fFullTime * 62.5); }
119
122
124 void SetTime(double setvalue) { fFullTime = static_cast<uint64_t>(setvalue / 62.5); }
125
127 int16_t GetMaxAdc();
128
129 // ----------------- Setters -----------------------------
130
136 void SetSample(int16_t value, uint8_t pos);
137
139 template<class Archive>
140 void serialize(Archive& ar, const unsigned int /*version*/)
141 {
142 ar& fElinkID;
143 ar& fChannelID;
144 ar& fCrobId;
145 ar& fCriId;
146 ar& fHitType;
147 ar& fNrSamples;
148 ar& fMultiHit;
149 ar& fFullTime;
150 ar& fSamples;
151 }
152};
153
154#endif
void SetSample(int16_t value, uint8_t pos)
void SetTime(double setvalue)
static const char * GetBranchName()
void IncNrSamples()
increase the number of samples stored in this raw message by one
const std::vector< int16_t > * GetSamples() const
void serialize(Archive &ar, const unsigned int)
Boost serialization function.
std::vector< int16_t > fSamples
friend class boost::serialization::access
CbmTrdRawMessageSpadic & operator=(const CbmTrdRawMessageSpadic &)=default
@ kUNU
Unused request. 100. .... .... .... cccc.
@ kChannelBufM
Channel buffer full and multihit from kEPO msg.
@ kChannelBuf
Channel buffer full from kEPO msg.
@ kNInfMsgs
Number of different info messages.
@ kBOM
Buffer overflow count. 11nn nnnn nnnn nnnn cccc.
@ kMIS
Missing request. 101. .... .... .... ....
@ kOrdFifoBuf
Multi-hit but ordering buffer full from kEPO msg.
@ kBUF
Buffer full. 011b b... .... .... cccc.
@ kMSB
Message build error. 010. .... .... .... cccc.
@ kSandN
Self and neighbor trigger at the same time.
@ kEPO
Epoch Marker or TS_MSB depending on the hitmessage version.