Skip to content

Commit

Permalink
Merge pull request #650 from kochebina/Buffer
Browse files Browse the repository at this point in the history
Buffer for GND
  • Loading branch information
kochebina authored Dec 5, 2023
2 parents da950ec + 70aa2a3 commit 6a6997b
Show file tree
Hide file tree
Showing 5 changed files with 359 additions and 171 deletions.
111 changes: 66 additions & 45 deletions source/digits_hits/include/GateBuffer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,80 @@ of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
----------------------*/

// OK GND 2022


/*! \class GateBuffer
\brief GateBuffer mimics the effect of limited transfer rate
5/12/2023 added to GND by [email protected]
\sa GateBuffer, GateBufferMessenger
*/

#ifndef GateBuffer_h
#define GateBuffer_h 1

#include "GateVDigitizerModule.hh"
#include "GateDigi.hh"
#include "GateClockDependent.hh"
#include "GateCrystalSD.hh"

#include "globals.hh"
#include <iostream>
#include <vector>

#include "GateVPulseProcessor.hh"
#include "GatePulse.hh"
#include "GateBufferMessenger.hh"
#include "GateSinglesDigitizer.hh"


class GateBufferMessenger;
class GateVDistribution;
class GateBuffer : public GateVPulseProcessor
class GateBuffer : public GateVDigitizerModule
{
public:
typedef unsigned long long int buffer_t;

GateBuffer(GatePulseProcessorChain* itsChain,
const G4String& itsName=theTypeName) ;

//! Destructor
virtual ~GateBuffer() ;


//! Implementation of the pure virtual method declared by the base class GateDigitizerComponent
//! print-out the attributes specific of the blurring
void SetBufferSize(buffer_t val) { m_bufferSize = val;}
void SetReadFrequency(G4double val) { m_readFrequency = val;}
void SetDoModifyTime(G4bool val) { m_doModifyTime = val;}
void SetMode(G4int val) { m_mode = val;}
void SetDepth(size_t depth);
virtual void DescribeMyself(size_t indent);

protected:
//! Implementation of the pure virtual method declared by the base class GateVPulseProcessor
//! This methods processes one input-pulse
//! It is is called by ProcessPulseList() for each of the input pulses
//! The result of the pulse-processing is incorporated into the output pulse-list

virtual void ProcessOnePulse(const GatePulse* inputPulse,GatePulseList& outputPulseList);
private:
buffer_t m_bufferSize;
std::vector<buffer_t> m_bufferPos;
buffer_t m_oldClock;
G4double m_readFrequency;
G4bool m_doModifyTime;
G4int m_mode;
std::vector<G4bool> m_enableList;
GateBufferMessenger *m_messenger; //!< Messenger

static const G4String& theTypeName; //!< Default type-name for all buffers
};
public:

typedef unsigned long long int Buffer_t;

GateBuffer(GateSinglesDigitizer *digitizer, G4String name);
~GateBuffer();

void Digitize() override;

//! Implementation of the pure virtual method declared by the base class GateDigitizerComponent
//! print-out the attributes specific of the blurring
void SetBufferSize(Buffer_t val) { m_BufferSize = val;}
void SetReadFrequency(G4double val) { m_readFrequency = val;}
void SetDoModifyTime(G4bool val) { m_doModifyTime = val;}
void SetMode(G4int val) { m_mode = val;}
void SetDepth(size_t depth);

void DescribeMyself(size_t );

protected:
Buffer_t m_BufferSize;
std::vector<Buffer_t> m_BufferPos;
Buffer_t m_oldClock;
G4double m_readFrequency;
G4bool m_doModifyTime;
G4int m_mode;
std::vector<G4bool> m_enableList;

private:
GateDigi* m_outputDigi;

GateBufferMessenger *m_Messenger;

GateDigiCollection* m_OutputDigiCollection;

GateSinglesDigitizer *m_digitizer;

static const G4String& theTypeName; //!< Default type-name for all Buffers

};

#endif








58 changes: 41 additions & 17 deletions source/digits_hits/include/GateBufferMessenger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,57 @@ of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
----------------------*/

// OK GND 2022

/*! \class GateBufferMessenger
\brief Messenger for the GateBuffer
\sa GateBuffer, GateBufferMessenger
*/


#ifndef GateBufferMessenger_h
#define GateBufferMessenger_h 1

#include "GatePulseProcessorMessenger.hh"
#include "G4UImessenger.hh"
#include "globals.hh"

#include "GateClockDependentMessenger.hh"
class GateBuffer;
class G4UIcmdWithAString;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;

class GateBuffer;

class GateBufferMessenger: public GatePulseProcessorMessenger
class GateBufferMessenger : public GateClockDependentMessenger
{
public:
GateBufferMessenger(GateBuffer* itsPulseProcessor);
virtual ~GateBufferMessenger();

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

private:
G4UIcmdWithADoubleAndUnit *m_bufferSizeCmd; //!< set the buffer size
G4UIcmdWithADoubleAndUnit *m_readFrequencyCmd; //!< set the read frequency
G4UIcmdWithABool *m_modifyTimeCmd; //!< does buffer modify the time of pulses
G4UIcmdWithAnInteger *m_setDepthCmd; //!< the depth of each individual buffer
G4UIcmdWithAnInteger *m_setModeCmd; //!< buffer readout mode
public:

GateBufferMessenger(GateBuffer*);
~GateBufferMessenger();

void SetNewValue(G4UIcommand*, G4String);


private:
GateBuffer* m_Buffer;

G4UIcmdWithADoubleAndUnit *m_BufferSizeCmd; //!< set the Buffer size
G4UIcmdWithADoubleAndUnit *m_readFrequencyCmd; //!< set the read frequency
G4UIcmdWithABool *m_modifyTimeCmd; //!< does Buffer modify the time of pulses
G4UIcmdWithAnInteger *m_setDepthCmd; //!< the depth of each individual Buffer
G4UIcmdWithAnInteger *m_setModeCmd; //!< Buffer readout mode


};

#endif








Loading

0 comments on commit 6a6997b

Please sign in to comment.