Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4GeneralCerenkov.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 //
0026 // --------------------------------------------------------------------
0027 //
0028 // G4GeneralCerenkov
0029 //
0030 // Class description:
0031 // The Cerenkov process using model approach when an object G4VXRayModel
0032 // is assign to G4LogicalVolume. A model is fully responsible for
0033 // Cerenkov gamma production. This process class performing only tecnical
0034 // operation and interaction with Geant4 kernel.
0035 //
0036 // Created 25.05.2025 V.Ivanchenko on base of G4Cerenkov class
0037 //
0038 // --------------------------------------------------------------------
0039 
0040 #ifndef G4GeneralCerenkov_h
0041 #define G4GeneralCerenkov_h 1
0042 
0043 #include "globals.hh"
0044 #include "G4ForceCondition.hh"
0045 #include "G4LogicalVolume.hh"
0046 #include "G4VXRayModel.hh"
0047 #include "G4VDiscreteProcess.hh"
0048 
0049 #include <vector>
0050 
0051 class G4Material;
0052 class G4ParticleDefinition;
0053 class G4PhysicsTable;
0054 class G4Step;
0055 class G4Track;
0056 class G4VParticleChange;
0057 
0058 class G4GeneralCerenkov : public G4VDiscreteProcess
0059 {
0060  public:
0061   explicit G4GeneralCerenkov(const G4String& processName = "Cerenkov",
0062                              G4ProcessType type = fElectromagnetic);
0063   ~G4GeneralCerenkov() override;
0064 
0065   G4GeneralCerenkov(const G4GeneralCerenkov& right) = delete;
0066   G4GeneralCerenkov& operator=(const G4GeneralCerenkov& right) = delete;
0067 
0068   G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
0069 
0070   void PreparePhysicsTable(const G4ParticleDefinition& part) override;
0071 
0072   void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
0073 
0074   G4double PostStepGetPhysicalInteractionLength(const G4Track& aTrack, G4double,
0075                                                 G4ForceCondition*) override;
0076   // Returns the discrete step limit and sets the 'StronglyForced'
0077   // condition for the DoIt to be invoked at every step.
0078 
0079   G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
0080                                   const G4Step& aStep) override;
0081   // This is the method implementing the Cerenkov process.
0082 
0083   void AddModelForVolume(G4VXRayModel*, const G4String& nameLogVolume);
0084   // explicit addition of a custom Cerenkov model to a logical volume
0085 
0086   void DumpInfo() const override { ProcessDescription(G4cout); };
0087   void ProcessDescription(std::ostream& out) const override;
0088 
0089   G4double GetMeanFreePath(const G4Track&, G4double,
0090                G4ForceCondition*) override;
0091   
0092   // Obsolete methods to be removed for the next major release
0093   
0094   void SetTrackSecondariesFirst(const G4bool state);
0095   // If set, the primary particle tracking is interrupted and any
0096   // produced Cerenkov photons are tracked next. When all have
0097   // been tracked, the tracking of the primary resumes.
0098 
0099   void SetMaxBetaChangePerStep(const G4double d);
0100   // Set the maximum allowed change in beta = v/c in % (perCent) per step.
0101 
0102   void SetMaxNumPhotonsPerStep(const G4int NumPhotons);
0103   // Set the maximum number of Cerenkov photons allowed to be generated during
0104   // a tracking step. This is an average ONLY; the actual number will vary
0105   // around this average. If invoked, the maximum photon stack will roughly be
0106   // of the size set. If not called, the step is not limited by the number of
0107   // photons generated.
0108 
0109   void SetStackPhotons(const G4bool);
0110   // Call by the user to set the flag for stacking the Cerenkov photons
0111 
0112   void SetVerboseLevel(G4int);
0113 
0114 private:
0115 
0116   const G4LogicalVolume* fCurrentLV{nullptr};
0117   G4VXRayModel* fCurrentModel{nullptr};
0118 
0119   G4double fMaxBetaChange{0.1};
0120   G4double fBetaMin{1.0};
0121   G4double fPreStepBeta{0.0};
0122   
0123   G4int fMaxPhotons{100};
0124 
0125   G4bool fStackingFlag{true};
0126   G4bool fTrackSecondariesFirst{true};
0127   G4bool isInitializer{false};
0128   G4bool isPrepared{false};
0129   G4bool isBuilt{false};
0130 
0131   G4int secID{-1};  // creator modelID
0132   G4int nModels{0};
0133 
0134   // map includes logical volume pointer and index of the model
0135   static std::vector<std::vector<const G4LogicalVolume*>* >* fLV;
0136 
0137   // vector is used only at initialisation
0138   // these models are destructed by G4LossTableManager
0139   static std::vector<G4VXRayModel*>* fSharedModels;
0140 
0141   // vector of names of logical volumes for master used for initilisation
0142   // not filled for a worker thread
0143   std::vector<G4String>* fLVNames{nullptr};
0144   
0145   // models used in run time - they are thread local, are
0146   // instantiated in worker thread, and are cloned from fSharedModels
0147   // these models are destructed by G4LossTableManager
0148   std::vector<G4VXRayModel*> fModels;
0149 
0150   // buffer for X-Rays
0151   std::vector<G4Track*> fSecondaries;
0152 };
0153 
0154 #endif