|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include "CoralBase/Blob.h"
22 ISvcLocator* pSvcLocator ) :
36 return StatusCode::SUCCESS;
44 const EventContext& ctx = Gaudi::Hive::currentContext();
48 return StatusCode::FAILURE;
59 return StatusCode::FAILURE;
66 return StatusCode::FAILURE;
77 std::ifstream
fin(
file.c_str());
80 return StatusCode::FAILURE;
84 float em0,em1,em2,em3,em4;
85 float had0,had1,had2,had3;
86 std::map<int,std::vector<float> > wmap;
87 while (std::getline(
fin,
line)){
88 int nread = sscanf(
line.c_str(),
"%d %f %f %f %f %f %f %f %f %f",
89 &ttbin,&em0,&em1,&em2,&em3,&em4,&had0,&had1,&had2,&had3);
90 if(nread != 10)
continue;
91 wmap[ttbin]=std::vector<float>{had0,had1,had2,had3};
98 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
99 spec->extend(
"HVScaleCorr",
"blob");
100 spec->extend<
unsigned>(
"version");
103 attrList[
"version"].setValue(0U);
113 float *pHV=
static_cast<float*
>(hvBlob.startingAddress());
114 std::vector<float> vScale;
121 unsigned nFilledIds=0;
122 unsigned nTotalIds=0;
123 for (
unsigned i=0;
i < hashMax; ++
i) {
127 const std::vector<Identifier> &cellIds=
m_scidTool->superCellToOfflineID(scId);
128 if (cellIds.empty()) {
129 ATH_MSG_ERROR(
"Got empty vector of cell ids for super cell id 0x"
131 return StatusCode::FAILURE;
143 if(wsum>0.) hvcorr /= wsum;
147 pHV[onlSCID->
channel_Hash(cablingSC->createSignalChannelID(scId))]=hvcorr;
156 coll->
add(0,attrList);
158 ATH_MSG_INFO(
"Total number of SuperCells:" << nTotalIds <<
", filled:" << nFilledIds);
163 writeHandle.addDependency (fullRange);
164 writeHandle.addDependency(hvHdl);
165 writeHandle.addDependency(cablingHdl);
166 writeHandle.addDependency(cablingHdlSC);
168 auto scHvCorr = std::make_unique<LArHVCorr>(std::move(vScale), cablingSC, calosccellID);
169 if (writeHandle.record(std::move(scHvCorr)).isFailure()) {
171 <<
" with EventRange " << writeHandle.getRange() <<
" into Conditions Store");
172 return StatusCode::FAILURE;
174 ATH_MSG_INFO(
"Recorded new " << writeHandle.key() <<
" with range " << writeHandle.getRange() <<
" into Conditions Store");
176 if(
detStore()->symLink(scHvCorr.get(), imscale).isFailure()) {
177 ATH_MSG_WARNING(
"Could not symlink " << writeHandle.key() <<
" to ILArHVScaleCorr");
180 return StatusCode::SUCCESS;
185 int reg = hecID->
region(
id);
189 case -2:
if(reg==0) ttbin=-16-
eta;
else ttbin=-27-2*
eta;
if(ttbin==-33) ttbin=-32;
break;
190 case 2:
if(reg==0) ttbin=15+
eta;
else ttbin=25+2*
eta;
192 if(ttbin!=0 && wmap.find(ttbin) != wmap.end()){
194 return wmap[ttbin][hecID->
sampling(
id)];
def retrieve(aClass, aKey=None)
virtual StatusCode initialize() override
virtual StatusCode stop() override
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
LArHVCorrToSCHVCorr(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
int eta(const Identifier id) const
return eta [0,9] outer part [0,3] inner part
ToolHandle< ICaloSuperCellIDTool > m_scidTool
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
Scalar eta() const
pseudorapidity method
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
value_type get_compact() const
Get the compact id.
Helper class for LArHEC offline identifiers.
SG::ReadCondHandleKey< ILArHVScaleCorr > m_contKey
const std::string & key() const
Return the StoreGate ID for the referenced object.
bool empty() const
Test if the key is blank.
This class is a collection of AttributeLists where each one is associated with a channel number....
Defines a common ERRORCODE enum for LAr-Calibration objects.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
StringProperty m_weightsName
Helper class for offline supercell identifiers.
::StatusCode StatusCode
StatusCode definition for legacy code.
StringProperty m_folderName
Helper class for offline supercell identifiers.
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
#define CHECK(...)
Evaluate an expression and check for errors.
bool is_lar_hec(Identifier id) const
size_type channelHashMax(void) const
Define channel hash tables max size.
Helpers for checking error return status codes and reporting errors.
StatusCode initialize(bool used=true)
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,...
float getWeight(const LArHEC_ID *hecID, const Identifier &id, std::map< int, std::vector< float > > &wmap)
#define ATH_MSG_WARNING(x)
int sampling(const Identifier id) const
return sampling [0,3] (only 0 for supercells)
int pos_neg(const Identifier id) const
return pos_neg -2 (C side) or 2 (A side)
virtual const float & HVScaleCorr(const HWIdentifier &id) const =0
SG::WriteCondHandleKey< LArHVCorr > m_outKey
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
int region(const Identifier id) const
return region [0,1]
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size