114 {
116
117
118 bool validWriteCondHandle{true};
119
122 if (writeHandleData[i].
isValid()) {
123 ATH_MSG_DEBUG(
"CondHandle " << writeHandleData[i].fullKey() <<
" is already valid."
124 << ". In theory this should not be called, but may happen"
125 << " if multiple concurrent events are being processed out of order.");
126 } else {
127 validWriteCondHandle = false;
128 }
129 }
130 SG::WriteCondHandle<SCT_AllGoodStripInfo> writeHandleInfo{
m_writeKeyInfo, ctx};
131 if (writeHandleInfo.
isValid()) {
133 << ". In theory this should not be called, but may happen"
134 << " if multiple concurrent events are being processed out of order.");
135 } else {
136 validWriteCondHandle = false;
137 }
138 if (validWriteCondHandle) return StatusCode::SUCCESS;
139
140
142 const CondAttrListCollection* readCdo[
NFEATURES]{*readHandle[
GAIN], *readHandle[
NOISE]};
144 if (readCdo[i]==nullptr) {
145 ATH_MSG_FATAL(
"Null pointer to the read conditions object " << readHandle[i].
key());
146 return StatusCode::FAILURE;
147 }
148
151 ATH_MSG_INFO(
"Size of CondAttrListCollection " << readHandle[i].fullKey() <<
" readCdo->size()= " << readCdo[i]->size());
153 }
154
155
156 SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> sctDetEle{
m_SCTDetEleCollKey, ctx};
157 const InDetDD::SiDetectorElementCollection* elements{sctDetEle.
retrieve()};
158 if (elements==nullptr) {
160 return StatusCode::FAILURE;
161 }
164 }
166
167
168 std::unique_ptr<SCT_CalibDefectData> writeCdoData[
NFEATURES]{
nullptr,
nullptr};
170 writeCdoData[
i] = std::make_unique<SCT_CalibDefectData>();
171 }
172 std::unique_ptr<SCT_AllGoodStripInfo> writeCdoInfo{std::make_unique<SCT_AllGoodStripInfo>()};
173
176 (*writeCdoInfo)[
w][
s]=
true;
177 }
178 }
179
180
181
182 SCT_CalibDefectData::CalibModuleDefects theseDefects;
183
184
188 for (; itLoop!=itLoop_end; ++itLoop) {
190 const coral::AttributeList &anAttrList{(*itLoop).second};
191
192
194 IdentifierHash hashId0{
m_id_sct->wafer_hash(moduleId)};
195 IdentifierHash hashId1;
196 m_id_sct->get_other_side(hashId0, hashId1);
197
198
203
204
209
210
211 const std::string &gaindefectb{(anAttrList[
"defectBeginChannel"]).
data<std::string>()};
212 const std::string &gaindefecte{(anAttrList[
"defectEndChannel"]).
data<std::string>()};
214 const std::string &parValue{(anAttrList[
"defectParameter"]).
data<std::string>()};
215
216
217 std::vector<unsigned int> gaindefectbvec;
218 fillEmptyVectorFromString(gaindefectb, gaindefectbvec);
219 std::vector<unsigned int> gaindefectevec;
220 fillEmptyVectorFromString(gaindefecte, gaindefectevec);
221 std::vector<unsigned int> defectTypevec;
222 fillEmptyVectorFromString(defectType, defectTypevec);
223 std::vector<double> parValuevec;
224 fillEmptyVectorFromString(parValue, parValuevec);
225
226
227 long unsigned int gainvec_size{gaindefectbvec.size()};
228 for (
long unsigned int i{0};
i<gainvec_size; ++
i) {
229
231 ATH_MSG_DEBUG(
"Defect type " << defectTypevec[i] <<
" is not defined! This defect is ignored.");
232 } else {
234 theseDefects.
begDefects.push_back(gaindefectbvec[i]);
235 theseDefects.
endDefects.push_back(gaindefectevec[i]);
236 theseDefects.
parValue.push_back(coerceToFloatRange(parValuevec[i]));
237 }
238 }
239
241 for (
unsigned int i{0};
i<theseDefects.
begDefects.size(); ++
i) {
242
243 bool ignoreDefect{false};
244 unsigned int ig{0};
256 }
257 ig++;
258 }
259 if (not ignoreDefect) {
260
262
264 const unsigned int waferId0{hashId0};
267 thisWaferIsGoodData0[side0StripNumber] = false;
268 } else {
269 const unsigned int waferId1{hashId1};
272 thisWaferIsGoodData1[side1StripNumber] = false;
273 }
274 }
275 }
276 }
277 }
278
279
283 continue;
284 }
285 if (not (writeCdoData[i]->addModule(moduleId, theseDefects))) {
286 ATH_MSG_ERROR(
"Unable to add module " << moduleId <<
" to NPtGain defect map");
287 return StatusCode::RECOVERABLE;
288 } else {
289 ATH_MSG_DEBUG(
"Defects for module " << moduleId <<
" added to NPG defect map");
290 }
291 }
else if (i==
NOISE) {
293 ATH_MSG_DEBUG(
"No NoiseOccupancy defects for module " << moduleId);
294 continue;
295 }
296 if (not (writeCdoData[i]->addModule(moduleId, theseDefects))) {
297 ATH_MSG_ERROR(
"Unable to add module " << moduleId <<
" to NoiseOccupancy defect map");
298 return StatusCode::RECOVERABLE;
299 } else {
300 ATH_MSG_DEBUG(
"Defects for module " << moduleId <<
" added to NoiseOccupancy defect map");
301 }
302 }
303 }
304 }
305
306
307 ATH_MSG_DEBUG(
"There are " << writeCdoInfo->size() <<
" elements in " << writeHandleInfo.
key());
308 if (writeHandleInfo.
record(std::move(writeCdoInfo)).isFailure()) {
309 ATH_MSG_FATAL(
"Could not record SCT_AllGoodStripInfo " << writeHandleInfo.
key()
310 <<
" with EventRange " << writeHandleInfo.
getRange() <<
" into Conditions Store");
311 return StatusCode::FAILURE;
312 }
313 ATH_MSG_INFO(
"recorded new CDO " << writeHandleInfo.
key() <<
" with range " << writeHandleInfo.
getRange() <<
" into Conditions Store");
315 ATH_MSG_DEBUG(
"There are " << writeCdoData[i]->size() <<
" elements in " << writeHandleData[i].
key());
316 if (writeHandleData[i].record(std::move(writeCdoData[i])).isFailure()) {
317 ATH_MSG_FATAL(
"Could not record SCT_CalibDefectData " << writeHandleData[i].
key()
318 <<
" with EventRange " << writeHandleData[i].
getRange() <<
" into Conditions Store");
319 return StatusCode::FAILURE;
320 }
321 ATH_MSG_INFO(
"recorded new CDO " << writeHandleData[i].
key() <<
" with range " << writeHandleData[i].
getRange() <<
" into Conditions Store");
322 }
323
324 return StatusCode::SUCCESS;
325}
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
char data[hepevt_bytes_allocation_ATLAS]
std::array< bool, SCT_ConditionsData::STRIPS_PER_WAFER > SCT_WaferGoodStripInfo
Class for data object used in SCT_ReadCalibDataCondAlg and SCT_AllGoodStripInfo.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
bool swapPhiReadoutDirection() const
Determine if readout direction between online and offline needs swapping.
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyNoise
SG::WriteCondHandleKey< SCT_AllGoodStripInfo > m_writeKeyInfo
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
SG::WriteCondHandleKey< SCT_CalibDefectData > m_writeKeyNoise
const SCT_ID * m_id_sct
Handle to SCT ID helper.
SG::WriteCondHandleKey< SCT_CalibDefectData > m_writeKeyGain
std::map< int, std::string > m_defectMapIntToString
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyGain
const_pointer_type retrieve()
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
void getRange(TH1D *s, int imax, double frac, int &lowerbin, int &upperbin, double &lowerfrac, double &upperfrac)
std::vector< std::string > typeOfDefect
std::vector< unsigned int > begDefects
std::vector< unsigned int > endDefects
std::vector< float > parValue