00001 #include "TYHadronWeight.h"
00002 #include "TMath.h"
00003
00004 double TYDefPar[5] = {1.20448,0.0066884,0.589213,0.0191205,1};
00005
00006 double TYHadronWeight(double w2, double totpt, int npi0, int res, double *par)
00007 {
00008
00009
00010
00011
00012
00013
00014
00015 double wei = 1.0;
00016 if ( res != 1003) return wei;
00017
00018 double A = 0.2289*TMath::Power(w2+18.14,-1.17)*(1+32.51*w2);
00019 double B = 0.1886*TMath::Power(w2,0.3501);
00020
00021 double Ap = (par[0]+w2*par[1])*A;
00022 double Bp = (par[2]+w2*par[3])*B;
00023
00024 double ExpTerm = -TMath::Power((totpt-Ap)/Bp,2)+TMath::Power((totpt-A)/B,2);
00025 wei =wei*B/Bp*TMath::Exp(ExpTerm/2.0);
00026
00027 double C = 0.01951+0.5909*TMath::Log(w2);
00028 double Cp = (par[4])*C;
00029 wei = wei*TMath::Exp(-(Cp-C))*TMath::Power(Cp/C,npi0);
00030
00031 if (wei<0) wei = 1;
00032 if (wei<1e-5) wei = 0;
00033 if (wei>10) wei = 10;
00034
00035 return wei;
00036 }
00037
00038 double TYHadronWeight(NueRecord *nr, double *par)
00039 {
00040 double w2 = double(nr->mctrue.w2);
00041
00042 return TYHadronWeight(w2, nr->shi.totpt, nr->shi.npi0,
00043 nr->mctrue.resonanceCode, par);
00044 }
00045
00046 double TYHadronWeight(NueRecord *nr)
00047 {
00048 return TYHadronWeight(nr, TYDefPar);
00049 }
00050
00051 double TYHadronWeight(double w2, double totpt, int npi0, int res)
00052 {
00053 return TYHadronWeight(w2,totpt,npi0,res, TYDefPar);
00054 }
00055