Skip to content

Commit fa06b8d

Browse files
authored
ITS efficiency maps protection for digitization out of range (#12889)
* ITS efficiency maps pretection for digitization out of range * ITS efficiency maps pretection for digitization out of range * ITS efficiency maps pretection for digitization out of range * typo in info message * sending message at EOR to infologger * fix formatting * fix * fix --------- Co-authored-by: Nicolo Valle <nicolo.valle@cern.ch>
1 parent b55b8bd commit fa06b8d

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

DataFormats/Detectors/ITSMFT/common/include/DataFormatsITSMFT/TimeDeadMap.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class TimeDeadMap
7373
}
7474
}
7575

76-
void decodeMap(unsigned long orbit, o2::itsmft::NoiseMap& noisemap, bool includeStaticMap = true)
77-
{ // for time-dependent and (optionally) static part
76+
void decodeMap(unsigned long orbit, o2::itsmft::NoiseMap& noisemap, bool includeStaticMap = true, long orbitGapAllowed = 330000)
77+
{ // for time-dependent and (optionally) static part. Use orbitGapAllowed = -1 to ignore check on orbit difference
7878

7979
if (mMAP_VERSION != "3" && mMAP_VERSION != "4") {
8080
LOG(error) << "Trying to decode time-dependent deadmap version " << mMAP_VERSION << ". Not implemented, doing nothing.";
@@ -84,14 +84,16 @@ class TimeDeadMap
8484
if (mEvolvingDeadMap.empty()) {
8585
LOG(warning) << "Time-dependent dead map is empty. Doing nothing.";
8686
return;
87-
} else if (orbit > mEvolvingDeadMap.rbegin()->first + 11000 * 300 || orbit < mEvolvingDeadMap.begin()->first - 11000 * 300) {
88-
// the map should not leave several minutes uncovered.
89-
LOG(warning) << "Time-dependent dead map: the requested orbit " << orbit << " seems to be out of the range stored in the map.";
9087
}
9188

9289
std::vector<uint16_t> closestVec;
9390
long dT = getMapAtOrbit(orbit, closestVec);
9491

92+
if (orbitGapAllowed >= 0 && std::abs(dT) > orbitGapAllowed) {
93+
LOG(warning) << "Requested orbit " << orbit << ", found " << orbit - dT << ". Orbit gap is too high, skipping time-dependent map.";
94+
closestVec.clear();
95+
}
96+
9597
// add static part if requested. something may be masked twice
9698
if (includeStaticMap && mMAP_VERSION != "3") {
9799
closestVec.insert(closestVec.end(), mStaticDeadMap.begin(), mStaticDeadMap.end());
@@ -125,18 +127,19 @@ class TimeDeadMap
125127
void getStaticMap(std::vector<uint16_t>& mmap) { mmap = mStaticDeadMap; };
126128

127129
long getMapAtOrbit(unsigned long orbit, std::vector<uint16_t>& mmap)
128-
{ // fills mmap and returns orbit - lower_bound
130+
{ // fills mmap and returns requested_orbit - found_orbit. Found orbit is the highest key lower or equal to the requested one
129131
if (mEvolvingDeadMap.empty()) {
130132
LOG(warning) << "Requested orbit " << orbit << "from an empty time-dependent map. Doing nothing";
131133
return (long)orbit;
132134
}
133135
auto closest = mEvolvingDeadMap.lower_bound(orbit);
134-
if (closest != mEvolvingDeadMap.end()) {
136+
if (closest != mEvolvingDeadMap.begin()) {
137+
--closest;
135138
mmap = closest->second;
136139
return (long)orbit - closest->first;
137140
} else {
138-
mmap = mEvolvingDeadMap.rbegin()->second;
139-
return (long)(orbit)-mEvolvingDeadMap.rbegin()->first;
141+
mmap = mEvolvingDeadMap.begin()->second;
142+
return (long)(orbit)-mEvolvingDeadMap.begin()->first;
140143
}
141144
}
142145

Detectors/ITSMFT/common/workflow/src/DeadMapBuilderSpec.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ void ITSMFTDeadMapBuilder::PrepareOutputCcdb(EndOfStreamContext* ec, std::string
269269

270270
if (ec != nullptr) {
271271

272-
LOG(info) << "Sending object " << info.getPath() << "/" << info.getFileName()
273-
<< "to ccdb-populator, of size " << image->size() << " bytes, valid for "
274-
<< info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp();
272+
LOG(important) << "Sending object " << info.getPath() << "/" << info.getFileName()
273+
<< "to ccdb-populator, of size " << image->size() << " bytes, valid for "
274+
<< info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp();
275275

276276
if (mRunMFT) {
277277
ec->outputs().snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, "TimeDeadMap", 1}, *image.get());
@@ -284,9 +284,9 @@ void ITSMFTDeadMapBuilder::PrepareOutputCcdb(EndOfStreamContext* ec, std::string
284284

285285
else if (!ccdburl.empty()) { // send from this workflow
286286

287-
LOG(info) << mSelfName << "sending object " << ccdburl << "/browse/" << info.getFileName()
288-
<< " of size " << image->size() << " bytes, valid for "
289-
<< info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp();
287+
LOG(important) << mSelfName << "sending object " << ccdburl << "/browse/" << info.getPath() << "/" << info.getFileName()
288+
<< " of size " << image->size() << " bytes, valid for "
289+
<< info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp();
290290

291291
o2::ccdb::CcdbApi mApi;
292292
mApi.init(ccdburl);
@@ -335,7 +335,7 @@ void ITSMFTDeadMapBuilder::stop()
335335
LOG(warning) << "endOfStream not processed. Sending output to ccdb from the " << detname << "deadmap builder workflow.";
336336
PrepareOutputCcdb(nullptr, mCCDBUrl);
337337
} else {
338-
LOG(warning) << "endOfStream not processed. Nothing forwarded as output.";
338+
LOG(alarm) << "endOfStream not processed. Nothing forwarded as output.";
339339
}
340340
isEnded = true;
341341
}

0 commit comments

Comments
 (0)