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 // 00029 // 00030 // GEANT4 virtual class: G4VQCrossSection -- header file 00031 // M.V. Kossov, CERN-ITEP(Moscow), 4-FEB-2004 00032 // The last update: M.V. Kossov, CERN/ITEP (Moscow) 27-Nov-04 00033 // 00034 // Short description: this G4 virtual class is made for the cross section 00035 // classes of the CHIPS model, which calculate the cross section for the 00036 // particular Element (virtual GetCrossSection member function). Each of the 00037 // CHIPS cross section classes creates its own Dynamic Associative Memory 00038 // Data Base (DAMDB) for the already used isotopes. For all of them thay use the 00039 // same algorithm. Common member functions of this algorithm can be in this 00040 // basic virtual class. Any CHIPS cross section class MUST inherit from this virtual 00041 // G4VQCrossSection class. In the G4QCollision class the general G4VQCrossSection* 00042 // pointer is connected to this or that CHIPS cross section class (depending on the 00043 // projectile particle), so each of the CHIPS cross section class must be 00044 // an evolving singletone. The singletone nature can not be realized in the 00045 // virtual class. So each derived CS class must have 00046 // static G4VQCrossSection* GetPointer(); // Gives a pointer to the singletone 00047 // static function, which is defined in the *.cc file as 00048 // // Returns Pointer to the G4VQCrossSection class 00049 // G4VQCrossSection* G4VQCrossSection::GetPointer() 00050 // { 00051 // static G4QXCrossSection theCrossSection; //***Static body of the Cross Section*** 00052 // return &theCrossSection; 00053 // } 00054 // the line 00055 // //virtual static G4VQCrossSection* GetPointer(); // Gives a pointer to the singletone 00056 // Reminds about this necesity, but in C++ the virtual static function can not be 00057 // realised, so the static function can not be realised in the interface. Developers 00058 // must take care of this themselves because this member fuction is called to get a pointer 00059 // to the singletone in the G4QCollision class. So there is an agreement to 00060 // make a separate CS class for each projectile particle, e.g. while the (pi-)d 00061 // and (pi+)d (as well as [n,z] and [z,n]) cross sections) are almost equal, 00062 // they must be calculated in different classes: G4QPiMinusCrossSection and 00063 // G4QPiPlusCrossSections. For the ion-nuclear cross sections there should exist only 00064 // one G4QIonCrossSection class with a huge (#0f isotopes times #of already produced 00065 // ions) DAMDB or a general analitic formula with parameters. --- December 2004 --- 00066 // ----------------------------------------------------------------------- 00067 // At present (25.11.04) for the test purposes this virtual class is created 00068 // for ohly G4QPhotonCrossSection, G4QElectronCrossSection, G4QMuonCrossSection, 00069 // G4QTauCrossSection and G4QProtonCrossSection (only for pp collisions now). 00070 // **************************************************************************************** 00071 // ********* This HEADER is temporary moved from the photolepton_hadron directory ********* 00072 // ******* DO NOT MAKE ANY CHANGE! With time it'll move back to photolepton...(M.K.) ****** 00073 // **************************************************************************************** 00074 // Short description: a basic class for all CHIPS reaction cross-sections. 00075 // ----------------------------------------------------------------------- 00076 00077 #ifndef G4VQCrossSection_h 00078 #define G4VQCrossSection_h 1 00079 00080 #include "G4ParticleTable.hh" 00081 #include "G4NucleiProperties.hh" 00082 #include <vector> 00083 #include "Randomize.hh" 00084 00085 class G4VQCrossSection 00086 { 00087 protected: 00088 00089 G4VQCrossSection() {;} // for each particle a separate instance of G4QCollision should be 00090 // used (and inside use a separate instance of G4Q*CrossSection) 00091 00092 public: 00093 virtual ~G4VQCrossSection() {;}// for each particle separate instance of G4QXCrossSection 00094 //@@ can be improved in future)// should be used and inside a separate istance of CS's 00095 // Set the new tolerance (abs(p_old/p_new-1)<tolerance) 00096 static void setTolerance(G4double tol){tolerance=tol;}// Set NewTolerance for SameCrosSec 00097 00098 // At present momentum (pMom) must be in GeV (@@ Units) 00099 virtual G4double GetCrossSection(G4bool, G4double, G4int, G4int, G4int pPDG=0) 00100 {return G4double(pPDG);} 00101 00102 virtual G4double ThresholdEnergy(G4int Z, G4int N, G4int PDG=0); // Gives 0 by default 00103 00104 // Define in the derived class, F=0 - create AMDB, F=-1 - read AMDB, F=1 - update AMDB 00105 virtual G4double CalculateCrossSection(G4bool CS, G4int F, G4int I, G4int PDG, G4int tgZ, 00106 G4int tgN, G4double pMom)=0;//*** PURE VIRTUAL *** 00107 00108 virtual G4double GetLastTOTCS(); // LastCalculated total cross-section (total elastic) 00109 00110 virtual G4double GetLastQELCS(); // LastCalculated quasielastic cross-section (quasifree) 00111 00112 virtual G4double GetDirectPart(G4double Q2); // DirectInteraction with QuarkPartons (nuA) 00113 00114 virtual G4double GetNPartons(G4double Q2); // #ofQuarkPartons in nonPerturbatPhaseSp(nuA) 00115 00116 // Subroutines for the t-chanel processes with a leader (DIS, Elastic, Quasielastic etc.) 00117 00118 virtual G4double GetExchangeEnergy(); // Returns energy of the t-chanel particle (gam,pi) 00119 00120 virtual G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG); // -t=Q2 for hadronic 00121 00122 virtual G4double GetSlope(G4int tZ, G4int tN, G4int pPDG); // B-slope of the maim maximum 00123 00124 virtual G4double GetHMaxT(); // max(-t=Q2)/2 for hadronic (MeV^2) 00125 00126 virtual G4double GetExchangeQ2(G4double nu=0); // Q2 for lepto-nuclear reactions 00127 00128 virtual G4double GetVirtualFactor(G4double nu, G4double Q2); // ReductionFactor (leptA) 00129 00130 virtual G4double GetQEL_ExchangeQ2(); // Get randomized Q2 for quasi-elastic scattering 00131 00132 virtual G4double GetNQE_ExchangeQ2(); // Get randomized Q2 for non quasi-elastic scat. 00133 00134 virtual G4int GetExchangePDGCode(); // PDGCode of the Exchange Particle (Pi0 by default) 00135 00136 // Body: Basic Parameters of DAMDB (each derived class can add it's own values) 00137 // ----------------------------------------------------------------------------- 00138 // The basic scheme of the DAMDB coveres the cross section for isotopes with fixed 00139 // Z (lastZ - number of protons) and N (lastN - number of neutrons) from the 00140 // Threshold momentum (TH) up to infinity. The cross section is first (Tab.1) 00141 // tabulated from the threshold till the boundary momentum (BP). The Tab.1 is 00142 // the function of the momentum (p) with the N1 elements. The N1 elements can be 00143 // not all different from zero. The first non-zero element is F1, the last non-zero 00144 // element is L1. If TH#0 the Tab.1 can be skipped. It is defined by N1=F1=L1=0 and 00145 // BP=TH. The Tab.1 is the function of the ln(p) with N2 elements (F2 is the first 00146 // non-zero element, L2 is the last non-zero element) from BP up tp MP. Both Tab.1 00147 // and Tab.2 are calculated when the projectile of the class meet the corresponding 00148 // ion. After that the tables are stored in the DAMDB for the fast calculations. To 00149 // avoid a complete calculation of the tables in the low energy calculation case, 00150 // the lastP momentum is used. The tables are calculated only till the momentum, 00151 // which already appeared in the simulation for this projectile and this isotope. 00152 // If the momentum above MP appeared, then the extrapolation function is calculated. 00153 // So, if lastP>MP it means that the cross section is defined for all energies above 00154 // TH. All parameters and pointers to arrays MUST be stored (F=0), updated (F=1) and 00155 // retrieved (F=-1) by the derived class in the CalculateCrossSection(F,I,N,Z,P) 00156 // function. The parameters are used for the immediate result: if the cross section is 00157 // calculated for the same Z, N, and fabs(p-lastP)/lastP<.001 (? - a parameter), the same 00158 // cross section (lastCS) is returned, if p<lastTH, then the 0 cross section is returned. 00159 // It helps to avoid double counting. The derived class can have only the approximation 00160 // functions, but such class is too slow, as it calculates the arythmetic equations each 00161 // time, when it is necessary to get a new cross section. So it is reasonable to 00162 // precalculate the tables, store them in memory, remember the pointers to these 00163 // functions and just interpolate them in the range of the most frequent energies (use 00164 // a LinearFit inline function of this virtual class for that). Starting some high 00165 // momentum (PM) the functional calculations are unavoidable, but fortunately they are 00166 // not frequent. In case of the ion-nuclear cross section the functional approach can 00167 // be reasonable, because tabulated cross-sections demand too much memory. 00168 // 00169 // ----------------------------------------------------------------------------- 00170 protected: 00171 G4double LinearFit(G4double X, G4int N, G4double* XN, G4double* YN); 00172 00173 G4double EquLinearFit(G4double X, G4int N, G4double X0, G4double DX, G4double* Y); 00174 00175 static G4double tolerance;// relative tolerance in momentum to get old CroSec 00176 }; 00177 00178 #endif