Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VQCrossSection.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id$
28 //
29 //
30 // CHIPS virtual class: G4VQCrossSection for the collision cross sections
31 // Created: M.V. Kossov, CERN/ITEP(Moscow), 10-OCT-04
32 // The last update: M.V. Kossov, CERN/ITEP (Moscow) 27-Nov-04
33 //
34 // ****************************************************************************************
35 // ********** This CLASS is temporary moved from the photolepton_hadron directory *********
36 // ******* DO NOT MAKE ANY CHANGE! With time it'll move back to photolepton...(M.K.) ******
37 // ****************************************************************************************
38 // Short description: a basic class for all CHIPS reaction cross-sections.
39 // -----------------------------------------------------------------------
40 
41 //#define debug
42 #define edebug
43 //#define pdebug
44 //#define ppdebug
45 //#define tdebug
46 //#define sdebug
47 
48 #include "G4VQCrossSection.hh"
49 
50 // Initialization of the
51 G4double G4VQCrossSection::tolerance=.001; // The relative tolarence for the same CrSec
52 
53 // Gives the threshold energy for different isotopes (can be improved in the derived class)
55 
56 G4double G4VQCrossSection::GetDirectPart(G4double) {return 0.;} // Direct interaction
57 
58 G4double G4VQCrossSection::GetNPartons(G4double) {return 3.;} // Direct interaction
59 
60 G4double G4VQCrossSection::GetLastTOTCS() {return 0.;} // Get the last total CS
61 
62 G4double G4VQCrossSection::GetLastQELCS() {return 0.;} // Get the last quasi-elast CS
63 
65 
67 
69 
71 
73 
75 
77 
79 
81 
82 // This function finds the linear approximation Y-point for the XN(N), YN(N) table
84 {
85  G4double Xj=XN[0];
86  G4double Xh=XN[N-1];
87  if(X<=Xj) return YN[0];
88  else if(X>=Xh) return YN[N-1];
89  G4double Xp=0.; G4int j=0; while (X>Xj && j<N) {j++; Xp=Xj; Xj=XN[j];}
90  return YN[j]-(Xj-X)*(YN[j]-YN[j-1])/(Xj-Xp);
91 }
92 
93 // This function finds the linear approximation Y-point for equidistant bins: XI=X0+I*DX
95  G4double* Y)
96 {
97 #ifdef pdebug
98  G4cout<<"G4VQCrossSection::EquLinearFit: ***Called*** X="<<X<<", N="<<N<<", X0="<<X0
99  <<", DX="<<DX<<G4endl;
100  G4cout<<"G4VQCrossSection::EquLinearFit: Y[0]="<<Y[0]<<", Y[N-1]="<<Y[N-1]<<G4endl;
101  //for(G4int i=1; i<N; i++)G4cout<<"-----G4VQCS::EquLinearFit: Y["<<i<<"]="<<Y[i]<<G4endl;
102 #endif
103  if(DX<=0. || N<2)
104  {
105  G4cerr<<"***G4VQCrossSection::EquLinearFit: DX="<<DX<<", N="<<N<<G4endl;
106  return Y[0];
107  }
108  G4int N2=N-2;
109  G4double d=(X-X0)/DX;
110  G4int j=static_cast<int>(d);
111  if (j<0) j=0;
112  else if(j>N2) j=N2;
113  d-=j; // excess
114  G4double yi=Y[j];
115  G4double sigma=yi+(Y[j+1]-yi)*d;
116 #ifdef pdebug
117  G4cout<<"G4VQCrossSection::EquLinearFit: CS="<<sigma<<G4endl;
118 #endif
119  return sigma;
120 }