Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:50:30

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 //
0026 //
0027 // $Id: G4Cerenkov.hh 108508 2018-02-15 15:54:35Z gcosmo $
0028 //
0029 // 
0030 ////////////////////////////////////////////////////////////////////////
0031 // Cerenkov Radiation Class Definition
0032 ////////////////////////////////////////////////////////////////////////
0033 //
0034 // File:        G4Cerenkov.hh
0035 // Description: Discrete Process - Generation of Cerenkov Photons
0036 // Version:     2.0
0037 // Created:     1996-02-21
0038 // Author:      Juliet Armstrong
0039 // Updated:     2007-09-30 change inheritance to G4VDiscreteProcess
0040 //              2005-07-28 add G4ProcessType to constructor
0041 //              1999-10-29 add method and class descriptors
0042 //              1997-04-09 by Peter Gumplinger
0043 //              > G4MaterialPropertiesTable; new physics/tracking scheme
0044 // mail:        gum@triumf.ca
0045 //
0046 ////////////////////////////////////////////////////////////////////////
0047 
0048 #ifndef Local_G4Cerenkov_modified_h
0049 #define Local_G4Cerenkov_modified_h 1
0050 
0051 /////////////
0052 // Includes
0053 /////////////
0054 
0055 #include <CLHEP/Units/SystemOfUnits.h>
0056 
0057 #include "globals.hh"
0058 #include "templates.hh"
0059 #include "Randomize.hh"
0060 #include "G4ThreeVector.hh"
0061 #include "G4ParticleMomentum.hh"
0062 #include "G4Step.hh"
0063 #include "G4VProcess.hh"
0064 #include "G4OpticalPhoton.hh"
0065 #include "G4DynamicParticle.hh"
0066 #include "G4Material.hh"
0067 #include "G4PhysicsTable.hh"
0068 #include "G4MaterialPropertyVector.hh"
0069 #include "G4MaterialPropertiesTable.hh"
0070 #include "G4PhysicsOrderedFreeVector.hh"
0071 
0072 // Class Description:
0073 // Discrete Process -- Generation of Cerenkov Photons.
0074 // Class inherits publicly from G4VDiscreteProcess.
0075 // Class Description - End:
0076 
0077 /////////////////////
0078 // Class Definition
0079 /////////////////////
0080 
0081 #ifdef INSTRUMENTED
0082 template <typename T> struct OpticksDebug ; 
0083 struct OpticksRandom ; 
0084 #endif 
0085 
0086 
0087 class Local_G4Cerenkov_modified : public G4VProcess
0088 {
0089 public:
0090 
0091 #ifdef INSTRUMENTED
0092    template <typename T> friend struct Local_G4Cerenkov_modifiedTest ;  
0093    bool looping_condition(unsigned& count); 
0094    OpticksDebug<double>* gen ; 
0095    OpticksDebug<double>* par ; 
0096    OpticksRandom* rnd ; 
0097 #endif
0098 
0099 
0100   ////////////////////////////////
0101   // Constructors and Destructor
0102   ////////////////////////////////
0103 
0104   explicit Local_G4Cerenkov_modified(const G4String& processName = "Cerenkov", 
0105              G4ProcessType type = fElectromagnetic);
0106   ~Local_G4Cerenkov_modified();
0107 
0108   explicit Local_G4Cerenkov_modified(const Local_G4Cerenkov_modified &right);
0109 
0110 private:
0111 
0112   //////////////
0113   // Operators
0114   //////////////
0115 
0116   Local_G4Cerenkov_modified& operator=(const Local_G4Cerenkov_modified &right) = delete;
0117 
0118 public:
0119 
0120   ////////////
0121   // Methods
0122   ////////////
0123 
0124   G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
0125   // Returns true -> 'is applicable', for all charged particles
0126   // except short-lived particles.
0127 
0128   void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
0129   // Build table at a right time
0130 
0131   G4double GetMeanFreePath(const G4Track& aTrack, 
0132                            G4double, G4ForceCondition* );
0133   // Returns the discrete step limit and sets the 'StronglyForced'
0134   // condition for the DoIt to be invoked at every step.
0135 
0136   G4double PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
0137                                                 G4double ,
0138                                                 G4ForceCondition* ) override;
0139   // Returns the discrete step limit and sets the 'StronglyForced'
0140   // condition for the DoIt to be invoked at every step.
0141 
0142   G4VParticleChange* PostStepDoIt(const G4Track& aTrack, 
0143                                   const G4Step&  aStep) override;
0144   // This is the method implementing the Cerenkov process.
0145 
0146   //  no operation in  AtRestDoIt and  AlongStepDoIt
0147   virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
0148                                                          G4double  ,
0149                                                          G4double  ,
0150                                                          G4double& ,
0151                                                          G4GPILSelection*
0152                                                 ) override { return -1.0; };
0153 
0154   virtual G4double AtRestGetPhysicalInteractionLength(const G4Track& ,
0155                                                       G4ForceCondition*
0156                                                  ) override { return -1.0; };
0157 
0158   //  no operation in  AtRestDoIt and  AlongStepDoIt
0159   virtual G4VParticleChange* AtRestDoIt(const G4Track& , const G4Step& ) 
0160                              override {return nullptr;};
0161 
0162   virtual G4VParticleChange* AlongStepDoIt(const G4Track& , const G4Step&) 
0163                              override {return nullptr;};
0164 
0165   void SetTrackSecondariesFirst(const G4bool state);
0166   // If set, the primary particle tracking is interrupted and any 
0167   // produced Cerenkov photons are tracked next. When all have 
0168   // been tracked, the tracking of the primary resumes.
0169 
0170   G4bool GetTrackSecondariesFirst() const;
0171   // Returns the boolean flag for tracking secondaries first.
0172 
0173   void SetMaxBetaChangePerStep(const G4double d);
0174   // Set the maximum allowed change in beta = v/c in % (perCent)
0175   // per step.
0176 
0177   G4double GetMaxBetaChangePerStep() const;
0178   // Returns the maximum allowed change in beta = v/c in % (perCent)
0179 
0180   void SetMaxNumPhotonsPerStep(const G4int NumPhotons);
0181   // Set the maximum number of Cerenkov photons allowed to be 
0182   // generated during a tracking step. This is an average ONLY; 
0183   // the actual number will vary around this average. If invoked, 
0184   // the maximum photon stack will roughly be of the size set.
0185   // If not called, the step is not limited by the number of 
0186   // photons generated.
0187 
0188   G4int GetMaxNumPhotonsPerStep() const;
0189   // Returns the maximum number of Cerenkov photons allowed to be
0190   // generated during a tracking step.
0191 
0192   void SetStackPhotons(const G4bool );
0193   // Call by the user to set the flag for stacking the scint. photons
0194 
0195   G4bool GetStackPhotons() const;
0196   // Return the boolean for whether or not the scint. photons are stacked
0197 
0198   G4int GetNumPhotons() const;
0199 
0200   G4int GetNumPhotons1() const;
0201   G4int GetNumPhotons2() const;
0202   // Returns the current number of scint. photons (after PostStepDoIt)
0203 
0204   void ResetNumPhotons() {
0205       fNumPhotons = 0;
0206       fNumPhotons1 = 0;
0207       fNumPhotons2 = 0;
0208   }
0209 
0210   G4PhysicsTable* GetPhysicsTable() const;
0211   // Returns the address of the physics table.
0212 
0213   void DumpPhysicsTable() const;
0214   // Prints the physics table.
0215 
0216 private:
0217   void BuildThePhysicsTable();
0218 
0219   /////////////////////
0220   // Helper Functions
0221   /////////////////////
0222 
0223   G4double GetAverageNumberOfPhotons(const G4double charge,
0224                                      const G4double beta,
0225                                      const G4Material *aMaterial,
0226                                      G4MaterialPropertyVector* Rindex); //const;
0227 
0228 
0229   G4double GetAverageNumberOfPhotons_s2(const G4double charge,
0230                                      const G4double beta,
0231                                      const G4Material *aMaterial,
0232                                      G4MaterialPropertyVector* Rindex) const;
0233 
0234 
0235 
0236   ///////////////////////
0237   // Class Data Members
0238   ///////////////////////
0239 
0240 protected:
0241 
0242   G4PhysicsTable* thePhysicsTable;
0243   //  A Physics Table can be either a cross-sections table or
0244   //  an energy table (or can be used for other specific
0245   //  purposes).
0246 
0247 private:
0248 
0249   G4bool fTrackSecondariesFirst;
0250   G4double fMaxBetaChange;
0251   G4int  fMaxPhotons;
0252 
0253   G4bool fStackingFlag;
0254 
0255 #ifdef INSTRUMENTED
0256 public:
0257   G4int override_fNumPhotons ;  
0258 private:
0259 #endif
0260 
0261   G4int fNumPhotons;
0262   G4int fNumPhotons1; // mean
0263   G4int fNumPhotons2; // mean
0264 
0265 private:
0266 
0267 };
0268 
0269   ////////////////////
0270   // Inline methods
0271   ////////////////////
0272 
0273 inline
0274 G4bool Local_G4Cerenkov_modified::GetTrackSecondariesFirst() const
0275 {
0276   return fTrackSecondariesFirst;
0277 }
0278 
0279 inline
0280 G4double Local_G4Cerenkov_modified::GetMaxBetaChangePerStep() const
0281 {
0282   return fMaxBetaChange;
0283 }
0284 
0285 inline
0286 G4int Local_G4Cerenkov_modified::GetMaxNumPhotonsPerStep() const
0287 {
0288   return fMaxPhotons;
0289 }
0290 
0291 inline
0292 void Local_G4Cerenkov_modified::SetStackPhotons(const G4bool stackingFlag)
0293 {
0294         fStackingFlag = stackingFlag;
0295 }
0296 
0297 inline
0298 G4bool Local_G4Cerenkov_modified::GetStackPhotons() const
0299 {
0300         return fStackingFlag;
0301 }
0302 
0303 inline
0304 G4int Local_G4Cerenkov_modified::GetNumPhotons() const
0305 {
0306         return fNumPhotons;
0307 }
0308 
0309 inline
0310 G4int Local_G4Cerenkov_modified::GetNumPhotons1() const
0311 {
0312         return fNumPhotons1;
0313 }
0314 
0315 inline
0316 G4int Local_G4Cerenkov_modified::GetNumPhotons2() const
0317 {
0318         return fNumPhotons2;
0319 }
0320 
0321 inline
0322 G4PhysicsTable* Local_G4Cerenkov_modified::GetPhysicsTable() const
0323 {
0324   return thePhysicsTable;
0325 }
0326 
0327 #endif /* Local_G4Cerenkov_modified_h */
0328 
0329