1//Dear emacs, this is -*- c++ -*-
4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
7#ifndef LARBYTESTREAM_LARRAWDATACONTBYTESTREAMTOOL_ICC
8#define LARBYTESTREAM_LARRAWDATACONTBYTESTREAMTOOL_ICC
11template <class COLLECTION >
12bool LArRawDataContByteStreamTool::checkGainConsistency(const COLLECTION* coll) const
14 typedef typename COLLECTION::const_iterator contIter;
15 contIter it=coll->begin();
16 contIter it_e=coll->end();
17 if (it==it_e) //empty container
19 int fixgain=(*it)->gain();
21 if (fixgain!=(*it)->gain())
27// We read all avaliable data => Loop over all LAr-Subdetectors and all RODs
28// All the methods derivated from the template should be there
29// The Following collection types are included :
30// LArAccumulatedCalibDigit, LArAccumulatedDigit, LArCalibDigit, LArDigit,
31// LArFebHeader and LArRawChannel
32template <class COLLECTION, typename ...ARGS >
34LArRawDataContByteStreamTool::convert(const RawEvent* re, COLLECTION* coll,
35CaloGain::CaloGain gain, ARGS&&... args) const {
37 if (prepareRobIndex(re, robIndex).isFailure()){
38 ATH_MSG_ERROR ( "Error in prepareRobIndex " );
39 return StatusCode::FAILURE;
41 RobIndex_t::const_iterator it = robIndex.find(eformat::LAR);
42 if ( it != robIndex.end() ) {
43 const std::vector<const uint32_t*>& robs = (*it).second;
44 std::vector<const uint32_t*>::const_iterator rob_add;
45 for(rob_add = robs.begin(); rob_add!=robs.end();++rob_add){
47 OFFLINE_FRAGMENTS_NAMESPACE::PointerType p;
48 OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag(*rob_add);
49 uint32_t fragSourceID = robFrag.rod_source_id();
50 if( fragSourceID & 0x1000 ){
51 ATH_MSG_DEBUG(" skip Latome fragment with source ID "<< std::hex << fragSourceID);
54 if (!m_decoder->check_valid (&robFrag, msg())) {
55 ATH_MSG_WARNING ( "Error reading bytestream event: " <<
56 "Invalid ROB fragment for source ID " << robFrag.rod_source_id() );
57 continue; //return StatusCode::FAILURE;
59 uint32_t n = robFrag.rod_ndata() ;
62 ATH_MSG_WARNING ( "Error reading bytestream event: " <<
63 "Empty ROD block (less than 3 words) for source ID " <<
64 robFrag.rod_source_id() );
67 ATH_MSG_DEBUG ( "Format Version Number of ROD-Data Block: " <<
68 MSG::hex << robFrag.rod_version() << MSG::dec);
69 ATH_MSG_VERBOSE ( "Calling RodDecoder for source ID " << MSG::hex
70 << robFrag.rod_source_id() << MSG::dec );
71 m_decoder->fillCollection(robFrag, p,n,*coll,gain, args...); // ..and decode them.
72 } catch (eformat::Issue& ex) {
73 ATH_MSG_WARNING ( " exception thrown by ROBFragment, badly corrupted event. Abort decoding " );
77 }//end if LAr SubDet or ROS event building
79 ATH_MSG_VERBOSE ( "End of LArDigitCnvTool. Container size=" << coll->size() );
80 return StatusCode::SUCCESS;