Skip to content

Commit

Permalink
Add option forceMinSecDifferenceToZero in CoinSorter for prototype te…
Browse files Browse the repository at this point in the history
…stbench simus
  • Loading branch information
kochebina committed Jul 18, 2023
1 parent d3530b2 commit e0c643d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
15 changes: 12 additions & 3 deletions source/digits_hits/include/GateCoincidenceSorter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,15 @@ public:
//! Set the minimum sector difference for valid coincidences
inline void SetMinSectorDifference(G4int diff)
{ m_minSectorDifference = diff; }

//! Get the depth of the system-level for coincidences

//! Get the force to 0 minimum sector difference for valid coincidences
inline G4bool GetForcedTo0MinSectorDifference() const
{ return m_forceMinSecDifferenceToZero; }
//! Set the force to 0 minimum sector difference for valid coincidences
inline void SetForcedTo0MinSectorDifference(G4bool diff)
{ m_forceMinSecDifferenceToZero = diff; }

//! Get the depth of the system-level for coincidences
inline G4int GetDepth() const
{ return m_depth; }
//! Set the depth of the system-level for coincidences
Expand Down Expand Up @@ -192,10 +199,12 @@ protected:
private:
//! \name Work storage variable
//@{

G4bool m_forceMinSecDifferenceToZero;

std::list<GateDigi*> m_presortBuffer; // incoming digis are presorted and buffered
G4int m_presortBufferSize;
G4bool m_presortWarning; // avoid repeat warnings

bool m_CCSorter; // compton camera sorter
G4bool m_triggerOnlyByAbsorber; //! Is the window only open by digis generated in the absorber ?
G4String m_absorberSD;// absorber "SD' volume name CC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private:
G4UIcmdWithADoubleAndUnit *windowJitterCmd; //!< the UI command 'setWindowJitter'
G4UIcmdWithADoubleAndUnit *offsetJitterCmd; //!< the UI command 'setOffsetJitter'
G4UIcmdWithAnInteger *minSectorDiffCmd; //!< the UI command 'minSectorDifference'
G4UIcmdWithABool *forceMinSectorDiffCmd;
G4UIcmdWithAnInteger *setDepthCmd; //!< the UI command 'setDepth'
G4UIcmdWithAnInteger *setPresortBufferSizeCmd; //!< the UI command 'setPresortBufferSize'
G4UIcmdWithAString *SetInputNameCmd; //!< The UI command "set input name"
Expand Down
8 changes: 5 additions & 3 deletions source/digits_hits/src/GateCoincidenceSorter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ GateCoincidenceSorter::GateCoincidenceSorter(GateDigitizerMgr* itsDigitizerMgr,
m_offset(0.),
m_offsetJitter(0.),
m_minSectorDifference(2),
m_forceMinSecDifferenceToZero(false),
m_multiplesPolicy(kKeepIfAllAreGoods),
m_allDigiOpenCoincGate(false),
m_depth(1),
Expand Down Expand Up @@ -693,9 +694,10 @@ G4bool GateCoincidenceSorter::IsForbiddenCoincidence(const GateDigi* digi1, cons
if (sectorDiff2<0)
sectorDiff2 += sectorNumber;
G4int sectorDifference = std::min(sectorDiff1,sectorDiff2);

//G4cout<<sectorDifference<<G4endl;

//Compare the sector difference with the minimum differences for valid coincidences
if (sectorDifference<m_minSectorDifference) {
if (sectorDifference<m_minSectorDifference && !m_forceMinSecDifferenceToZero) {
if (nVerboseLevel>1)
G4cout << "[GateCoincidenceSorter::IsForbiddenCoincidence]: coincidence between neighbor blocks --> refused\n";
return true;
Expand All @@ -719,7 +721,7 @@ G4bool GateCoincidenceSorter::IsForbiddenCoincidence(const GateDigi* digi1, cons
G4int sectorDifference = std::min(sectorDiff1,sectorDiff2);

//Compare the sector difference with the minimum differences for valid coincidences
if (sectorDifference<m_minSectorDifference) {
if (sectorDifference<m_minSectorDifference && !m_forceMinSecDifferenceToZero) {
if (nVerboseLevel>1)
G4cout << "[GateCoincidenceSorter::IsForbiddenCoincidence]: coincidence between neighbour blocks --> refused\n";
return true;
Expand Down
10 changes: 9 additions & 1 deletion source/digits_hits/src/GateCoincidenceSorterMessenger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ GateCoincidenceSorterMessenger::GateCoincidenceSorterMessenger(GateCoincidenceSo
minSectorDiffCmd->SetParameterName("diff",false);
minSectorDiffCmd->SetRange("diff>=1");

cmdName = GetDirectoryName()+"forceMinSecDifferenceToZero";
forceMinSectorDiffCmd = new G4UIcmdWithABool(cmdName,this);
forceMinSectorDiffCmd->SetGuidance("Force the minimum sector difference for valid coincidences to 0: specsific case for prototype testbench simulations.");
forceMinSectorDiffCmd->SetParameterName("ForceDiff0",false);


cmdName = GetDirectoryName()+"setDepth";
setDepthCmd = new G4UIcmdWithAnInteger(cmdName.c_str(),this);
setDepthCmd->SetGuidance("Set the depth of system-level for coincidences.");
Expand Down Expand Up @@ -111,7 +117,7 @@ GateCoincidenceSorterMessenger::~GateCoincidenceSorterMessenger()
delete SetTriggerOnlyByAbsorberCmd;
delete SetAcceptancePolicy4CCCmd;
delete SetEventIDCoincCmd;

delete forceMinSectorDiffCmd;
}


Expand All @@ -125,6 +131,8 @@ void GateCoincidenceSorterMessenger::SetNewValue(G4UIcommand* aCommand, G4String
{ m_CoincidenceSorter->SetOffset(offsetCmd->GetNewDoubleValue(newValue)); }
else if( aCommand == offsetJitterCmd )
{ m_CoincidenceSorter->SetOffsetJitter(offsetJitterCmd->GetNewDoubleValue(newValue)); }
else if( aCommand == forceMinSectorDiffCmd )
{ m_CoincidenceSorter->SetForcedTo0MinSectorDifference(forceMinSectorDiffCmd->GetNewBoolValue(newValue)); }
else if( aCommand == minSectorDiffCmd )
{ m_CoincidenceSorter->SetMinSectorDifference(minSectorDiffCmd->GetNewIntValue(newValue)); }
else if( aCommand == setDepthCmd )
Expand Down

0 comments on commit e0c643d

Please sign in to comment.