13     const char* ppfxDir = 
getenv(
"PPFX_DIR");
    15     sprintf(dirData,
"%s/data",ppfxDir);
    23     spart_prod.push_back(
"neu"); 
const int idx_neu = 7;
    34     for(
int i=0;i<part_size;i++){
    36         fpC_x[i] = 
new TFile(Form(
"%s/MC/FTFP/invxs_%s_FTFP_BERT.root",dirData,
spart_prod[i].c_str()),
"read");
    40         fpC_x[i] = 
new TFile(Form(
"%s/MC/FTFP/yield_%s_FTFP_BERT.root",dirData,
spart_prod[i].c_str()),
"read");
    41         for(
int j=0;j<mom_size;j++)
vpC_n.push_back((TH1D*)
fpC_x[i]->Get(Form(
"dndxf_%dGeV",
mom_inc[j])));
    48     for(
int i=0;i<qe_size;i++){
    50         fqe_corr[i] = 
new TFile(Form(
"%s/MC/FTFP/invxs_qe_corr_%s.root",dirData,
spart_qe_corr[i].c_str()),
"read");
    53       else if(i==(qe_size-1)){
    54         fqe_corr[i] = 
new TFile(Form(
"%s/MC/FTFP/yield_qe_corr_%s.root",dirData,
spart_qe_corr[i].c_str()),
"read");
    61     const char* cscl_parts[Nscl] = {
"pip",
"pim",
"kap",
"kam",
"prt"};
    62     const int Nmomscl = 11;
    63     const int mom_scale[Nmomscl] = {12,20,31,40,50,60,70,80,100,120,158};
    64     for(Int_t ipart=0;ipart<Nscl;ipart++){
    69     for(Int_t ipart=0;ipart<Nscl;ipart++){
    70       std::vector<TH2F*> tmp_scl;
    71       for(
int imom=0;imom<Nmomscl;imom++){
    78     for(
int imom=0;imom<Nmomscl;imom++){
    88     if(pdgcode!=211 && pdgcode!=-211 && pdgcode!=321 && pdgcode!=-321 && pdgcode!=2212 && pdgcode!=2112 && pdgcode!=130 && pdgcode!=310)
return -1;    
    94     for(
size_t i=0;i<
mom_inc.size()-1;i++){
   104     if(pdgcode ==  211)idx_part=0;
   105     if(pdgcode == -211)idx_part=1;
   106     if(pdgcode ==  321)idx_part=2;
   107     if(pdgcode == -321)idx_part=3;
   116     if(pdgcode ==  130)idx_part=5;
   117     if(pdgcode ==  310)idx_part=6;
   120     double qe_corr = 1.0;
   122       int binp     = 
vpC_x[idx_part][idx_lowp]->FindBin(xf,pt);
   123       double mclow = 
vpC_x[idx_part][idx_lowp]->GetBinContent(binp);
   124       double mchi  = 
vpC_x[idx_part][idx_hip]->GetBinContent(binp);
   125       mcval = mclow + (incP-double(
mom_inc[idx_lowp]))*(mchi-mclow)/(double(
mom_inc[idx_hip])-double(
mom_inc[idx_lowp]));
   127         int binqe       = 
vqe_corr_p[idx_lowp]->FindBin(xf,pt);
   128         double qelow    = 
vqe_corr_p[idx_lowp]->GetBinContent(binqe);
   129         double qehi     = 
vqe_corr_p[idx_hip]->GetBinContent(binqe);
   130          qe_corr  = qelow + (incP-double(
mom_inc[idx_lowp]))*(qehi-qelow)/(double(
mom_inc[idx_hip])-double(
mom_inc[idx_lowp]));
   133     else if(idx_part==7){
   134       int binp     = 
vpC_n[idx_lowp]->FindBin(xf);
   135       double mclow = 
vpC_n[idx_lowp]->GetBinContent(binp);
   136       double mchi  = 
vpC_n[idx_hip]->GetBinContent(binp);
   137       mcval = mclow + (incP-double(
mom_inc[idx_lowp]))*(mchi-mclow)/(double(
mom_inc[idx_hip])-double(
mom_inc[idx_lowp]));
   138       int binqe    = 
vqe_corr_n[idx_lowp]->FindBin(xf);
   139       double qelow = 
vqe_corr_n[idx_lowp]->GetBinContent(binqe);
   140       double qehi  = 
vqe_corr_n[idx_hip]->GetBinContent(binqe);
   141       qe_corr  = qelow + (incP-double(
mom_inc[idx_lowp]))*(qehi-qelow)/(double(
mom_inc[idx_hip])-double(
mom_inc[idx_lowp]));
   147     if(mcval<1.
e-12 || mcval!=mcval)
return -1;
   155     double xx[13] ={12,20,31,40,50,60,70,80,90,100,110,120,158};
   156     double yy[13] ={153386793./197812683.,160302538./197811564.,164508480./197831250.,166391359./197784915.,
   157                     167860919./197822312.,168882647./197807739.,169681805./197803099.,170311264./197811098.,
   158                     170860912./197822002.,171309291./197834756.,171651963./197811822.,171991260./197823012.,
   159                   172902228./197804669.};
   163     for(
int i=0;i<12;i++){
   164       if(inc_mom>=
double(xx[i]) && inc_mom<
double(xx[i+1])){
   169     double frac_low = yy[idx_lowp];
   170     double frac_hi  = yy[idx_hip];
   171     double frac_m   =  frac_low + (inc_mom-double(xx[idx_lowp]))*(frac_hi-frac_low)/(double(xx[idx_hip])-double(xx[idx_lowp]));
   173     if(genid==0)
return frac_m*243.2435;
   174     else if(genid>0)
return frac_m;
   176       std::cout<<
"Something is wrong with gen "<<
std::endl;
   183     double xx[13] ={12,20,31,40,50,60,70,80,90,100,110,120,158};
   184     double yy[13] ={153386793./197812683.,160302538./197811564.,164508480./197831250.,166391359./197784915.,
   185                     167860919./197822312.,168882647./197807739.,169681805./197803099.,170311264./197811098.,
   186                     170860912./197822002.,171309291./197834756.,171651963./197811822.,171991260./197823012.,
   187                   172902228./197804669.};
   191     for(
int i=0;i<12;i++){
   192       if(inc_mom>=
double(xx[i]) && inc_mom<
double(xx[i+1])){
   197     double frac_low = yy[idx_lowp];
   198     double frac_hi  = yy[idx_hip];
   199     double frac_m   =  frac_low + (inc_mom-double(xx[idx_lowp]))*(frac_hi-frac_low)/(double(xx[idx_hip])-double(xx[idx_lowp]));
   201     if(genid==0 && pdg==2212)
return frac_m*243.2435;
   202     if(genid>0  && pdg==2212)
return frac_m;
   203     if(genid==0 && pdg==2112)
return frac_m;
   204     if(genid>0  && pdg==2112)
return frac_m/243.2435;
 std::vector< std::string > spart_qe_corr
 
std::vector< TH2D * > vqe_corr_p
 
std::vector< TH1F * > hTTScl_n
Vector of the scaling histograms for neutrons: 
 
std::vector< TH1D * > vpC_n
 
double getMCval_pC_X(double incP, double xf, double pt, int pdgcode)
MC value for this HP production. 
 
std::vector< int > mom_inc
 
std::vector< std::vector< TH2F * > > hTTScl
Vector of the scaling histograms: 
 
double getMCxs_pC_nucleon(int genid, int pdg, double inc_mom)
Get the MC roduction cross-section pC->n, p: 
 
std::vector< TH2D * > vpC_x[8]
 
std::vector< TFile * > fTTscale
 
A class to manage the MC value for thin target. 
 
fInnerVessel push_back(Point(-578.400000, 0.000000, 0.000000))
 
std::string getenv(std::string const &name)
 
std::vector< std::string > spart_prod
 
static ThinTargetMC * instance
 
std::vector< TH1D * > vqe_corr_n
 
double getMCxs_pC_piK(int genid, double inc_mom)
Get the MC roduction cross-section pC->pi, K: 
 
QTextStream & endl(QTextStream &s)
 
static ThinTargetMC * getInstance()