From d76a634e699437a58b2cff4c79d5de438b433305 Mon Sep 17 00:00:00 2001 From: Apar Agarwal <a.agarwal@vecc.gov.in> Date: Sat, 2 Dec 2023 05:49:54 +0000 Subject: [PATCH] To implement correct digitization on the side boundary pads for both GEM and RPC Earlier the pads on one edge of the frame used to be under estimated on one side while they were overestimated on the opposite side. This problem should now be rectified by taking into account the special case of module boundaries. Add special case of pad size being smaller than the spot radius --- sim/detectors/much/CbmMuchDigitizeGem.cxx | 50 ++++++++++++++++++----- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/sim/detectors/much/CbmMuchDigitizeGem.cxx b/sim/detectors/much/CbmMuchDigitizeGem.cxx index 853b8b923a..b537f78bef 100644 --- a/sim/detectors/much/CbmMuchDigitizeGem.cxx +++ b/sim/detectors/much/CbmMuchDigitizeGem.cxx @@ -1,6 +1,6 @@ /* Copyright (C) 2009-2021 St. Petersburg Polytechnic University, St. Petersburg SPDX-License-Identifier: GPL-3.0-only - Authors: Vikas Singhal, Ekata Nandy, Volker Friese, Evgeny Kryshen [committer] */ + Authors: Apar Agarwal, Vikas Singhal, Ekata Nandy, Volker Friese, Evgeny Kryshen [committer] */ /** CbmMuchDigitizeGem.cxx *@author Vikas Singhal <vikas@vecc.gov.in> @@ -1145,15 +1145,45 @@ Double_t CbmMuchDigitizeGem::GetNPrimaryElectronsPerCm(const CbmMuchPoint* point } // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- -Bool_t CbmMuchDigitizeGem::AddCharge(CbmMuchSectorRadial* s, UInt_t ne, Int_t /*iPoint*/, Double_t /*time*/, - Double_t /*driftTime*/, Double_t phi1, Double_t phi2) -{ - CbmMuchPadRadial* pad1 = s->GetPadByPhi(phi1); - if (!pad1) return kFALSE; - //assert(pad1); has to check if any pad address is NULL - CbmMuchPadRadial* pad2 = s->GetPadByPhi(phi2); - if (!pad2) return kFALSE; - //assert(pad2); has to check if any pad address is NULL +Bool_t CbmMuchDigitizeGem::AddCharge(CbmMuchSectorRadial *s, UInt_t ne, + Int_t /*iPoint*/, Double_t /*time*/, + Double_t /*driftTime*/, Double_t phi1, + Double_t phi2) { + CbmMuchPadRadial *pad1 = s->GetPadByPhi(phi1); + if (!pad1) + pad1 = s->GetPadByPhi( + (phi1 + phi2) / 2.0); // This condition helps us deal with boundary pads + else // Special case if pad size is smaller than spot radius + { + for (Double_t phi = phi1; phi < (phi1 + phi2) / 2.0; + phi += 0.1) // This may potentially slow down the code + { + pad1 = s->GetPadByPhi(phi); + if (pad1) + break; + } + } + if (!pad1) + return kFALSE; + // assert(pad1); has to check if any pad address is NULL + CbmMuchPadRadial *pad2 = s->GetPadByPhi(phi2); + if (!pad2) + pad2 = s->GetPadByPhi( + (phi1 + phi2) / 2.0); // This condition helps us deal with boundary pads + else // Special case if pad size is smaller than spot radius + { + for (Double_t phi = phi2; phi > (phi1 + phi2) / 2.0; + phi -= 0.1) // This may potentially slow down the code + { + pad2 = s->GetPadByPhi(phi); + if (pad2) + break; + } + } + + if (!pad2) + return kFALSE; + // assert(pad2); has to check if any pad address is NULL if (pad1 == pad2) { UInt_t address = pad1->GetAddress(); //Finding that if for the same address if already charge stored then add the charge. -- GitLab