source: trunk/source/processes/hadronic/models/chiral_inv_phase_space/calcul/G4NuMuXYIntegration.cc @ 819

Last change on this file since 819 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 9.6 KB
Line 
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// G4 Tools program: NuMu DIS (x,Q2) approximation is integrated over x
28// .....................................................
29// Created: M.V. Kossov, CERN/ITEP(Moscow), 30-Sept-05
30//
31//=====================================================================
32#include "globals.hh"
33#include <iostream>
34#include <fstream>
35#include <vector>
36#include "G4ios.hh"
37#include <CLHEP/GenericFunctions/LogGamma.hh>
38
39void strucf(int A, double x, double ydME, double& f2, double& xf3, double& fL)
40{
41  const Genfun::LogGamma lGam;
42  double N=3., D=0., Del=0., U2=0., U3=0., V=0.;
43  double Q2=x*ydME;
44  double r=0.;
45  double max=1.;
46  double H=1.22;
47  if(A==1)                   // Proton
48  {
49    r=std::sqrt(Q2/1.66);
50    max=.5;
51  }
52  else if(A<13)              // Light nuclei
53  {
54    double f=Q2/4.62;
55    r=f*f;
56    max=.3;
57    if(A>2) H=1.;
58  }
59  else if(A>0)               // Heavy nuclei
60  {
61    double f=Q2/3.4;
62    double ff=f*f;
63    r=ff*ff;
64    max=.5;
65    H=1.;
66  }
67  else G4cout<<"strucf: A="<<A<<" <= 0"<< G4endl;
68  //
69  N=3.+.3581*std::log(1.+Q2/.04); // a#of partons in the nonperturbative phase space
70  Del=(1.+r)/(12.5+r/max);
71  double S=std::pow(1.+.6/Q2,-1.-Del);
72  D=H*S*(1.-.5*S);
73  V=3*(1.-D)*(N-1.);
74  double cc=Q2/.08;
75  double cc2=cc*cc;
76  double C=(1.+cc2)/(1.+cc2/.24)/(1.+Q2/21.6);
77  double c3=C+C+C;
78  double uu=std::exp(lGam(N-Del)-lGam(N-1.)-lGam(1.-Del))/N;
79  U2=(c3+N-3.)*uu;
80  U3=c3*uu;
81  // From here the Q2 coefficients are used
82  double x1=std::pow(1.-x,N-2.);
83  double pp=D*std::pow(x,-Del)*x1;
84  double dir=V*x*x1;
85  double per=U2*pp;
86                f2 = per + dir;
87  xf3= U3*pp+dir;
88  fL = per/4.;
89  return;
90}
91
92void getFun(int A, double lx, double ydME, double* f)
93{
94  double f2=0., xf3=0., fL=0.;
95  if (lx>0.5) G4cerr<<"***getFun: ln(x)="<<lx<<">.5"<<G4endl;
96  double x=std::exp(lx);
97  strucf(A, x, ydME, f2, xf3, fL);
98  f[0]=x*f2;          // direct part
99  f[1]=x*(-f2+xf3);   // *y (neutrino) part
100  f[2]=x*(-f2-xf3);   // *y (anti-neutrino) part
101  f[3]=x*(f2-fL-xf3); // *y2 (neutrino) part
102  f[4]=x*(f2-fL+xf3); // *y2 (anti-neutrino) part
103}
104
105int main()
106{
107  const double reps=.01;        // relative accuracy of the total Q2 integral calculation
108  const double xeps=.0001;      // relative accuracy of the total X integral calculation
109  //           =========
110  const double GF=1.16637e-5;   // Fermi constant in GeV^-2
111  const double GF2=GF*GF;       // Squared Fermi constant in GeV^-4
112  const double MW=80.425;       // Mass of W-boson in GeV
113  const double MW2=MW*MW;       // Squared mass of W-boson in GeV^2
114  const double MW4=MW2*MW2;     // Quadro mass of W-boson in GeV^4
115  const double hc2=38937932300.;// (hc)^2 in GeV^2*10^-38cm2 to convert GeV^-2 to 10^-38cm2
116  const double pif=3.14159265*4;// 4pi
117  const double sik=GF2*MW4*hc2/pif; // precalculated coefficient
118  const double mpi=.1349766;    // pi0 meson mass in GeV
119  const double mpi2=mpi*mpi;    // m_pi^2 in GeV^2
120  const double me=.00051099892; // electron mass in GeV
121  const double me2=me*me;       // m_e^2 in GeV^2
122  const double hme2=me2/2;      // .5*m_e^2 in GeV^2
123  const double mmu=.105658369;  // mu meson mass in GeV
124  const double mmu2=mmu*mmu;    // m_mu^2 in GeV^2
125  const double hmmu2=mmu2/2;    // .5*m_mu^2 in GeV^2
126  const double mtau=1.777;      // tau meson mass in GeV
127  const double mtau2=mtau*mtau; // m_tau^2 in GeV^2
128  const double hmtau2=mtau2/2;  // .5*m_e^2 in GeV^2
129  const double mp=.93827203;    // proton mass in GeV
130  const double mn=.93956536;    // neutron mass in GeV
131  const double md=1.87561282;   // deuteron mass in GeV
132  const double MN=.931494043;   // Nucleon mass (inside nucleus) in GeV (atomic mass unit)
133  const double mp2=mp*mp;       // m_p^2 in GeV^2
134  const double MN2=MN*MN;       // M_N^2 in GeV^2
135  const double dMN=MN+MN;       // 2*M_N in GeV
136  const double EminE=me+me2/dMN;// Threshold for muon production
137  const double EminMu=mmu+mmu2/dMN;  // Threshold for muon production
138  const double EminTau=mmu+mmu2/dMN; // Threshold for muon production
139  //std::ofstream fileNuMuX("NuMuXQ2.out", std::ios::out);
140  //fileNuMuX.setf( std::ios::scientific, std::ios::floatfield );
141  // _____ Begin of Test Area
142  //Genfun::LogGamma logGamma;
143  //double n=4.9;
144                //double g=exp(logGamma(n));
145  //G4cout<<"Gamma("<<n<<") = "<<g<<G4endl;
146  // ^^^^^ End of Test Area
147  //
148  double f[5];                    // A working array
149  int    A=12;                    // Neucleus for which calculations should be done
150  double lEnuMin=std::log(EminMu);     // Log of Minimum energy of neutrino
151  double lEnuMax=std::log(300.);       // Log of Maximum energy of neutrino
152  int    nE=20;
153  double dlE=(lEnuMax-lEnuMin)/nE;
154  G4cout<<"Emin="<<EminMu<<",lEi="<<lEnuMin<<",lEa="<<lEnuMax<<",dlE="<<dlE<<G4endl;
155  for(double lEnu=lEnuMin+dlE/2; lEnu<lEnuMax; lEnu+=dlE)
156                {
157    double Enu=std::exp(lEnu);         // Energy of neutrino/anti-neutrino
158    double dEnu=Enu+Enu;          // doubled energy of nu/anu
159    double Enu2=Enu*Enu;          // squared energy of nu/anu
160    double ME=Enu*MN;             // M*E
161    double dME=ME+ME;             // 2*M*E
162    double DIStsig=1.;            // Total curent DIS cross-section to be integrated
163    double DISmsig=1.e20;         // Total remembered DIS cross-section
164    double dEMN=(dEnu+MN)*ME;
165    double MEm=ME-hmmu2;
166    double sqE=Enu*std::sqrt(MEm*MEm-mmu2*MN2);
167    double E2M=MN*Enu2-(Enu+MN)*hmmu2;
168    double ymax=(E2M+sqE)/dEMN;
169    double ymin=(E2M-sqE)/dEMN;
170    // The Q2min/max calculation is not necessary in this method
171    //double rmin=1.-ymin;
172    //double rhm2E=hmmu2/Enu2;
173    //double Q2min=(Enu2+Enu2)*(rmin-rhm2E-sqrt(rmin*rmin-rhm2E-rhm2E));
174    //double Q2max=dME*ymax;
175    int    nY=8;
176    //G4cout<<"*** E="<<Enu<<", N="<<nY<<", yi="<<ymin<<" < ya="<<ymax<<G4endl;
177    while(std::fabs(DIStsig-DISmsig)/DIStsig>reps)
178    {
179      DISmsig=DIStsig;
180      DIStsig=0.;
181      nY*=2;
182      double dY=(ymax-ymin)/nY;
183      for(double y=ymin+dY/2; y<ymax; y+=dY)
184                                  {
185        double y2=y*y;
186        double DISxint=1.;        // Curent DIS x-integral
187        double DISmint=1.e20;     // Remembered DIS x-integral
188        double lXmin=std::log((std::sqrt(Enu2+mmu2)-Enu)/MN);
189        double lXmax=0.;          // Temporary, while QES is in DIS
190        double ydME=y*dME;
191        int    nX=8;
192        while(std::fabs(DISxint-DISmint)/DISxint>xeps)
193        {
194          DISmint=DISxint;
195          DISxint=0.;
196          nX*=2;
197          double dlX=(lXmax-lXmin)/nX;
198          for(double lX=lXmin+dlX/2; lX<lXmax; lX+=dlX)
199                                      {
200            getFun(A, lX, ydME, f);
201            double dik=std::exp(lX)*ydME+MW2;
202            //DISxint+=(f[0]+f[0]+(y+y)*f[1]+y2*f[3])/dik/dik; // neutrino
203            DISxint+=(f[0]+f[0]+(y+y)*f[2]+y2*f[4])/dik/dik; // anti-neutrino
204            //G4cout<<f[0]<<","<<f[1]<<","<<f[2]<<","<<f[3]<<","<<f[4]<<G4endl;
205          }
206          DISxint*=dlX;
207          //G4cout<<"--- E="<<Enu<<" --- Q2="<<Q2<<" --- nX="<<nX<<", iX="<<DISxint
208          //      <<", mX="<<DISmint<<", rX="<<(DISxint-DISmint)/DISxint<<G4endl;
209        }
210        //G4cout<<"(E="<<Enu<<"), Q2="<<Q2<<", I="<<DISxint/dik/dik<<G4endl;
211        DIStsig+=DISxint;
212      }
213      DIStsig*=dY;
214      //G4cout<<"=== E="<<Enu<<" ===> nQ="<<nQ2<<", iQ="<<DIStsig<<", mQ="<<DISmsig
215                                                //      <<", rQ="<<(DIStsig-DISmsig)/DIStsig<<G4endl;
216    }
217    DIStsig*=sik*dMN; // Jakobian is 2ME => instead of 1/E must be *2M
218    G4cout<<"*** E="<<Enu<<",sig/E="<<DIStsig<<G4endl;
219                } // End of the Enery LOOP
220  // int np=0;
221  //for(int m=0; m<2; m++)
222  //{
223  //  //fileNuMuX<<"  static const G4double SH"<<n<<"[nH]={"<<G4endl<<"    ";
224  //  //G4cout<<"**** A_high="<<m<<G4endl;
225  //  np=0;
226  //  int nC=14;
227         //  for(G4int en=0; en<nC; en++)
228         //  {
229  //    //G4double sig=1.;
230  //    np++;
231  //    //if(np==7)           // Write by 7 number in brackets
232  //    //{
233  //    //  if(en==nC-1) fileNuMuX<<sig<<"};"<<G4endl;
234  //    //  else         fileNuMuX<<sig<<","<<G4endl<<"    ";
235         //    //}
236  //    //else           fileNuMuX<<sig<<",";
237  //    //if(np==7) np=0;
238  //  } // End of the point LOOP
239  //} // End of the isotop LOOP
240  return EXIT_SUCCESS;
241}
Note: See TracBrowser for help on using the repository browser.