BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnMSCDigit.h
Go to the documentation of this file.
1#ifndef BMNMSCDIGIT_H
2#define BMNMSCDIGIT_H
3
4#include <array>
5#include <chrono>
6// ROOT
7#include "TObject.h"
8// BmnRoot
9#include "BmnFunctionSet.h"
10#include "RawTypes.h"
11
12using SysClock = std::chrono::system_clock;
13using SysPoint = std::chrono::time_point<SysClock>;
14
15template<typename IntType = UChar_t>
16class BmnMSCDigit : public TObject
17{
18 public:
19 /** Constructor
20 * \param[in] iSerial : crate serial
21 * \param[in] iSlot : crate slot
22 * \param[in] iValue : counters array ptr
23 * \param[in] evId : spill's last eventID in case of EndOfSpill data,
24 * or eventID in case of normal spill data
25 * \param[in] time : timestamp for normal spill data
26 * \param[in] ext_cond : external conditions (MSC_EC_SPILL and MSC_EC_BUSY bits)
27 */
28 BmnMSCDigit(UInt_t iSerial = 0,
29 UInt_t iSlot = 0,
30 std::array<IntType, MSC_N_COUNTERS> iValue = {},
31 UInt_t evId = 0,
32 SysPoint time = SysPoint::min(),
33 UChar_t ext_cond = 0)
34 : fSerial(iSerial)
35 , fSlot(iSlot)
36 , fValue(iValue)
37 // , fTime(time)
38 , fTS(BmnFunctionSet::TimePoint2TS(time))
39 , fEventId(evId)
40 , fExtCond(ext_cond)
41 {
42 // for (UInt_t i = 0; i < NVals; ++i)
43 // fValue[i] = iValue[i];
44 }
45
46 /** Constructor
47 * \param[in] iSerial : crate serial
48 * \param[in] iSlot : crate slot
49 * \param[in] evId : spill's last eventID in case of EndOfSpill data,
50 * or eventID in case of normal spill data
51 * \param[in] time : timestamp for normal spill data
52 */
53 BmnMSCDigit(UInt_t iSerial, UInt_t iSlot, UInt_t evId, SysPoint time = SysPoint::min())
54 : fSerial(iSerial)
55 , fSlot(iSlot)
56 , fTS(BmnFunctionSet::TimePoint2TS(time))
57 , fEventId(evId)
58 , fExtCond(0)
59 {}
60
61 UInt_t GetSerial() const { return fSerial; }
62
63 UInt_t GetSlot() const { return fSlot; }
64
65 std::array<IntType, MSC_N_COUNTERS>& GetValue() { return fValue; }
66
68
69 TTimeStamp GetTS() const { return fTS; }
70
71 UInt_t GetLastEventId() const { return fEventId; }
72
73 bool IsSpill() { return (fExtCond & MSC_EC_SPILL); }
74
75 bool IsBusy() { return (fExtCond & MSC_EC_BUSY); }
76
77 constexpr static const UInt_t GetNVals() { return NVals; }
78 /** Destructor **/
79 virtual ~BmnMSCDigit() {}
80
81 private:
82 static const UInt_t NVals = MSC_N_COUNTERS;
85 std::array<IntType, NVals> fValue;
86 // SysPoint fTime;
90
92};
93
94#endif /* BMNMSCDIGIT_H */
unsigned char UChar_t
unsigned int UInt_t
#define ClassDef(name, id)
std::chrono::system_clock SysClock
std::chrono::time_point< SysClock > SysPoint
const uint8_t MSC_EC_BUSY
Definition RawTypes.h:90
const uint32_t MSC_N_COUNTERS
Definition RawTypes.h:88
const uint8_t MSC_EC_SPILL
Definition RawTypes.h:89
Class with static common functions to simplify experiment code.
static SysPoint TimeStamp2TP(TTimeStamp p)
BmnMSCDigit(UInt_t iSerial, UInt_t iSlot, UInt_t evId, SysPoint time=SysPoint::min())
Constructor.
Definition BmnMSCDigit.h:53
static constexpr const UInt_t GetNVals()
Definition BmnMSCDigit.h:77
UInt_t fSlot
Definition BmnMSCDigit.h:84
UChar_t fExtCond
Definition BmnMSCDigit.h:89
static const UInt_t NVals
Definition BmnMSCDigit.h:82
UInt_t fSerial
Definition BmnMSCDigit.h:83
UInt_t GetSerial() const
Definition BmnMSCDigit.h:61
SysPoint GetTime() const
Definition BmnMSCDigit.h:67
std::array< IntType, NVals > fValue
Definition BmnMSCDigit.h:85
bool IsSpill()
Definition BmnMSCDigit.h:73
TTimeStamp fTS
Definition BmnMSCDigit.h:87
UInt_t fEventId
Definition BmnMSCDigit.h:88
TTimeStamp GetTS() const
Definition BmnMSCDigit.h:69
bool IsBusy()
Definition BmnMSCDigit.h:75
UInt_t GetLastEventId() const
Definition BmnMSCDigit.h:71
std::array< IntType, MSC_N_COUNTERS > & GetValue()
Definition BmnMSCDigit.h:65
virtual ~BmnMSCDigit()
Destructor.
Definition BmnMSCDigit.h:79
UInt_t GetSlot() const
Definition BmnMSCDigit.h:63
BmnMSCDigit(UInt_t iSerial=0, UInt_t iSlot=0, std::array< IntType, MSC_N_COUNTERS > iValue={}, UInt_t evId=0, SysPoint time=SysPoint::min(), UChar_t ext_cond=0)
Constructor.
Definition BmnMSCDigit.h:28
std::chrono::time_point< SysClock > SysPoint
Definition BmnMSCDigit.h:13