28 ATH_MSG_DEBUG(
"MBTS monitoring, handle validity " << mbtsbits.isValid());
30 if (!mbtsbits.isValid()) {
32 return StatusCode::SUCCESS;
35 if (mbtsbits->size() == 0) {
36 return StatusCode::SUCCESS;
41 std::bitset<32> triggerWord;
42 std::bitset<32> timeWord;
43 static constexpr std::bitset<32>
mask = 0xFFFFFFFF;
48 static constexpr
double timeCut = 10
e-4;
49 static constexpr
double energyCut = 60. / 222.;
52 if (not trigDecTool->isPassed(trig, TrigDefs::requireDecision)) {
62 auto energyWeightedTime_A =
Scalar<float>(
"MBTS_A_EWTime", 0.);
63 auto energyWeightedTime_C =
Scalar<float>(
"MBTS_C_EWTime", 0.);
71 fill(
"MBTSall", TrigCounts);
74 const auto mbts_itr = mbtsbits->front();
77 const auto& mbtsHitEnergies = mbts_itr->triggerEnergies();
80 const auto& mbtsHitTimes = mbts_itr->triggerTimes();
82 ATH_MSG_DEBUG(
"MBTS hits times container size: " << mbtsHitTimes.size());
84 if (mbtsHitTimes.size() != 32)
86 "MBTS Cell Times are stored incorrectly. The array should have 32 elements (24 should be filled).");
87 if (mbtsHitEnergies.size() != 32)
89 "MBTS Cell Energies are stored incorrectly. The array should have 32 elements (24 should be filled).");
93 mbtsTime = mbtsHitTimes.at(
i);
94 mbtsEnergy = mbtsHitEnergies.at(
i);
96 if (mbtsEnergy > energyCut) {
100 if (std::abs(mbtsTime) > timeCut) {
104 if (not(triggerWord[
i] and timeWord[
i])) {
108 ATH_MSG_DEBUG(
"MBTS channelID=" << channelID <<
", mbtsEnergy=" << mbtsEnergy <<
", mbtsTime=" << mbtsTime);
109 fill(trig +
"_shifter", channelID, mbtsTime, mbtsEnergy);
112 energyMean_A += mbtsHitEnergies.at(
i);
113 timeMean_A += mbtsHitTimes.at(
i);
114 energyWeightedTime_A += mbtsHitEnergies.at(
i) * mbtsHitTimes.at(
i);
118 energyMean_C += mbtsHitEnergies.at(
i);
119 timeMean_C += mbtsHitTimes.at(
i);
120 energyWeightedTime_C += mbtsHitEnergies.at(
i) * mbtsHitTimes.at(
i);
126 if (ebaCounters > 0) {
127 energyMean_A /= ebaCounters;
128 timeMean_A /= ebaCounters;
130 if (energyMean_A > 0) {
131 energyWeightedTime_A /= energyMean_A * ebaCounters;
134 ATH_MSG_DEBUG(
"Side A energyMean_A=" << energyMean_A <<
", timeMean_A=" << timeMean_A
135 <<
", energyWeightedTime_A=" << energyWeightedTime_A);
137 fill(trig +
"_expert", energyMean_A, timeMean_A);
139 energyWeightedTime_A = -999;
142 if (ebcCounters > 0) {
143 energyMean_C /= ebcCounters;
144 timeMean_C /= ebcCounters;
146 if (energyMean_C > 0) {
147 energyWeightedTime_C /= energyMean_C * ebcCounters;
150 ATH_MSG_DEBUG(
"Side C energyMean_C=" << energyMean_C <<
", timeMean_C=" << timeMean_C
151 <<
", energyWeightedTime_C=" << energyWeightedTime_C);
153 fill(trig +
"_expert", energyMean_C, timeMean_C);
155 energyWeightedTime_C = -999;
158 timeWord &= triggerWord;
160 const std::bitset<8> InnerEbaBitset((triggerWord & timeWord &
mask).to_ulong());
161 const std::bitset<8> OuterEbaBitset((((triggerWord & timeWord) >> 8) &
mask).to_ulong());
162 const std::bitset<8> InnerEbcBitset((((triggerWord & timeWord) >> 16) &
mask).to_ulong());
163 const std::bitset<8> OuterEbcBitset((((triggerWord & timeWord) >> 24) &
mask).to_ulong());
165 const auto sideA_hits = InnerEbaBitset.count() + OuterEbaBitset.count();
166 const auto sideC_hits = InnerEbcBitset.count() + OuterEbcBitset.count();
168 auto MBTS_A_hits =
Scalar<int>(
"MBTS_A_hits", sideA_hits);
169 auto MBTS_C_hits =
Scalar<int>(
"MBTS_C_hits", sideC_hits);
170 auto MBTS_diff_timeMean =
Scalar<float>(
"MBTS_diff_timeMean", timeMean_A - timeMean_C);
171 auto MBTS_diff_weightedTimeMean =
172 Scalar<float>(
"MBTS_diff_weightedTimeMean", energyWeightedTime_A - energyWeightedTime_C);
174 fill(trig +
"_shifter", MBTS_A_hits, MBTS_C_hits, energyWeightedTime_A, energyWeightedTime_C, MBTS_diff_timeMean,
175 MBTS_diff_weightedTimeMean);
178 return StatusCode::SUCCESS;