Skip to content

Commit d5c05d4

Browse files
noferinishahor02
authored andcommitted
flag also TOF noisy channel in diagnostic
1 parent 5e980ac commit d5c05d4

6 files changed

Lines changed: 29 additions & 12 deletions

File tree

DataFormats/Detectors/TOF/include/DataFormatsTOF/Diagnostic.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ class Diagnostic
3636
int getFrequency(ULong64_t pattern); // Get frequency
3737
int getFrequencyROW() { return getFrequency(0); } // Readout window frequency
3838
int getFrequencyEmptyCrate(int crate) { return getFrequency(getEmptyCrateKey(crate)); } // empty crate frequency
39+
int fillNoisy(int channel, int frequency = 1) { return fill(getNoisyChannelKey(channel), frequency); }
3940
int fillROW() { return fill(0); }
4041
int fillEmptyCrate(int crate, int frequency = 1) { return fill(getEmptyCrateKey(crate), frequency); }
41-
ULong64_t getEmptyCrateKey(int crate);
42+
static ULong64_t getEmptyCrateKey(int crate);
43+
static ULong64_t getNoisyChannelKey(int channel);
4244
void print() const;
4345
void clear() { mVector.clear(); }
4446
void fill(const Diagnostic& diag); // for calibration

DataFormats/Detectors/TOF/src/Diagnostic.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ ULong64_t Diagnostic::getEmptyCrateKey(int crate)
7474
return key;
7575
}
7676

77+
ULong64_t Diagnostic::getNoisyChannelKey(int channel)
78+
{
79+
ULong64_t key = (ULong64_t(12) << 32) + channel; // slot=12 means noisy channels
80+
return key;
81+
}
82+
7783
void Diagnostic::fill(const Diagnostic& diag)
7884
{
7985
LOG(DEBUG) << "Filling diagnostic word";

Detectors/TOF/base/include/TOFBase/WindowFiller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class WindowFiller
9494
bool mFutureToBeSorted = false;
9595

9696
// only needed from Decoder
97-
int mMaskNoiseRate = -1;
97+
int mMaskNoiseRate = -999999999;
9898
int mChannelCounts[o2::tof::Geo::NCHANNELS]; // count of channel hits in the current TF (if MaskNoiseRate enabled)
9999

100100
// digit info

Detectors/TOF/base/src/WindowFiller.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,4 +477,17 @@ void WindowFiller::fillDiagnosticFrequency()
477477
}
478478
}
479479
}
480+
481+
// fill also noise diagnostic if the counts within the TF is larger than a threashold (default >=11, -> 1 kHZ)
482+
int masknoise = mMaskNoiseRate;
483+
if (masknoise < 0) {
484+
masknoise = -masknoise;
485+
}
486+
487+
for (int i = 0; i < Geo::NCHANNELS; i++) {
488+
if (mChannelCounts[i] >= masknoise) {
489+
//Fill noisy in diagnostic
490+
mDiagnosticFrequency.fillNoisy(i);
491+
}
492+
}
480493
}

Detectors/TOF/reconstruction/src/Decoder.cxx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ bool Decoder::close()
114114
void Decoder::clear()
115115
{
116116
reset();
117-
if (mMaskNoiseRate > 0) {
118-
clearCounts();
119-
}
117+
clearCounts();
120118

121119
mPatterns.clear();
122120
mCratePatterns.clear();
@@ -140,9 +138,7 @@ void Decoder::InsertDigit(int icrate, int itrm, int itdc, int ichain, int channe
140138
return;
141139
}
142140

143-
if (mMaskNoiseRate > 0) {
144-
mChannelCounts[digitInfo.channel]++;
145-
}
141+
mChannelCounts[digitInfo.channel]++;
146142

147143
mHitDecoded++;
148144

@@ -204,9 +200,7 @@ void Decoder::readTRM(int icru, int icrate, uint32_t orbit, uint16_t bunchid)
204200
continue;
205201
}
206202

207-
if (mMaskNoiseRate > 0) {
208-
mChannelCounts[digitInfo.channel]++;
209-
}
203+
mChannelCounts[digitInfo.channel]++;
210204

211205
mHitDecoded++;
212206

Detectors/TOF/workflow/src/CompressedDecodingTask.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ void CompressedDecodingTask::init(InitContext& ic)
4848

4949
if (mMaskNoise) {
5050
mDecoder.maskNoiseRate(mNoiseRate);
51+
} else {
52+
mDecoder.maskNoiseRate(-mNoiseRate); // negative means -> flag but not filter
5153
}
5254

5355
auto finishFunction = [this]() {
@@ -420,7 +422,7 @@ DataProcessorSpec getCompressedDecodingSpec(const std::string& inputDesc, bool c
420422
Options{
421423
{"row-filter", VariantType::Bool, false, {"Filter empty row"}},
422424
{"mask-noise", VariantType::Bool, false, {"Flag to mask noisy digits"}},
423-
{"noise-counts", VariantType::Int, 1000, {"Counts in a single (TF) payload"}}}};
425+
{"noise-counts", VariantType::Int, 11, {"Counts in a single (TF) payload"}}}};
424426
}
425427

426428
} // namespace tof

0 commit comments

Comments
 (0)