Skip to content

Commit 2da1d8b

Browse files
noferinishahor02
authored andcommitted
fix in TOF diagnostic words
1 parent cfb8410 commit 2da1d8b

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,24 @@ class Diagnostic
4141
int fillEmptyCrate(int crate, int frequency = 1) { return fill(getEmptyCrateKey(crate), frequency); }
4242
static ULong64_t getEmptyCrateKey(int crate);
4343
static ULong64_t getNoisyChannelKey(int channel);
44+
static ULong64_t getTRMKey(int crate, int trm);
4445
void print() const;
4546
void clear() { mVector.clear(); }
4647
void fill(const Diagnostic& diag); // for calibration
4748
void fill(const gsl::span<const o2::tof::Diagnostic>){}; // for calibration
4849
void merge(const Diagnostic* prev);
50+
unsigned long size() const { return mVector.size(); }
51+
ULong64_t getPattern(int i) const
52+
{
53+
auto iter = mVector.begin();
54+
for (; i-- > 0;) {
55+
iter++;
56+
}
57+
return iter->first;
58+
}
59+
int getSlot(ULong64_t pattern) const;
60+
int getCrate(ULong64_t pattern) const;
61+
int getChannel(ULong64_t pattern) const;
4962

5063
private:
5164
std::map<ULong64_t, uint32_t> mVector; // diagnostic frequency vector (key/pattern , frequency)

DataFormats/Detectors/TOF/src/Diagnostic.cxx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,40 @@ void Diagnostic::print() const
7070

7171
ULong64_t Diagnostic::getEmptyCrateKey(int crate)
7272
{
73-
ULong64_t key = (ULong64_t(11) << 32) + (ULong64_t(crate) << 36); // slot=11 means empty crate
73+
ULong64_t key = (ULong64_t(13) << 32) + (ULong64_t(crate) << 36); // slot=13 means empty crate
7474
return key;
7575
}
7676

7777
ULong64_t Diagnostic::getNoisyChannelKey(int channel)
7878
{
79-
ULong64_t key = (ULong64_t(12) << 32) + channel; // slot=12 means noisy channels
79+
ULong64_t key = (ULong64_t(14) << 32) + channel; // slot=14 means noisy channels
8080
return key;
8181
}
8282

83+
ULong64_t Diagnostic::getTRMKey(int crate, int trm)
84+
{
85+
ULong64_t key = (ULong64_t(trm) << 32) + (ULong64_t(crate) << 36);
86+
return key;
87+
}
88+
89+
int Diagnostic::getSlot(ULong64_t pattern) const
90+
{
91+
return (pattern & 68719476735) / 4294967296;
92+
}
93+
94+
int Diagnostic::getCrate(ULong64_t pattern) const
95+
{
96+
return (pattern & 8796093022207) / 68719476736;
97+
}
98+
99+
int Diagnostic::getChannel(ULong64_t pattern) const
100+
{
101+
if (getSlot(pattern) == 14 && getCrate(pattern) == 0 && pattern != 0) {
102+
return (pattern & 262143);
103+
}
104+
return -1;
105+
}
106+
83107
void Diagnostic::fill(const Diagnostic& diag)
84108
{
85109
LOG(DEBUG) << "Filling diagnostic word";

Detectors/TOF/base/src/WindowFiller.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ void WindowFiller::fillDiagnosticFrequency()
464464
for (int dd = fd; dd < lastdia; dd++) {
465465
if (mPatterns[dd] >= 28) {
466466
slot = mPatterns[dd] - 28;
467-
key = (ULong64_t(slot) << 32) + (ULong64_t(ic) << 36);
467+
key = mDiagnosticFrequency.getTRMKey(ic, slot);
468468
continue;
469469
}
470470

0 commit comments

Comments
 (0)