ATLAS Offline Software
LArHVCorrMaker.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Include files
10 #include "CoralBase/Blob.h"
13 
14 #include <cmath>
15 #include <unistd.h>
16 
17 
18 
19 
20 //---------------------------------------------------------------------------
22 = default;
23 
24 //---------------------------------------------------------------------------
26 {
27  ATH_MSG_INFO ( " in initialize " );
28  ATH_CHECK( detStore()->retrieve(m_lar_on_id,"LArOnlineID") );
31  return StatusCode::SUCCESS;
32 }
33 
34 
35 //---------------------------------------------------------------------------
37 {
38  return StatusCode::SUCCESS;
39 }
40 
41 
42 //---------------------------------------------------------------------------
44 {
45  ATH_MSG_INFO ( " in stop" );
46 
47  const EventContext& ctx = Gaudi::Hive::currentContext();
50 
51  const unsigned hashMax=m_lar_on_id->channelHashMax();
52  coral::AttributeListSpecification* spec = new coral::AttributeListSpecification;
53  spec->extend("HVScaleCorr", "blob");
54  spec->extend<unsigned>("version");
55  auto coll = std::make_unique<CondAttrListCollection>(true);
56  coral::AttributeList attrList(*spec);
57  spec->release();
58  attrList["version"].setValue(0U);
59  coral::Blob& blob=attrList["HVScaleCorr"].data<coral::Blob>();
60  blob.resize(hashMax*sizeof(float));
61  float* pblob=static_cast<float*>(blob.startingAddress());
62  //Loop over online hash (to make sure that *every* field of the blob gets filled
63  for (unsigned hs=0;hs<hashMax;++hs) {
64  float value=1.0;
65  if (cabling->isOnlineConnectedFromHash(hs)) {
66  const Identifier id=cabling->cnvToIdentifierFromHash(hs);
67  const HWIdentifier hwid = cabling->createSignalChannelID (id);
68  ATH_MSG_VERBOSE("Filling value for id " << id.get_identifier32().get_compact());
69  value=scaleCorr->HVScaleCorr(hwid);
70  }
71  pblob[hs]=value;
72  }
73  coll->add(1,attrList); //Add as channel 1 to AttrListCollection
74 
75  ATH_CHECK( detStore()->record(std::move(coll), m_folderName) );
76  return StatusCode::SUCCESS;
77 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArHVScaleCorrFlat.h
LArHVCorrMaker.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
LArHVCorrMaker::initialize
virtual StatusCode initialize() override
Definition: LArHVCorrMaker.cxx:25
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
athena.value
value
Definition: athena.py:122
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
LArHVCorrMaker::m_scaleCorrKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_scaleCorrKey
Definition: LArHVCorrMaker.h:49
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
HWIdentifier
Definition: HWIdentifier.h:13
AthenaAttributeList.h
ReadCondHandle.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArHVCorrMaker::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArHVCorrMaker.h:51
CreatePhysValWebPage.hs
hs
Definition: CreatePhysValWebPage.py:107
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArHVCorrMaker::m_lar_on_id
const LArOnlineID * m_lar_on_id
Definition: LArHVCorrMaker.h:43
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArOnlineID_Base::channelHashMax
size_type channelHashMax(void) const
Define channel hash tables max size.
Definition: LArOnlineID_Base.cxx:1901
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArHVCorrMaker::m_folderName
Gaudi::Property< std::string > m_folderName
Definition: LArHVCorrMaker.h:45
ILArHVScaleCorr::HVScaleCorr
virtual const float & HVScaleCorr(const HWIdentifier &id) const =0
LArHVCorrMaker::stop
virtual StatusCode stop() override
Definition: LArHVCorrMaker.cxx:43
LArHVCorrMaker::execute
virtual StatusCode execute() override
Definition: LArHVCorrMaker.cxx:36
LArHVCorrMaker::~LArHVCorrMaker
virtual ~LArHVCorrMaker()
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
LArOnlineID.h