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: G4VQCrossSection.cc,v 1.14 2007/11/15 09:36:43 mkossov Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // CHIPS virtual class: G4VQCrossSection for the collision cross sections |
---|
32 | // Created: M.V. Kossov, CERN/ITEP(Moscow), 10-OCT-04 |
---|
33 | // The last update: M.V. Kossov, CERN/ITEP (Moscow) 27-Nov-04 |
---|
34 | // |
---|
35 | //========================================================================================= |
---|
36 | // **************************************************************************************** |
---|
37 | // ********** This CLASS is temporary moved from the photolepton_hadron directory ********* |
---|
38 | // ******* DO NOT MAKE ANY CHANGE! With time it'll move back to photolepton...(M.K.) ****** |
---|
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) |
---|
54 | G4double G4VQCrossSection::ThresholdEnergy(G4int , G4int, G4int) {return 0.;} // Fake use |
---|
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 | |
---|
64 | G4double G4VQCrossSection::GetExchangeEnergy() {return 0.;} |
---|
65 | |
---|
66 | G4double G4VQCrossSection::GetExchangeQ2(G4double) {return 0.;} |
---|
67 | |
---|
68 | G4double G4VQCrossSection::GetSlope(G4int,G4int,G4int) {return 0.;} |
---|
69 | |
---|
70 | G4double G4VQCrossSection::GetExchangeT(G4int,G4int,G4int) {return 0.;} |
---|
71 | |
---|
72 | G4double G4VQCrossSection::GetHMaxT() {return 0.;} |
---|
73 | |
---|
74 | G4double G4VQCrossSection::GetQEL_ExchangeQ2() {return 0.;} |
---|
75 | |
---|
76 | G4double G4VQCrossSection::GetNQE_ExchangeQ2() {return 0.;} |
---|
77 | |
---|
78 | G4int G4VQCrossSection::GetExchangePDGCode() {return 0;} |
---|
79 | |
---|
80 | G4double G4VQCrossSection::GetVirtualFactor(G4double nu, G4double Q2) {return 0.*nu*Q2;} |
---|
81 | |
---|
82 | // This function finds the linear approximation Y-point for the XN(N), YN(N) table |
---|
83 | G4double G4VQCrossSection::LinearFit(G4double X, G4int N, G4double* XN, G4double* YN) |
---|
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 |
---|
94 | G4double G4VQCrossSection::EquLinearFit(G4double X, G4int N, G4double X0, G4double DX, |
---|
95 | G4double* Y) |
---|
96 | { |
---|
97 | #ifdef pdebug |
---|
98 | G4cout<<"G4VQCrossSection::EquLinearFit: ***Called*** X="<<DX<<", N="<<N<<", X0="<<X0 |
---|
99 | <<", DX="<<DX<<G4endl; |
---|
100 | G4cout<<"G4VQCrossSection::EquLinearFit: Y[0]="<<Y[0]<<", Y[N-1]="<<Y[N-1]<<G4endl; |
---|
101 | #endif |
---|
102 | if(DX<=0. || N<2) |
---|
103 | { |
---|
104 | G4cerr<<"***G4VQCrossSection::EquLinearFit: DX="<<DX<<", N="<<N<<G4endl; |
---|
105 | return Y[0]; |
---|
106 | } |
---|
107 | G4int N2=N-2; |
---|
108 | G4double d=(X-X0)/DX; |
---|
109 | G4int j=static_cast<int>(d); |
---|
110 | if (j<0) j=0; |
---|
111 | else if(j>N2) j=N2; |
---|
112 | d-=j; // excess |
---|
113 | G4double yi=Y[j]; |
---|
114 | G4double sigma=yi+(Y[j+1]-yi)*d; |
---|
115 | return sigma; |
---|
116 | } |
---|