ATLAS Offline Software
CscRdoContByteStreamTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
10 #include "CscROD_Encoder.h"
12 #include <map>
13 // contructor
14 Muon::CscRdoContByteStreamTool::CscRdoContByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent) :
15  base_class(type, name, parent) {
16  declareProperty("RODVersion", m_rodVersion = 0x0200);
17  declareProperty("IsCosmicData", m_isCosmic = false);
18  declareProperty("IsOldCosmicData", m_isOldCosmic = false);
19 }
20 
21 // initialize
24  ATH_MSG_DEBUG("Muon::CscRdoContByteStreamTool::initialize()");
25 
26  // get the cabling service
27  ATH_CHECK(m_cabling.retrieve());
28  ATH_CHECK(m_idHelperSvc.retrieve());
29 
30  ATH_CHECK(m_byteStreamCnvSvc.retrieve());
31 
32  // create CSC RDO ID to source ID mapper
33  m_hid2re.set(m_cabling.get(), &m_idHelperSvc->cscIdHelper());
34  if (m_isCosmic) {
35  m_hid2re.set_isCosmic();
36  if (m_isOldCosmic) m_hid2re.set_isOldCosmic();
37  }
38  return StatusCode::SUCCESS;
39 }
40 
41 // convert CSC RDO to ByteStream
43  // Get the event assembler
45  ATH_CHECK(m_byteStreamCnvSvc->getFullEventAssembler(fea, "CscRdoContByteStream"));
46 
47  fea->idMap().set(m_cabling.get(), &m_idHelperSvc->cscIdHelper());
48  if (m_cabling->nROD() == 16)
49  fea->setRodMinorVersion(0x400);
50  else
51  fea->setRodMinorVersion(m_rodVersion);
52 
53  StatusCode sc = StatusCode::SUCCESS;
54 
56 
57  // a map for ROD ID onto Encoder
58  std::map<uint32_t, CscROD_Encoder> mapEncoder;
59 
62  CscRawDataContainer::const_iterator it_col_end = cont->end();
63 
64  bool first = true;
65  for (; it_col != it_col_end; ++it_col) {
67  if (first && !(*it_col)->empty()) {
68  first = false;
69  uint32_t eventType = (*it_col)->eventType();
70  fea->setDetEvtType(eventType);
71  }
72 
73  // get ROD ID
74  const uint32_t rodId = m_hid2re.getRodID(*it_col);
75 
76  // map the RDO onto Encoder
77  mapEncoder[rodId].setRdo(*it_col);
78  mapEncoder[rodId].setIdHelper(&m_idHelperSvc->cscIdHelper());
79  }
80 
81  // loop over map and fill all ROD Data Blocks
82  std::map<uint32_t, CscROD_Encoder>::iterator it_map = mapEncoder.begin();
83  std::map<uint32_t, CscROD_Encoder>::iterator it_map_end = mapEncoder.end();
84  for (; it_map != it_map_end; ++it_map) {
85  // get ROD data address
86  theROD = fea->getRodData((*it_map).first);
87 
88  // fill ROD data
89  sc = ((*it_map).second).fillROD(*theROD, log);
90  if (sc.isFailure()) return StatusCode::RECOVERABLE;
91  }
92 
93  return sc;
94 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition: FullEventAssembler.h:40
Muon::CscRdoContByteStreamTool::CscRdoContByteStreamTool
CscRdoContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition: CscRdoContByteStreamTool.cxx:14
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CscRawDataContainer.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
CscRdoContByteStreamTool.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CscROD_Encoder.h
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:239
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:79
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:233
FullEventAssembler::idMap
IDMAP_t & idMap()
Return reference to IDMAP.
Muon::CscRdoContByteStreamTool::m_isOldCosmic
bool m_isOldCosmic
Definition: CscRdoContByteStreamTool.h:57
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Muon::CscRdoContByteStreamTool::m_rodVersion
uint16_t m_rodVersion
Definition: CscRdoContByteStreamTool.h:55
CSC_Hid2RESrcID::set
void set(CSCcablingSvc *p_cabling, const CscIdHelper *cscId)
initialize the identifier helper
Definition: CSC_Hid2RESrcID.h:48
Muon::CscRdoContByteStreamTool::convert
virtual StatusCode convert(const CscRawDataContainer *cont, MsgStream &log) const override
Definition: CscRdoContByteStreamTool.cxx:42
FullEventAssembler::setRodMinorVersion
void setRodMinorVersion(uint16_t m)
change the ROD minor version
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:536
Muon::CscRdoContByteStreamTool::m_isCosmic
bool m_isCosmic
Definition: CscRdoContByteStreamTool.h:56
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CscRawDataContainer
This container provides access to collections of CSC RDOs and a mechanism for recording them.
Definition: CscRawDataContainer.h:23
Muon::CscRdoContByteStreamTool::initialize
virtual StatusCode initialize() override
Definition: CscRdoContByteStreamTool.cxx:22
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition: FullEventAssembler.h:54
CLASS_DEF.h
macros to associate a CLID to a type
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
FullEventAssembler::setDetEvtType
void setDetEvtType(uint32_t m)
change Detector Event Type