Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4QuasiScintillation.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 // Class Description:
0026 //
0027 // This class is a modified clone of G4Scintillation, extended to support
0028 // offloading optical photon generation. Offloading can be enabled either
0029 // via the G4OpticalParameters::Instance()->SetScintOffloadPhotons(true)
0030 // method or the UI command:
0031 //
0032 // /process/optical/scintillation/setOffloadPhotons true
0033 //
0034 // When offloading is enabled, the process generates a single secondary track
0035 // of type G4QuasiOpticalPhoton, along with associated metadata encapsulated
0036 // in G4ScintillationQuasiTrackInfo. This auxiliary track information is used
0037 // to generate optical photons at a later stage—typically during offloading.
0038 //
0039 // The intended workflow leverages G4VTrackingManager, which delegates these
0040 // secondary tracks to a dedicated G4ProcessManager for G4QuasiOpticalPhoton.
0041 // These tracks are then handled by a user-defined custom tracking manager,
0042 // independent of the default process managers used for other particles.
0043 //
0044 // The primary purpose of this class is to facilitate the transfer of essential
0045 // data for offloaded optical photon generation in heterogeneous computing
0046 // models
0047 
0048 #ifndef G4QuasiScintillation_h
0049 #define G4QuasiScintillation_h 1
0050 
0051 #include "globals.hh"
0052 #include "G4EmSaturation.hh"
0053 #include "G4OpticalPhoton.hh"
0054 #include "G4VRestDiscreteProcess.hh"
0055 
0056 #include <map>
0057 
0058 class G4PhysicsTable;
0059 class G4Step;
0060 class G4Track;
0061 
0062 class G4QuasiScintillation : public G4VRestDiscreteProcess
0063 {
0064  public:
0065   explicit G4QuasiScintillation(const G4String& procName = "QausiScintillation",
0066                                 G4ProcessType type       = fElectromagnetic);
0067   ~G4QuasiScintillation();
0068 
0069   G4QuasiScintillation(const G4QuasiScintillation& right) = delete;
0070   G4QuasiScintillation& operator=(const G4QuasiScintillation& right) = delete;
0071 
0072   // G4QuasiScintillation Process has both PostStepDoIt (for energy
0073   // deposition of particles in flight) and AtRestDoIt (for energy
0074   // given to the medium by particles at rest)
0075 
0076   G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
0077   // Returns true -> 'is applicable', for any particle type except
0078   // for an 'opticalphoton' and for short-lived particles
0079 
0080   void ProcessDescription(std::ostream&) const override;
0081   void DumpInfo() const override {ProcessDescription(G4cout);};
0082 
0083   void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
0084   // Build table at the right time
0085 
0086   void PreparePhysicsTable(const G4ParticleDefinition& part) override;
0087   void Initialise();
0088 
0089   G4double GetMeanFreePath(const G4Track& aTrack, G4double,
0090                            G4ForceCondition*) override;
0091   // Returns infinity; i. e. the process does not limit the step,
0092   // but sets the 'StronglyForced' condition for the DoIt to be
0093   // invoked at every step.
0094 
0095   G4double GetMeanLifeTime(const G4Track& aTrack, G4ForceCondition*) override;
0096   // Returns infinity; i. e. the process does not limit the time,
0097   // but sets the 'StronglyForced' condition for the DoIt to be
0098   // invoked at every step.
0099 
0100   G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
0101                                   const G4Step& aStep) override;
0102   G4VParticleChange* AtRestDoIt(const G4Track& aTrack,
0103                                 const G4Step& aStep) override;
0104 
0105   G4double GetScintillationYieldByParticleType(const G4Track& aTrack,
0106                                                const G4Step& aStep,
0107                                                G4double& yield1,
0108                                                G4double& yield2,
0109                                                G4double& yield3,
0110                                                G4double& timeconstant1,
0111                                                G4double& timeconstant2,
0112                                                G4double& timeconstant3);
0113   // allow multiple time constants with scint by particle type
0114   // Returns the number of scintillation photons calculated when
0115   // scintillation depends on the particle type and energy
0116   // deposited (includes nonlinear dependendency) and updates the
0117   // yields for each channel
0118 
0119   void SetTrackSecondariesFirst(const G4bool state);
0120   // If set, the primary particle tracking is interrupted and any
0121   // produced scintillation photons are tracked next. When all
0122   // have been tracked, the tracking of the primary resumes.
0123 
0124   G4bool GetTrackSecondariesFirst() const;
0125   // Returns the boolean flag for tracking secondaries first.
0126 
0127   void SetFiniteRiseTime(const G4bool state);
0128   // If set, the G4QuasiScintillation process expects the user to have
0129   // set the constant material property SCINTILLATIONRISETIME{1,2,3}.
0130 
0131   G4bool GetFiniteRiseTime() const;
0132   // Returns the boolean flag for a finite scintillation rise time.
0133 
0134   G4PhysicsTable* GetIntegralTable1() const;
0135   // Returns the address of scintillation integral table #1.
0136 
0137   G4PhysicsTable* GetIntegralTable2() const;
0138   // Returns the address of scintillation integral table #2.
0139 
0140   G4PhysicsTable* GetIntegralTable3() const;
0141   // Returns the address of scintillation integral table #3.
0142 
0143   void AddSaturation(G4EmSaturation* sat);
0144   // Adds Birks Saturation to the process.
0145 
0146   void RemoveSaturation();
0147   // Removes the Birks Saturation from the process.
0148 
0149   G4EmSaturation* GetSaturation() const;
0150   // Returns the Birks Saturation.
0151 
0152   void SetScintillationByParticleType(const G4bool);
0153   // Called by the user to set the scintillation yield as a function
0154   // of energy deposited by particle type
0155 
0156   G4bool GetScintillationByParticleType() const;
0157   // Return the boolean that determines the method of scintillation
0158   // production
0159 
0160   void SetScintillationTrackInfo(const G4bool trackType);
0161   // Call by the user to set the G4ScintillationTrackInformation
0162   // to scintillation photon track
0163 
0164   G4bool GetScintillationTrackInfo() const;
0165   // Return the boolean for whether or not the
0166   // G4QuasiScintillationTrackInformation is set to the scint. photon track
0167 
0168   void SetStackPhotons(const G4bool);
0169   // Call by the user to set the flag for stacking the scint. photons
0170 
0171   G4bool GetStackPhotons() const;
0172   // Return the boolean for whether or not the scint. photons are stacked
0173 
0174   void SetOffloadPhotons(const G4bool);
0175   // Call by the user to set the flag for offloading the scint. photons
0176 
0177   G4bool GetOffloadPhotons() const;
0178   // Return the boolean for whether or not the scint. photons are offloaded
0179 
0180   G4int GetNumPhotons() const;
0181   // Returns the current number of scint. photons (after PostStepDoIt)
0182 
0183   void DumpPhysicsTable() const;
0184   // Prints the fast and slow scintillation integral tables.
0185 
0186   void SetVerboseLevel(G4int);
0187   // sets verbosity
0188 
0189  private:
0190   void BuildInverseCdfTable(const G4MaterialPropertyVector* MPV,
0191                             G4PhysicsFreeVector* vec) const;
0192   // Build the inverse cumulative distribution function (C.D.F.) table
0193   // for the scintillation photon energy spectrum
0194 
0195  private:
0196 
0197   G4PhysicsTable* fIntegralTable1;
0198   G4PhysicsTable* fIntegralTable2;
0199   G4PhysicsTable* fIntegralTable3;
0200   std::map<std::size_t, std::size_t> fIndexMPT;
0201 
0202   G4EmSaturation* fEmSaturation;
0203   const G4ParticleDefinition* opticalphoton =
0204     G4OpticalPhoton::OpticalPhotonDefinition();
0205 
0206   G4int fNumPhotons;
0207   
0208   G4bool fScintillationByParticleType;
0209   G4bool fScintillationTrackInfo;
0210   G4bool fStackingFlag;
0211   G4bool fOffloadingFlag;
0212   G4bool fTrackSecondariesFirst;
0213   G4bool fFiniteRiseTime;
0214 
0215 #ifdef G4DEBUG_SCINTILLATION
0216   G4double ScintTrackEDep, ScintTrackYield;
0217 #endif
0218   // emission time distribution when there is a finite rise time
0219   G4double sample_time(G4double tau1, G4double tau2);
0220 
0221   G4int secID = -1;  // creator modelID
0222   G4int fNumEnergyWarnings = 0;
0223 
0224 };
0225 
0226 ////////////////////
0227 // Inline methods
0228 ////////////////////
0229 
0230 inline G4bool G4QuasiScintillation::GetTrackSecondariesFirst() const
0231 {
0232   return fTrackSecondariesFirst;
0233 }
0234 
0235 inline G4bool G4QuasiScintillation::GetFiniteRiseTime() const
0236 {
0237   return fFiniteRiseTime;
0238 }
0239 
0240 inline G4PhysicsTable* G4QuasiScintillation::GetIntegralTable1() const
0241 {
0242   return fIntegralTable1;
0243 }
0244 
0245 inline G4PhysicsTable* G4QuasiScintillation::GetIntegralTable2() const
0246 {
0247   return fIntegralTable2;
0248 }
0249 
0250 inline G4PhysicsTable* G4QuasiScintillation::GetIntegralTable3() const
0251 {
0252   return fIntegralTable3;
0253 }
0254 
0255 inline void G4QuasiScintillation::AddSaturation(G4EmSaturation* sat)
0256 {
0257   fEmSaturation = sat;
0258 }
0259 
0260 inline void G4QuasiScintillation::RemoveSaturation()
0261 {
0262   fEmSaturation = nullptr;
0263 }
0264 
0265 inline G4EmSaturation* G4QuasiScintillation::GetSaturation() const
0266 {
0267   return fEmSaturation;
0268 }
0269 
0270 inline G4bool G4QuasiScintillation::GetScintillationByParticleType() const
0271 {
0272   return fScintillationByParticleType;
0273 }
0274 
0275 inline G4bool G4QuasiScintillation::GetScintillationTrackInfo() const
0276 {
0277   return fScintillationTrackInfo;
0278 }
0279 
0280 inline G4bool G4QuasiScintillation::GetStackPhotons() const
0281 {
0282   return fStackingFlag;
0283 }
0284 
0285 inline G4bool G4QuasiScintillation::GetOffloadPhotons() const
0286 {
0287   return fOffloadingFlag;
0288 }
0289 
0290 inline G4int G4QuasiScintillation::GetNumPhotons() const
0291 {
0292   return fNumPhotons;
0293 }
0294 
0295 #endif /* G4QuasiScintillation_h */