ATLAS Offline Software
Loading...
Searching...
No Matches
LArRawSCCalibDataReadingAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
12#include "eformat/Version.h"
13#include "eformat/index.h"
14
15
16
18
19
20 if (m_accDigitKey.key().size()>0) {
21 ATH_CHECK(m_accDigitKey.initialize());
22 m_doAccDigits=true;
23 }
24 else {
25 m_doAccDigits=false;
26 }
27
28 if (m_accCalibDigitKey.key().size()>0) {
29 ATH_CHECK(m_accCalibDigitKey.initialize());
31 }
32 else {
34 }
35
36 if (m_latomeHeaderCollKey.key().size()>0) {
37 ATH_CHECK(m_latomeHeaderCollKey.initialize());
39 }
40 else {
41 m_doLATOMEHeader=false;
42 }
43
44
46 ATH_MSG_FATAL("Needs ether Digits or CalibDigits or AccDigits or AccCalibDigit Key");
47 return StatusCode::FAILURE;
48 }
49
51 ATH_MSG_FATAL("Could not have both CalibDigits, AccCalibDigits Key");
52 return StatusCode::FAILURE;
53 }
54
55 ATH_CHECK( m_mapKey.initialize() );
56 ATH_CHECK( m_cablingKey.initialize() );
57 ATH_CHECK( m_calibMapKey.initialize() );
58
60 ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnlineID"));
61
62 ATH_CHECK(m_latomeDecoder.retrieve());
63
64
65 return StatusCode::SUCCESS;
66}
67
68StatusCode LArRawSCCalibDataReadingAlg::execute(const EventContext& ctx) const {
69 LArAccumulatedDigitContainer* accdigits=nullptr;
70 LArAccumulatedCalibDigitContainer* caccdigits=nullptr;
71 LArLATOMEHeaderContainer* latome_header_coll = nullptr;
72
73
74 if (m_doAccDigits) {
76 ATH_CHECK(accdigitsHdl.record(std::make_unique<LArAccumulatedDigitContainer>()));
77 accdigits=accdigitsHdl.ptr();
78 accdigits->reserve(35000); //Enough space for the full calo
79 }
80
83 ATH_CHECK(caccdigitsHdl.record(std::make_unique<LArAccumulatedCalibDigitContainer>()));
84 caccdigits=caccdigitsHdl.ptr();
85 caccdigits->reserve(35000); //Enough space for the full calo
86 }
87
88 if (m_doLATOMEHeader) {
90 ATH_CHECK(latomeHeaderHdl.record(std::make_unique<LArLATOMEHeaderContainer>()));
91 latome_header_coll = latomeHeaderHdl.ptr();
92 latome_header_coll->reserve(120);
93 }
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
104 const LArOnOffIdMapping *onoffmap = *cablingHdl;
105 if(!onoffmap) {
106 ATH_MSG_ERROR( "Do not have mapping object " << m_cablingKey.key());
107 return StatusCode::FAILURE;
108 }
109
111 const LArCalibLineMapping *clmap=*clmapHdl;
112 if(!clmap) {
113 ATH_MSG_ERROR("Do not have calib line mapping with the key " << m_calibMapKey.key());
114 return StatusCode::FAILURE;
115 }
116
117 //Get full events and filter out LAr ROBs
118 const RawEvent* rawEvent=m_robDataProviderSvc->getEvent(ctx);
119
120 StatusCode sc = m_latomeDecoder->convert(rawEvent, map, onoffmap, clmap,
121 accdigits, caccdigits,
122 latome_header_coll);
123 if (sc != StatusCode::SUCCESS)
124 ATH_MSG_WARNING("ERROR LATOMEDecoder tool returned an error. LAr SC containers might be garbage");
125
126
127 return StatusCode::SUCCESS;
128}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
const ServiceHandle< StoreGateSvc > & detStore() const
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
Container class for LArAccumulatedCalibDigit.
Container class for LArAccumulatedDigit.
Container class for LArLATOMEHeader.
class to provide SC mapping
SG::WriteHandleKey< LArAccumulatedDigitContainer > m_accDigitKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
ToolHandle< LArLATOMEDecoder > m_latomeDecoder
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
SG::ReadCondHandleKey< LArCalibLineMapping > m_calibMapKey
SG::WriteHandleKey< LArLATOMEHeaderContainer > m_latomeHeaderCollKey
SG::ReadCondHandleKey< LArLATOMEMapping > m_mapKey
StatusCode execute(const EventContext &ctx) const override
SG::WriteHandleKey< LArAccumulatedCalibDigitContainer > m_accCalibDigitKey
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
STL class.