16 bool is_nan(
const T&
val) {
20 enum ResponseCurveFit{NO_CURVE=0, POLYNOMIAL, GRILLO, EXPONENTIAL,
LINEAR, N_FUNCS};
22 float responseCurve(
const float param0,
const float param1,
const float param2,
const float vthreshold,
const unsigned int rcFunc) {
23 float result{std::numeric_limits<float>::quiet_NaN()};
27 result = (vthreshold - param0)/param1;
31 if ((vthreshold - param2)!=0) {
32 float err2{param0/(vthreshold-param2)-1.0
f};
40 float err3{param1*(1.0f-((vthreshold-param0)/param2))};
42 result = (vthreshold-param0)/err3;
48 result = (-param1 + std::sqrt((param1*param1)-(4.0*param2*(param0-vthreshold)))) / 2.0*param2;
60 void parseResponseCurveArguments(
float*
p,
const std::string&
arguments) {
69 const std::string chipFolderName{
"/SCT/DAQ/Configuration/Chip"};
87 return StatusCode::SUCCESS;
96 if (writeHandle.isValid()) {
97 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
98 <<
". In theory this should not be called, but may happen"
99 <<
" if multiple concurrent events are being processed out of order.");
100 return StatusCode::SUCCESS;
106 if (readCdo==
nullptr) {
108 return StatusCode::FAILURE;
111 writeHandle.addDependency(readHandle);
112 ATH_MSG_INFO(
"Size of CondAttrListVec " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
113 ATH_MSG_INFO(
"Range of input is " << readHandle.getRange());
116 std::unique_ptr<SCT_CondParameterData> writeCdo{std::make_unique<SCT_CondParameterData>()};
119 static const unsigned int nChipsPerModule{12};
120 static const unsigned int nChipsPerSide{6};
121 static const float mVperDacBit{2.5};
124 for (; modItr != modEnd; modItr += nChipsPerModule) {
126 const unsigned int truncatedSerialNumber{modItr->first - 1};
128 if (not moduleHash.is_valid())
continue;
135 std::vector<SCT_Chip*> chipsInMod;
136 chipsInMod.reserve(nChipsPerSide);
139 for (; channelItr != channelEnd; ++channelItr) {
142 float vthr{mVperDacBit * channelItr->second[10].data<
short>()};
143 short rcFunctionIndex{channelItr->second[15].data<
short>()};
144 const std::string &rcArgumentString{channelItr->second[16].data<std::string>()};
145 parseResponseCurveArguments(
parameters, rcArgumentString);
148 chipsum+=femtoCoulombThreshold;
150 float moduleAverage{chipsum/nChipsPerSide};
156 if (writeHandle.record(std::move(writeCdo)).isFailure()) {
157 ATH_MSG_FATAL(
"Could not record SCT_CondParameterData " << writeHandle.key()
158 <<
" with EventRange " << writeHandle.getRange()
159 <<
" into Conditions Store");
160 return StatusCode::FAILURE;
162 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.key() <<
" with range " << writeHandle.getRange() <<
" into Conditions Store");
164 return StatusCode::SUCCESS;
170 return StatusCode::SUCCESS;