From 9b22d000c891d8a508b766afefe4c1ee17892f5b Mon Sep 17 00:00:00 2001 From: Arvind Khuntia Date: Tue, 5 Sep 2023 16:04:18 +0200 Subject: [PATCH 1/2] [FDD] TCM trgeer signals added to Simulation --- .../FIT/FDD/simulation/src/Digitizer.cxx | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/Detectors/FIT/FDD/simulation/src/Digitizer.cxx b/Detectors/FIT/FDD/simulation/src/Digitizer.cxx index c8be105263fdc..6551c31ed02a6 100644 --- a/Detectors/FIT/FDD/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/FDD/simulation/src/Digitizer.cxx @@ -192,25 +192,51 @@ void Digitizer::storeBC(const BCCache& bc, o2::dataformats::MCTruthContainer& labels) { // LOG(info) << "Storing BC " << bc; - int first = digitsCh.size(), nStored = 0; + float totalChargeA = 0, totalChargeC = 0; + int n_hit_A = 0, n_hit_C = 0, total_time_A = 0, total_time_C = 0; + bool nChCside = 8; for (int ic = 0; ic < Nchannels; ic++) { float chargeADC = integrateCharge(bc.pulse[ic]); + int cfdTime = int(simulateTimeCFD(bc.pulse[ic])); + if (chargeADC != 0) { + if (ic < nChCside) { + totalChargeC += chargeADC; + total_time_C += cfdTime; + n_hit_C++; + } else { + totalChargeA += chargeADC; + total_time_A += cfdTime; + n_hit_A++; + } uint8_t channelBits = parameters.defaultFEEbits; if (std::rand() % 2) { ChannelData::setFlag(ChannelData::kNumberADC, channelBits); } - digitsCh.emplace_back(ic, int(simulateTimeCFD(bc.pulse[ic])), int(chargeADC), channelBits); + digitsCh.emplace_back(ic, cfdTime, int(chargeADC), channelBits); nStored++; } } - // bc.print(); - + //SET TRIGGERS + Bool_t is_A, is_C, isVertex, is_Central, is_SemiCentral = 0; + is_A = n_hit_A > 0; + is_C = n_hit_C > 0; + uint32_t amplA = is_A ? totalChargeA * 0.125 : -5000; // sum amplitude A side / 8 (hardware) + uint32_t amplC = is_C ? totalChargeC * 0.125 : -5000; // sum amplitude C side / 8 (hardware) + int timeA = is_A ? total_time_A / n_hit_A : -5000; // average time A side + int timeC = is_C ? total_time_C / n_hit_C : -5000; // average time C side + isVertex = is_A && is_C; + + bool isLaser = false; + bool isOutputsAreBlocked = false; + bool isDataValid = true; + mTriggers.setTriggers(is_A, is_C, isVertex, is_Central, is_SemiCentral, int8_t(n_hit_A), int8_t(n_hit_C), + amplA, amplC, timeA, timeC, isLaser, isOutputsAreBlocked, isDataValid); if (nStored != 0) { int nBC = digitsBC.size(); digitsBC.emplace_back(first, nStored, bc, mTriggers); - digitsTrig.emplace_back(bc, 0, 0, 0, 0, 0); + digitsTrig.emplace_back(bc, is_A, is_C, isVertex, is_Central, is_SemiCentral); for (const auto& lbl : bc.labels) { labels.addElement(nBC, lbl); From 5ffc533dae2bc49daaaa99facf88c2cbe4614084 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 5 Sep 2023 14:08:58 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- Detectors/FIT/FDD/simulation/src/Digitizer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/FIT/FDD/simulation/src/Digitizer.cxx b/Detectors/FIT/FDD/simulation/src/Digitizer.cxx index 6551c31ed02a6..adb056792d8e4 100644 --- a/Detectors/FIT/FDD/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/FDD/simulation/src/Digitizer.cxx @@ -218,7 +218,7 @@ void Digitizer::storeBC(const BCCache& bc, nStored++; } } - //SET TRIGGERS + // SET TRIGGERS Bool_t is_A, is_C, isVertex, is_Central, is_SemiCentral = 0; is_A = n_hit_A > 0; is_C = n_hit_C > 0;