Skip to content

Commit

Permalink
Merge branch 'develop' into Oudihat-Radia-CoincidenceTimeDiffSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
Oudihat-Radia authored Sep 3, 2024
2 parents ab0b2b2 + 65825c2 commit 290224b
Show file tree
Hide file tree
Showing 30 changed files with 968 additions and 223 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
options: [none, rtk, torch, optic]
exclude:
- os: macos-latest
options: torch

env:
ROOT_VERSION: 'v6-26-08'
ROOT_VERSION: 'v6-32-02'
GEANT4_VERSION: 'v11.2.1'
ITK_VERSION: 'v5.3.0'
ROOT_DIR: $(HOME)/software/root
Expand All @@ -38,8 +41,8 @@ jobs:
uses: actions/cache@v3
with:
path: ~/software
key: ${{ matrix.os }}-geant4-${{ env.GEANT4_VERSION }}-root-${{ env.ROOT_VERSION }}-build4
restore-keys: ${{ matrix.os }}-geant4-${{ env.GEANT4_VERSION }}-root-${{ env.ROOT_VERSION }}-build4
key: ${{ matrix.os }}-geant4-${{ env.GEANT4_VERSION }}-root-${{ env.ROOT_VERSION }}-build1
restore-keys: ${{ matrix.os }}-geant4-${{ env.GEANT4_VERSION }}-root-${{ env.ROOT_VERSION }}-build1
- name: Install dependencies
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
Expand Down Expand Up @@ -129,8 +132,8 @@ jobs:
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.10.1%2Bcpu.zip
unzip libtorch-cxx11-abi-shared-with-deps-1.10.1+cpu.zip
elif [ "${{ matrix.os }}" == 'macos-latest' ]; then
wget https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.10.1.zip
unzip libtorch-macos-1.10.1.zip
wget https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-2.2.0.zip
unzip libtorch-macos-arm64-2.2.0.zip
fi
fi
if [ "${{ matrix.options }}" == 'rtk' ]; then
Expand Down
9 changes: 5 additions & 4 deletions docs/digitizer_and_detector_modeling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1417,10 +1417,11 @@ Here is an example of how to configure this in a macro file:
**Example** ::


/gate/digitizerMgr/CoincidenceDigitizer/finalCoinc/insert buffer
/gate/digitizerMgr/CoincidenceDigitizer/finalCoinc/buffer/setBufferSize 64 B
/gate/digitizerMgr/CoincidenceDigitizer/finalCoinc/buffer/setReadFrequency 10 MHz
/gate/digitizerMgr/CoincidenceDigitizer/finalCoinc/buffer/setMode 1
/gate/digitizerMgr/CoincidenceDigitizer/finalCoinc/insert buffer
/gate/digitizerMgr/CoincidenceDigitizer/finalCoinc/buffer/setBufferSize 64 B
/gate/digitizerMgr/CoincidenceDigitizer/finalCoinc/buffer/setReadFrequency 10 MHz
/gate/digitizerMgr/CoincidenceDigitizer/finalCoinc/buffer/setMode 1



For a coincidence sorter user can chose a presort buffer with a following command:
Expand Down
32 changes: 22 additions & 10 deletions source/digits_hits/include/GateCoincidenceBuffer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,35 @@ See LICENSE.md for further details
#include "G4ThreeVector.hh"

#include "GateVCoincidencePulseProcessor.hh"
#include "GateVDigitizerModule.hh"
#include "GateCoincidenceDigi.hh"
#include "GateClockDependent.hh"
#include "GateCrystalSD.hh"


#include "GateDigi.hh"
#include "GateCoincidenceBufferMessenger.hh"
#include "GateCoincidenceDigitizer.hh"
class GateCoincidenceBufferMessenger;


class GateCoincidenceBuffer : public GateVCoincidencePulseProcessor
class GateCoincidenceBuffer : public GateVDigitizerModule
{
public:
typedef unsigned long long int buffer_t;


void Digitize() override;

//! Destructor
virtual ~GateCoincidenceBuffer() ;
// virtual ~GateCoincidenceBuffer() ;


//! Constructs a new dead time attached to a GateDigitizer
GateCoincidenceBuffer(GateCoincidencePulseProcessorChain* itsChain,
const G4String& itsName);
//GateCoincidenceBuffer(GateCoincidencePulseProcessorChain* itsChain,
///const G4String& itsName);
GateCoincidenceBuffer(GateCoincidenceDigitizer *digitizer, G4String name);
~GateCoincidenceBuffer();

public:

void SetBufferSize(buffer_t val) { m_bufferSize = val;}
void SetReadFrequency(G4double val) { m_readFrequency = val;}
Expand All @@ -50,17 +59,20 @@ public:
protected:

/*! Implementation of the pure virtual method declared by the base class GateVCoincidencePulseProcessor*/
GateCoincidencePulse* ProcessPulse(GateCoincidencePulse* inputPulse,G4int iPulse);


private:
//GateCoincidencePulse* ProcessPulse(GateCoincidencePulse* inputPulse,G4int iPulse);
buffer_t m_bufferSize;
buffer_t m_bufferPos;
buffer_t m_oldClock;
G4double m_readFrequency;
// G4bool m_doModifyTime;
G4int m_mode;

private:

GateCoincidenceBufferMessenger *m_messenger; //!< Messenger
GateCoincidenceDigi* m_outputDigi;
GateCoincidenceDigiCollection* m_OutputDigiCollection;
GateCoincidenceDigitizer *m_digitizer;
};


Expand Down
10 changes: 7 additions & 3 deletions source/digits_hits/include/GateCoincidenceBufferMessenger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ See LICENSE.md for further details

#ifndef GateCoincidenceBufferMessenger_h
#define GateCoincidenceBufferMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"

#include "GatePulseProcessorMessenger.hh"
#include "GateClockDependentMessenger.hh"
//#include "GatePulseProcessorMessenger.hh"

class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
Expand All @@ -21,14 +24,15 @@ class GateCoincidenceBuffer;
class GateCoincidenceBufferMessenger: public GateClockDependentMessenger
{
public:
GateCoincidenceBufferMessenger(GateCoincidenceBuffer* itsBuffer);
GateCoincidenceBufferMessenger(GateCoincidenceBuffer*);
virtual ~GateCoincidenceBufferMessenger();

inline void SetNewValue(G4UIcommand* aCommand, G4String aString);

inline GateCoincidenceBuffer* GetBuffer(){ return (GateCoincidenceBuffer*) GetClockDependent(); }
//inline GateCoincidenceBuffer* GetBuffer(){ return (GateCoincidenceBuffer*) GetClockDependent(); }

private:
GateCoincidenceBuffer* m_CoincidenceBuffer;
G4UIcmdWithADoubleAndUnit *m_bufferSizeCmd; //!< set the dead time value
G4UIcmdWithADoubleAndUnit *m_readFrequencyCmd; //!< set the dead time mode
// G4UIcmdWithABool *m_modifyTimeCmd; //!< does buffer modify the time of pulses
Expand Down
36 changes: 22 additions & 14 deletions source/digits_hits/include/GateCoincidenceMultiplesKiller.hh
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
/*----------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
----------------------*/


#ifndef GateCoincidenceMultiplesKiller_h
#define GateCoincidenceMultiplesKiller_h 1

#include "globals.hh"
#include <iostream>
#include <vector>
#include "G4ThreeVector.hh"
#include "GateVDigitizerModule.hh"
#include "GateCoincidenceDigi.hh"
#include "GateClockDependent.hh"
#include "GateCrystalSD.hh"

#include "globals.hh"
#include "GateVPulseProcessor.hh"
#include "GateObjectStore.hh"
#include "GateVCoincidencePulseProcessor.hh"

#include "GateCoincidenceDigitizer.hh"
#include "GateCoincidenceMultiplesKillerMessenger.hh"

class GateCoincidenceMultiplesKillerMessenger;


class GateCoincidenceMultiplesKiller : public GateVCoincidencePulseProcessor
class GateCoincidenceMultiplesKiller : public GateVDigitizerModule
{
public:

Expand All @@ -31,26 +35,30 @@ public:
//! Destructor
virtual ~GateCoincidenceMultiplesKiller() ;

//! Constructs attached to a GateDigitizer
GateCoincidenceMultiplesKiller(GateCoincidenceDigitizer *digitizer, G4String name);

//! Constructs a new dead time attached to a GateDigitizer
GateCoincidenceMultiplesKiller(GateCoincidencePulseProcessorChain* itsChain,
const G4String& itsName);

public:
void Digitize() override;

//! Implementation of the pure virtual method declared by the base class GateClockDependent
//! print-out the attributes specific of the MultiplesKiller
virtual void DescribeMyself(size_t indent);

protected:

/*! Implementation of the pure virtual method declared by the base class GateVCoincidencePulseProcessor*/
GateCoincidencePulse* ProcessPulse(GateCoincidencePulse* inputPulse,G4int iPulse);



private:
GateCoincidenceMultiplesKillerMessenger *m_messenger; //!< Messenger
GateCoincidenceDigi* m_outputDigi;

GateCoincidenceDigiCollection* m_OutputDigiCollection;

GateCoincidenceDigitizer* m_digitizer;
G4int nVerboseLevel;




};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
----------------------*/


#ifndef GateCoincidenceMultiplesKillerMessenger_h
#define GateCoincidenceMultiplesKillerMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"

#include "GateClockDependentMessenger.hh"

#include "GatePulseProcessorMessenger.hh"

class G4UIdirectory;

Expand All @@ -19,14 +21,19 @@ class GateCoincidenceMultiplesKiller;
class GateCoincidenceMultiplesKillerMessenger: public GateClockDependentMessenger
{
public:
GateCoincidenceMultiplesKillerMessenger(GateCoincidenceMultiplesKiller* itsMultiplesKiller);
GateCoincidenceMultiplesKillerMessenger(GateCoincidenceMultiplesKiller*);
virtual ~GateCoincidenceMultiplesKillerMessenger();

inline void SetNewValue(G4UIcommand* aCommand, G4String aString);

inline GateCoincidenceMultiplesKiller* GetMultiplesKiller(){ return (GateCoincidenceMultiplesKiller*) GetClockDependent(); }
//inline GateCoincidenceMultiplesKiller* GetMultiplesKiller(){ return (GateCoincidenceMultiplesKiller*) GetClockDependent(); }

private:


GateCoincidenceMultiplesKiller* m_CoincidenceMultiplesKiller;


};

#endif
8 changes: 7 additions & 1 deletion source/digits_hits/include/GateDistributionFile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class GateDistributionFile : public GateVDistributionArray
inline G4int GetColumnX() const {return m_column_for_X;}
inline G4int GetColumnY() const {return m_column_for_Y;}

void Read();
void Read();
void ReadMatrix2d();

virtual void DescribeMyself(size_t indent);
private:
Expand All @@ -41,6 +42,11 @@ class GateDistributionFile : public GateVDistributionArray
G4int m_column_for_X;
G4int m_column_for_Y;
GateDistributionFileMessenger* m_messenger;
std::map<std::pair<double, double>, double> stddevMap;

std::vector<double> xValues;
std::vector<double> yValues;

};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class GateDistributionFileMessenger: public GateDistributionArrayMessenger
G4UIcmdWithAnInteger *setColXCmd;
G4UIcmdWithAnInteger *setColYCmd;
G4UIcmdWithoutParameter *readCmd;
G4UIcmdWithoutParameter *read2DCmd;
G4UIcmdWithoutParameter *autoXCmd;
};

Expand Down
3 changes: 3 additions & 0 deletions source/digits_hits/include/GateDistributionMessenger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GateDistributionMessenger: public GateNamedObjectMessenger
void SetNewValue(G4UIcommand* aCommand, G4String aString);
void SetUnitX(const G4String& unitX);
void SetUnitY(const G4String& unitY);

inline G4String UnitCategoryX() const {return m_unitX.empty()?"":G4UIcommand::CategoryOf(m_unitX);}
inline G4String UnitCategoryY() const {return m_unitY.empty()?"":G4UIcommand::CategoryOf(m_unitY);}

Expand All @@ -41,8 +42,10 @@ class GateDistributionMessenger: public GateNamedObjectMessenger
G4UIcmdWithoutParameter *getMaxY_Cmd ;
G4UIcmdWithoutParameter *getRandom_Cmd ;
G4UIcmdWithADoubleAndUnit *getValueCmd ;

G4String m_unitX;
G4String m_unitY;

};

#endif
Loading

0 comments on commit 290224b

Please sign in to comment.