G4ProductionCuts.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 // GEANT4 tag $Name: geant4-09-04-ref-00 $
00029 //
00030 // 
00031 // ------------------------------------------------------------
00032 //      GEANT 4 class header file 
00033 //
00034 //
00035 // Class Description
00036 //  This class is 
00037 //
00038 // ------------------------------------------------------------
00039 //   First Implementation          17 Sep. 2002  H.Kurahige
00040 //   Add cuts for proton           28 Jul. 2009  H.Kurashige
00041 // ------------------------------------------------------------
00042 
00043 #ifndef G4ProductionCuts_h 
00044 #define G4ProductionCuts_h 1
00045 
00046 #include "globals.hh"
00047 #include "G4ios.hh"
00048 #include <vector>
00049 #include "G4ParticleDefinition.hh"
00050 
00051 enum G4ProductionCutsIndex
00052 {
00053   idxG4GammaCut =0,
00054   idxG4ElectronCut,
00055   idxG4PositronCut,
00056  
00057   idxG4ProtonCut,  // for proton
00058 
00059   NumberOfG4CutIndex
00060 };
00061 
00062 class G4ProductionCuts  
00063 {
00064   public: // with description
00065   //  constructor 
00066   G4ProductionCuts();
00067 
00068   //  copy constructor 
00069   G4ProductionCuts(const G4ProductionCuts &right);
00070 
00071   G4ProductionCuts & operator=(const G4ProductionCuts &right);
00072 
00073   public: 
00074   //  destructor 
00075   virtual ~G4ProductionCuts();
00076 
00077   // equal opperators
00078   G4int operator==(const G4ProductionCuts &right) const;
00079   G4int operator!=(const G4ProductionCuts &right) const;
00080 
00081   public: // with description
00082   // Set Cuts methods
00083   void              SetProductionCut(G4double cut, G4int index = -1);
00084   void              SetProductionCut(G4double cut, G4ParticleDefinition* ptcl);
00085   void              SetProductionCut(G4double cut, const G4String& pName);
00086   // Set the productionCut in range with an index to particle type
00087   // if index is omitted, the value is applied to all particles
00088 
00089   G4double          GetProductionCut(G4int index) const;
00090   // Get the productionCut in range with an index to particle type
00091 
00092   G4double          GetProductionCut(const G4String& name) const;
00093   // Get the productionCut in range with a name of particle type
00094   
00095   void              SetProductionCuts(std::vector<G4double>&);
00096   // Set the vector of production cuts in range for all particles
00097 
00098   const std::vector<G4double>&   GetProductionCuts() const;
00099   // Get the vector of production cuts in range for all particles
00100 
00101   G4bool           IsModified() const;
00102   // return true if any cut value has been modified 
00103   // after last calculation of PhysicsTable          
00104 
00105   void             PhysicsTableUpdated();
00106   // inform end of calculation of PhysicsTable  to ProductionCut 
00107  
00108   public:
00109   static G4int GetIndex(const G4String& name);
00110   static G4int GetIndex(const G4ParticleDefinition* ptcl);
00111 
00112   protected:
00113   std::vector<G4double>         fRangeCuts;
00114   G4bool                          isModified;
00115 
00116   private:
00117   static const G4ParticleDefinition* gammaDef;
00118   static const G4ParticleDefinition* electDef;
00119   static const G4ParticleDefinition* positDef;
00120 
00121   static const G4ParticleDefinition* protonDef; // for proton
00122 
00123 };
00124 
00125 
00126 inline
00127 void  G4ProductionCuts::SetProductionCut(G4double cut, G4int index)
00128 {
00129   if (index<0) {
00130     for(G4int i = 0; i < NumberOfG4CutIndex; i++) {
00131       fRangeCuts[i] = cut;
00132     }
00133     isModified = true;
00134 
00135   } else if (index < NumberOfG4CutIndex) {
00136     fRangeCuts[index] = cut;
00137     isModified = true;
00138   }     
00139 }
00140 
00141 inline 
00142 void  G4ProductionCuts::SetProductionCut(G4double cut, G4ParticleDefinition* ptcl)
00143 {
00144   G4int idx = -1;
00145   if(ptcl) idx = GetIndex(ptcl);
00146   if(idx>=0) SetProductionCut(cut,idx);
00147 }
00148 
00149 inline
00150 void  G4ProductionCuts::SetProductionCut(G4double cut, const G4String& pName)
00151 {
00152   G4int idx = GetIndex(pName);
00153   if(idx>=0) SetProductionCut(cut,idx);
00154 }
00155 
00156 inline
00157 G4double  G4ProductionCuts::GetProductionCut(G4int index) const
00158 {
00159   G4double cut=-1.0;
00160   if ( (index>=0) && (index<NumberOfG4CutIndex) ) {
00161     cut = fRangeCuts[index]; 
00162   }
00163   return cut;
00164 }
00165 
00166 inline
00167 G4double  G4ProductionCuts::GetProductionCut(const G4String& name) const
00168 {
00169   return GetProductionCut(GetIndex(name)); 
00170 }
00171 
00172 
00173 inline
00174 const std::vector<G4double>&   G4ProductionCuts::GetProductionCuts() const
00175 {
00176   return fRangeCuts;
00177 }
00178 
00179 inline
00180 G4bool  G4ProductionCuts::IsModified() const
00181 {
00182   return isModified;
00183 }
00184 
00185 inline
00186 void   G4ProductionCuts::PhysicsTableUpdated()
00187 {
00188   isModified = false;
00189 }
00190 
00191 #endif
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 

Generated on Mon May 27 17:49:26 2013 for Geant4 by  doxygen 1.4.7