Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4QuasiCerenkov.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 G4Cerenkov, extended to support
0028 // offloading optical photon generation. Offloading can be enabled either
0029 // via the G4OpticalParameters::Instance()->SetCerenkovOffloadPhotons(true)
0030 // method or the UI command:
0031 //
0032 // /process/optical/cerenkov/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 G4CerenkovQuasiTrackInfo. 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 G4QuasiCerenkov_h
0049 #define G4QuasiCerenkov_h 1
0050 
0051 #include "globals.hh"
0052 #include "G4DynamicParticle.hh"
0053 #include "G4ForceCondition.hh"
0054 #include "G4GPILSelection.hh"
0055 #include "G4MaterialPropertyVector.hh"
0056 #include "G4VProcess.hh"
0057 
0058 #include <map>
0059 
0060 class G4Material;
0061 class G4ParticleDefinition;
0062 class G4PhysicsTable;
0063 class G4Step;
0064 class G4Track;
0065 class G4VParticleChange;
0066 
0067 class G4QuasiCerenkov : public G4VProcess
0068 {
0069  public:
0070   explicit G4QuasiCerenkov(const G4String& processName = "QuasiCerenkov",
0071                       G4ProcessType type          = fElectromagnetic);
0072   ~G4QuasiCerenkov();
0073 
0074   explicit G4QuasiCerenkov(const G4QuasiCerenkov& right);
0075 
0076   G4QuasiCerenkov& operator=(const G4QuasiCerenkov& right) = delete;
0077 
0078   G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
0079   // Returns true -> 'is applicable', for all charged particles
0080   // except short-lived particles.
0081 
0082   void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
0083   // Build table at a right time
0084 
0085   void PreparePhysicsTable(const G4ParticleDefinition& part) override;
0086   void Initialise();
0087 
0088   G4double GetMeanFreePath(const G4Track& aTrack, G4double, G4ForceCondition*);
0089   // Returns the discrete step limit and sets the 'StronglyForced'
0090   // condition for the DoIt to be invoked at every step.
0091 
0092   G4double PostStepGetPhysicalInteractionLength(const G4Track& aTrack, G4double,
0093                                                 G4ForceCondition*) override;
0094   // Returns the discrete step limit and sets the 'StronglyForced'
0095   // condition for the DoIt to be invoked at every step.
0096 
0097   G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
0098                                   const G4Step& aStep) override;
0099   // This is the method implementing the Cerenkov process.
0100 
0101   //  no operation in  AtRestDoIt and  AlongStepDoIt
0102   virtual G4double AlongStepGetPhysicalInteractionLength(
0103     const G4Track&, G4double, G4double, G4double&, G4GPILSelection*) override
0104   {
0105     return -1.0;
0106   };
0107 
0108   virtual G4double AtRestGetPhysicalInteractionLength(
0109     const G4Track&, G4ForceCondition*) override
0110   {
0111     return -1.0;
0112   };
0113 
0114   //  no operation in  AtRestDoIt and  AlongStepDoIt
0115   virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) override
0116   {
0117     return nullptr;
0118   };
0119 
0120   virtual G4VParticleChange* AlongStepDoIt(const G4Track&,
0121                                            const G4Step&) override
0122   {
0123     return nullptr;
0124   };
0125 
0126   void SetTrackSecondariesFirst(const G4bool state);
0127   // If set, the primary particle tracking is interrupted and any
0128   // produced Cerenkov photons are tracked next. When all have
0129   // been tracked, the tracking of the primary resumes.
0130 
0131   G4bool GetTrackSecondariesFirst() const;
0132   // Returns the boolean flag for tracking secondaries first.
0133 
0134   void SetMaxBetaChangePerStep(const G4double d);
0135   // Set the maximum allowed change in beta = v/c in % (perCent) per step.
0136 
0137   G4double GetMaxBetaChangePerStep() const;
0138   // Returns the maximum allowed change in beta = v/c in % (perCent)
0139 
0140   void SetMaxNumPhotonsPerStep(const G4int NumPhotons);
0141   // Set the maximum number of Cerenkov photons allowed to be generated during
0142   // a tracking step. This is an average ONLY; the actual number will vary
0143   // around this average. If invoked, the maximum photon stack will roughly be
0144   // of the size set. If not called, the step is not limited by the number of
0145   // photons generated.
0146 
0147   G4int GetMaxNumPhotonsPerStep() const;
0148   // Returns the maximum number of Cerenkov photons allowed to be
0149   // generated during a tracking step.
0150 
0151   void SetStackPhotons(const G4bool);
0152   // Call by the user to set the flag for stacking the Cerenkov photons
0153 
0154   G4bool GetStackPhotons() const;
0155   // Return the boolean for whether or not the Cerenkov photons are stacked
0156 
0157   void SetOffloadPhotons(const G4bool);
0158   // Call by the user to set the flag for offloading the Cerenkov photons
0159 
0160   G4bool GetOffloadPhotons() const;
0161   // Return the boolean for whether or not the Cerenkov photons are offloaded
0162 
0163   G4int GetNumPhotons() const;
0164   // Returns the current number of scint. photons (after PostStepDoIt)
0165 
0166   G4PhysicsTable* GetPhysicsTable() const;
0167   // Returns the address of the physics table.
0168 
0169   void DumpPhysicsTable() const;
0170   // Prints the physics table.
0171 
0172   G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta,
0173                                      const G4Material* aMaterial,
0174                                      G4MaterialPropertyVector* Rindex) const;
0175 
0176   void DumpInfo() const override {ProcessDescription(G4cout);};
0177   void ProcessDescription(std::ostream& out) const override;
0178 
0179   void SetVerboseLevel(G4int);
0180   // sets verbosity
0181 
0182  protected:
0183   G4PhysicsTable* thePhysicsTable;
0184   std::map<std::size_t, std::size_t> fIndexMPT;
0185 
0186  private:
0187   G4double fMaxBetaChange;
0188   
0189   G4int fMaxPhotons;
0190   G4int fNumPhotons;
0191 
0192   G4bool fStackingFlag;
0193   G4bool fOffloadingFlag;
0194   G4bool fTrackSecondariesFirst;
0195 
0196   G4int secID = -1;  // creator modelID
0197 
0198 };
0199 
0200 inline G4bool G4QuasiCerenkov::GetTrackSecondariesFirst() const
0201 {
0202   return fTrackSecondariesFirst;
0203 }
0204 
0205 inline G4double G4QuasiCerenkov::GetMaxBetaChangePerStep() const
0206 {
0207   return fMaxBetaChange;
0208 }
0209 
0210 inline G4int G4QuasiCerenkov::GetMaxNumPhotonsPerStep() const { return fMaxPhotons; }
0211 
0212 inline G4bool G4QuasiCerenkov::GetStackPhotons() const { return fStackingFlag; }
0213 
0214 inline G4bool G4QuasiCerenkov::GetOffloadPhotons() const { return fOffloadingFlag; }
0215 
0216 inline G4int G4QuasiCerenkov::GetNumPhotons() const { return fNumPhotons; }
0217 
0218 inline G4PhysicsTable* G4QuasiCerenkov::GetPhysicsTable() const
0219 {
0220   return thePhysicsTable;
0221 }
0222 
0223 #endif /* G4QuasiCerenkov_h */