ATLAS Offline Software
Loading...
Searching...
No Matches
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
15LArRawSCDataReadingAlg::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
25 m_doAdc = !m_adcCollKey.empty();
26 ATH_CHECK(m_adcCollKey.initialize(m_doAdc));
27
28 m_doAdcBas = !m_adcBasCollKey.empty();
30
31 m_doEt = !m_etCollKey.empty();
32 ATH_CHECK(m_etCollKey.initialize(m_doEt));
33
34 m_doEtId = !m_etIdCollKey.empty();
35 ATH_CHECK(m_etIdCollKey.initialize(m_doEtId));
36
39
40 ATH_CHECK(m_mapKey.initialize() );
41
43 ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnlineID"));
44
45 ATH_CHECK(m_latomeDecoder.retrieve());
46
47 return StatusCode::SUCCESS;
48}
49
50
51StatusCode 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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
Container class for LArDigit.
Container class for LArLATOMEHeader.
class to provide SC mapping
Container class for LArRawSC.
SG::ReadCondHandleKey< LArLATOMEMapping > m_mapKey
SG::WriteHandleKey< LArDigitContainer > m_adcBasCollKey
StatusCode execute(const EventContext &ctx) const override
SG::WriteHandleKey< LArDigitContainer > m_adcCollKey
Gaudi::Property< std::vector< uint32_t > > m_robList
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
StatusCode initialize() override
const LArOnlineID * m_onlineId
SG::WriteHandleKey< LArRawSCContainer > m_etCollKey
SG::WriteHandleKey< LArRawSCContainer > m_etIdCollKey
ToolHandle< LArLATOMEDecoder > m_latomeDecoder
SG::WriteHandleKey< LArLATOMEHeaderContainer > m_latomeHeaderCollKey
LArRawSCDataReadingAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
STL class.