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