Skip to content

Commit

Permalink
Merge pull request #654 from OpenGATE/IRnewOption
Browse files Browse the repository at this point in the history
IntrinsicResolution GainVariance as option
  • Loading branch information
kochebina authored Dec 8, 2023
2 parents 1b9f024 + 92198d0 commit c2ae546
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 4 additions & 0 deletions source/digits_hits/include/GateIntrinsicResolution.hh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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);
Expand All @@ -76,6 +78,8 @@ protected:
G4double m_XtalkpCent;
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<G4String> m_file; //!< Vector which contains the name(s) of the file(s) for the lookout table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ private:
G4UIcmdWithADouble *coeffTECmd;
G4UIcmdWithAString *newFileQECmd;
G4UIcmdWithADouble *uniqueQECmd;

G4UIcmdWithADouble *varianceCmd;

G4UIcmdWithADouble *edgesFractionCmd;
G4UIcmdWithADouble *cornersFractionCmd;

Expand Down
3 changes: 2 additions & 1 deletion source/digits_hits/src/GateIntrinsicResolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ GateIntrinsicResolution::GateIntrinsicResolution(GateSinglesDigitizer *digitizer
m_LY(1),
m_TE(1),
m_QE(1),
m_variance(0.1),
m_edgesCrosstalkFraction(0),
m_cornersCrosstalkFraction(0),
isFirstEvent(true),
Expand Down Expand Up @@ -167,7 +168,7 @@ void GateIntrinsicResolution::Digitize()
G4double Nph = energy*m_LY*m_TE*m_QE*m_XtalkpCent;
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));

Expand Down
17 changes: 14 additions & 3 deletions source/digits_hits/src/GateIntrinsicResolutionMessenger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,21 @@ GateIntrinsicResolutionMessenger::GateIntrinsicResolutionMessenger (GateIntrinsi
uniqueQECmd = new G4UIcmdWithADouble(cmdName,this);
uniqueQECmd->SetGuidance("Set an unique quantum efficiency");

cmdName = GetDirectoryName() + "setEdgesFraction";

cmdName = GetDirectoryName() + "setGainVariance";
varianceCmd = new G4UIcmdWithADouble(cmdName,this);
varianceCmd->SetGuidance("Set an unique quantum efficiency");


cmdName = GetDirectoryName() + "setXtalkEdgesFraction";
edgesFractionCmd = new G4UIcmdWithADouble(cmdName,this);
edgesFractionCmd->SetGuidance("Set the fraction of energy which leaves on each edge crystal");

cmdName = GetDirectoryName() + "setCornersFraction";
cmdName = GetDirectoryName() + "setXtalkCornersFraction";
cornersFractionCmd = new G4UIcmdWithADouble(cmdName,this);
cornersFractionCmd->SetGuidance("Set the fraction of the energy which leaves on each corner crystal");


}


Expand All @@ -78,6 +85,7 @@ GateIntrinsicResolutionMessenger::~GateIntrinsicResolutionMessenger()
delete coeffTECmd;
delete newFileQECmd;
delete uniqueQECmd;
delete varianceCmd;
delete edgesFractionCmd;
delete cornersFractionCmd;
}
Expand Down Expand Up @@ -109,6 +117,10 @@ void GateIntrinsicResolutionMessenger::SetNewValue(G4UIcommand * aCommand,G4Stri
{
m_IntrinsicResolution->SetUniqueQE(uniqueQECmd->GetNewDoubleValue(newValue));
}
else if ( aCommand==varianceCmd )
{
m_IntrinsicResolution->SetVariance(varianceCmd->GetNewDoubleValue(newValue));
}
else if (aCommand ==edgesFractionCmd)
{
m_IntrinsicResolution->SetEdgesFraction (edgesFractionCmd->GetNewDoubleValue(newValue));
Expand All @@ -117,7 +129,6 @@ void GateIntrinsicResolutionMessenger::SetNewValue(G4UIcommand * aCommand,G4Stri
{
m_IntrinsicResolution->SetCornersFraction (cornersFractionCmd->GetNewDoubleValue(newValue));
}

else
{
GateClockDependentMessenger::SetNewValue(aCommand,newValue);
Expand Down

0 comments on commit c2ae546

Please sign in to comment.