ATLAS Offline Software
Run2ChargeCalibParser.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
9 #include "PixelConditionsData/PixelChargeCalibUtils.h" //for getBecAndLayer
10 
11 
12 
13 namespace{
14  constexpr size_t FEStringSize{21};
15 } // namespace
16 
19 
20 namespace PixelChargeCalib{
21  ChargeCalibrationBundle
22  Run2ChargeCalibParser::parseImpl(unsigned int moduleHash, const std::string & data){
23  IdentifierHash wafer_hash = IdentifierHash(moduleHash);
24  const InDetDD::SiDetectorElement *element = m_elements->getDetectorElement(wafer_hash);
25  const auto & [numChips, technology] = PixelChargeCalib::numChipsAndTechnology(element);
26  //
27  std::stringstream ss(data);
28  std::vector<std::string> component;
29  std::string buffer;
30  std::getline(ss, buffer, '\n'); // skip first line
31  while (std::getline(ss, buffer, '\n')) { component.push_back(buffer); }
32  const size_t numFE = component.size();
33  if (numFE != numChips){
34  std::cout << "Warning that the number of chips in the DB string and the number of chips according to readout technology are not equal\n";
35  }
36  //
38  //
39  // loop over FEs
40  for (size_t i{}; i < numFE; i++) {
41  std::stringstream checkFE(component[i]);
42  std::vector<std::string> FEString;
43  while (std::getline(checkFE, buffer, ' ')) { FEString.push_back(buffer); }
44 
45  if (FEString.size() < FEStringSize) {
46  b.isValid=false;
47  return b;
48  }
49 
50  auto getInt = getFunc<int>(FEString);
51  auto getFloat = getFunc<float>(FEString);
52  //
53  b.threshold.emplace_back(getInt(1), getInt(2), getInt(3), getInt(4));
54  b.thresholdLong.emplace_back(getInt(5), getInt(6), getInt(7), getInt(8));
55  b.thresholdGanged.emplace_back(getInt(9), getInt(10), getInt(11), getInt(12));
56  b.params.emplace_back(getFloat(13), getFloat(14), getFloat(15));
57  b.paramsGanged.emplace_back(getFloat(16), getFloat(17), getFloat(18));
58  b.totRes.emplace_back(getFloat(19), getFloat(20));
59 
60  // Linear extrapolation above large charge
63  const auto & [barrel_ec, layer] = getBecAndLayer(m_pixelID, wafer_hash);
64  // search for ToT when charge exceeds threshold
65  int totlimit = -1;
66  int start = m_configData->getToTThreshold(barrel_ec,layer);
67  int end = m_configData->getFEI3Latency(barrel_ec,layer);
68  // Normal pixels
69  totlimit = b.idxAtChargeLimit(m_chargeLimit, InDetDD::PixelDiodeType::NORMAL, start, end);
70  b.insertLinearParams(InDetDD::PixelDiodeType::NORMAL, totlimit);
71  // Ganged pixels
72  totlimit = b.idxAtChargeLimit(m_chargeLimit, InDetDD::PixelDiodeType::GANGED, start, end);
73  b.insertLinearParams(InDetDD::PixelDiodeType::GANGED, totlimit);
74  } else {
75  b.lin.emplace_back(0.f, 0.f);
76  b.linGanged.emplace_back(0.f, 0.f);
77  }
78  }
79  return b;
80  }
81 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
PixelModuleData::getPIXLinearExtrapolation
bool getPIXLinearExtrapolation() const
Definition: PixelModuleData.cxx:332
PixelChargeCalib::Run2ChargeCalibParser::parseImpl
virtual ChargeCalibrationBundle parseImpl(unsigned int hash, const std::string &data) override final
Definition: Run2ChargeCalibParser.cxx:22
PixelChargeCalib::getBecAndLayer
std::pair< int, int > getBecAndLayer(const PixelID *pPixelId, IdentifierHash hash)
Definition: PixelChargeCalibUtils.cxx:13
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
Run2ChargeCalibParser.h
Parses a database run3 format string to a ChargeCalibrationBundle.
InDetDD::PixelReadoutTechnology::FEI3
@ FEI3
PixelChargeCalib::numChipsAndTechnology
std::pair< size_t, InDetDD::PixelReadoutTechnology > numChipsAndTechnology(const InDetDD::SiDetectorElement *element)
Definition: PixelChargeCalibUtils.cxx:19
InDetDD::PixelDiodeType::GANGED
@ GANGED
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
PixelModuleData::getToTThreshold
int getToTThreshold(int barrel_ec, int layer) const
Definition: PixelModuleData.cxx:107
PixelChargeCalibCondData::CalibrationStrategy::RUN3PIX
@ RUN3PIX
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
ChargeCalibrationBundle.h
Struct for holding vectors of charge calibration constants, with utility methods.
PixelChargeCalib::IChargeCalibrationParser::m_configData
const PixelModuleData * m_configData
Definition: IChargeCalibrationParser.h:51
hist_file_dump.f
f
Definition: hist_file_dump.py:135
PixelModuleData::getFEI3Latency
int getFEI3Latency(int barrel_ec, int layer) const
Definition: PixelModuleData.cxx:238
PixelChargeCalibUtils.h
PixelChargeCalib::IChargeCalibrationParser::m_chargeLimit
static constexpr float m_chargeLimit
If the calculated charge exceeds this limit, a linear extrapolation is used at this point.
Definition: IChargeCalibrationParser.h:55
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
PixelChargeCalib::IChargeCalibrationParser::m_elements
const InDetDD::SiDetectorElementCollection * m_elements
Definition: IChargeCalibrationParser.h:52
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SiDetectorElement.h
PixelChargeCalib::IChargeCalibrationParser::m_pixelID
const PixelID * m_pixelID
Definition: IChargeCalibrationParser.h:53
PixelModuleDesign.h
PixelChargeCalib
Definition: IChargeCalibrationParser.h:30
PixelModuleData.h
Store pixel constant parameters in PixelModuleData.
PixelChargeCalib::ChargeCalibrationBundle
bundles of parameters used together in the PixelChargeCalibCondAlg
Definition: ChargeCalibrationBundle.h:24
InDetDD::PixelDiodeType::NORMAL
@ NORMAL
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
InDetDD::SiDetectorElementCollection::getDetectorElement
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Definition: SiDetectorElementCollection.cxx:15