ATLAS Offline Software
FCAL_HV_Energy_Rescale.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // FCAL_HV_Energy_Rescale.cxx
8 // Implementation file for class FCAL_HV_Energy_Rescale
9 // Author: S.Binet<binet@cern.ch>
11 
12 // CaloCondPhysAlgs includes
13 #include "FCAL_HV_Energy_Rescale.h"
17 
21 
22 #include "CoolKernel/types.h"
23 #include "CoolKernel/Record.h"
24 #include "CoralBase/AttributeListSpecification.h"
25 
27  ISvcLocator* pSvcLocator ) :
28  AthAlgorithm( name, pSvcLocator )
29 {
30  declareProperty("Folder",m_folder="/LAR/CellCorrOfl/EnergyCorr");
31 }
32 
33 
35 = default;
36 
37 
39 {
42  return StatusCode::SUCCESS;
43 }
44 
46 {
47  return StatusCode::SUCCESS;
48 }
49 
51 {
52  return StatusCode::SUCCESS;
53 }
54 
56 {
57  const EventContext& ctx = Gaudi::Hive::currentContext();
59 
60  const CaloCell_ID* calocell_id;
61  CHECK(detStore()->retrieve(calocell_id,"CaloCell_ID"));
62 
63  IdentifierHash hashMin,hashMax;
64  calocell_id->calo_cell_hash_range(CaloCell_ID::LARFCAL, hashMin,hashMax);
65 
67  const LArOnOffIdMapping* cabling{*cablingHdl};
68  if(!cabling) {
69  ATH_MSG_ERROR("Do not have cabling mapping from key " << m_cablingKey.key() );
70  return StatusCode::FAILURE;
71  }
72 
73  ATH_MSG_INFO( "Working on hash range 0 to " << hashMax );
74 
75  coral::AttributeListSpecification* spec = new coral::AttributeListSpecification();
76  spec->extend("CaloCondBlob16M","blob");// , cool::StorageType::Blob16M);
78  coral::Blob& blob=(*attrList)["CaloCondBlob16M"].data<coral::Blob>();
80  spec->release(); // deletes spec
81  // cppcheck-suppress memleak
82  spec = nullptr;
83 
84  //Blob Definition Vector
85  std::vector<std::vector<float> > defVec;
86  defVec.emplace_back(1,1);
87  flt->init(defVec,hashMax,1);
88 
89  CHECK(detStore()->record(attrList,m_folder));
90 
91  std::vector<float> setVec(1,1);
92  unsigned nFCAL=0, nSmall=0, nSet=0;
93  for(unsigned h=0;h<hashMax;++h) {
94  float value=1.0;
95  if (calocell_id->is_fcal(h)) {
96  ++nFCAL;
97  Identifier id=calocell_id->cell_id(h);
98  HWIdentifier hwid=cabling->createSignalChannelID(id);
99  const float corr=scaleCorr->HVScaleCorr(hwid);
100 
101  if (fabs(1.0-corr)>0.01) {
102  value=corr;
103  ++nSet;
104  }
105  else
106  ++nSmall;
107  ATH_MSG_INFO( "FCAL module " << calocell_id->sampling(id) << " corr=" << corr << " =>" << value );
108  }
109  //std::cout << h << " " << value << std::endl;
110  setVec[0]=value;
111  flt->setData(h,0,setVec);
112  }//end loop over hash
113 
114  ATH_MSG_INFO( "Found " << nFCAL << " FCAL channels of which " << nSet << " have a correction. (" << nSmall << " below threshold)" );
115 
116  return StatusCode::SUCCESS;
117 }
118 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCondBlobFlt
Class for storing a number of floats (Flt) and functions on those.
Definition: CaloCondBlobFlt.h:29
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
athena.value
value
Definition: athena.py:122
FCAL_HV_Energy_Rescale::~FCAL_HV_Energy_Rescale
virtual ~FCAL_HV_Energy_Rescale()
Destructor:
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HWIdentifier
Definition: HWIdentifier.h:13
AthenaAttributeList.h
ReadCondHandle.h
CaloCell_ID.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
FCAL_HV_Energy_Rescale::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: FCAL_HV_Energy_Rescale.h:41
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloCell_Base_ID::calo_cell_hash_range
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
CaloCell_Base_ID::is_fcal
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
ILArHVScaleCorr.h
CaloCell_Base_ID::sampling
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
extractSporadic.h
list h
Definition: extractSporadic.py:97
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
FCAL_HV_Energy_Rescale::execute
virtual StatusCode execute()
Definition: FCAL_HV_Energy_Rescale.cxx:50
AthAlgorithm
Definition: AthAlgorithm.h:47
CaloCondBlobAlgs_fillNoiseFromASCII.flt
flt
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:97
FCAL_HV_Energy_Rescale.h
FCAL_HV_Energy_Rescale::FCAL_HV_Energy_Rescale
FCAL_HV_Energy_Rescale(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition: FCAL_HV_Energy_Rescale.cxx:26
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CaloCondBlobAlgs_fillNoiseFromASCII.defVec
defVec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:92
FCAL_HV_Energy_Rescale::finalize
virtual StatusCode finalize()
Definition: FCAL_HV_Energy_Rescale.cxx:45
FCAL_HV_Energy_Rescale::m_folder
std::string m_folder
Definition: FCAL_HV_Energy_Rescale.h:45
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCell_Base_ID::cell_id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
CaloCondBlobFlt.h
h
CaloCondBlobFlt::getInstance
static CaloCondBlobFlt * getInstance(coral::Blob &blob)
Returns a pointer to a non-const CaloCondBlobFlt.
Definition: CaloCondBlobFlt.cxx:12
FCAL_HV_Energy_Rescale::m_scaleCorrKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_scaleCorrKey
Definition: FCAL_HV_Energy_Rescale.h:43
FCAL_HV_Energy_Rescale::initialize
virtual StatusCode initialize()
Definition: FCAL_HV_Energy_Rescale.cxx:38
IdentifierHash
Definition: IdentifierHash.h:38
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20