From 89f29efe103221265bc4d6446b6c8f8e5bdbaf69 Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Wed, 28 Oct 2020 23:55:42 -0400
Subject: [PATCH] LArByteStream: Const fixes

Get rid of the member variables LArRodDecoder::m_rodFrag and m_error,
as a step toward making the LArRodDecoder methods const.
---
 .../LArRawDataContByteStreamTool.icc          |   4 +-
 .../LArByteStream/LArRodDecoder.h             | 140 +++++++++---------
 .../LArByteStream/src/LArRodDecoder.cxx       |  67 +++++----
 3 files changed, 113 insertions(+), 98 deletions(-)

diff --git a/LArCalorimeter/LArCnv/LArByteStream/LArByteStream/LArRawDataContByteStreamTool.icc b/LArCalorimeter/LArCnv/LArByteStream/LArByteStream/LArRawDataContByteStreamTool.icc
index b0f9552b693..39f70ee129d 100644
--- a/LArCalorimeter/LArCnv/LArByteStream/LArByteStream/LArRawDataContByteStreamTool.icc
+++ b/LArCalorimeter/LArCnv/LArByteStream/LArByteStream/LArRawDataContByteStreamTool.icc
@@ -73,8 +73,8 @@ StatusCode LArRawDataContByteStreamTool::convert(const RawEvent* re, COLLECTION*
                               << MSG::dec);
               ATH_MSG_VERBOSE ( "Calling RodDecoder for source ID " << MSG::hex 
                                 << robFrag.rod_source_id() << MSG::dec );
-	      m_decoder->setRobFrag(&robFrag);
-	      m_decoder->fillCollection(p,n,*coll,gain); // ..and decode them.
+	      m_decoder->fillCollection(robFrag,
+                                        p,n,*coll,gain); // ..and decode them.
             }
             catch (eformat::Issue& ex) {
               ATH_MSG_WARNING ( " exception thrown by ROBFragment, badly corrupted event. Abort decoding " );
diff --git a/LArCalorimeter/LArCnv/LArByteStream/LArByteStream/LArRodDecoder.h b/LArCalorimeter/LArCnv/LArByteStream/LArByteStream/LArRodDecoder.h
index 1dbd6e0b503..12808c0c4e2 100644
--- a/LArCalorimeter/LArCnv/LArByteStream/LArByteStream/LArRodDecoder.h
+++ b/LArCalorimeter/LArCnv/LArByteStream/LArByteStream/LArRodDecoder.h
@@ -149,33 +149,46 @@ public:
   inline void setsecfeb (HWIdentifier feb) {m_febIdHLT = feb.get_identifier32().get_compact();};
 
   // fast decoding for trigger
-  inline void fillCollectionHLT (const uint32_t* p, uint32_t n, LArCellCollection& coll);
+  inline uint32_t fillCollectionHLT (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                     const uint32_t* p, uint32_t n, LArCellCollection& coll);
 
-  void fillCollection(const uint32_t* p, uint32_t n, LArRawChannelContainer& coll, const CaloGain::CaloGain gain); 
+  void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                      const uint32_t* p, uint32_t n, LArRawChannelContainer& coll, const CaloGain::CaloGain gain) const; 
 
   //Specialized method to convert ROD Data words into LArDigit
-  void fillCollection(const uint32_t* p, uint32_t n, LArDigitContainer& coll, const CaloGain::CaloGain gain);
+  void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                      const uint32_t* p, uint32_t n, LArDigitContainer& coll, const CaloGain::CaloGain gain) const;
 
   //Specialized method to convert ROD Accumulated Calib Digit words into LArAccumulatedCalibDigit
-  void fillCollection(const uint32_t* p, uint32_t n, LArAccumulatedCalibDigitContainer& coll, const CaloGain::CaloGain gain);
+  void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                      const uint32_t* p,
+                      uint32_t n,
+                      LArAccumulatedCalibDigitContainer& coll,
+                      const CaloGain::CaloGain gain);
 
   //Specialized method to convert ROD Accumulated Digit words into LArAccumulatedDigit
-  void fillCollection(const uint32_t* p, uint32_t n, LArAccumulatedDigitContainer& coll, const CaloGain::CaloGain gain);
+  void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                      const uint32_t* p, uint32_t n, LArAccumulatedDigitContainer& coll, const CaloGain::CaloGain gain) const;
 
   //Specialized method to convert ROD Data words into LArCalibDigit
-  void fillCollection(const uint32_t* p, uint32_t n, LArCalibDigitContainer& coll, const CaloGain::CaloGain gain);
+  void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                      const uint32_t* p,
+                      uint32_t n,
+                      LArCalibDigitContainer& coll,
+                      const CaloGain::CaloGain gain);
 
   //Specialized method to convert ROD Data words to read the headers of the Feb
-  void fillCollection(const uint32_t* p, uint32_t n, LArFebHeaderContainer& coll, const CaloGain::CaloGain);
+  void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                      const uint32_t* p, uint32_t n, LArFebHeaderContainer& coll, const CaloGain::CaloGain) const;
 
   //fast convert ROD Data words to read the headers of the Feb
-  inline void fillCollectionHLTFeb(const uint32_t* p, uint32_t n, LArFebEnergyCollection& coll);
+  inline uint32_t fillCollectionHLTFeb(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                       const uint32_t* p, uint32_t n, LArFebEnergyCollection& coll);
                                                       
   //fast convert ROD Data words to read the headers of the Feb coming from ROS
-  inline void fillCollectionHLTROSFeb(const uint32_t* p, uint32_t n, LArFebEnergyCollection& coll);
+  inline uint32_t fillCollectionHLTROSFeb(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                          const uint32_t* p, uint32_t n, LArFebEnergyCollection& coll);
                                                       
-  inline void setRobFrag(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* rob);
-  
   //Send an error reported by the eformat package to a MsgStream.
   //inline void report_error (const ers::Issue& error, MsgStream& log);
   //Inputs: error: The eformat exception
@@ -183,22 +196,22 @@ public:
 
   //Check an eformat fragment for validity. Report an error if it's not valid.
   template <class T>
-  inline bool check_valid (const T* frag, MsgStream& log);
+  inline bool check_valid (const T* frag, MsgStream& log) const;
   //Inputs: frag: The fragment to check
   //        log:  The Gaudi MsgStream.
-  inline uint32_t report_error( void ) { return m_error; }
 	
     
     
 private:
-  LArRodBlockStructure* prepareBlockStructure(const uint32_t* p, uint32_t n, const CaloGain::CaloGain RequestedGain);
+  LArRodBlockStructure* prepareBlockStructure(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                              const uint32_t* p, uint32_t n, const CaloGain::CaloGain RequestedGain) const;
   inline void setCellEnergy(
    LArCell* element, int energy, int time,
    int quality, CaloGain::CaloGain gain) const ;
   LArRodBlockStructure* m_larblockstruct;
 
   inline void writeFebInfo(
-     LArCellCollection& m_coll, LArFebEnergy& febene);
+     LArCellCollection& m_coll, LArFebEnergy& febene) const;
 
   //  inline void writeFebInfo(LArRawChannelContainer& m_coll, LArFebEnergy& febene);
 
@@ -249,21 +262,14 @@ private:
   LArRodBlockStructure* m_rodPhysicsV5;
   LArRodBlockStructure* m_rodPhysicsV6;
 
-  const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* m_robFrag ;
-  //uint32_t m_rodVersion;
-  //uint16_t m_rodMinorVersion;
-  //uint8_t m_rodBlockType;
-  
-
   bool m_MultiDSPMode;
   bool m_CheckSum;
-  uint32_t m_error;
   unsigned short m_requiredPhysicsNSamples;
 
 } ; 
 
 template <class T>
-inline bool LArRodDecoder::check_valid (const T* frag, MsgStream& /*log*/)
+inline bool LArRodDecoder::check_valid (const T* frag, MsgStream& /*log*/) const
 { 
 
 
@@ -295,20 +301,17 @@ inline void LArRodDecoder::report_error (const ers::Issue& error, MsgStream& log
 }
 */
 
-inline void LArRodDecoder::setRobFrag(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* rob)
-{m_robFrag=rob;
-}
-
 // fillCollection for HLT without automatic BS Cnv
 
-void LArRodDecoder::fillCollectionHLT(const uint32_t* p, uint32_t n
-	, LArCellCollection& coll)
+uint32_t LArRodDecoder::fillCollectionHLT(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                          const uint32_t* p, uint32_t n,
+                                          LArCellCollection& coll)
 {
   LArCell *collElem=0; //Pointer to a new element to be added to the collection
-  m_error = 0;
+  uint32_t error = 0;
 
 #ifndef NDEBUG
-  ATH_MSG_VERBOSE("Prepare LArRodBlockStructure. Got a fragement of size " << n);
+  ATH_MSG_VERBOSE("Prepare LArRodBlockStructure. Got a fragment of size " << n);
 #endif
 /*  if (n<2) //Avoid segmentation fault
     {(*m_log) << MSG::WARNING << "Got empty Rod Fragment!" << endmsg;
@@ -319,15 +322,15 @@ void LArRodDecoder::fillCollectionHLT(const uint32_t* p, uint32_t n
   if (blocksize>n) {
     msg(MSG::ERROR) << "Got truncated ROD Fragment!" << endmsg;
     // First Bit is truncated (see also below)
-    m_error|= 0x1;
-    return;
+    error|= 0x1;
+    return error;
   }
 
   if ( m_larblockstruct == (LArRodBlockStructure*)NULL ||  m_MultiDSPMode ){
   // If you don't know the format, find it out!
-  eformat::helper::Version ver(m_robFrag->rod_version());
+  eformat::helper::Version ver(robFrag.rod_version());
   const uint16_t& rodMinorVersion= ver.minor_version();
-  const uint32_t& rodBlockType=m_robFrag->rod_detev_type()&0xff;
+  const uint32_t& rodBlockType=robFrag.rod_detev_type()&0xff;
 #ifndef NDEBUG
   ATH_MSG_VERBOSE("RodBlockType=" << (int)rodBlockType << " Version: "<< rodMinorVersion);
 #endif
@@ -336,14 +339,14 @@ void LArRodDecoder::fillCollectionHLT(const uint32_t* p, uint32_t n
   if (rodBlockType>=m_BlStructArray.size() || m_BlStructArray[rodBlockType].size()==0)
     {msg(MSG::ERROR) << "Unknown Rod block type " << (int)rodBlockType << endmsg;
      // Second Bit is block empty or unknown
-     m_error|= 0x2;
-     return;
+     error|= 0x2;
+     return error;
     }
   if (rodMinorVersion>=m_BlStructArray[rodBlockType].size() || m_BlStructArray[rodBlockType][rodMinorVersion]==NULL)
     {msg(MSG::ERROR) << "No version " << rodMinorVersion  << " of Rod Block Type  " << (int)rodBlockType << "known." << endmsg;
      // Second Bit is block empty or unknown
-     m_error|= 0x2;
-    return;
+     error|= 0x2;
+     return error;
     }
 #ifndef NDEBUG
   else
@@ -379,7 +382,7 @@ void LArRodDecoder::fillCollectionHLT(const uint32_t* p, uint32_t n
 	ATH_MSG_DEBUG("Bad FebID=0x"<< std::hex << BlStruct->getFEBID() << std::dec << " found for this FEB, skipping it!");
 #endif
      // Third Bit is FEB ID issue (disabled - use 0x20 instead)
-     //m_error|= 0x4;
+     //error|= 0x4;
        continue;
     }
   // RL 05.11.2007 checksum
@@ -391,7 +394,7 @@ void LArRodDecoder::fillCollectionHLT(const uint32_t* p, uint32_t n
       msg(MSG::WARNING) << " online checksum  = 0x" << MSG::hex << onsum  << endmsg;
       msg(MSG::WARNING) << " offline checksum = 0x" << MSG::hex << offsum << MSG::dec << endmsg;
      // Fourth Bit CheckSum issue (maybe disabled!)
-     m_error|= 0x8;
+     error|= 0x8;
       continue;
     }
   }
@@ -424,37 +427,38 @@ void LArRodDecoder::fillCollectionHLT(const uint32_t* p, uint32_t n
   }
   while (BlStruct->nextFEB()); //Get NextFeb
   // Error meaning data corruption. Maybe in any FEB
-  if ( BlStruct->report_error() ) m_error |= 0x1;
+  if ( BlStruct->report_error() ) error |= 0x1;
   // error of uncompatible number of cells is bit 5
   unsigned int collection_size = coll.size();
-  if ( feb_number== 0 && collection_size>0 ) m_error |= 0x20;
-  if ( feb_number== 1 && collection_size !=128 ) m_error |= 0x20;
-  if ( feb_number== 2 && collection_size !=256 ) m_error |= 0x20;
-  return;
+  if ( feb_number== 0 && collection_size>0 ) error |= 0x20;
+  if ( feb_number== 1 && collection_size !=128 ) error |= 0x20;
+  if ( feb_number== 2 && collection_size !=256 ) error |= 0x20;
+  return error;
 }
 
 
-void LArRodDecoder::fillCollectionHLTFeb(const uint32_t* p, uint32_t n
-        , LArFebEnergyCollection& coll)
+uint32_t LArRodDecoder::fillCollectionHLTFeb(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                             const uint32_t* p, uint32_t n,
+                                             LArFebEnergyCollection& coll)
 {
 #ifndef NDEBUG
-  ATH_MSG_VERBOSE("Prepare LArRodBlockStructure. Got a fragement of size " << n);
+  ATH_MSG_VERBOSE("Prepare LArRodBlockStructure. Got a fragment of size " << n);
 #endif
   if (n<2) //Avoid segmentation fault
     {msg(MSG::WARNING) << "Got empty Rod Fragment!" << endmsg;
-     return;
+     return 0;
     }
   const uint32_t blocksize=p[0]; //First word contains block size
   if (blocksize>n)
     {msg(MSG::ERROR) << "Got truncated ROD Fragment!" << endmsg;
-     return;
+     return 0;
     }
 
   if ( m_larblockstruct == (LArRodBlockStructure*)NULL){
   // If you don't know the format, find it out!
-  eformat::helper::Version ver(m_robFrag->rod_version());
+  eformat::helper::Version ver(robFrag.rod_version());
   const uint16_t& rodMinorVersion= ver.minor_version();
-  const uint32_t& rodBlockType=m_robFrag->rod_detev_type()&0xff;
+  const uint32_t& rodBlockType=robFrag.rod_detev_type()&0xff;
 #ifndef NDEBUG
   ATH_MSG_VERBOSE("RodBlockType=" << (int)rodBlockType << " Version: "<< rodMinorVersion);
 #endif
@@ -462,11 +466,11 @@ void LArRodDecoder::fillCollectionHLTFeb(const uint32_t* p, uint32_t n
 
   if (rodBlockType>=m_BlStructArray.size() || m_BlStructArray[rodBlockType].size()==0)
     {msg(MSG::ERROR) << "Unknown Rod block type " << (int)rodBlockType << endmsg;
-     return;
+     return 0;
     }
   if (rodMinorVersion>=m_BlStructArray[rodBlockType].size() || m_BlStructArray[rodBlockType][rodMinorVersion]==NULL)
     {msg(MSG::ERROR) << "No version " << rodMinorVersion  << " of Rod Block Type  " << (int)rodBlockType << "known." << endmsg;
-    return;
+    return 0;
     }
 #ifndef NDEBUG
   else
@@ -529,25 +533,25 @@ void LArRodDecoder::fillCollectionHLTFeb(const uint32_t* p, uint32_t n
       coll.push_back(febenergy);
     }
   while (BlStruct->nextFEB()); //Get NextFeb
-  return;
+  return 0;
 }
 
-void LArRodDecoder::fillCollectionHLTROSFeb(const uint32_t* p, uint32_t n
-        , LArFebEnergyCollection& coll)
+uint32_t LArRodDecoder::fillCollectionHLTROSFeb(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                                const uint32_t* p, uint32_t n,
+                                                LArFebEnergyCollection& coll)
 {
-  m_error = 0;
 #ifndef NDEBUG
-  ATH_MSG_VERBOSE("Prepare LArRodBlockStructure. Got a fragement of size " << n);
+  ATH_MSG_VERBOSE("Prepare LArRodBlockStructure. Got a fragment of size " << n);
 #endif
   if (n<2) //Avoid segmentation fault
     {msg(MSG::WARNING) << "Got empty Rod Fragment!" << endmsg;
-     return;
+     return 0;
     }
   if ( m_larblockstruct == (LArRodBlockStructure*)NULL){
   // If you don't know the format, find it out!
-  eformat::helper::Version ver(m_robFrag->rod_version());
+  eformat::helper::Version ver(robFrag.rod_version());
   const uint16_t& rodMinorVersion= ver.minor_version();
-  const uint32_t& rodBlockType=m_robFrag->rod_detev_type()&0xff;
+  const uint32_t& rodBlockType=robFrag.rod_detev_type()&0xff;
 #ifndef NDEBUG
   ATH_MSG_VERBOSE("RodBlockType=" << (int)rodBlockType << " Version: "<< rodMinorVersion);
 #endif
@@ -555,11 +559,11 @@ void LArRodDecoder::fillCollectionHLTROSFeb(const uint32_t* p, uint32_t n
 
   if (rodBlockType>=m_BlStructArray.size() || m_BlStructArray[rodBlockType].size()==0)
     {msg(MSG::ERROR) << "Unknown Rod block type " << (int)rodBlockType << endmsg;
-     return;
+     return 0;
     }
   if (rodMinorVersion>=m_BlStructArray[rodBlockType].size() || m_BlStructArray[rodBlockType][rodMinorVersion]==NULL)
     {msg(MSG::ERROR) << "No version " << rodMinorVersion  << " of Rod Block Type  " << (int)rodBlockType << "known." << endmsg;
-    return;
+    return 0;
     }
 #ifndef NDEBUG
   else
@@ -572,7 +576,7 @@ void LArRodDecoder::fillCollectionHLTROSFeb(const uint32_t* p, uint32_t n
 
   LArFebEnergy* febenergy;
   int nfebs = BlStruct->setFragmentVirtualROB(p,n);
-  if ( !nfebs ) return;
+  if ( !nfebs ) return 0;
   for(int i = 0; i<nfebs; i++) {
       febenergy = new LArFebEnergy( BlStruct->getVROBFebId() );
       febenergy->setFebEx(BlStruct->getVROBEx());
@@ -581,7 +585,7 @@ void LArRodDecoder::fillCollectionHLTROSFeb(const uint32_t* p, uint32_t n
       febenergy->setFebSumE(BlStruct->getVROBSumE());
       coll.push_back(febenergy);
   } // nfebs loop
-  return;
+  return 0;
 }
 
 
@@ -594,7 +598,7 @@ inline void LArRodDecoder:: setCellEnergy(
 }
 
 inline void LArRodDecoder:: writeFebInfo(
-   LArCellCollection& coll, LArFebEnergy& febene)
+   LArCellCollection& coll, LArFebEnergy& febene) const
  {
    coll.addfebenergy(febene);
  }
diff --git a/LArCalorimeter/LArCnv/LArByteStream/src/LArRodDecoder.cxx b/LArCalorimeter/LArCnv/LArByteStream/src/LArRodDecoder.cxx
index b8fc28a6025..762f24de746 100644
--- a/LArCalorimeter/LArCnv/LArByteStream/src/LArRodDecoder.cxx
+++ b/LArCalorimeter/LArCnv/LArByteStream/src/LArRodDecoder.cxx
@@ -57,9 +57,7 @@ LArRodDecoder::LArRodDecoder ( const std::string& type, const std::string& name,
     m_rodPhysicsV3(0),
     m_rodPhysicsV4(0),
     m_rodPhysicsV5(0),
-    m_rodPhysicsV6(0),
-    m_robFrag(0),
-    m_error(0)
+    m_rodPhysicsV6(0)
  {
   declareInterface< LArRodDecoder  >( this );
   declareProperty("IgnoreCheckFEBs",m_IgnoreCheckFEBs);
@@ -80,7 +78,6 @@ LArRodDecoder::LArRodDecoder ( const std::string& type, const std::string& name,
   declareProperty("CheckSum", m_CheckSum=false);
   declareProperty("StatusMask", m_StatusMask=0x00000212);
   declareProperty("RequiredPhysicsNSamples", m_requiredPhysicsNSamples = 0);
-  m_robFrag=NULL;
 }
 
 // destructor 
@@ -313,14 +310,15 @@ StatusCode LArRodDecoder::finalize()
 }
 
 
-void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArDigitContainer& coll, CaloGain::CaloGain RequestedGain) //const
+void LArRodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                   const uint32_t* p, uint32_t n, LArDigitContainer& coll, CaloGain::CaloGain RequestedGain) const
 { // Digit pointer
   LArDigit * dg=0 ;
   CaloGain::CaloGain calogain;
   uint32_t gain;
   int fcNb;
   std::vector<short> samples;
-  LArRodBlockStructure* BlStruct=prepareBlockStructure(p, n, RequestedGain);
+  LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
   if (!BlStruct) return;
 
 
@@ -416,7 +414,8 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArDigitContai
 //*******
 
 
-void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArRawChannelContainer& coll, CaloGain::CaloGain RequestedGain) 
+void LArRodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                   const uint32_t* p, uint32_t n, LArRawChannelContainer& coll, CaloGain::CaloGain RequestedGain) const
 { 
   int32_t energy;
   int32_t time;
@@ -424,7 +423,7 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArRawChannelC
   uint32_t gain;
   int fcNb;
   HWIdentifier cId;
-  LArRodBlockStructure* BlStruct=prepareBlockStructure(p, n, RequestedGain);
+  LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
   if (!BlStruct) return;
 
   //std::cout << "Decoding LArRawChannels from ROD size=0x" << std::hex << n << std::endl;
@@ -514,7 +513,11 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArRawChannelC
 }
 
 
-void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArCalibDigitContainer& coll, CaloGain::CaloGain RequestedGain)
+void LArRodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                   const uint32_t* p,
+                                   uint32_t n,
+                                   LArCalibDigitContainer& coll,
+                                   CaloGain::CaloGain RequestedGain)
 { // CalibDigit pointer
   LArCalibDigit * dg=0 ;
   uint32_t gain;
@@ -528,7 +531,7 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArCalibDigitC
   //  std::cout << " -     " << std::hex << p[i] << std::endl;
 
   ATH_MSG_VERBOSE("FillCollection for LArCalibDigitContainer is called.");
-  LArRodBlockStructure* BlStruct=prepareBlockStructure(p, n, RequestedGain);
+  LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
   //  std::cout << "Done with LArRodBlock prepare" << std::endl;
   if (!BlStruct) return;
   // std::cout << " canSetCalibration() " << BlStruct->canSetCalibration() << std::endl;
@@ -721,7 +724,11 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArCalibDigitC
   return;
 }
 
-void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArAccumulatedCalibDigitContainer& coll, CaloGain::CaloGain RequestedGain) //const
+void LArRodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                   const uint32_t* p,
+                                   uint32_t n,
+                                   LArAccumulatedCalibDigitContainer& coll,
+                                   CaloGain::CaloGain RequestedGain)
 { // Accumulated Digit pointer
   LArAccumulatedCalibDigit * dg=0 ;
   CaloGain::CaloGain calogain;
@@ -738,7 +745,7 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArAccumulated
   //  for(int i=0;i<16;i++)
   //  std::cout << " -     " << std::hex << p[i] << std::endl;
 
-  LArRodBlockStructure* BlStruct=prepareBlockStructure(p, n, RequestedGain);
+  LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
   if (!BlStruct) return;
   do
     {
@@ -846,7 +853,8 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArAccumulated
   return;
 }
 
-void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArAccumulatedDigitContainer& coll, CaloGain::CaloGain RequestedGain) //const
+void LArRodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                   const uint32_t* p, uint32_t n, LArAccumulatedDigitContainer& coll, CaloGain::CaloGain RequestedGain) const
 { // Accumulated Digit pointer
   LArAccumulatedDigit * dg=0 ;
   CaloGain::CaloGain calogain;
@@ -859,7 +867,7 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArAccumulated
   //  for(int i=0;i<16;i++)
   //  std::cout << " -     " << std::hex << p[i] << std::endl;
 
-  LArRodBlockStructure* BlStruct=prepareBlockStructure(p, n, RequestedGain);
+  LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
   if (!BlStruct) return;
   do
     {
@@ -939,7 +947,8 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArAccumulated
   return;
 }
 
-void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArFebHeaderContainer& coll,const CaloGain::CaloGain RequestedGain)
+void LArRodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                   const uint32_t* p, uint32_t n, LArFebHeaderContainer& coll,const CaloGain::CaloGain RequestedGain) const
 {
   LArFebHeader* larFebHeader;
   //uint32_t NWtot=0;
@@ -948,7 +957,7 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArFebHeaderCo
   //  for(int i=0;i<16;i++)
   //  std::cout << " -     " << std::hex << p[i] << std::endl;
 
-  LArRodBlockStructure* BlStruct=prepareBlockStructure(p, n, RequestedGain);
+  LArRodBlockStructure* BlStruct=prepareBlockStructure(robFrag, p, n, RequestedGain);
   if (!BlStruct) return;
 
   do{
@@ -987,13 +996,13 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArFebHeaderCo
     larFebHeader=new LArFebHeader(FEBID);
     //setROD header data
     
-    larFebHeader->SetFormatVersion(m_robFrag->rod_version());
-    larFebHeader->SetSourceId(m_robFrag->rod_source_id());
-    larFebHeader->SetRunNumber(m_robFrag->rod_run_no());
-    larFebHeader->SetELVL1Id(m_robFrag->rod_lvl1_id());
-    larFebHeader->SetBCId(m_robFrag->rod_bc_id());
-    larFebHeader->SetLVL1TigType(m_robFrag->rod_lvl1_trigger_type());
-    larFebHeader->SetDetEventType(m_robFrag->rod_detev_type());
+    larFebHeader->SetFormatVersion(robFrag.rod_version());
+    larFebHeader->SetSourceId(robFrag.rod_source_id());
+    larFebHeader->SetRunNumber(robFrag.rod_run_no());
+    larFebHeader->SetELVL1Id(robFrag.rod_lvl1_id());
+    larFebHeader->SetBCId(robFrag.rod_bc_id());
+    larFebHeader->SetLVL1TigType(robFrag.rod_lvl1_trigger_type());
+    larFebHeader->SetDetEventType(robFrag.rod_detev_type());
   
     //set DSP data
     const unsigned nsample=BlStruct->getNumberOfSamples();
@@ -1010,8 +1019,8 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArFebHeaderCo
     larFebHeader->SetOfflineChecksum(BlStruct->offlineCheckSum());
 
     if(!BlStruct->hasControlWords()) {
-      larFebHeader->SetFebELVL1Id(m_robFrag->rod_lvl1_id());
-      larFebHeader->SetFebBCId(m_robFrag->rod_bc_id());
+      larFebHeader->SetFebELVL1Id(robFrag.rod_lvl1_id());
+      larFebHeader->SetFebBCId(robFrag.rod_bc_id());
     } else {
       const uint16_t evtid = BlStruct->getCtrl1(0) & 0x1f;
       const uint16_t bcid  = BlStruct->getCtrl2(0) & 0x1fff;
@@ -1034,7 +1043,9 @@ void LArRodDecoder::fillCollection(const uint32_t* p, uint32_t n, LArFebHeaderCo
 }
 
 
-LArRodBlockStructure* LArRodDecoder::prepareBlockStructure(const uint32_t* p, uint32_t n, const CaloGain::CaloGain RequestedGain)
+LArRodBlockStructure*
+LArRodDecoder::prepareBlockStructure(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag,
+                                     const uint32_t* p, uint32_t n, const CaloGain::CaloGain RequestedGain) const
 { 
 #ifndef NDEBUG
   ATH_MSG_DEBUG("Prepare LArRodBlockStructure. Got a fragement of size " << n);
@@ -1049,9 +1060,9 @@ LArRodBlockStructure* LArRodDecoder::prepareBlockStructure(const uint32_t* p, ui
   //   return NULL;
   //  }
   //Get version and blocktype form header
-  eformat::helper::Version ver(m_robFrag->rod_version());
+  eformat::helper::Version ver(robFrag.rod_version());
   const uint16_t rodMinorVersion=ver.minor_version();
-  const uint32_t rodBlockType=m_robFrag->rod_detev_type()&0xff;
+  const uint32_t rodBlockType=robFrag.rod_detev_type()&0xff;
   if (rodBlockType>=m_BlStructArray.size() || m_BlStructArray[rodBlockType].size()==0)
     {msg(MSG::ERROR) << "Unknown Rod block type " <<  rodBlockType << endmsg;
      return NULL;
-- 
GitLab