|
ATLAS Offline Software
|
Go to the documentation of this file.
25 #include "Gaudi/Property.h"
26 #include "GaudiKernel/IToolSvc.h"
40 #include "CoralBase/Blob.h"
47 m_em_idhelper(nullptr),
48 m_hec_idhelper(nullptr),
49 m_fcal_idhelper(nullptr),
50 m_online_idhelper(nullptr),
51 m_sem_idhelper(nullptr),
52 m_shec_idhelper(nullptr),
53 m_sfcal_idhelper(nullptr),
54 m_sonline_idhelper(nullptr),
55 m_scell_idhelper(nullptr)
82 return StatusCode::SUCCESS;
88 return StatusCode::SUCCESS;
96 case 1:
return fix1();
102 return StatusCode::FAILURE;
108 return StatusCode::FAILURE;
112 default:
return StatusCode::SUCCESS;
126 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
127 spec->extend(
"Pedestal",
"blob");
128 spec->extend(
"PedestalRMS",
"blob");
129 spec->extend<
unsigned>(
"version");
136 (*attrList)[
"version"].setValue(0U);
139 blobPed.resize(hashMax*
sizeof(
float));
140 blobRMS.resize(hashMax*
sizeof(
float));
141 float* pblobPed=
static_cast<float*
>(blobPed.startingAddress());
142 float* pblobRMS=
static_cast<float*
>(blobRMS.startingAddress());
144 for (
unsigned hs=0;
hs<hashMax;++
hs) {
153 collPed->add(
gain,*attrList);
156 if (
sc.isFailure()) {
157 ATH_MSG_ERROR(
"Failed to record CondAttrListCollection for pedestal " );
168 spec =
new coral::AttributeListSpecification();
169 spec->extend(
"RampVec",
"blob");
170 spec->extend<
unsigned>(
"nPoints");
171 spec->extend<
unsigned>(
"version");
175 std::vector<float> defaultRamp={0.0,1.0};
181 for (
unsigned hs=0;
hs<hashMax && nPoints==0;++
hs) {
184 nPoints=rampref.size();
188 return StatusCode::FAILURE;
191 defaultRamp.resize(nPoints,0.0);
192 ATH_MSG_DEBUG(
"Gain " <<
gain <<
": Found a ramp polynom of degree " << nPoints <<
" in input data" );
194 (*attrList)[
"version"].setValue(0U);
196 (*attrList)[
"nPoints"].setValue(nPoints);
197 blobRamp.resize(hashMax*
sizeof(
float)*nPoints);
198 float* pblobRamp=
static_cast<float*
>(blobRamp.startingAddress());
200 for (
unsigned hs=0;
hs<hashMax;++
hs) {
204 if (rampVec.size()>=nPoints) {
205 for (
size_t i=0;
i<nPoints;++
i) {
211 message <<
"Polynom degree doesn't match. Expect " << nPoints <<
", got " << rampVec.size() <<
".";
212 for (
size_t i=0;
i<nPoints;++
i) {
213 pblobRamp[nPoints*
hs+
i]=defaultRamp[
i];
219 coll->add(
gain,*attrList);
221 sc=
detStore()->record(coll,
"/LAR/ElecCalibMCSC/Ramp");
222 if (
sc.isFailure()) {
223 ATH_MSG_ERROR(
"Failed to record CondAttrListCollection for ramp " );
224 return StatusCode::FAILURE;
227 ATH_MSG_INFO(
"Converted Ramps to inline storage. Total number of channels " <<
n );
228 ATH_MSG_INFO(
"Number of channels filled with default ramp {0,1} " << nDefault <<
" (including disconnected)" );
230 return StatusCode::SUCCESS;
239 coral::AttributeListSpecification* spec_calib =
new coral::AttributeListSpecification();
240 spec_calib->extend(
"OnlineHashToCalibIds",
"blob");
241 spec_calib->extend<
unsigned>(
"version");
244 (*al_calib)[
"version"].setValue(0U);
245 blobCalib.resize(onlHashMax*
sizeof(
uint32_t)*5);
248 spec_calib->release();
249 spec_calib =
nullptr;
255 std::vector<unsigned> calibHist(17,0);
256 unsigned calibHistMax=0;
258 std::ofstream
outfile(
"SCIdentifiers.txt");
260 outfile <<
"hash id bec pn FT SL chan id calo pn sampl reg eta phi calib" << std::endl;
262 for (
uint32_t onlHash=0;onlHash<onlHashMax;++onlHash) {
265 const std::vector<HWIdentifier>& calibIDs_tmp=
cl->calibSlotLine(hwid);
266 std::vector<HWIdentifier> calibIDs;
267 for (
unsigned i=0;
i<calibIDs_tmp.size(); ++
i) {
268 if(
std::find(calibIDs.begin(), calibIDs.end(), calibIDs_tmp[
i]) == calibIDs.end()) calibIDs.push_back(calibIDs_tmp[
i]);
272 if (
cabling->isOnlineConnected(hwid)) {
273 *
id=
cabling->cnvToIdentifier(hwid);
280 const size_t nCalibLines=calibIDs.size();
281 if (nCalibLines > calibHistMax ) calibHistMax=nCalibLines;
282 if(calibHistMax > 17) {
283 ATH_MSG_ERROR(
"Too much calib lines, adjust please !!!" << calibHistMax);
284 return StatusCode::FAILURE;
286 (calibHist[nCalibLines])++;
287 pBlobCalib[calibIndex++]=nCalibLines;
288 for(
uint32_t iCalib=0;iCalib<nCalibLines;++iCalib)
289 pBlobCalib[calibIndex++]=calibIDs[iCalib].get_identifier32().get_compact();
292 blobCalib.resize(calibIndex*
sizeof(
uint32_t));
299 msg(MSG::INFO) <<
"nCalib[i] ";
300 for (
unsigned j=0;j<17;++j)
301 msg() << calibHist[j] <<
"/";
306 return StatusCode::SUCCESS;
310 const Identifier *
id, std::vector<HWIdentifier>* calibIDs, std::ostream&
out) {
314 << onlineID->
pos_neg(hwid) <<
" "
316 << onlineID->
slot(hwid) <<
" "
317 << onlineID->
channel(hwid) <<
" : ";
319 out << std::hex <<
"0x" <<
id->get_identifier32().get_compact() << std::dec <<
" "
321 << caloCellID->
pos_neg(*
id) <<
" "
323 << caloCellID->
region(*
id) <<
" "
324 << caloCellID->
eta(*
id) <<
" "
325 << caloCellID->
phi(*
id) <<
" ";
328 out <<
" disconnected ";
331 for (
size_t i=0;
i<calibIDs->size();++
i) {
332 out << std::hex <<
"0x" << calibIDs->at(
i).get_identifier32().get_compact() <<
" ";
337 out << std::dec << std::endl;
def retrieve(aClass, aKey=None)
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
int region(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
std::string find(const std::string &s)
return a remapped string
const LArHEC_ID * m_hec_idhelper
virtual ~FixLArElecSCCalib()
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
const CaloCell_SuperCell_ID * m_scell_idhelper
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
const std::string & key() const
Return the StoreGate ID for the referenced object.
virtual StatusCode initialize() override
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
This class is a collection of AttributeLists where each one is associated with a channel number....
StatusCode fix2(const LArOnOffIdMapping *cabling, const LArCalibLineMapping *cl)
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
value_type get_compact(void) const
Get the compact id.
const LArHEC_SuperCell_ID * m_shec_idhelper
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
::StatusCode StatusCode
StatusCode definition for legacy code.
Helper base class for offline cell identifiers.
const LArEM_SuperCell_ID * m_sem_idhelper
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
Helper class for offline supercell identifiers.
int eta(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
#define CHECK(...)
Evaluate an expression and check for errors.
const LArEM_ID * m_em_idhelper
Helper for the Liquid Argon Calorimeter cell identifiers.
virtual StatusCode execute() override
void print(const HWIdentifier &hwid, const LArOnlineID_Base *onlineID, const CaloCell_Base_ID *caloCellID, const Identifier *id=nullptr, std::vector< HWIdentifier > *calibIDs=nullptr, std::ostream &out=std::cout)
FixLArElecSCCalib(const std::string &name, ISvcLocator *pSvcLocator)
size_type channelHashMax(void) const
Define channel hash tables max size.
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKeySC
StatusCode initialize(bool used=true)
int phi(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
virtual RampRef_t ADC2DAC(const HWIdentifier &CellID, int gain) const
const LArFCAL_SuperCell_ID * m_sfcal_idhelper
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
std::vector< value_type > asVector() const
Convert back to a vector.
const LArFCAL_ID * m_fcal_idhelper
const LArOnlineID * m_online_idhelper
Identifier32 get_identifier32(void) const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Helper base class for offline cell identifiers.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
virtual StatusCode stop() override
Proxy for accessing a range of float values like a vector.
const LArOnline_SuperCellID * m_sonline_idhelper