ATLAS Offline Software
Loading...
Searching...
No Matches
LArAccumulatedCalibDigitContByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7
9
15
16#include "GaudiKernel/MsgStream.h"
17#include "GaudiKernel/StatusCode.h"
18#include "GaudiKernel/DataObject.h"
19#include "GaudiKernel/IRegistry.h"
20
23
27
28// Tool
29#include "GaudiKernel/IToolSvc.h"
30
31//STL-Stuff
32#include <map>
33#include <iostream>
34
35
37 AthConstConverter(storageType(), classID(),svcloc,"LArAccumulatedCalibDigitContByteStreamCnv"),
38 m_tool("LArRawDataContByteStreamTool"),
39 m_rdpSvc("ROBDataProviderSvc", name()),
40 m_calibLineMappingKey ("LArCalibLineMap")
41{}
42
46
49
50
51StatusCode
53{
54 ATH_CHECK( AthConstConverter::initialize() );
55
56 if ( m_rdpSvc.retrieve().isFailure()) {
57 ATH_MSG_WARNING( " Can't get ByteStreamInputSvc interface Reading of ByteStream Data not possible. " );
58 }
59
60 ATH_CHECK( m_tool.retrieve() );
61 ATH_CHECK( m_calibLineMappingKey.initialize() );
62
63 return StatusCode::SUCCESS;
64}
65
66StatusCode
67LArAccumulatedCalibDigitContByteStreamCnv::createObjConst(IOpaqueAddress* pAddr, DataObject*& pObj) const
68{//Convert Accumulated Calib Digits from ByteStream to StoreGate
69 ATH_MSG_VERBOSE( "Executing CreateObj method for LArAccumulatedCalibDigitContainer " );
70
71
72 if (!m_rdpSvc) {
73 ATH_MSG_ERROR( " ROBDataProviderSvc not loaded. Can't read ByteStream." );
74 return StatusCode::FAILURE;
75 }
76
77 ByteStreamAddress* pRE_Addr{};
78 ATH_CHECK( (pRE_Addr = dynamic_cast<ByteStreamAddress*>(pAddr)) != nullptr );
79
80 const EventContext& ctx = pRE_Addr->getEventContext();
81 const RawEvent* re = m_rdpSvc->getEvent(ctx);
82 if (!re) {
83 ATH_MSG_ERROR( "Could not get raw event from ByteStreamInputSvc" );
84 }
85 const std::string& key = *(pAddr->par()); // Get key used in the StoreGateSvc::retrieve function
86 // get gain and pass to convert function.
87 CaloGain::CaloGain gain=CaloGain::LARNGAIN; //At this place, LARNGAINS means Automatic gain.
88 if (key=="HIGH")
90 else if (key=="MEDIUM")
92 else if (key=="LOW")
94
96
97 // Convert the RawEvent to LArAccumulatedCalibDigitContainer
98 ATH_MSG_DEBUG( "Converting LArAccumulatedCalibDigits (from ByteStream). key=" << key << " ,gain=" << gain );
100 if (not *calibLineMapping){
101 delete DigitContainer;
102 ATH_MSG_ERROR("LArAccumulatedCalibDigitContByteStreamCnv::createObjConst: nullptr.");
103 return StatusCode::FAILURE;
104 }
105 StatusCode sc=m_tool->convert(re,DigitContainer,gain,
106 **calibLineMapping);
107 if (sc!=StatusCode::SUCCESS) {
108 ATH_MSG_WARNING( "Conversion tool returned an error. LArAccumulatedCalibDigitContainer might be empty." );
109 }
110 DigitContainer->setDelayScale(25./240.); //FIXME should not be hardcoded!
111 pObj = SG::asStorable(DigitContainer) ;
112
113 return StatusCode::SUCCESS;
114}
115
116// IWS 19.07.2005
117 StatusCode
118 LArAccumulatedCalibDigitContByteStreamCnv::createRepConst(DataObject* /*pObj*/, IOpaqueAddress*& /*pAddr*/) const
119{// convert LArAccumulatedCalibDigits from StoreGate into ByteStream
120 ATH_MSG_ERROR( "CreateRep method of LArAccumulatedCalibDigitContainer not implemented" );
121 return StatusCode::SUCCESS;
122}
123
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
macros to associate a CLID to a type
uint32_t CLID
The Class ID type.
static Double_t sc
Helper tool for conversion of raw data classes to/from LArByteStream.
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
const std::string & name() const
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
const EventContext & getEventContext() const
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
SG::ReadCondHandleKey< LArCalibLineMapping > m_calibLineMappingKey
Container class for LArAccumulatedCalibDigit.
void setDelayScale(const double scale)
set the delay Scale
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ LARLOWGAIN
Definition CaloGain.h:18
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)