Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mirrors to the Cherenkov channel & reduce memory usage #23

Merged
merged 11 commits into from
Jan 24, 2022
75 changes: 60 additions & 15 deletions DRsim/DRsimG4Fast/include/FastSimModelOpFiber.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,46 @@
#include "G4OpBoundaryProcess.hh"
#include "G4GenericMessenger.hh"
#include "G4OpBoundaryProcess.hh"
#include "G4OpAbsorption.hh"
#include "G4OpWLS.hh"
#include "G4Material.hh"

struct FastFiberData {
public:
FastFiberData(G4int, G4double, G4double, G4double, G4ThreeVector, G4ThreeVector, G4ThreeVector, G4int status=G4OpBoundaryProcessStatus::Undefined);
~FastFiberData() {}

FastFiberData& operator=(const FastFiberData &right);
void reset();

G4double GetAbsorptionNILL() { return mOpAbsorptionNumIntLenLeft; }
void SetAbsorptionNILL(G4double in) { mOpAbsorptionNumIntLenLeft = in; }

G4double GetWLSNILL() { return mOpWLSNumIntLenLeft; }
void SetWLSNILL(G4double in) { mOpWLSNumIntLenLeft = in; }

G4int GetOpBoundaryStatus() { return mOpBoundaryStatus; }
void SetOpBoundaryStatus(G4int in) { mOpBoundaryStatus = in; }

G4double GetStepLengthInterval() { return mStepLengthInterval; }
void AddStepLengthInterval(G4double in) { mStepLengthInterval += in; }

G4bool checkRepetitive(const FastFiberData, G4bool checkInterval=true);

G4int trackID;
G4double kineticEnergy;
G4double globalTime;
G4double pathLength;
G4ThreeVector globalPosition;
G4ThreeVector momentumDirection;
G4ThreeVector polarization;
private:
G4int mOpBoundaryStatus;
G4double mOpAbsorptionNumIntLenLeft;
G4double mOpWLSNumIntLenLeft;
G4double mStepLengthInterval;
};

class FastSimModelOpFiber : public G4VFastSimulationModel {
public:
FastSimModelOpFiber(G4String, G4Region*);
Expand All @@ -16,30 +54,37 @@ class FastSimModelOpFiber : public G4VFastSimulationModel {
virtual G4bool ModelTrigger(const G4FastTrack&);
virtual void DoIt(const G4FastTrack&, G4FastStep&);

void SetCoreMaterial(G4Material* mat) { fCoreMaterial = mat; }

private:
void DefineCommands();

bool checkTotalInternalReflection(const G4Track* track);
G4double CalculateVelocityForOpticalPhoton(const G4Track* track);
void setOpBoundaryProc(const G4Track* track);
void getCoreMaterial(const G4Track* track);
G4bool checkTotalInternalReflection(const G4Track* track);
G4bool checkAbsorption(const G4double prevNILL, const G4double currentNILL);
G4bool checkNILL();

void setPostStepProc(const G4Track* track);
void reset();
void print();

G4GenericMessenger* fMessenger;
G4OpBoundaryProcess* fOpBoundaryProc;
G4Material* fCoreMaterial;
G4GenericMessenger* mMessenger;
G4OpBoundaryProcess* pOpBoundaryProc;
G4OpAbsorption* pOpAbsorption;
G4OpWLS* pOpWLS;
G4Material* pCoreMaterial;
G4bool fProcAssigned;

FastFiberData mDataPrevious;
FastFiberData mDataCurrent;

G4int fSafety;
G4double fTrkLength;
G4double fNtransport;
G4double fTransportUnit;
G4ThreeVector fFiberAxis;
G4double mNtransport;
G4double mTransportUnit;
G4ThreeVector mFiberPos;
G4ThreeVector mFiberAxis;
G4bool fKill;
G4int fNtotIntRefl;
G4int fTrackId;
G4bool fTransported;

G4bool fSwitch;
G4int fVerbose;
};

#endif
Loading