ATLAS Offline Software
Loading...
Searching...
No Matches
LArHVCorrMaker.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Include files
11#include "CoralBase/Blob.h"
15
16#include <cmath>
17#include <unistd.h>
18
19
20
21
22//---------------------------------------------------------------------------
24= default;
25
26//---------------------------------------------------------------------------
28{
29 ATH_MSG_INFO ( " in initialize " );
30 ATH_CHECK( m_scaleCorrKey.initialize() );
31 ATH_CHECK( m_cablingKey.initialize() );
32 return StatusCode::SUCCESS;
33}
34
35
36//---------------------------------------------------------------------------
38{
39 return StatusCode::SUCCESS;
40}
41
42
43//---------------------------------------------------------------------------
45{
46 ATH_MSG_INFO ( " in stop" );
47
48 const EventContext& ctx = Gaudi::Hive::currentContext();
49
51
53
54 const LArOnlineID_Base* lar_on_id = nullptr;
55 if(m_isSC) {
56 const LArOnline_SuperCellID* scid=nullptr;
57 ATH_CHECK( detStore()->retrieve(scid,"LArOnline_SuperCellID") );
58 lar_on_id=scid;
59 } else {
60 const LArOnlineID* lid=nullptr;
61 ATH_CHECK( detStore()->retrieve(lid,"LArOnlineID") );
62 lar_on_id=lid;
63 }
64
65 const unsigned hashMax=lar_on_id->channelHashMax();
66 coral::AttributeListSpecification* spec = new coral::AttributeListSpecification;
67 spec->extend("HVScaleCorr", "blob");
68 spec->extend<unsigned>("version");
69 auto coll = std::make_unique<CondAttrListCollection>(true);
70 coral::AttributeList attrList(*spec);
71 spec->release();
72 attrList["version"].setValue(0U);
73 coral::Blob& blob=attrList["HVScaleCorr"].data<coral::Blob>();
74 blob.resize(hashMax*sizeof(float));
75 float* pblob=static_cast<float*>(blob.startingAddress());
76 //Loop over online hash (to make sure that *every* field of the blob gets filled
77 for (unsigned hs=0;hs<hashMax;++hs) {
78 float value=1.0;
79 if (cabling->isOnlineConnectedFromHash(hs)) {
80 const Identifier id=cabling->cnvToIdentifierFromHash(hs);
81 const HWIdentifier hwid = cabling->createSignalChannelID (id);
82 ATH_MSG_VERBOSE("Filling value for id " << id.get_identifier32().get_compact());
83 value=scaleCorr->HVScaleCorr(hwid);
84 }
85 pblob[hs]=value;
86 }
87
88 if(m_isSC) {
89 coll->add(0,attrList); //Add as channel 0 to AttrListCollection
90 } else {
91 coll->add(1,attrList); //Add as channel 1 to AttrListCollection
92 }
93
94 ATH_CHECK( detStore()->record(std::move(coll), m_folderName) );
95 return StatusCode::SUCCESS;
96}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
const ServiceHandle< StoreGateSvc > & detStore() const
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_scaleCorrKey
virtual StatusCode execute() override
virtual StatusCode stop() override
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_folderName
virtual ~LArHVCorrMaker()
BooleanProperty m_isSC
Helper for the Liquid Argon Calorimeter cell identifiers.
size_type channelHashMax() const
Define channel hash tables max size.