NuMIPPWeightCalculator Class Reference

#include <NuMIPPWeightCalculator.h>

List of all members.

Public Member Functions

 NuMIPPWeightCalculator (int pdgcode, const char *yieldsfile)
 ~NuMIPPWeightCalculator ()
double getWeight (double pt, double pz)
double yield (double pt, double pz)
double integralYield (double pt, double pz)
double upperGamma (double a, double z)

Private Attributes

int pdgcode
TH2 * hpip
TH2 * hpim
TH2 * hkp
TH2 * hkm
double par [16]
double err [16]
double a1
double a2
double a3
double a4
double b1
double b2
double b3
double b4
double c1
double c2
double c3
double c1s
double c2s
double c3s
double c4s
double c5s

Detailed Description

Definition at line 7 of file NuMIPPWeightCalculator.h.


Constructor & Destructor Documentation

NuMIPPWeightCalculator::NuMIPPWeightCalculator ( int  pdgcode,
const char *  yieldsfile 
)

Definition at line 11 of file NuMIPPWeightCalculator.cxx.

References a1, a2, a3, a4, b1, b2, b3, b4, c1, c1s, c2, c2s, c3, c3s, c4s, c5s, err, hkm, hkp, hpim, hpip, par, and pdgcode.

00011                                                                            {
00012 
00013   pdgcode=pdgcode_;
00014   TFile* weightFile = new TFile(y,"READ");
00015 
00016   hpip = dynamic_cast<TH2*>(weightFile->Get("hpip"));
00017   hpim = dynamic_cast<TH2*>(weightFile->Get("hpim"));
00018   hkp = dynamic_cast<TH2*>(weightFile->Get("hkp"));
00019   hkm = dynamic_cast<TH2*>(weightFile->Get("hkm"));
00020   
00021   hpip->SetDirectory(0);
00022   hpim->SetDirectory(0);
00023   hkp->SetDirectory(0);
00024   hkm->SetDirectory(0);
00025   weightFile->Close();
00026 
00027   // here, decide on which parameters to load depending on pdgcode
00028   if(pdgcode==211 || pdgcode==321){
00029     // we'll need the pi+ parameters for K+
00030     /*
00031       old parameters
00032       par[0]=-3.88674e-06; err[0]=1.03849e-06;
00033       par[1]= 2.60984e+00; err[1]=3.89089e-01;
00034       par[2]=-2.90048e+00; err[2]=1.22100e-01;
00035       par[3]=1.53609e+00;  err[3]=9.37157e-02;
00036       par[4]=4.35796e-05;  err[4]=3.32793e-06;
00037       par[5]=3.18592e+00;  err[5]=6.03205e-01;
00038       par[6]=-3.73884e-01; err[6]=6.87133e-01;
00039       par[7]=1.99459e+00;  err[7]=2.25944e-02;
00040       par[8]=-1.46818e-02; err[8]=5.03887e-04;
00041       par[9]=1.30658e+00;  err[9]=3.38904e-03;
00042       par[10]=2.84956e+00; err[10]=4.05912e-02;
00043       par[11]=1.59194e+01; err[11]=1.11202e+01;
00044       par[12]=-6.70989e+00;err[12]=3.93253e-02;
00045       par[13]=-3.44275e-01;err[13]=1.05230e-01;
00046       par[14]=-2.05415e+00;err[14]=4.47947e-01;
00047       par[15]=1.37236e+00; err[15]=2.45680e-02;
00048     */
00049     par[0]=-4.78013e-02;   err[0]=1.19397e-02;
00050     par[1]=2.33448e+00;    err[1]=3.60672e-01;
00051     par[2]=-2.87377e+00;   err[2]=1.19466e-01;
00052     par[3]= 1.58776e+00;   err[3]=8.80333e-02;
00053     par[4]= 6.19486e-01;   err[4]=4.44506e-02;
00054     par[5]= 2.97725e+00;   err[5]=4.79023e-01;
00055     par[6]=-5.82068e-01;   err[6]=4.51469e-01;
00056     par[7]= 2.00057e+00;   err[7]=2.17944e-02;
00057     par[8]=-1.66956e-02;   err[8]=8.17237e-03;
00058     par[9]= 1.28141e+00;   err[9]=1.02537e-01;
00059     par[10]= 2.82830e+00;  err[10]=7.60376e-02;
00060     par[11]= 1.51087e+02;  err[11]=1.17148e+01;
00061     par[12]=-2.98852e+00;  err[12]=7.97788e-02;
00062     par[13]=-9.79769e-01;  err[13]=2.99573e-02;
00063     par[14]=-1.33430e+01;  err[14]=1.01973e+00;
00064     par[15]=-4.34652e+00;  err[15]=7.21293e-01;
00065     
00066   }
00067   else if(pdgcode==-211 || pdgcode==-321){
00068     par[0]=-2.48243e-02;  err[0]=1.52576e-02;
00069     par[1]= 2.49064e+00;  err[1]=8.43619e-01;
00070     par[2]=-3.24621e+00;  err[2]=3.17207e-01;
00071     par[3]= 1.73858e+00;  err[3]=1.90866e-01;
00072     par[4]= 8.21670e-01;  err[4]=1.68474e-01;
00073     par[5]= 5.98007e+00;  err[5]=1.06923e+00;
00074     par[6]=-5.79955e-01;  err[6]=9.18860e-01;
00075     par[7]= 1.93172e+00;  err[7]=5.56422e-02;
00076     par[8]=-3.43805e-01;  err[8]=2.27023e-01;
00077     par[9]= 6.62117e-01;  err[9]=1.29493e-01;
00078     par[10]= 1.69688e+00; err[10]=5.17940e-01;
00079     par[11]= 1.94655e+02; err[11]=1.54600e+01;
00080     par[12]=-3.33326e+00; err[12]=1.00273e-01;
00081     par[13]=-7.93735e-01; err[13]=2.65278e-02;
00082     par[14]=-1.83873e+01; err[14]=1.42727e+00;
00083     par[15]=-9.93403e+00; err[15]=1.26850e+00;
00084   }
00085 
00086   a1=par[0]; a2=par[1]; a3=par[2]; a4=par[3];
00087   b1=par[4]; b2=par[5]; b3=par[6]; b4=par[7];
00088   c1=par[8]; c2=par[9]; c3=par[10];
00089   c1s=par[11]; c2s=par[12]; c3s=par[13]; 
00090   c4s=par[14]; c5s=par[15];
00091 
00092 
00093 
00094   delete weightFile;
00095 }

NuMIPPWeightCalculator::~NuMIPPWeightCalculator (  )  [inline]

Definition at line 10 of file NuMIPPWeightCalculator.h.

References hkm, hkp, hpim, and hpip.

00010                              {
00011       hpip->Delete();//TH2::~TH2();
00012       hpim->Delete();//TH2::~TH2();
00013       hkp->Delete();//TH2::~TH2();
00014       hkm->Delete();//TH2::~TH2();
00015       //delete[] par;
00016       //delete[] err;
00017       //delete[] hpip;
00018       //                  delete[] hpim;
00019       //                  delete[] hkp;
00020       //                  delete[] hkm;
00021     };


Member Function Documentation

double NuMIPPWeightCalculator::getWeight ( double  pt,
double  pz 
)

Definition at line 122 of file NuMIPPWeightCalculator.cxx.

References hkm, hkp, hpim, hpip, pdgcode, and yield().

Referenced by NuMIPP::ApplyMippWeights().

00122                                                             {
00123   
00124   TH2* h = 0;
00125   if(pdgcode==211) h=hpip;
00126   else if(pdgcode==-211) h=hpim;
00127   else if(pdgcode==321) h=hkp;
00128   else if(pdgcode==-321) h=hkm;
00129   else return 1;
00130   
00131   if(pdgcode==211 || pdgcode==-211){
00132     if(pt>0.5 && (pz>80 || pz<8)) return 1;
00133     if(pt<0.5 && (pz>80 || pz<0.3)) return 1;
00134   }
00135   else if(pdgcode==321 || pdgcode==-321){
00136     return 1; //for now
00137   }
00138   
00139   double numerator=yield(pt,pz);
00140   double denominator=h->Interpolate(pz,pt);
00141   double w=numerator/denominator;
00142   if((w!=w) || (fabs(w) == std::numeric_limits<double>::infinity())){w=1.0;} // NAN test
00143 
00145   // need to divide the denominator by the bin widths
00146   // since we are comparing to d2N/dpTdpZ
00147   //  double dpT=h->GetYaxis()->GetBinWidth(h->GetYaxis()->FindBin(pt));
00148   //  double dpz=h->GetXaxis()->GetBinWidth(h->GetXaxis()->FindBin(pz));
00149   //  denominator/=(dpT*dpz);
00150 
00151   return w;
00152   
00153 
00154 }

double NuMIPPWeightCalculator::integralYield ( double  pt,
double  pz 
)

Definition at line 168 of file NuMIPPWeightCalculator.cxx.

References a1, a2, a3, a4, b1, b2, b3, b4, c1, c1s, c2, c2s, c3, c3s, c4s, c5s, MuELoss::e, and upperGamma().

00168                                                                 {
00169   
00170   
00171   
00172   // this is the indefinite integral of the MIPP yields
00173   // the measure is dpT
00174   const double pinc=120; // beam momentum
00175 
00176   const double x=pz/pinc; // not the usual xF
00177 
00178   // MIPP parameterization from J. Paley Wine&Cheese
00179   const double A = a1*pow(1-x,a2)*(1+a3*x)*pow(x,-a4);
00180   
00181   const double B = b1*pow(1-x,b2)*(1+b3*x)*pow(x,-b4);
00182   
00183   double C=0.0;
00184   if(x<0.22){
00185     C = -c1/pow(x,c2)+c3;
00186   }
00187   else {
00188     C = c1s/exp((x+c2s)*c3s)+c4s*x+c5s;
00189   }
00190 
00191   if(pt<1e-3) pt=1e-3;
00192   
00193   const double q=C*pow(pt,1.5);
00194 
00195   const double t1=-(2*sqrt(pt))/(9*C);
00196   
00197   const double t2=(3*A/pt)*pow(q,1.0/3.0)*upperGamma(2.0/3.0,q);
00198   
00199   const double t3=3*B*exp(-q);
00200   
00201   const double t4=(B/pow(q,1.0/3.0))*upperGamma(1.0/3.0,q);;
00202 
00203   const double iyield = (1/pinc)*t1*(t2+t3+t4);
00204 
00205   return iyield;
00206   
00207 
00208 }

double NuMIPPWeightCalculator::upperGamma ( double  a,
double  z 
)

Definition at line 157 of file NuMIPPWeightCalculator.cxx.

Referenced by integralYield().

00157                                                            {
00158   // this is the "upper" incomplete gamma function
00159   // which is what mathematica refers to as an "incomplete gamma function"
00160   // TMath::Gamma is the "lower" incomplete gamma function
00161 
00162   // Gamma(a) = upper(a,z)+lower(a,z)
00163   
00164   return TMath::Gamma(a)*(1-TMath::Gamma(a,z));
00165   
00166 }

double NuMIPPWeightCalculator::yield ( double  pt,
double  pz 
)

Definition at line 97 of file NuMIPPWeightCalculator.cxx.

References a1, a2, a3, a4, b1, b2, b3, b4, c1, c1s, c2, c2s, c3, c3s, c4s, and c5s.

Referenced by getWeight().

00097                                                         {
00098   
00099   const double pinc=120; // beam momentum
00100   const double x=pz/pinc; // not the usual xF
00101 
00102   // MIPP parameterization from J. Paley Wine&Cheese
00103   const double A = a1*pow(1-x,a2)*(1+a3*x)*pow(x,-a4);
00104   
00105   const double B = b1*pow(1-x,b2)*(1+b3*x)*pow(x,-b4);
00106 
00107   double C=0.0;
00108   if(x<0.22){
00109     C = -c1/pow(x,c2)+c3;
00110   }
00111   else {
00112     C = c1s/exp((x+c2s)*c3s) +c4s*x+c5s;
00113   }
00114     
00115   const double yield=(1/pinc)*(A+pt*B)*exp(-C*pow(pt,1.5));
00116   
00117   return yield;
00118   
00119 }


Member Data Documentation

double NuMIPPWeightCalculator::a1 [private]

Definition at line 38 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::a2 [private]

Definition at line 38 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::a3 [private]

Definition at line 38 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::a4 [private]

Definition at line 38 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::b1 [private]

Definition at line 39 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::b2 [private]

Definition at line 39 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::b3 [private]

Definition at line 39 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::b4 [private]

Definition at line 39 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::c1 [private]

Definition at line 40 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::c1s [private]

Definition at line 41 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::c2 [private]

Definition at line 40 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::c2s [private]

Definition at line 41 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::c3 [private]

Definition at line 40 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::c3s [private]

Definition at line 41 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::c4s [private]

Definition at line 41 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::c5s [private]

Definition at line 41 of file NuMIPPWeightCalculator.h.

Referenced by integralYield(), NuMIPPWeightCalculator(), and yield().

double NuMIPPWeightCalculator::err[16] [private]

Definition at line 37 of file NuMIPPWeightCalculator.h.

Referenced by NuMIPPWeightCalculator().

double NuMIPPWeightCalculator::par[16] [private]

Definition at line 36 of file NuMIPPWeightCalculator.h.

Referenced by NuMIPPWeightCalculator().

Definition at line 29 of file NuMIPPWeightCalculator.h.

Referenced by getWeight(), and NuMIPPWeightCalculator().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1