ATLAS Offline Software
LArRawSCDataReadingAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #include "eformat/Version.h"
12 #include "eformat/index.h"
13 
14 
15 LArRawSCDataReadingAlg::LArRawSCDataReadingAlg(const std::string& name, ISvcLocator* pSvcLocator) :
16  AthReentrantAlgorithm(name, pSvcLocator),
17  m_latomeDecoder ("LArByteStream/LATOMEDecoder", this) {
18 
19  declareProperty("LATOMEDecoder", m_latomeDecoder);
20 }
21 
22 
24 
27 
30 
33 
36 
39 
41 
42  ATH_CHECK(m_robDataProviderSvc.retrieve());
43  ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnlineID"));
44 
45  ATH_CHECK(m_latomeDecoder.retrieve());
46 
47  return StatusCode::SUCCESS;
48 }
49 
50 
51 StatusCode LArRawSCDataReadingAlg::execute(const EventContext& ctx) const {
52 
53  LArDigitContainer* adc_coll = nullptr;
54  LArDigitContainer* adc_bas_coll = nullptr;
55  LArRawSCContainer* et_coll = nullptr;
56  LArRawSCContainer* et_id_coll = nullptr;
57  LArLATOMEHeaderContainer* latome_header_coll = nullptr;
58 
59  if (m_doAdc) {
61  ATH_CHECK(adcHdl.record(std::make_unique<LArDigitContainer>()));
62  adc_coll = adcHdl.ptr();
63  adc_coll->reserve(1000);
64  }
65 
66  if (m_doAdcBas) {
68  ATH_CHECK(adcBasHdl.record(std::make_unique<LArDigitContainer>()));
69  adc_bas_coll = adcBasHdl.ptr();
70  adc_bas_coll->reserve(1000);
71  }
72 
73  if (m_doEt) {
75  ATH_CHECK(etHdl.record(std::make_unique<LArRawSCContainer>()));
76  et_coll = etHdl.ptr();
77  et_coll->reserve(1000);
78  }
79 
80  if (m_doEtId) {
82  ATH_CHECK(etIdHdl.record(std::make_unique<LArRawSCContainer>()));
83  et_id_coll = etIdHdl.ptr();
84  et_id_coll->reserve(1000);
85  }
86 
87  if (m_doLATOMEHeader) {
89  ATH_CHECK(latomeHeaderHdl.record(std::make_unique<LArLATOMEHeaderContainer>()));
90  latome_header_coll = latomeHeaderHdl.ptr();
91  latome_header_coll->reserve(1000);
92  }
93  if ( m_robList.empty() ) return StatusCode::SUCCESS;
94 
95  // Get the mapping
97  const LArLATOMEMapping *map=*mapHdl;
98  if(!map) {
99  ATH_MSG_ERROR("Do not have LATOME mapping with the key " << m_mapKey.key());
100  return StatusCode::FAILURE;
101  }
102 
103  //Get the raw event
104  //
105 
106  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
107  m_robDataProviderSvc->addROBData( ctx, m_robList );
108  m_robDataProviderSvc->getROBData( ctx, m_robList, robFrags );
109 
110  // Call the converter
111  StatusCode sc = m_latomeDecoder->convert(robFrags, map,
112  adc_coll, adc_bas_coll, et_coll, et_id_coll,
113  latome_header_coll);
114  if (sc != StatusCode::SUCCESS)
115  ATH_MSG_WARNING("ERROR LATOMEDecoder tool returned an error. LAr SC containers might be garbage");
116 
117  return StatusCode::SUCCESS;
118 }
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArRawSCDataReadingAlg::m_adcBasCollKey
SG::WriteHandleKey< LArDigitContainer > m_adcBasCollKey
Definition: LArRawSCDataReadingAlg.h:43
LArRawSCContainer.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
LArRawSCDataReadingAlg::m_robList
Gaudi::Property< std::vector< uint32_t > > m_robList
Definition: LArRawSCDataReadingAlg.h:51
LArRawSCContainer
Container class for LArRawSC.
Definition: LArRawSCContainer.h:17
LArLATOMEHeaderContainer.h
LArRawSCDataReadingAlg::m_latomeDecoder
ToolHandle< LArLATOMEDecoder > m_latomeDecoder
Definition: LArRawSCDataReadingAlg.h:57
LArRawSCDataReadingAlg::m_doLATOMEHeader
bool m_doLATOMEHeader
Definition: LArRawSCDataReadingAlg.h:64
LArRawSCDataReadingAlg::LArRawSCDataReadingAlg
LArRawSCDataReadingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArRawSCDataReadingAlg.cxx:15
LArLATOMEMapping
class to provide SC mapping
Definition: LArLATOMEMapping.h:28
LArLATOMEHeaderContainer
Container class for LArLATOMEHeader.
Definition: LArLATOMEHeaderContainer.h:19
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
LArRawSCDataReadingAlg::m_onlineId
const LArOnlineID * m_onlineId
Definition: LArRawSCDataReadingAlg.h:54
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
LArRawSCDataReadingAlg::initialize
StatusCode initialize() override
Definition: LArRawSCDataReadingAlg.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArRawSCDataReadingAlg::m_adcCollKey
SG::WriteHandleKey< LArDigitContainer > m_adcCollKey
Definition: LArRawSCDataReadingAlg.h:42
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
LArRawSCDataReadingAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: LArRawSCDataReadingAlg.cxx:51
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
LArRawSCDataReadingAlg::m_mapKey
SG::ReadCondHandleKey< LArLATOMEMapping > m_mapKey
Definition: LArRawSCDataReadingAlg.h:40
LArRawSCDataReadingAlg::m_etIdCollKey
SG::WriteHandleKey< LArRawSCContainer > m_etIdCollKey
Definition: LArRawSCDataReadingAlg.h:45
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
LArRawSCDataReadingAlg::m_doAdcBas
bool m_doAdcBas
Definition: LArRawSCDataReadingAlg.h:61
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArDigitContainer.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArRawSCDataReadingAlg::m_doEtId
bool m_doEtId
Definition: LArRawSCDataReadingAlg.h:63
LArRawSCDataReadingAlg::m_doAdc
bool m_doAdc
Definition: LArRawSCDataReadingAlg.h:60
LArRawSCDataReadingAlg::m_doEt
bool m_doEt
Definition: LArRawSCDataReadingAlg.h:62
LArDigitContainer
Container class for LArDigit.
Definition: LArDigitContainer.h:24
LArRawSCDataReadingAlg::m_etCollKey
SG::WriteHandleKey< LArRawSCContainer > m_etCollKey
Definition: LArRawSCDataReadingAlg.h:44
LArRawSCDataReadingAlg.h
LArRawSCDataReadingAlg::m_robDataProviderSvc
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
Definition: LArRawSCDataReadingAlg.h:49
LArRawSCDataReadingAlg::m_latomeHeaderCollKey
SG::WriteHandleKey< LArLATOMEHeaderContainer > m_latomeHeaderCollKey
Definition: LArRawSCDataReadingAlg.h:46
IROBDataProviderSvc.h
LArOnlineID.h