ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcLucrodData.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ZDC_LUCRODDATA_H
6#define ZDC_LUCRODDATA_H
7
8// working in ADC scale for Run 3
9//#define ADC2MV 0.3663
10#define ADC2MV 1
11#include <vector>
12#include <cstdint>
13#include <sstream>
14#include <iostream>
15
16typedef struct ZdcLucrodChannelType {
17
18 unsigned int id;
19 std::vector <uint16_t> waveform;
21
22
23
25
26 public:
27
28 ZdcLucrodData(unsigned int id) {
29
30 m_lucrodID = id;
31 m_bcid = 0;
32 m_runNumber = 0;
33 m_level1ID = 0;
34 m_numBCs = 0;
35 m_status = 0;
36
37 m_trigAvgA = 0;
38 m_trigAvgC = 0;
39
40 m_trigData.clear();
41 m_chanData.clear();
42 };
43
45
46 void SetBCID (unsigned int val) { m_bcid = val; }
47 void SetRunNumber(unsigned int val) { m_runNumber = val; }
48 void SetLevel1ID (unsigned int val) { m_level1ID = val; }
49 void SetNumBCs (unsigned int val) { m_numBCs = val; }
50 void SetStatus (unsigned int val) { m_status = val; }
51
52 void SetTrigAvgA(uint16_t val) { m_trigAvgA = val; }
53 void SetTrigAvgC(uint16_t val) { m_trigAvgC = val; }
54
55 void AddTrigData(uint16_t val) { m_trigData.push_back(val); }
56
57 bool AddChanData(unsigned int id, const std::vector<uint16_t>& waveform) {
58
59 ZdcLucrodChannel channel;
60
61 channel.id = id;
62 channel.waveform = waveform;
63
64 // Check for valid length
65 //
66 if (waveform.size() != m_numBCs*8) return false;
67
68 m_chanData.push_back(std::move(channel));
69 return true;
70 }
71
72 unsigned int GetLucrodID() const { return m_lucrodID; }
73 unsigned int GetBCID() const { return m_bcid; }
74 unsigned int GetRunNumber() const { return m_runNumber; }
75 unsigned int GetLevel1ID() const { return m_level1ID; }
76 unsigned int GetNumBCs() const { return m_numBCs; }
77 unsigned int GetStatus() const { return m_status; }
78
79 uint16_t GetTrigAvgA() const { return m_trigAvgA; }
80 uint16_t GetTrigAvgC() const { return m_trigAvgC; }
81
82 const std::vector<uint16_t>& GetTrigData() const { return m_trigData; }
83 const ZdcLucrodChannel& GetChanData(int it) const { return m_chanData[it]; }
84
85 unsigned int GetTrigDataSize() const { return m_trigData.size(); }
86 unsigned int GetChanDataSize() const { return m_chanData.size(); }
87
88 std::string str() const {
89
90 std::ostringstream ost;
91
92 ost << " LucrodID: " << std::dec << m_lucrodID << std::endl
93 << " BCID: " << std::dec << m_bcid << std::endl
94 << " RunNumber: " << std::dec << m_runNumber << std::endl
95 << " Level1ID: 0x" << std::hex << m_level1ID << std::endl
96 << " NumBCs: " << std::dec << m_numBCs << std::endl
97 << " Status: " << std::dec << m_status << std::endl;
98
99 for (unsigned int nch=0; nch<m_chanData.size(); nch++)
100 {
101
102 std::vector<uint16_t> waveform = m_chanData[nch].waveform;
103
104 ost << " ch: " << m_chanData[nch].id << " waveform:";
105
106 for (unsigned int sample=0; sample<waveform.size(); sample++)
107 ost << " " << waveform[sample]/ADC2MV;
108
109 ost << std::endl;
110 }
111
112 ost << " trigAvgA: " << m_trigAvgA/ADC2MV << std::endl;
113 ost << " trigAvgC: " << m_trigAvgC/ADC2MV << std::endl;
114 ost << " trigAmpl:";
115
116 for (unsigned int nch=0; nch<m_trigData.size(); nch++)
117 ost << " " << m_trigData[nch]/ADC2MV;
118
119 ost << std::endl << " stat: " << m_status;
120
121 return ost.str();
122 }
123
124 std::ostream& operator<<(std::ostream& os) { os << str(); return os; }
125
126 private:
127
128 unsigned int m_lucrodID;
129 unsigned int m_bcid;
130 unsigned int m_runNumber;
131 unsigned int m_level1ID;
132 unsigned int m_numBCs;
133 unsigned int m_status;
134
135 uint16_t m_trigAvgA;
136 uint16_t m_trigAvgC;
137
138 std::vector<uint16_t> m_trigData;
139 std::vector<ZdcLucrodChannel> m_chanData;
140};
141
142#endif
struct ZdcLucrodChannelType ZdcLucrodChannel
#define ADC2MV
uint16_t GetTrigAvgC() const
void SetStatus(unsigned int val)
unsigned int GetLucrodID() const
unsigned int GetChanDataSize() const
void SetTrigAvgA(uint16_t val)
std::string str() const
unsigned int GetLevel1ID() const
unsigned int m_lucrodID
const std::vector< uint16_t > & GetTrigData() const
bool AddChanData(unsigned int id, const std::vector< uint16_t > &waveform)
unsigned int GetTrigDataSize() const
unsigned int m_bcid
unsigned int GetRunNumber() const
unsigned int m_status
void AddTrigData(uint16_t val)
std::ostream & operator<<(std::ostream &os)
void SetLevel1ID(unsigned int val)
std::vector< uint16_t > m_trigData
void SetRunNumber(unsigned int val)
uint16_t m_trigAvgA
void SetNumBCs(unsigned int val)
const ZdcLucrodChannel & GetChanData(int it) const
uint16_t m_trigAvgC
ZdcLucrodData(unsigned int id)
uint16_t GetTrigAvgA() const
unsigned int m_runNumber
unsigned int m_level1ID
unsigned int GetStatus() const
unsigned int m_numBCs
void SetBCID(unsigned int val)
unsigned int GetBCID() const
unsigned int GetNumBCs() const
void SetTrigAvgC(uint16_t val)
std::vector< ZdcLucrodChannel > m_chanData
std::vector< uint16_t > waveform