141 const int Trig_b7(7);
143 bool physicRun = (l1TriggerType == 0) || (((l1TriggerType >> Trig_b7) & 1) == 1);
146 ATH_MSG_DEBUG(
"Calibration Event found => skip filling histograms.");
147 return StatusCode::SUCCESS;
164 uint32_t nBunches(0);
167 ctpDecoder.
setRDO(ctpRdoContainer.
get());
168 nBunches = ctpRdoContainer->getNumberOfBunches();
171 short l1aBunch = ctpRdoContainer->getL1AcceptBunchPosition();
173 const CTP_BC & bunch = ctpBunchCrossings[l1aBunch];
179 const std::bitset<512> currentTBP(bunch.
getTBP());
180 for (
size_t counter = 0; counter <
m_ctpID.size(); ++counter) {
181 if (
m_ctpID[counter] < 0)
continue;
182 if (currentTBP.test(
m_ctpID[counter])) {
183 hasTBP[counter] =
true;
185 ++triggerMultiplicityA;
187 ++triggerMultiplicityC;
192 fill(
"TileTriggerMultiplicityMBTSA", l1aBCID, triggerMultiplicityA);
193 fill(
"TileTriggerMultiplicityMBTSC", l1aBCID, triggerMultiplicityC);
194 fill(
"TileTriggerMultiplicityPerSideMBTS", triggerMultiplicityA, triggerMultiplicityC);
196 std::vector<int> triggerTypes;
197 std::vector<int> triggerCounters;
198 std::vector<int> triggerInWindowCounters;
199 std::vector<int> deltaBCIDs;
203 for (
const CTP_BC& ctpBunchCrossing : ctpBunchCrossings) {
204 bcid = ctpBunchCrossing.getBCID();
206 int deltaBCID = l1aBCID - bcid;
208 std::vector<std::reference_wrapper<const std::bitset<512>>> triggers;
209 triggers.push_back(ctpBunchCrossing.getTBP());
210 triggers.push_back(ctpBunchCrossing.getTAP());
211 triggers.push_back(ctpBunchCrossing.getTAV());
214 for (
const std::bitset<512>& currentTrigger : triggers) {
215 triggerTypes.clear();
216 triggerCounters.clear();
217 triggerInWindowCounters.clear();
220 for (
size_t counter = 0; counter <
m_ctpID.size(); ++counter) {
221 if (
m_ctpID[counter] < 0)
continue;
222 if (currentTrigger.test(
m_ctpID[counter])) {
223 triggerInWindowCounters.push_back(counter);
226 deltaBCIDs.push_back(deltaBCID);
229 if (bcid == l1aBCID) {
230 triggerCounters.push_back(counter);
231 int mbtsType = counter / 8;
235 triggerTypes.push_back(mbtsType);
236 triggerTypes.push_back(counter < 16 ? 2 : 5);
247 if (bcid == l1aBCID) {
254 std::vector<int> coincidentTriggers1;
255 std::vector<int> coincidentTriggers2;
256 for (
int counter1 : triggerCounters) {
257 for (
int counter2 : triggerCounters) {
258 coincidentTriggers1.push_back(counter1);
259 coincidentTriggers2.push_back(counter2);
276 std::vector<float> energyCounters;
280 std::vector<float> energies;
284 std::vector<float> timeCounters;
287 std::vector<float> times;
290 std::vector<float> triggerEnergies;
293 std::vector<float> triggerTimes;
296 std::vector<int> energyHitCounters;
297 std::vector<int> triggerHitCounters;
302 for (
const TileCell* cell : *mbtsContainer) {
314 energyCounters.push_back(counter);
316 double energy = cell->energy();
318 energies.push_back(energy);
320 double time = cell->time();
323 float quality = cell->quality();
326 <<
", energy= " << energy <<
" pCb"
327 <<
", time= " << time
328 <<
", quality= " << quality);
338 if (hasTBP[counter]) {
339 monEfficiency = 1.0F;
340 triggerHitCounters.push_back(counter);
341 triggerEnergies.push_back(energy);
342 triggerTimes.push_back(time);
353 timeCounters.push_back(counter);
354 times.push_back(time);
356 energyHitCounters.push_back(counter);
362 if (std::abs(time) > 10e-4) {
376 fill(
"TileOccupancyMBTS", monHitCounter);
377 fill(
"TileEnergySummaryMBTS", monEnergyCounter, monSummaryEnergy);
379 fill(
"TileTimeSummaryMBTS", monTimeCounter, monSummaryTime);
383 fill(
"TileTriggerOccupancyMBTS", monTriggerHitCounter);
384 fill(
"TileTriggerEnergySummaryMBTS", monTriggerHitCounter, monTriggerSummaryEnergy);
385 fill(
"TileTriggerTimeSummaryMBTS", monTriggerHitCounter, monTriggerSummaryTime);
391 fill(
"TileTimeMBTSA", monTimeA);
397 fill(
"TileTimeMBTSC", monTimeC);
400 if (nHitsA > 0 && nHitsC > 0) {
401 double timeDifference = timeA - timeC;
403 fill(
"TileTimeDifferenceMBTS", monTimeDifference);
404 fill(
"TileTimeDifferenceMBTSLB", lumiBlock, monTimeDifference);
408 std::vector<int> coincidentCounters1;
411 std::vector<int> coincidentCounters2;
414 for (
int counter1 : energyHitCounters) {
415 for (
int counter2 : energyHitCounters) {
416 coincidentCounters1.push_back(counter1);
417 coincidentCounters2.push_back(counter2);
421 fill(
"TileCoincidentHitsMBTS", monCoincidentCounters1, monCoincidentCounters2);
423 std::vector<int> errors;
426 std::vector<int> counters;
475 fill(
"TileErrorsMBTS", monErrorCounters, monErrors);
486 if (digitsCollection->empty())
continue;
487 HWIdentifier adc_id = digitsCollection->front()->adc_HWID();
493 if (MBTSchannel >= 0) {
494 for (
const TileDigits* tile_digits: *digitsCollection) {
496 adc_id = tile_digits->adc_HWID();
498 if (channel == MBTSchannel) {
501 double sampleMean = 0;
502 double sampleRMS = 0;
504 std::vector<float> samples = tile_digits->samples();
505 unsigned int nSamples = samples.size();
508 for (
float sample : samples) {
509 sampleMean += sample;
510 sampleRMS += sample * sample;
513 auto min_max = std::minmax_element(samples.begin(), samples.end());
514 float minSample = *min_max.first;
515 float maxSample = *min_max.second;
517 if ((maxSample - minSample) > 10) {
521 std::vector<int> sampleNumbers;
522 sampleNumbers.reserve(nSamples);
523 for (
unsigned int i = 0; i < nSamples; ++i) sampleNumbers.push_back(i);
527 if (hasTBP[counter]) {
532 sampleMean /= nSamples;
533 sampleRMS = sampleRMS / nSamples - sampleMean * sampleMean;
534 sampleRMS = (sampleRMS > 0.0 && nSamples > 1u) ? sqrt(sampleRMS * nSamples / (nSamples - 1u)) : 0.0;
539 monPedestal = samples.front();
550 return StatusCode::SUCCESS;