Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:39

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 // G4MaterialCutsCouple
0027 //
0028 // Class description:
0029 //
0030 // The same material can be used in regions with different cut values,
0031 // and physics processes must prepare several different cross-sections
0032 // for that material.
0033 // The G4ProductionCutsTable has G4MaterialCutsCouple objects, each of
0034 // which consists of a material paired with a cut value.
0035 // G4MaterialCutsCouples objects are numbered with an index which is the
0036 // same as the index of a G4PhysicsVector for the corresponding
0037 // G4MaterialCutsCouple in the G4PhysicsTable.
0038 // The list of G4MaterialCutsCouple objects used in the geometry setup
0039 // is updated before starting the event loop in each run.
0040 
0041 // Author: H.Kurashige, 17 September 2002 - First implementation
0042 // --------------------------------------------------------------------
0043 #ifndef G4MaterialCutsCouple_hh 
0044 #define G4MaterialCutsCouple_hh 1
0045 
0046 #include "globals.hh"
0047 #include "G4ios.hh"
0048 #include "G4ProductionCuts.hh"
0049 
0050 class G4Material;
0051 
0052 class G4MaterialCutsCouple  
0053 {
0054   public:
0055 
0056     G4MaterialCutsCouple();
0057     G4MaterialCutsCouple(const G4Material*, G4ProductionCuts* cut = nullptr);
0058       // Constructors
0059 
0060     virtual ~G4MaterialCutsCouple();
0061       // Destructor 
0062 
0063     G4MaterialCutsCouple(const G4MaterialCutsCouple& right);
0064     G4MaterialCutsCouple& operator=(const G4MaterialCutsCouple& right);
0065       // Copy constructor & assignment operator
0066 
0067     G4bool operator==(const G4MaterialCutsCouple& right) const;
0068     G4bool operator!=(const G4MaterialCutsCouple& right) const;
0069       // Equality operators
0070 
0071     void SetMaterial(const G4Material*);
0072       // Set pointer to material
0073 
0074     const G4Material* GetMaterial() const;
0075       // Get pointer to material
0076 
0077     void SetProductionCuts(G4ProductionCuts*);
0078       // Set pointer to production cuts
0079 
0080     G4ProductionCuts* GetProductionCuts() const;
0081       // Get pointer to production cuts
0082 
0083     G4bool IsRecalcNeeded() const;
0084       // Return true if cut and/or material has been modified 
0085       // after last calculation of PhysicsTable          
0086 
0087     void PhysicsTableUpdated();
0088       // Inform end of calculation of Physics Table  
0089 
0090     void SetIndex(G4int idx);
0091     G4int GetIndex() const;
0092       // Set/Get the index number in G4ProductionCutsTable
0093 
0094     void SetUseFlag(G4bool flg = true);
0095     G4bool IsUsed() const;
0096  
0097   private:
0098 
0099     G4bool            isMaterialModified = false;
0100     const G4Material* fMaterial = nullptr;
0101     G4ProductionCuts* fCuts = nullptr;
0102     G4int             indexNumber = -1;
0103     G4bool            isUsedInGeometry = false;
0104 };
0105 
0106 // ------------------
0107 // Inline methods
0108 // ------------------
0109 
0110 inline 
0111 void G4MaterialCutsCouple::SetIndex(G4int idx)
0112 {
0113   indexNumber = idx;
0114 }
0115 
0116 inline
0117 G4int G4MaterialCutsCouple::GetIndex() const
0118 {
0119   return indexNumber;
0120 }
0121 
0122 inline 
0123 void G4MaterialCutsCouple::SetUseFlag(G4bool flg)
0124 {
0125   isUsedInGeometry = flg;
0126 }
0127 
0128 inline
0129 G4bool G4MaterialCutsCouple::IsUsed() const
0130 {
0131   return isUsedInGeometry;
0132 }
0133 
0134 inline
0135 void G4MaterialCutsCouple::SetProductionCuts(G4ProductionCuts* aCut)
0136 {
0137   fCuts = aCut;
0138 }
0139 
0140 inline
0141 G4ProductionCuts* G4MaterialCutsCouple::GetProductionCuts() const
0142 {
0143   return fCuts;
0144 }
0145 
0146 inline
0147 G4bool G4MaterialCutsCouple::operator==(const G4MaterialCutsCouple& right) const
0148 {
0149   return (this == &right);
0150 }
0151 
0152 inline
0153 G4bool G4MaterialCutsCouple::operator!=(const G4MaterialCutsCouple& right) const
0154 {
0155   return (this !=  &right);
0156 }
0157 
0158 inline
0159 void  G4MaterialCutsCouple::SetMaterial(const G4Material* material)
0160 {
0161   fMaterial = material;
0162   isMaterialModified = true;
0163 }
0164 
0165 inline
0166 const G4Material* G4MaterialCutsCouple::GetMaterial() const
0167 {
0168   return fMaterial;
0169 }
0170 
0171 inline
0172 G4bool  G4MaterialCutsCouple::IsRecalcNeeded() const
0173 {
0174   G4bool isCutModified = false;
0175   if (fCuts != nullptr ) isCutModified = fCuts->IsModified();
0176   return (isMaterialModified || isCutModified);
0177 }
0178 
0179 inline
0180 void G4MaterialCutsCouple::PhysicsTableUpdated()
0181 {
0182   if (fCuts != nullptr ) fCuts->PhysicsTableUpdated();
0183   isMaterialModified = false;
0184 }
0185 
0186 #endif