ATLAS Offline Software
Loading...
Searching...
No Matches
ALFA_Decoder Class Reference

#include <ALFA_Decoder.h>

Inheritance diagram for ALFA_Decoder:
Collaboration diagram for ALFA_Decoder:

Public Types

typedef ALFA_RawData m_ALFA_RawData
typedef ALFA_RawDataCollection m_ALFA_RawDataCollection

Public Member Functions

 ALFA_Decoder (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ALFA_Decoder ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
StatusCode fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, ALFA_RawDataContainer *rdoCont, std::vector< unsigned int > *vecHash=NULL)
ALFA_RawDataCollectiongetCollection (unsigned int MotherBoardId, ALFA_RawDataContainer *cont)
ALFA_RawDatagetRawData (unsigned int PMFId, ALFA_RawDataCollection *coll)
const eformat::FullEventFragment< const uint32_t * > * eventFragment () const
const eformat::ROBFragment< const uint32_t * > * robFragment () const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

const eformat::FullEventFragment< const uint32_t * > * m_event = nullptr
const eformat::ROBFragment< const uint32_t * > * m_robFrag = nullptr
unsigned int m_fragment_number = 0U
ServiceHandle< IROBDataProviderSvcm_robDataProvider
 Service for reading bytestream.
ALFA_RawDataReadOutm_ALFA_RawDataReadOut = nullptr
ALFA_RawDataCollectionReadOutm_ALFA_RawDataCollectionReadOut = nullptr
ALFA_RawDataContainerReadOutm_ALFA_RawDataContainerReadOut = nullptr
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 37 of file ALFA_Decoder.h.

Member Typedef Documentation

◆ m_ALFA_RawData

Definition at line 43 of file ALFA_Decoder.h.

◆ m_ALFA_RawDataCollection

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ALFA_Decoder()

ALFA_Decoder::ALFA_Decoder ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 23 of file ALFA_Decoder.cxx.

24 : AthAlgTool(type,name,parent),
25 m_robDataProvider ("ROBDataProviderSvc",name)
26 //, m_ALFA_RawDataContainerReadOut(0), m_ALFA_RawDataCollectionReadOut(0), m_ALFA_RawDataReadOut(0)
27{
28 declareInterface<ALFA_Decoder>(this);
29
30}
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
AthAlgTool()
Default constructor:

◆ ~ALFA_Decoder()

ALFA_Decoder::~ALFA_Decoder ( )
virtual

Definition at line 37 of file ALFA_Decoder.cxx.

38{
39}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ eventFragment()

const eformat::FullEventFragment< const uint32_t * > * ALFA_Decoder::eventFragment ( ) const
inline

Definition at line 63 of file ALFA_Decoder.h.

63{ return m_event; }
const eformat::FullEventFragment< const uint32_t * > * m_event

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fillCollection()

StatusCode ALFA_Decoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * robFrag,
ALFA_RawDataContainer * rdoCont,
std::vector< unsigned int > * vecHash = NULL )

Definition at line 103 of file ALFA_Decoder.cxx.

104{
105 msg(MSG::DEBUG) << " ALFA_RoDDecoder::fillCollection" << endmsg;
106
107 ALFA_RawDataCollection* collection = nullptr;
108
109 uint32_t wordPos = 0;
110
111 std::vector<uint32_t> VData;
112
113 VData.clear();
114
115
116 uint32_t Event_num=0;
117 uint32_t Event_num_max=0;
118 uint16_t fiber_hit;
119
120 uint16_t tmpFiber;
121 uint16_t thisMB;
122 uint16_t tmpMB;
123 uint16_t MBIdNum=0;
124
125 uint16_t tmpADC1=10000;
126 uint16_t tmpADC2=10000;
127 uint16_t tmpScaler=100;
128
129 std::vector<bool> tmpLvl1Pattern;
130 std::vector<bool> tmpLvl2Pattern;
131 std::vector<bool> tmpEFPattern;
132 uint32_t wo=0;
133
134 uint32_t EcrId=1;
135 uint32_t LvL1 =0;
136
137 uint32_t Count_evt=0;
138
139 int n=0;
140
141
142 // retrieve EventInfo
143 const EventInfo* eventInfo=nullptr;
144 StatusCode sc = evtStore()->retrieve(eventInfo);
145 if (sc.isFailure()) {
146 ATH_MSG_WARNING (" cannot retrieve EventInfo, will not set ALFA bit information ");
147 }
148
149 // Check the ROB and ROD fragment for lenght and version consistency
150
151 try
152 {
153 robFrag->check();
154 }
155
156 catch (eformat::Issue &ex)
157 {
158 msg(MSG::WARNING) <<ex.what ()<< endmsg;
159 if (!eventInfo->updateErrorState(EventInfo::ForwardDet, EventInfo::Error))
160 msg(MSG::WARNING) <<"Cannot set ALFA error state"<< endmsg;
161 return StatusCode::SUCCESS; // error in fragment - we search for no collection
162 }
163
164 // Check the ROB status word for truncation or corruption.
165
166 uint32_t nstat = robFrag->nstatus();
167
168 if (nstat)
169 {
170 const uint32_t *it;
171 robFrag->status (it);
172
173
174 if (*it)
175 {
176 msg(MSG::WARNING) << " Error in ROB status word: 0x" << endmsg;
177 if (!eventInfo->updateErrorState(EventInfo::ForwardDet, EventInfo::Error))
178 msg(MSG::WARNING) <<"Cannot set ALFA error state"<< endmsg;
179 if (!eventInfo->updateEventFlagBit(EventInfo::ForwardDet, ALFAEventBitInfo::ROB_ERROR))
180 msg(MSG::WARNING) <<"Cannot set event bit info for ALFA"<< endmsg;
181
182 return StatusCode::SUCCESS;
183 }
184 }
185
186 // set the data pointer type
187
189
190 robFrag->rod_data(vint);
191
192 // get number of data words in the fragment
193 uint32_t size = robFrag->rod_ndata();
194
195 // get source ID
196 uint32_t ROD_source_ID = robFrag->rod_source_id();
197
198
199 uint32_t ROD_LVL1_ID = robFrag->rod_lvl1_id();
200
201 msg(MSG::DEBUG) << "============================" << std::endl;
202 msg(MSG::DEBUG) << "Frag Size : " << robFrag->rod_fragment_size_word() << endmsg;
203 msg(MSG::DEBUG) << "Header Size: " << robFrag->rod_header_size_word() << endmsg;
204 msg(MSG::DEBUG) << "Source ID : " << ROD_source_ID << endmsg;
205 msg(MSG::DEBUG) << "Run num : " << robFrag->rod_run_no() << endmsg;
206 msg(MSG::DEBUG) << "Version : " << robFrag->rod_version() << endmsg;
207 msg(MSG::DEBUG) << " ROD_LVL1_ID " << ROD_LVL1_ID << endmsg;
208 msg(MSG::DEBUG) << "============================" << std::endl;
209
210 // msg(MSG::INFO) << "ROD Time_StampID " <<robFrag->bc_time_seconds() << endmsg;
211
212
213 uint32_t evt_Id = ((robFrag->rod_lvl1_id()) & 0xFF000000) >> 24;
214 uint32_t lvl1_Id = ((robFrag->rod_lvl1_id()) & 0x00FFFFFF) ;
215
216
217 msg(MSG::DEBUG) <<" evt_Id : " << evt_Id << " lvl1_Id : " << lvl1_Id <<endmsg;
218
219 /*msg(MSG::DEBUG) << " **********Decoder dumping the words******** "<< endmsg;
220
221 if (size > 0) {
222 msg(MSG::DEBUG) << " The size of this ROD-read is "<< endmsg;
223 for (unsigned int i=0; i < size; i++)
224 msg(MSG::DEBUG) << " word " << i << " = " << MSG::hex << vint[i] << MSG::dec<< endmsg;
225 } else {
226 msg(MSG::DEBUG) << " Buffer size 0 ! "<< endmsg;
227 return StatusCode::FAILURE;
228 }*/
229
230
231 m_ALFA_RawDataCollectionReadOut->decodeWord(vint[wordPos]);
232 m_ALFA_RawDataReadOut->decodeWord(vint[wordPos]);
233 m_ALFA_RawDataContainerReadOut->decodeWord(vint[wordPos]);
234
235 int l=0;
236
237 if(EcrId!=evt_Id)
238 {
239 n++;
240 l=1;
241 }
242
243 if (n==0) Event_num = LvL1;
244 else Event_num = ((robFrag->rod_lvl1_id()) & 0x00FFFFFF) + Event_num;
245
246 LvL1 = ((robFrag->rod_lvl1_id()) & 0x00FFFFFF)+1 ;
247 EcrId = ((robFrag->rod_lvl1_id()) & 0xFF000000) >> 24;
248
249 if(l==1) Event_num_max=Event_num;
250
251 Event_num = ((robFrag->rod_lvl1_id()) & 0x00FFFFFF)+1 + Event_num_max;
252
253 Count_evt++;
254 //if (Count_evt == maxEvt) break;
255
256 msg(MSG::DEBUG) << " Event_num " << Event_num << " Count_evt " << Count_evt << endmsg;
257
258
259
260
262 {
263 msg(MSG::DEBUG) << " Found the beginning of buffer "<< endmsg;
264 // Check that Lvl1d matches the one from the ROD header. this is the number of event.it corresponds to m_ALFA_RawDataReadOut->ecnt_BOT() and m_ALFA_RawDataReadOut->ecnt_EOT()
265 msg(MSG::DEBUG) << " Level 1 Id : " << m_ALFA_RawDataCollectionReadOut->lvl1Id()<< endmsg;
266 }
267 else
268 {
269 msg(MSG::DEBUG) << " Beginning of block not found BOB "<< endmsg;
270 } // BOB
271
272
273 while (!m_ALFA_RawDataCollectionReadOut->is_EOB())
274 {
275
276 //Check for corrupted data
277
278 while ((!m_ALFA_RawDataCollectionReadOut->is_BOL()) && (!m_ALFA_RawDataCollectionReadOut->is_EOB()))
279 {
280 wordPos += 1;
281 if (wordPos >= size)
282 {
283 msg(MSG::WARNING)<<" Error: data corrupted" << endmsg;
284 if (!eventInfo->updateErrorState(EventInfo::ForwardDet, EventInfo::Error))
285 msg(MSG::WARNING) <<"Cannot set ALFA error state"<< endmsg;
286 if (!eventInfo->updateEventFlagBit(EventInfo::ForwardDet, ALFAEventBitInfo::CORRUPTION))
287 msg(MSG::WARNING) <<"Cannot set event bit info for ALFA"<< endmsg;
288
289 return StatusCode::SUCCESS;
290 }
291 m_ALFA_RawDataCollectionReadOut->decodeWord(vint[wordPos]);
292 }
293
294
296 {
297 msg(MSG::DEBUG) << " Found the beginning of Link BOL"<< endmsg;
298 msg(MSG::DEBUG) << " MrodNum BOL : " << m_ALFA_RawDataCollectionReadOut->MrodNum()<< " RODinput BOL : " <<m_ALFA_RawDataCollectionReadOut->RODinput()<< endmsg;
299
300 } // is_BOL()
301
302 else if (m_ALFA_RawDataCollectionReadOut->is_EOB())
303 {
304 msg(MSG::WARNING)<<" Error: collection not found " << endmsg;
305 if (!eventInfo->updateErrorState(EventInfo::ForwardDet, EventInfo::Error))
306 msg(MSG::WARNING) <<"Cannot set ALFA error state"<< endmsg;
307 if (!eventInfo->updateEventFlagBit(EventInfo::ForwardDet, ALFAEventBitInfo::COLL_NOT_FOUND))
308 msg(MSG::WARNING) <<"Cannot set event bit info for ALFA"<< endmsg;
309
310 return StatusCode::SUCCESS;
311 } // is_EOB()
312
313
314 wordPos += 1;
315 if (wordPos >= size)
316 {
317 msg(MSG::WARNING)<<" Error: data corrupted"<< endmsg;
318 if (!eventInfo->updateErrorState(EventInfo::ForwardDet, EventInfo::Error))
319 msg(MSG::WARNING) <<"Cannot set ALFA error state"<< endmsg;
320 if (!eventInfo->updateEventFlagBit(EventInfo::ForwardDet, ALFAEventBitInfo::CORRUPTION))
321 msg(MSG::WARNING) <<"Cannot set event bit info for ALFA"<< endmsg;
322 return StatusCode::SUCCESS;
323 }
324
325
326 m_ALFA_RawDataCollectionReadOut->decodeWord(vint[wordPos]);
327 m_ALFA_RawDataReadOut->decodeWord(vint[wordPos]);
328
329 while (!m_ALFA_RawDataCollectionReadOut->is_TWC())
330 {
331
332 uint16_t slotIdNum = m_ALFA_RawDataReadOut->SlotId();
333
334 msg(MSG::DEBUG)<<" Decoding data from Slot Id number : " << slotIdNum << endmsg;
335
336 ALFA_RawData* rawData;
337
338 // Loop on the TDC data words and create the corresponding RDO's
339
340 while (!m_ALFA_RawDataReadOut->is_EOT())
341 {
342 wordPos += 1;
343 if (wordPos >= size)
344 {
345 msg(MSG::WARNING)<<" Error: data corrupted" << endmsg;
346 if (!eventInfo->updateErrorState(EventInfo::ForwardDet, EventInfo::Error))
347 msg(MSG::WARNING) <<"Cannot set ALFA error state"<< endmsg;
348 if (!eventInfo->updateEventFlagBit(EventInfo::ForwardDet, ALFAEventBitInfo::CORRUPTION))
349 msg(MSG::WARNING) <<"Cannot set event bit info for ALFA"<< endmsg;
350
351 return StatusCode::SUCCESS;
352 }
353
354 m_ALFA_RawDataReadOut->decodeWord(vint[wordPos]);
355
356 uint16_t PMFIdNum;
357 uint16_t WordIdNum;
358 uint16_t FiberNum;
359
360 if (m_ALFA_RawDataReadOut->is_TDCt() && m_ALFA_RawDataReadOut->bit26_27()==0 && !m_ALFA_RawDataReadOut->bit16() && !m_ALFA_RawDataReadOut->bit18() )
361 {
362
363 //msg(MSG::DEBUG)<<" DECODER : PMFId " << m_ALFA_RawDataReadOut->PMFId() << " MBId " << m_ALFA_RawDataReadOut->MBId() << endmsg;
364
365
366 if(m_ALFA_RawDataReadOut->PMFId() ==0 && m_ALFA_RawDataReadOut->WordId() ==0) //PMF0 contains the information on wich MB is readen
367 {
368
369 msg(MSG::DEBUG) << " Creation of the new collection"<< endmsg;
370
371 tmpMB = m_ALFA_RawDataReadOut->fiber();
372
373
374 for (unsigned int i=0;i<8;i++)
375 {
376
377 thisMB = (char) tmpMB & 0x00000001;
378 tmpMB>>=1;
379
380 if(thisMB==1)
381 {
382 MBIdNum=i+1;
383
384 collection = getCollection(MBIdNum,rdoCont );
385 if(collection) collection->SetMBId_POT(MBIdNum);
386
387 msg(MSG::DEBUG)<<" DECODER : MBIdNum " << MBIdNum << endmsg;
388
389
390 }
391
392
393 } // loop over 8 Mother Boards
394
395 } // PMFId() ==0 & WordId() ==0
396
397
398
399
400 if(m_ALFA_RawDataReadOut->PMFId() >0 && m_ALFA_RawDataReadOut->PMFId() <24)
401 {
402
403
404 tmpFiber = m_ALFA_RawDataReadOut->fiber();
405
406 WordIdNum = m_ALFA_RawDataReadOut->WordId();
407 PMFIdNum = m_ALFA_RawDataReadOut->PMFId();
408
409 rawData = new ALFA_RawData(PMFIdNum);
410
411 rawData->SetWordId_PMF(WordIdNum);
412
413 rawData->SetPMFId_PMF(PMFIdNum);
414 rawData->SetMBId_PMF(MBIdNum);
415
416 rawData->Set_error_bit17(m_ALFA_RawDataReadOut->error_bit17());
417
418 std::vector<uint16_t> hitId;
419
420 for (unsigned int i=0;i<16;i++)
421 {
422
423 FiberNum=100;
424 fiber_hit = (char) tmpFiber & 0x00000001;
425 tmpFiber>>=1;
426
427 if(fiber_hit==1)
428 {
429 FiberNum=m_ALFA_RawDataReadOut->WordId()*16+i;
430 hitId.push_back(FiberNum);
431 //msg(MSG::DEBUG)<<" fiberNum = " << FiberNum <<", fiber_hit = " << fiber_hit << " PMFIdNum = " << PMFIdNum <<" WordIdNum = " << WordIdNum <<endmsg;
432 }
433 else hitId.push_back(100);
434
435 } // loop over 16 fibers
436
437
438 rawData->SetMarocChan_PMF(hitId);
439
440 rawData->addData(vint[wordPos]);
441 rawData->PushBack_PMF(FiberNum);
442 if(collection) collection->push_back(rawData);
443 else delete rawData;
444
445 } // PMFIdNum >0 && <24
446
447
448
449
450
451 if(m_ALFA_RawDataReadOut->PMFId()==24) // PMF 24 contains trigger and charge infos
452 {
453
454
455 if(m_ALFA_RawDataReadOut->WordId()==0)
456 {
457 const auto& tmpPattern=m_ALFA_RawDataReadOut->pattern();
458 if(collection) collection->Set_pattern_POT(tmpPattern);
459
460 // // TEST of the readed trigger pattern
461 // std::vector<bool> testpattern = m_ALFA_RawDataReadOut->pattern();
462 // //uint16_t testMBid = m_ALFA_RawDataReadOut->MBId();
463 // uint16_t testPMFid = m_ALFA_RawDataReadOut->PMFId();
464 // msg() << MSG::DEBUG << "MB : " << MBIdNum << endmsg;
465 // msg(MSG::DEBUG) << "PMF : " << testPMFid << endmsg;
466 // for (unsigned int i = 0; i < (unsigned int) testpattern.size(); i++)
467 // {
468 // msg(MSG::DEBUG) << "Trig pattern " << i << " : " << testpattern[i] << endmsg;
469 // }
470 // // end of TEST of the readed trigger pattern
471
472
473 } // m_ALFA_RawDataReadOut->WordId()==0
474
475
476 else
477 if(m_ALFA_RawDataReadOut->WordId()==1)
478 {
479 tmpScaler=m_ALFA_RawDataReadOut->scaler();
480 if(collection) collection->Set_scaler_POT(tmpScaler);
481 }
482 else
483 if(m_ALFA_RawDataReadOut->WordId()==2)
484 {
485 tmpADC1=m_ALFA_RawDataReadOut->ADC();
486 if(collection) collection->Set_ADC1_POT(tmpADC1);
487 if(collection) msg(MSG::DEBUG) <<" tmpADC1 = " << tmpADC1 << endmsg;
488 }
489 else
490 if(m_ALFA_RawDataReadOut->WordId()==3)
491 {
492 tmpADC2=m_ALFA_RawDataReadOut->ADC();
493 if(collection) collection->Set_ADC2_POT(tmpADC2);
494 if(collection) msg(MSG::DEBUG)<<" tmpADC2 = " << tmpADC2 << endmsg;
495 }
496
497 if(collection) collection->SetTrigSyncErr(m_ALFA_RawDataReadOut->error_bit17());
498
499 } //TSM PMF24
500
501
502 } // TSM
503
504
505 } // End of loop on AMTs (EOT)
506
507
508 if (m_ALFA_RawDataReadOut->is_EOT() && m_ALFA_RawDataReadOut->bit24_27()!=0)
509 {
510 msg(MSG::DEBUG) << " Event Counter EOT : " << m_ALFA_RawDataReadOut->ecnt_EOT()<< endmsg;
511 }
512
513 wordPos += 1;
514 if (wordPos >= size)
515 {
516 msg(MSG::WARNING)<<" Error: data corrupted" << endmsg;
517 if (!eventInfo->updateErrorState(EventInfo::ForwardDet, EventInfo::Error))
518 msg(MSG::WARNING) <<"Cannot set ALFA error state"<< endmsg;
519 if (!eventInfo->updateEventFlagBit(EventInfo::ForwardDet, ALFAEventBitInfo::CORRUPTION))
520 msg(MSG::WARNING) <<"Cannot set event bit info for ALFA"<< endmsg;
521
522 return StatusCode::SUCCESS;
523 }
524
525
526 m_ALFA_RawDataCollectionReadOut->decodeWord(vint[wordPos]);
527 m_ALFA_RawDataReadOut->decodeWord(vint[wordPos]);
528
529 } // End of loop on TDCs (TWC)
530
531 wordPos += 1;
532 if (wordPos >= size)
533 {
534 msg(MSG::WARNING)<<" Error: data corrupted" << endmsg;
535 if (!eventInfo->updateErrorState(EventInfo::ForwardDet, EventInfo::Error))
536 msg(MSG::WARNING) <<"Cannot set ALFA error state"<< endmsg;
537 if (!eventInfo->updateEventFlagBit(EventInfo::ForwardDet, ALFAEventBitInfo::CORRUPTION))
538 msg(MSG::WARNING) <<"Cannot set event bit info for ALFA"<< endmsg;
539
540 return StatusCode::SUCCESS;
541 }
542
543 m_ALFA_RawDataCollectionReadOut->decodeWord(vint[wordPos]);
544
545 } //EOB
546
547
548 // take full event
549 const eformat::FullEventFragment<const uint32_t*> * event = m_robDataProvider->getEvent(Gaudi::Hive::currentContext());
550
551 msg(MSG::DEBUG) << "========FULL=============" << std::endl;
552 msg(MSG::DEBUG) << "Event time (sec): " << (uint32_t)event->bc_time_seconds() << std::endl;
553 msg(MSG::DEBUG) << "Event time (ns): " << (uint32_t)event->bc_time_nanoseconds() << std::endl;
554 msg(MSG::DEBUG) << "Global ID: " << (uint32_t)event->global_id() << std::endl;
555 msg(MSG::DEBUG) << "Run Type: " << (uint32_t)event->run_type() << std::endl;
556 msg(MSG::DEBUG) << "Run Number: " << (uint32_t)event->run_no() << std::endl;
557 msg(MSG::DEBUG) << "Lumi Block: " << (uint32_t)event->lumi_block() << std::endl;
558 msg(MSG::DEBUG) << "Level1 ID: " << (uint32_t)event->lvl1_id() << std::endl;
559 msg(MSG::DEBUG) << "BCID: " << (uint32_t)event->bc_id() << std::endl;
560 msg(MSG::DEBUG) << "Level1 trig type: " << (uint32_t)event->lvl1_trigger_type() << std::endl;
561 msg(MSG::DEBUG) << "Level1 Nwords: " << (uint32_t)event->nlvl1_trigger_info() << std::endl;
562 msg(MSG::DEBUG) << "Level2 Nwords: " << (uint32_t)event->nlvl2_trigger_info() << std::endl;
563 msg(MSG::DEBUG) << "EF Nwords: " << (uint32_t)event->nevent_filter_info() << std::endl;
564 msg(MSG::DEBUG) << "============================" << std::endl;
565
566 uint32_t Time_StampID = event->bc_time_seconds();
567 uint32_t Time_StampnsID = event->bc_time_nanoseconds();
568 uint32_t BC_ID = event->bc_id();
569 uint32_t LumiBlock_ID = event->lumi_block();
570
571 if(rdoCont) rdoCont->SetTimeStamp(Time_StampID);
572 if(rdoCont) rdoCont->SetTimeStampns(Time_StampnsID);
573 if(rdoCont) rdoCont->SetBCId(BC_ID);
574 if(rdoCont) rdoCont->SetLumiBlock(LumiBlock_ID);
575
576 /*
577 For the LVL1 trigger there are three consecutive blocks of 256 bits (8 ints):
578 256 bits for the TBP (trigger before prescale)
579 256 bits for the TAP (trigger after prescale
580 256 bits for the TAV (trigger after veto)
581 */
582 const uint32_t *point_lvl1 = event->lvl1_trigger_info();
583 uint32_t point_lvl1_end = event->nlvl1_trigger_info();
584 for(uint32_t i = 0; i <= point_lvl1_end; ++i)
585 {
586 wo = *(point_lvl1 + i);
587 for(uint32_t j = 0; j < 32; ++j)
588 {
589 tmpLvl1Pattern.push_back((wo & 0x1));
590 wo >>= 1;
591 }
592 }
593 if(rdoCont) rdoCont->SetLvl1Pattern(tmpLvl1Pattern);
594
595 wo=0;
596
597 //It's not defined how many LVL2 and EF words are there
598 const uint32_t *point_lvl2 = event->lvl2_trigger_info();
599 uint32_t point_lvl2_end = event->nlvl2_trigger_info();
600 for(uint32_t i = 0; i <= point_lvl2_end; ++i)
601 {
602 wo = *(point_lvl2 + i);
603 for(uint32_t j = 0; j < 32; ++j)
604 {
605 tmpLvl2Pattern.push_back((wo & 0x1));
606 wo >>= 1;
607 }
608 }
609 //std::cout << std::dec << std::endl;
610 if(rdoCont) rdoCont->SetLvl2Pattern(tmpLvl2Pattern);
611
612 wo=0;
613
614 //std::cout << "Event num " << event->global_id() << std::endl;
615 //std::cout << "EF pat:" << std::endl;
616 const uint32_t *point_ef = event->event_filter_info();
617 uint32_t point_ef_end = event->nevent_filter_info();
618 for(uint32_t i = 0; i <= point_ef_end; ++i)
619 {
620 wo = *(point_ef + i);
621 //std::cout << std::dec << i << ": ";
622 //std::cout << std::hex << wo << " ";
623 for(uint32_t j = 0; j < 32; ++j)
624 {
625 tmpEFPattern.push_back((wo & 0x1));
626 wo >>= 1;
627 }
628 }
629 //std::cout << std::dec << std::endl;
630 if(rdoCont) rdoCont->SetEFPattern(tmpEFPattern);
631
632
633
635 {
636 msg(MSG::DEBUG) << " Found the end of block EOB ---------------------- "<< endmsg;
637 }
638
639 wordPos += 1;
640 m_ALFA_RawDataCollectionReadOut->decodeWord(vint[wordPos]);
641
642 return StatusCode::SUCCESS;
643
644}
#define endmsg
#define ATH_MSG_WARNING(x)
static Double_t sc
ALFA_RawDataCollection * getCollection(unsigned int MotherBoardId, ALFA_RawDataContainer *cont)
ALFA_RawDataCollectionReadOut * m_ALFA_RawDataCollectionReadOut
ALFA_RawDataContainerReadOut * m_ALFA_RawDataContainerReadOut
ALFA_RawDataReadOut * m_ALFA_RawDataReadOut
void Set_ADC1_POT(uint16_t ADC1_number)
void Set_ADC2_POT(uint16_t ADC2_number)
void Set_pattern_POT(const std::vector< bool > &pattern_number)
void Set_scaler_POT(uint16_t scaler_number)
void SetMBId_POT(uint16_t MB_number)
void SetTimeStampns(uint32_t tmpTimeStampns)
void SetTimeStamp(uint32_t tmpTimeStamp)
void SetLvl2Pattern(const std::vector< bool > &tmplvl2_pattern)
void SetBCId(uint32_t tmpBCId)
void SetLvl1Pattern(const std::vector< bool > &tmplvl1_pattern)
void SetLumiBlock(uint32_t tmpLumiBlock)
void SetEFPattern(const std::vector< bool > &tmpef_pattern)
void SetPMFId_PMF(uint16_t PMF_number)
void SetMarocChan_PMF(const std::vector< uint16_t > &MarocChan)
void Set_error_bit17(bool bit)
void addData(uint32_t dataWord)
void SetWordId_PMF(uint16_t Word_number)
void PushBack_PMF(uint16_t fiber_hit)
void SetMBId_PMF(uint16_t MB_number)
ServiceHandle< StoreGateSvc > & evtStore()
MsgStream & msg() const
value_type push_back(value_type pElem)
Add an element to the end of the collection.
@ ForwardDet
The forward detectors.
@ Error
The sub-detector issued an error.
@ COLL_NOT_FOUND
collection not found
@ CORRUPTION
data corrupted
@ ROB_ERROR
ROB status error.
::StatusCode StatusCode
StatusCode definition for legacy code.
const DataType * PointerType
Definition RawEvent.h:25
l
Printing final latex table to .tex output file.
EventInfo_v1 EventInfo
Definition of the latest event info version.
setWord1 uint16_t
setEventNumber uint32_t

◆ finalize()

StatusCode ALFA_Decoder::finalize ( )
virtual

Definition at line 83 of file ALFA_Decoder.cxx.

84{
85
86 msg(MSG::DEBUG) << " ALFA_RoDDecoder::FINALIZE" << endmsg;
87
88 msg(MSG::DEBUG) << " Bytestream summary:" << m_fragment_number << " fragments found" << endmsg;
89
90
94
95 return StatusCode::SUCCESS;
96}
unsigned int m_fragment_number

◆ getCollection()

ALFA_RawDataCollection * ALFA_Decoder::getCollection ( unsigned int MotherBoardId,
ALFA_RawDataContainer * cont )

Definition at line 652 of file ALFA_Decoder.cxx.

653{
654
655 msg(MSG::DEBUG) << " ALFA_RoDDecoder::getCollection" << endmsg;
656
657 ALFA_RawDataCollection* coll;
658
660 bool collExists = false;
663
664
665 for (; it!=itE; ++it)
666 {
667 if ((*it)->GetMBId_POT() == MBIdNum)
668 {
669 collExists = true;
670 cont_it = it;
671 }
672 }
673 if (collExists)
674 {
675 msg(MSG::DEBUG) << " Collection exists " << endmsg;
676 return nullptr;
677
678 }
679 else // if collection does not exist create it
680 {
681 coll = new ALFA_RawDataCollection(MBIdNum);
682 msg(MSG::DEBUG) << " create collection; MBId " << MBIdNum <<endmsg;
683 cont->push_back(coll); // add collection to container
684
685
686 }
687
688
689 return coll;
690}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.

◆ getRawData()

ALFA_RawData * ALFA_Decoder::getRawData ( unsigned int PMFId,
ALFA_RawDataCollection * coll )

◆ initialize()

StatusCode ALFA_Decoder::initialize ( )
virtual

Definition at line 45 of file ALFA_Decoder.cxx.

46{
47
48
50 sc = AthAlgTool::initialize();
51 msg(MSG::DEBUG) << " ALFA_RoDDecoder::initialize" << endmsg;
52 if (sc.isFailure()) return sc;
53
54 // Get ROBDataProviderSvc
55 if (m_robDataProvider.retrieve().isFailure())
56 {
57 msg(MSG::FATAL) << "Failed to retrieve service " << m_robDataProvider << endmsg;
58 return StatusCode::FAILURE;
59 } else
60 msg(MSG::DEBUG) << "Retrieved service " << m_robDataProvider << endmsg;
61
62
64
65
66 // Initialize decoding classes
67 m_ALFA_RawDataReadOut = new ALFA_RawDataReadOut();
68 m_ALFA_RawDataCollectionReadOut = new ALFA_RawDataCollectionReadOut();
69 m_ALFA_RawDataContainerReadOut = new ALFA_RawDataContainerReadOut();
70
71
72 return StatusCode::SUCCESS;
73}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & ALFA_Decoder::interfaceID ( )
static

Definition at line 14 of file ALFA_Decoder.cxx.

15{
16 return IID_IALFA_Decoder;
17}
static const InterfaceID IID_IALFA_Decoder("ALFA_Decoder", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ robFragment()

const eformat::ROBFragment< const uint32_t * > * ALFA_Decoder::robFragment ( ) const
inline

Definition at line 64 of file ALFA_Decoder.h.

64{ return m_robFrag; }
const eformat::ROBFragment< const uint32_t * > * m_robFrag

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_ALFA_RawDataCollectionReadOut

ALFA_RawDataCollectionReadOut* ALFA_Decoder::m_ALFA_RawDataCollectionReadOut = nullptr
private

Definition at line 78 of file ALFA_Decoder.h.

◆ m_ALFA_RawDataContainerReadOut

ALFA_RawDataContainerReadOut* ALFA_Decoder::m_ALFA_RawDataContainerReadOut = nullptr
private

Definition at line 79 of file ALFA_Decoder.h.

◆ m_ALFA_RawDataReadOut

ALFA_RawDataReadOut* ALFA_Decoder::m_ALFA_RawDataReadOut = nullptr
private

Definition at line 77 of file ALFA_Decoder.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_event

const eformat::FullEventFragment<const uint32_t*>* ALFA_Decoder::m_event = nullptr
private

Definition at line 68 of file ALFA_Decoder.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fragment_number

unsigned int ALFA_Decoder::m_fragment_number = 0U
private

Definition at line 71 of file ALFA_Decoder.h.

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> ALFA_Decoder::m_robDataProvider
private

Service for reading bytestream.

Definition at line 74 of file ALFA_Decoder.h.

◆ m_robFrag

const eformat::ROBFragment<const uint32_t*>* ALFA_Decoder::m_robFrag = nullptr
private

Definition at line 69 of file ALFA_Decoder.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: