ATLAS Offline Software
BCM_RawContByteStreamTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // BCM_RawContByteStreamTool.cxx
7 // Implementation file for class BCM_RawContByteStreamTool
9 // (c) ATLAS Detector software
12 // Version 00-00-02 05/03/2007 Daniel Dobos for pixels
13 // Version 00-00-11 05/02/2009 Daniel Dobos for BCM
15 
17 
19 
20 #include "BCM_RodEncoder.h"
21 
22 #include <cstdint>
23 #include <map>
24 
26 // constructor
28 BCM_RawContByteStreamTool::BCM_RawContByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent):AthAlgTool(type,name,parent) {
29  declareInterface<BCM_RawContByteStreamTool>(this);
30  declareProperty("RodBlockVersion",m_RodBlockVersion=0);
31  declareProperty("BCs_per_LVL1ID",m_BCs_per_LVL1ID=1);
32 }
33 
35 // destructor
38 }
39 
41 // initialize
45  return StatusCode::SUCCESS;
46 }
47 
49 // finalize
53  return StatusCode::SUCCESS;
54 }
55 
57 // convert
60 {
61  FullEventAssembler<SrcIdMap>* fea = nullptr;
62  ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea,
63  "BCMRawCont") );
65 
66  // set ROD Minor version
68  ATH_MSG_DEBUG( "Setting ROD Minor Version Number to: " << m_RodBlockVersion );
69 
70  // a map for ROD ID onto Encoder
71  std::map<uint32_t, BCM_RodEncoder> mapEncoder;
72 
73  // loop over the BCM RDO collections
74  BCM_RDO_Container::const_iterator it_coll = cont->begin();
75  BCM_RDO_Container::const_iterator it_coll_end = cont->end();
76  ATH_MSG_DEBUG( "Found " << cont->size() << " BCM RDO collections" );
77 
78  for( ; it_coll!=it_coll_end; ++it_coll) {
79  const BCM_RDO_Collection* coll = (*it_coll);
80 
81  // get OfflineId (channel number) and RODID
82  if (coll != nullptr) {
83  unsigned int offlineId = coll->getChannel();
84  uint32_t rodId = getSourceID(offlineId);
85  if ( offlineId >= 16 ) {
86  ATH_MSG_ERROR( "Didn't find RODID for OfflineID: " << offlineId );
87  }
88 
89  mapEncoder[rodId].setRodMinorVersion(m_RodBlockVersion);
90 
91  // loop over the RDOs
94 
95  for(; it_b!=it_e; ++it_b){
96  const BCM_RawData* d = *it_b;
97  mapEncoder[rodId].addRdo(d);
98  }
99  }
100  else
101  ATH_MSG_WARNING( "Container contains NULLpointer to collection, skipping collection" );
102  }
103 
104  // Fill the ROD Data into Full Event loop over Encoder map and fill all ROD Data Blocks
105  std::map<uint32_t,BCM_RodEncoder>::iterator it_map = mapEncoder.begin();
106  std::map<uint32_t,BCM_RodEncoder>::iterator it_map_end = mapEncoder.end();
107  for (; it_map != it_map_end; ++it_map) {
108  theROD = fea->getRodData((*it_map).first);
109  ((*it_map).second).fillROD(*theROD, m_BCs_per_LVL1ID);
110  }
111  return StatusCode::SUCCESS;
112 }
113 
114 static const InterfaceID IID_IBCM_RawContByteStreamTool("BCM_RawContByteStreamTool", 1, 0);
116  return IID_IBCM_RawContByteStreamTool;
117 }
118 
120 // getSourceID - convert channelID into ROD source ID
122 unsigned int BCM_RawContByteStreamTool::getSourceID(int ChannelID) const
123 {
124  // CHANGED TO NEW SOURCE ID 0x0081000A -> 0x0081004A and 0x0081000C -> 0x0081004C
125  switch(ChannelID) {
126  case 0:
127  return 0x0081004A;
128  case 1:
129  return 0x0081004C;
130  case 2:
131  return 0x0081004A;
132  case 3:
133  return 0x0081004C;
134  case 4:
135  return 0x0081004A;
136  case 5:
137  return 0x0081004C;
138  case 6:
139  return 0x0081004A;
140  case 7:
141  return 0x0081004C;
142  case 8:
143  return 0x0081004C;
144  case 9:
145  return 0x0081004A;
146  case 10:
147  return 0x0081004C;
148  case 11:
149  return 0x0081004A;
150  case 12:
151  return 0x0081004C;
152  case 13:
153  return 0x0081004A;
154  case 14:
155  return 0x0081004C;
156  case 15:
157  return 0x0081004A;
158  default:
159  return 0xffffffff;
160  }
161 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
BCM_RawContByteStreamTool::m_BCs_per_LVL1ID
int m_BCs_per_LVL1ID
Definition: BCM_RawContByteStreamTool.h:52
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
BCM_RawContByteStreamTool::getSourceID
unsigned int getSourceID(int ChannelID) const
Definition: BCM_RawContByteStreamTool.cxx:122
FullEventAssembler< SrcIdMap >
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
hist_file_dump.d
d
Definition: hist_file_dump.py:137
initialize
void initialize()
Definition: run_EoverP.cxx:894
BCM_RawContByteStreamTool::convert
StatusCode convert(BCM_RDO_Container *cont) const
Definition: BCM_RawContByteStreamTool.cxx:59
BCM_RawContByteStreamTool.h
BCM_RawContByteStreamTool::m_RodBlockVersion
unsigned short m_RodBlockVersion
Definition: BCM_RawContByteStreamTool.h:51
BCM_RDO_Collection::getChannel
virtual unsigned int getChannel() const
Definition: BCM_RDO_Collection.h:33
BCM_RawContByteStreamTool::~BCM_RawContByteStreamTool
virtual ~BCM_RawContByteStreamTool()
Definition: BCM_RawContByteStreamTool.cxx:37
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
BCM_RDO_Container
Definition: BCM_RDO_Container.h:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
BCM_RawData
Definition: BCM_RawData.h:36
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
BCM_RawContByteStreamTool::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition: BCM_RawContByteStreamTool.h:48
BCM_RodEncoder.h
BCM_RawContByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
Definition: BCM_RawContByteStreamTool.cxx:115
InDetBCM_RawDataCLASS_DEF.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
BCM_RawContByteStreamTool::finalize
virtual StatusCode finalize() override
Definition: BCM_RawContByteStreamTool.cxx:51
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
BCM_RawContByteStreamTool::initialize
virtual StatusCode initialize() override
Definition: BCM_RawContByteStreamTool.cxx:43
FullEventAssembler::setRodMinorVersion
void setRodMinorVersion(uint16_t m)
change the ROD minor version
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
BCM_RawContByteStreamTool::BCM_RawContByteStreamTool
BCM_RawContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: BCM_RawContByteStreamTool.cxx:28
AthAlgTool
Definition: AthAlgTool.h:26
BCM_RDO_Collection
Definition: BCM_RDO_Collection.h:27
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.