69 {
70 ATH_MSG_DEBUG(
"AFP_ByteStream2RawCnv::fillColelction rob_source_id: in decimal="<<std::dec<<robFrag->rob_source_id()<<
", in hex=0x"<<std::hex<<robFrag->rob_source_id()<<std::dec);
71
72 try {
73 robFrag->check();
74 } catch (...) {
76 return StatusCode::SUCCESS;
77 }
78
79 const uint32_t nStat = robFrag->nstatus();
80 if (nStat) {
82 robFrag->status(it);
83 if (*it) {
85 return StatusCode::SUCCESS;
86 }
87 }
88
89 if (!rawContainer) {
91 return StatusCode::SUCCESS;
92 }
93
94
95
97 robFrag->rod_data(vint);
98
99 if (robFrag->rod_nstatus() <= 0) {
101 return StatusCode::SUCCESS;
102 }
103
104 const eformat::FullEventFragment<const uint32_t*> *
event =
m_robDataProvider->getEvent(Gaudi::Hive::currentContext());
105
106
107
108
109 if (event) {
110
116 }
117
118
119
122
123 std::array<uint32_t, 16> picoTDC_data = {};
124
125 const uint32_t size = robFrag->rod_ndata();
126 for (
unsigned i = 0;
i < size;
i++) {
129
131 AFP_RawCollectionHead* collectionHead = nullptr;
133
135 rawContainer);
136 collectionHead = collectionToF;
137 }
139
141 rawContainer);
142 collectionHead = collectionSi;
143 }
144 else {
145 ATH_MSG_ERROR(
"Unidentified value of link="<<the_link<<
" for header record.");
146 return StatusCode::FAILURE;
147 }
148
149 if (!collectionHead) {
151 << the_link << ", robID = " << robFrag->rob_source_id() <<")");
152 return StatusCode::SUCCESS;
153 }
154
155
157 collectionHead->
setLink(the_link);
160 collectionHead->
setRobId(robFrag->rob_source_id());
161 }
163
165
166
167 if ( !collectionToF ) {
169 return StatusCode::SUCCESS;
170 }
171
173 if(!bit23)
174 {
175
177 if(bits22_21==2)
178 {
179
186
188 }
189 else
190 {
191 ATH_MSG_DEBUG(
"This is not a ToF measurement, bit23 = "<<bit23<<
", bits22_21 "<<bits22_21<<
", ignoring word = "<<the_word);
192 }
193 }
194 else
195 {
197 if (bits23_22==0b10) {
198
199
201 if (bits21_20==0b10) {
202
205 if (bit18==0) {
206
207 if (picoTDC_data[channel] == 0) {
208 picoTDC_data[
channel] = the_word;
209 } else {
210 if (
m_wordReadout->getBits(picoTDC_data[channel], 18, 18) == 1) {
213
220
222
224 } else {
225 ATH_MSG_WARNING(
"Fine time word for channel "<<channel<<
" is already set to "<<picoTDC_data[channel]<<
", cannot set it to "<<the_word<<
", will not overwrite");
226 }
227 }
228 } else {
229
230 if (picoTDC_data[channel] == 0) {
231 picoTDC_data[
channel] = the_word;
232 } else {
233 if (
m_wordReadout->getBits(picoTDC_data[channel], 18, 18) == 0) {
236
243
245
247 } else {
248 ATH_MSG_WARNING(
"Coarse time word for channel "<<channel<<
" is already set to "<<picoTDC_data[channel]<<
", cannot set it to "<<the_word<<
", will not overwrite");
249 }
250 }
251 }
252 }
253 else {
254 ATH_MSG_DEBUG(
"This is not a ToF measurement, bits23_22 = "<<bits23_22<<
", bits21_20 "<<bits21_20<<
", ignoring word = "<<the_word);
255 }
256 }
257 else {
258 ATH_MSG_WARNING(
"Unexpected pattern in bits 22-23 = "<<bits23_22<<
", ignoring word = "<<the_word);
259 }
260 }
261 }
263
264
265
266 if ( !collectionSi ) {
267 ATH_MSG_WARNING(
"No silicon detector collection available to fill data.");
268 return StatusCode::SUCCESS;
269 }
270
271
277
279 }
280
281
287
289 }
290 }
291 else {
292 ATH_MSG_ERROR(
"Not recognised value of link="<<the_link<<
" for data record.");
293 return StatusCode::FAILURE;
294 }
295
296 }
297 }
298
299
300 for (std::size_t channel=0;
channel<picoTDC_data.size();++
channel) {
302 if (word != 0) {
304 ATH_MSG_WARNING(
"Incomplete picoTDC data for channel "<<channel<<
", fine word "<<word<<
" could not be paired");
305 } else {
306 ATH_MSG_WARNING(
"Incomplete picoTDC data for channel "<<channel<<
", coarse word "<<word<<
" could not be paired");
307 }
308 }
309 }
310
311 return StatusCode::SUCCESS;
312}
AFP_RawCollection< AFP_SiRawData > AFP_SiRawCollection
Class representing collection of silicon detector data.
AFP_RawCollection< AFP_ToFRawData > AFP_ToFRawCollection
AFP_ToFRawData_v2 AFP_ToFRawData
#define ATH_MSG_WARNING(x)
AFP_ToFRawCollection * getCollectionToF(AFP_RawContainer *container) const
Adds new time-of-flight collection to AFP_RawContainer.
static const uint32_t s_siNoHitMarker
ToolHandle< AFP_WordReadOut > m_wordReadout
void setDataHeader(uint32_t the_word, AFP_RawDataCommonHead *dataHead) const
Sets data header information for given argument based on m_wordReadout.
bool isLinkSi(const unsigned int link) const
returns true if provided link corresponds to silicon detector information
bool isLinkToF(const unsigned int link) const
returns true if provided link corresponds to time-of-flight information
AFP_SiRawCollection * getCollectionSi(AFP_RawContainer *container) const
Adds new silicon collection to AFP_RawContainer.
void setLvl1Id(const uint16_t lvl1Id)
void setBcId(const uint16_t bcId)
void setLink(const uint16_t link)
void setFrontendFlag(const uint32_t flag)
void setRobId(const uint32_t robId)
RAWDATA_T & newDataRecord()
Creates a new empty data record in the collection and returns reference to it.
void setLvl1Id(const uint32_t lvl1ID)
void setTimeStamp(const uint32_t timeStamp)
void setTimeStampNS(const uint32_t timeStampNS)
void setBCId(const uint32_t bcId)
void setLumiBlock(const uint32_t lumiBlock)
void setTimeOverThreshold(const uint16_t timeOverThreshold)
void setColumn(const uint16_t column)
void setRow(const uint32_t row)
void setChannel(const uint16_t channel)
void setHeader(const uint16_t header)
void setEdge(const uint16_t edge)
void setPulseLength(const uint32_t pulseLength)
void setTime(const uint32_t time)
const DataType * PointerType