G4VQCrossSection.cc

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 //
00029 //
00030 // CHIPS virtual class: G4VQCrossSection for the collision cross sections
00031 // Created: M.V. Kossov, CERN/ITEP(Moscow), 10-OCT-04
00032 // The last update: M.V. Kossov, CERN/ITEP (Moscow) 27-Nov-04
00033 // 
00034 // ****************************************************************************************
00035 // ********** This CLASS is temporary moved from the photolepton_hadron directory *********
00036 // ******* DO NOT MAKE ANY CHANGE! With time it'll move back to photolepton...(M.K.) ******
00037 // ****************************************************************************************
00038 // Short description: a basic class for all CHIPS reaction cross-sections.
00039 // -----------------------------------------------------------------------
00040 
00041 //#define debug
00042 #define edebug
00043 //#define pdebug
00044 //#define ppdebug
00045 //#define tdebug
00046 //#define sdebug
00047 
00048 #include "G4VQCrossSection.hh"
00049 
00050 // Initialization of the
00051 G4double  G4VQCrossSection::tolerance=.001;   // The relative tolarence for the same CrSec
00052 
00053 // Gives the threshold energy for different isotopes (can be improved in the derived class)
00054 G4double G4VQCrossSection::ThresholdEnergy(G4int , G4int, G4int) {return 0.;} // Fake use
00055 
00056 G4double G4VQCrossSection::GetDirectPart(G4double) {return 0.;} // Direct interaction
00057 
00058 G4double G4VQCrossSection::GetNPartons(G4double) {return 3.;} // Direct interaction
00059 
00060 G4double G4VQCrossSection::GetLastTOTCS() {return 0.;} // Get the last total CS
00061 
00062 G4double G4VQCrossSection::GetLastQELCS() {return 0.;} // Get the last quasi-elast CS
00063 
00064 G4double G4VQCrossSection::GetExchangeEnergy() {return 0.;}
00065 
00066 G4double G4VQCrossSection::GetExchangeQ2(G4double) {return 0.;}
00067 
00068 G4double G4VQCrossSection::GetSlope(G4int,G4int,G4int) {return 0.;}
00069 
00070 G4double G4VQCrossSection::GetExchangeT(G4int,G4int,G4int) {return 0.;}
00071 
00072 G4double G4VQCrossSection::GetHMaxT() {return 0.;}
00073 
00074 G4double G4VQCrossSection::GetQEL_ExchangeQ2() {return 0.;}
00075 
00076 G4double G4VQCrossSection::GetNQE_ExchangeQ2() {return 0.;}
00077 
00078 G4int G4VQCrossSection::GetExchangePDGCode() {return 0;}
00079 
00080 G4double G4VQCrossSection::GetVirtualFactor(G4double nu, G4double Q2) {return 0.*nu*Q2;}
00081 
00082 // This function finds  the linear approximation Y-point for the XN(N), YN(N) table
00083 G4double G4VQCrossSection::LinearFit(G4double X, G4int N, G4double* XN, G4double* YN)
00084 {
00085   G4double Xj=XN[0];
00086   G4double Xh=XN[N-1];
00087   if(X<=Xj) return YN[0]; 
00088   else if(X>=Xh) return YN[N-1];
00089   G4double Xp=0.; G4int j=0; while (X>Xj && j<N) {j++; Xp=Xj; Xj=XN[j];}
00090   return YN[j]-(Xj-X)*(YN[j]-YN[j-1])/(Xj-Xp);
00091 }
00092 
00093 // This function finds the linear approximation Y-point for equidistant bins: XI=X0+I*DX
00094 G4double G4VQCrossSection::EquLinearFit(G4double X, G4int N, G4double X0, G4double DX,
00095                                         G4double* Y)
00096 {
00097 #ifdef pdebug
00098   G4cout<<"G4VQCrossSection::EquLinearFit: ***Called*** X="<<X<<", N="<<N<<", X0="<<X0
00099         <<", DX="<<DX<<G4endl;
00100   G4cout<<"G4VQCrossSection::EquLinearFit: Y[0]="<<Y[0]<<", Y[N-1]="<<Y[N-1]<<G4endl;
00101   //for(G4int i=1; i<N; i++)G4cout<<"-----G4VQCS::EquLinearFit: Y["<<i<<"]="<<Y[i]<<G4endl;
00102 #endif
00103   if(DX<=0. || N<2)
00104   {
00105     G4cerr<<"***G4VQCrossSection::EquLinearFit: DX="<<DX<<", N="<<N<<G4endl;
00106     return Y[0];
00107   }
00108   G4int    N2=N-2;
00109   G4double d=(X-X0)/DX;
00110   G4int         j=static_cast<int>(d);
00111   if     (j<0)  j=0;
00112   else if(j>N2) j=N2;
00113   d-=j; // excess
00114   G4double yi=Y[j];
00115   G4double sigma=yi+(Y[j+1]-yi)*d;
00116 #ifdef pdebug
00117   G4cout<<"G4VQCrossSection::EquLinearFit: CS="<<sigma<<G4endl;
00118 #endif
00119   return sigma;
00120 }

Generated on Mon May 27 17:50:20 2013 for Geant4 by  doxygen 1.4.7