14#ifndef ALICEO2_ITSMFT_TIMEDEADMAP_H
15#define ALICEO2_ITSMFT_TIMEDEADMAP_H
33 TimeDeadMap(std::map<
unsigned long, std::vector<uint16_t>>& deadmap)
35 mEvolvingDeadMap.swap(deadmap);
43 void fillMap(
unsigned long firstOrbit,
const std::vector<uint16_t>& deadVect)
45 mEvolvingDeadMap[firstOrbit] = deadVect;
48 void fillMap(
const std::vector<uint16_t>& deadVect)
50 mStaticDeadMap = deadVect;
55 mEvolvingDeadMap.clear();
56 mStaticDeadMap.clear();
61 if (mMAP_VERSION ==
"3") {
62 LOG(error) <<
"Trying to decode static part of deadmap version " << mMAP_VERSION <<
". Not implemented, doing nothing.";
65 for (
int iel = 0; iel < mStaticDeadMap.size(); iel++) {
66 uint16_t
w = mStaticDeadMap[iel];
69 for (
int w2 = (
w & 0x7FFF) + 1; w2 < mStaticDeadMap.at(iel + 1); w2++) {
79 if (mMAP_VERSION !=
"3" && mMAP_VERSION !=
"4") {
80 LOG(error) <<
"Trying to decode time-dependent deadmap version " << mMAP_VERSION <<
". Not implemented, doing nothing.";
84 if (mEvolvingDeadMap.empty()) {
85 LOG(warning) <<
"Time-dependent dead map is empty. Doing nothing.";
89 std::vector<uint16_t> closestVec;
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.";
98 if (includeStaticMap && mMAP_VERSION !=
"3") {
99 closestVec.insert(closestVec.end(), mStaticDeadMap.begin(), mStaticDeadMap.end());
104 for (
int iel = 0; iel < closestVec.size(); iel++) {
105 uint16_t
w = closestVec.at(iel);
108 for (
int w2 = (
w & 0x7FFF) + 1; w2 < closestVec.at(iel + 1); w2++) {
121 std::vector<unsigned long> keys;
122 std::transform(mEvolvingDeadMap.begin(), mEvolvingDeadMap.end(), std::back_inserter(keys),
123 [](
const auto& O) { return O.first; });
127 void getStaticMap(std::vector<uint16_t>& mmap) { mmap = mStaticDeadMap; };
131 if (mEvolvingDeadMap.empty()) {
132 LOG(warning) <<
"Requested orbit " <<
orbit <<
"from an empty time-dependent map. Doing nothing";
135 auto closest = mEvolvingDeadMap.upper_bound(
orbit);
136 if (closest != mEvolvingDeadMap.begin()) {
138 mmap = closest->second;
139 return (
long)
orbit - closest->first;
141 mmap = mEvolvingDeadMap.begin()->second;
142 return (
long)(
orbit)-mEvolvingDeadMap.begin()->first;
152 bool mIsDefaultObject =
false;
153 std::string mMAP_VERSION =
"3";
154 std::map<unsigned long, std::vector<uint16_t>> mEvolvingDeadMap;
155 std::vector<uint16_t> mStaticDeadMap;
NoiseMap class for the ITS and MFT.
void maskFullChip(int chip, bool cleanNoisyPixels=false)
void fillMap(const std::vector< uint16_t > &deadVect)
TimeDeadMap(std::map< unsigned long, std::vector< uint16_t > > &deadmap)
void fillMap(unsigned long firstOrbit, const std::vector< uint16_t > &deadVect)
void setMapVersion(std::string version)
long getMapAtOrbit(unsigned long orbit, std::vector< uint16_t > &mmap)
unsigned long getEvolvingMapSize() const
void decodeMap(unsigned long orbit, o2::itsmft::NoiseMap &noisemap, bool includeStaticMap=true, long orbitGapAllowed=330000)
TimeDeadMap()=default
Constructor.
~TimeDeadMap()=default
Destructor.
void setAsDefault(bool isdef=true)
void getStaticMap(std::vector< uint16_t > &mmap)
void decodeMap(o2::itsmft::NoiseMap &noisemap)
std::string getMapVersion() const
std::vector< unsigned long > getEvolvingMapKeys()
GLubyte GLubyte GLubyte GLubyte w
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"