From 64b66608572856fcd972ec2bb868c3ad6acb2120 Mon Sep 17 00:00:00 2001 From: kochebina Date: Wed, 6 Dec 2023 17:39:06 +0100 Subject: [PATCH] IntrinsicResolution GainVariance as option --- source/digits_hits/include/GateIntrinsicResolution.hh | 4 ++++ .../include/GateIntrinsicResolutionMessenger.hh | 2 +- source/digits_hits/src/GateIntrinsicResolution.cc | 3 ++- .../src/GateIntrinsicResolutionMessenger.cc | 11 ++++++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/source/digits_hits/include/GateIntrinsicResolution.hh b/source/digits_hits/include/GateIntrinsicResolution.hh index 3781cbb7c..0e81c1d16 100755 --- a/source/digits_hits/include/GateIntrinsicResolution.hh +++ b/source/digits_hits/include/GateIntrinsicResolution.hh @@ -58,6 +58,8 @@ public: //! Apply an unique quantum efficiency for all the channels void SetUniqueQE(G4double val) { m_uniqueQE = val; }; + void SetVariance(G4double val) { m_variance = val; }; + void CreateTable(); void CheckVolumeName(G4String val); @@ -72,6 +74,8 @@ protected: G4double m_QE; //Quantum efficiency G4bool isFirstEvent; + G4double m_variance; + G4double m_uniqueQE; //!< Value of the quantum efficiency if it's unique G4int m_nbFiles; //!< Number of file(s) used for creating the lookout table std::vector m_file; //!< Vector which contains the name(s) of the file(s) for the lookout table diff --git a/source/digits_hits/include/GateIntrinsicResolutionMessenger.hh b/source/digits_hits/include/GateIntrinsicResolutionMessenger.hh index eabde5295..0c260dbfc 100755 --- a/source/digits_hits/include/GateIntrinsicResolutionMessenger.hh +++ b/source/digits_hits/include/GateIntrinsicResolutionMessenger.hh @@ -53,7 +53,7 @@ private: G4UIcmdWithADouble *coeffTECmd; G4UIcmdWithAString *newFileQECmd; G4UIcmdWithADouble *uniqueQECmd; - + G4UIcmdWithADouble *varianceCmd; }; diff --git a/source/digits_hits/src/GateIntrinsicResolution.cc b/source/digits_hits/src/GateIntrinsicResolution.cc index 9d9b0747f..5bb5a4cf5 100755 --- a/source/digits_hits/src/GateIntrinsicResolution.cc +++ b/source/digits_hits/src/GateIntrinsicResolution.cc @@ -58,6 +58,7 @@ GateIntrinsicResolution::GateIntrinsicResolution(GateSinglesDigitizer *digitizer m_LY(1), m_TE(1), m_QE(1), + m_variance(0.1), isFirstEvent(true), m_outputDigi(0), m_OutputDigiCollection(0), @@ -179,7 +180,7 @@ void GateIntrinsicResolution::Digitize() G4double Nph = energy*m_LY*m_TE*m_QE;//*XtalkpCent GND TODO; G4double Ri = m_resolution * sqrt((m_Eref / energy)); - G4double resol = sqrt((1.1/Nph)*(GateConstants::fwhm_to_sigma*GateConstants::fwhm_to_sigma) + Ri*Ri); + G4double resol = sqrt((1+m_variance/Nph)*(GateConstants::fwhm_to_sigma*GateConstants::fwhm_to_sigma) + Ri*Ri); m_outputDigi->SetEnergy(G4RandGauss::shoot(energy,(resol * energy)/GateConstants::fwhm_to_sigma)); diff --git a/source/digits_hits/src/GateIntrinsicResolutionMessenger.cc b/source/digits_hits/src/GateIntrinsicResolutionMessenger.cc index 7cc75d066..11955a82f 100755 --- a/source/digits_hits/src/GateIntrinsicResolutionMessenger.cc +++ b/source/digits_hits/src/GateIntrinsicResolutionMessenger.cc @@ -58,6 +58,11 @@ GateIntrinsicResolutionMessenger::GateIntrinsicResolutionMessenger (GateIntrinsi cmdName = GetDirectoryName() + "setUniqueQE"; uniqueQECmd = new G4UIcmdWithADouble(cmdName,this); uniqueQECmd->SetGuidance("Set an unique quantum efficiency"); + + cmdName = GetDirectoryName() + "setGainVariance"; + varianceCmd = new G4UIcmdWithADouble(cmdName,this); + varianceCmd->SetGuidance("Set an unique quantum efficiency"); + } @@ -69,6 +74,7 @@ GateIntrinsicResolutionMessenger::~GateIntrinsicResolutionMessenger() delete coeffTECmd; delete newFileQECmd; delete uniqueQECmd; + delete varianceCmd; } @@ -98,7 +104,10 @@ void GateIntrinsicResolutionMessenger::SetNewValue(G4UIcommand * aCommand,G4Stri { m_IntrinsicResolution->SetUniqueQE(uniqueQECmd->GetNewDoubleValue(newValue)); } - + else if ( aCommand==varianceCmd ) + { + m_IntrinsicResolution->SetVariance(varianceCmd->GetNewDoubleValue(newValue)); + } else { GateClockDependentMessenger::SetNewValue(aCommand,newValue);