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 // For LATOME while no Condition alg exists
12 #include "LArLATOMEROBIDs.h"
13 #include "eformat/Version.h"
14 #include "eformat/index.h"
15 
16 
17 LArRawSCDataReadingAlg::LArRawSCDataReadingAlg(const std::string& name, ISvcLocator* pSvcLocator) :
18  AthReentrantAlgorithm(name, pSvcLocator),
19  m_latomeDecoder ("LArByteStream/LATOMEDecoder", this) {
20 
21  declareProperty("LATOMEDecoder", m_latomeDecoder);
22 }
23 
24 
26 
29 
32 
35 
38 
41 
43 
44  ATH_CHECK(m_robDataProviderSvc.retrieve());
45  ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnlineID"));
46 
47  ATH_CHECK(m_latomeDecoder.retrieve());
48 
49  return StatusCode::SUCCESS;
50 }
51 
52 
53 StatusCode LArRawSCDataReadingAlg::execute(const EventContext& ctx) const {
54 
55  LArDigitContainer* adc_coll = nullptr;
56  LArDigitContainer* adc_bas_coll = nullptr;
57  LArRawSCContainer* et_coll = nullptr;
58  LArRawSCContainer* et_id_coll = nullptr;
59  LArLATOMEHeaderContainer* latome_header_coll = nullptr;
60 
61  if (m_doAdc) {
63  ATH_CHECK(adcHdl.record(std::make_unique<LArDigitContainer>()));
64  adc_coll = adcHdl.ptr();
65  adc_coll->reserve(1000);
66  }
67 
68  if (m_doAdcBas) {
70  ATH_CHECK(adcBasHdl.record(std::make_unique<LArDigitContainer>()));
71  adc_bas_coll = adcBasHdl.ptr();
72  adc_bas_coll->reserve(1000);
73  }
74 
75  if (m_doEt) {
77  ATH_CHECK(etHdl.record(std::make_unique<LArRawSCContainer>()));
78  et_coll = etHdl.ptr();
79  et_coll->reserve(1000);
80  }
81 
82  if (m_doEtId) {
84  ATH_CHECK(etIdHdl.record(std::make_unique<LArRawSCContainer>()));
85  et_id_coll = etIdHdl.ptr();
86  et_id_coll->reserve(1000);
87  }
88 
89  if (m_doLATOMEHeader) {
91  ATH_CHECK(latomeHeaderHdl.record(std::make_unique<LArLATOMEHeaderContainer>()));
92  latome_header_coll = latomeHeaderHdl.ptr();
93  latome_header_coll->reserve(1000);
94  }
95 
96  // Get the mapping
98  const LArLATOMEMapping *map=*mapHdl;
99  if(!map) {
100  ATH_MSG_ERROR("Do not have LATOME mapping with the key " << m_mapKey.key());
101  return StatusCode::FAILURE;
102  }
103 
104  //Get the raw event
105  // patch for the HLT usage
106  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
107  m_robDataProviderSvc->getROBData( ctx, LArByteStream::s_allROBIDs_LATOME, robFrags );
108 
109  // Call the converter
110  StatusCode sc = m_latomeDecoder->convert(robFrags, map,
111  adc_coll, adc_bas_coll, et_coll, et_id_coll,
112  latome_header_coll);
113  if (sc != StatusCode::SUCCESS)
114  ATH_MSG_WARNING("ERROR LATOMEDecoder tool returned an error. LAr SC containers might be garbage");
115 
116  return StatusCode::SUCCESS;
117 }
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:40
LArRawSCContainer.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArRawSCContainer
Container class for LArRawSC.
Definition: LArRawSCContainer.h:17
LArLATOMEHeaderContainer.h
LArRawSCDataReadingAlg::m_latomeDecoder
ToolHandle< LArLATOMEDecoder > m_latomeDecoder
Definition: LArRawSCDataReadingAlg.h:52
LArRawSCDataReadingAlg::m_doLATOMEHeader
bool m_doLATOMEHeader
Definition: LArRawSCDataReadingAlg.h:59
LArRawSCDataReadingAlg::LArRawSCDataReadingAlg
LArRawSCDataReadingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArRawSCDataReadingAlg.cxx:17
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:49
LArLATOMEROBIDs.h
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:83
LArRawSCDataReadingAlg::initialize
StatusCode initialize() override
Definition: LArRawSCDataReadingAlg.cxx:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArRawSCDataReadingAlg::m_adcCollKey
SG::WriteHandleKey< LArDigitContainer > m_adcCollKey
Definition: LArRawSCDataReadingAlg.h:39
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.
LArRawSCDataReadingAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: LArRawSCDataReadingAlg.cxx:53
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:37
LArRawSCDataReadingAlg::m_etIdCollKey
SG::WriteHandleKey< LArRawSCContainer > m_etIdCollKey
Definition: LArRawSCDataReadingAlg.h:42
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArRawSCDataReadingAlg::m_doAdcBas
bool m_doAdcBas
Definition: LArRawSCDataReadingAlg.h:56
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArDigitContainer.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
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:58
LArRawSCDataReadingAlg::m_doAdc
bool m_doAdc
Definition: LArRawSCDataReadingAlg.h:55
LArRawSCDataReadingAlg::m_doEt
bool m_doEt
Definition: LArRawSCDataReadingAlg.h:57
LArDigitContainer
Container class for LArDigit.
Definition: LArDigitContainer.h:24
LArRawSCDataReadingAlg::m_etCollKey
SG::WriteHandleKey< LArRawSCContainer > m_etCollKey
Definition: LArRawSCDataReadingAlg.h:41
LArRawSCDataReadingAlg.h
LArRawSCDataReadingAlg::m_robDataProviderSvc
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
Definition: LArRawSCDataReadingAlg.h:46
LArRawSCDataReadingAlg::m_latomeHeaderCollKey
SG::WriteHandleKey< LArLATOMEHeaderContainer > m_latomeHeaderCollKey
Definition: LArRawSCDataReadingAlg.h:43
IROBDataProviderSvc.h
LArOnlineID.h