Extrapolate2D_Simple Class Reference

#include <Extrapolate2D_Simple.h>

Inheritance diagram for Extrapolate2D_Simple:
Extrapolate2D

List of all members.

Public Member Functions

 Extrapolate2D_Simple ()
virtual ~Extrapolate2D_Simple ()
void SetUseInputWithNo3DHists ()
void OscillatePrediction ()

Private Member Functions

void ReadNDDataFile ()
void ReadFNFile ()
void ReadFNFileNo3D ()
void ReadFiles ()
void SetupPredHists ()
void FarNearPred (Background::Background_t bg)
void AppearancePred (Background::Background_t bg)
void BeamNuePred ()
void RebinInputHists ()
void OscillatePrediction_SepNuNuBar ()
void OscillatePrediction_NoSep ()

Private Attributes

bool UseInputWithNo3D
map< Background::Background_t,
TH2D * > 
FD_RecoVsPID
map< Background::Background_t,
TH2D * > 
ND_RecoVsPID
TH2D * NDMC_Total
TH2D * NDMC_BNueCC
TH2D * NDMC_NuMuCC
TH2D * NDMC_NC
TH2D * NDData_Ratio

Detailed Description

Definition at line 21 of file Extrapolate2D_Simple.h.


Constructor & Destructor Documentation

Extrapolate2D_Simple::Extrapolate2D_Simple (  ) 

Definition at line 5 of file Extrapolate2D_Simple.cxx.

References Extrapolate2D::DeltaCP, Extrapolate2D::DeltaMSq12, Extrapolate2D::DeltaMSq23, Extrapolate2D::FDComponents, Extrapolate2D::FNforBeamNue, Extrapolate2D::Init, Extrapolate2D::InitializeOscCalc(), Background::kBNueCC, Background::kNC, Background::kNueCC, Background::kNuMuCC, Background::kNuTauCC, Extrapolate2D::MRE_infile, Extrapolate2D::nPID, Extrapolate2D::nReco, Extrapolate2D::nRecoCC, Extrapolate2D::nTrue, Extrapolate2D::Oscillated, Extrapolate2D::PIDEdges, Extrapolate2D::PrintResult, Extrapolate2D::ReadError, Extrapolate2D::ReadExtrapFromFile, Extrapolate2D::ReadMREFromFile, Extrapolate2D::RebinE, Extrapolate2D::RebinP, Extrapolate2D::RecoCCEdges, Extrapolate2D::RecoEdges, Extrapolate2D::SetFarPOT(), Extrapolate2D::SetNearPOT(), Extrapolate2D::SetRunPeriod(), Extrapolate2D::Theta12, Extrapolate2D::Theta13, Extrapolate2D::Theta23, Extrapolate2D::TrueEdges, UseInputWithNo3D, Extrapolate2D::UseSeparateNuNuBar, and Extrapolate2D::WriteOutput.

00006 {
00007   int i;
00008   
00009   nReco = 100;
00010   nRecoCC = 100;
00011   for(i=0;i<nReco+1;i++)
00012   {
00013     RecoEdges.push_back(i*1.);
00014     RecoCCEdges.push_back(i*1.);
00015   }
00016   nTrue = 1200;
00017   for(i=0;i<nTrue+1;i++)
00018   {
00019     TrueEdges.push_back(i*0.1);
00020   }
00021   nPID = 20;
00022   for(i=0;i<nPID+1;i++)
00023   {
00024     PIDEdges.push_back(i*0.05);
00025   }
00026   
00027   SetNearPOT();
00028   SetFarPOT();
00029   FNforBeamNue = false;
00030   SetRunPeriod();
00031   InitializeOscCalc();
00032   
00033   FDComponents.clear();
00034   FDComponents.push_back(Background::kNC);
00035   FDComponents.push_back(Background::kNuMuCC);
00036   FDComponents.push_back(Background::kNuTauCC);
00037   FDComponents.push_back(Background::kNueCC);
00038   FDComponents.push_back(Background::kBNueCC);
00039   
00040   Theta13=0;
00041   Theta12=0;
00042   Theta23=0;
00043   DeltaMSq23=0;
00044   DeltaMSq12=0;
00045   DeltaCP=0;
00046   
00047   ReadExtrapFromFile = false;
00048   
00049   MRE_infile = "NULL";
00050   ReadMREFromFile = false;
00051   
00052   RebinE = false;
00053   RebinP = false;
00054   
00055   PrintResult = false;
00056   
00057   WriteOutput = false;
00058   
00059   Init = false;//ie haven't called GetPrediction() yet
00060   
00061   ReadError = false;
00062   
00063   UseInputWithNo3D = false;
00064   
00065   Oscillated = false;//haven't called OscillatePrediction() yet
00066   
00067   UseSeparateNuNuBar=false;
00068   
00069   return;
00070 }

Extrapolate2D_Simple::~Extrapolate2D_Simple (  )  [virtual]

Definition at line 71 of file Extrapolate2D_Simple.cxx.

00072 {
00073 }


Member Function Documentation

void Extrapolate2D_Simple::AppearancePred ( Background::Background_t  bg  )  [private, virtual]

Reimplemented from Extrapolate2D.

Definition at line 688 of file Extrapolate2D_Simple.cxx.

References Extrapolate2D::FD_Eff, Extrapolate2D::FD_Nu_TrueVsRecoVsPID, Extrapolate2D::FD_NuBar_TrueVsRecoVsPID, Extrapolate2D::FD_True2Reco_Fid, Extrapolate2D::FD_TrueVsRecoVsPID, it, Background::kNueCC, Background::kNuTauCC, Extrapolate2D::NominalOscProb, Extrapolate2D::NominalOscProb_NuBar, Extrapolate2D::nPID, Extrapolate2D::nReco, Extrapolate2D::nTrue, Extrapolate2D::Pred, Extrapolate2D::Pred_3D, Extrapolate2D::Pred_CC_Fid, Extrapolate2D::Pred_Nu_3D, Extrapolate2D::Pred_NuBar_3D, Extrapolate2D::qNuMuToNue, Extrapolate2D::qNuMuToNuTau, Extrapolate2D::UseSeparateNuNuBar, and Extrapolate2D::XSecWeight.

00689 {
00690   if(bg!=Background::kNueCC && bg!=Background::kNuTauCC)
00691   {
00692     cout<<"Can only use AppearancePred() for taus and signal nues"<<endl;
00693     return;
00694   }
00695   
00696   int ip,ir,it;
00697   double temp,sum;
00698   double nu,nubar;
00699   for(ip=0;ip<nPID;ip++)
00700   {
00701     for(ir=0;ir<nReco;ir++)
00702     {
00703       sum=0;
00704       
00705       for(it=0;it<nTrue;it++)
00706       {
00707         temp = Pred_CC_Fid->GetBinContent(it+1)*XSecWeight[bg]->GetBinContent(it+1)*FD_True2Reco_Fid[bg]->GetBinContent(ir+1,it+1)*FD_Eff[bg]->GetBinContent(ip+1,ir+1);
00708         nu=temp;
00709         nubar=temp;
00710         
00711         if(bg==Background::kNueCC)
00712         {
00713           temp*=NominalOscProb[qNuMuToNue]->GetBinContent(it+1);
00714           Pred_3D[qNuMuToNue]->SetBinContent(ip+1,ir+1,it+1,temp);
00715           
00716           if(UseSeparateNuNuBar)
00717           {
00718             if(FD_TrueVsRecoVsPID[qNuMuToNue]->GetBinContent(ip+1,ir+1,it+1)>0)
00719             {
00720               nu*=(NominalOscProb[qNuMuToNue]->GetBinContent(it+1)*FD_Nu_TrueVsRecoVsPID[qNuMuToNue]->GetBinContent(ip+1,ir+1,it+1)/FD_TrueVsRecoVsPID[qNuMuToNue]->GetBinContent(ip+1,ir+1,it+1));
00721             }
00722             else
00723             {
00724               nu=0;
00725             }
00726             Pred_Nu_3D[qNuMuToNue]->SetBinContent(ip+1,ir+1,it+1,nu);
00727             
00728             if(FD_TrueVsRecoVsPID[qNuMuToNue]->GetBinContent(ip+1,ir+1,it+1)>0)
00729             {
00730               nubar*=(NominalOscProb_NuBar[qNuMuToNue]->GetBinContent(it+1)*FD_NuBar_TrueVsRecoVsPID[qNuMuToNue]->GetBinContent(ip+1,ir+1,it+1)/FD_TrueVsRecoVsPID[qNuMuToNue]->GetBinContent(ip+1,ir+1,it+1));
00731             }
00732             else
00733             {
00734               nubar=0;
00735             }
00736             Pred_NuBar_3D[qNuMuToNue]->SetBinContent(ip+1,ir+1,it+1,nubar);
00737           }
00738         }
00739         if(bg==Background::kNuTauCC)
00740         {
00741           temp*=NominalOscProb[qNuMuToNuTau]->GetBinContent(it+1);
00742           Pred_3D[qNuMuToNuTau]->SetBinContent(ip+1,ir+1,it+1,temp);
00743         }
00744         
00745         if(UseSeparateNuNuBar && bg==Background::kNueCC)
00746         {
00747           sum += (nu+nubar);
00748         }
00749         else 
00750         {
00751           sum+=temp;
00752         }
00753       }
00754       Pred[bg]->SetBinContent(ip+1,ir+1,sum);
00755     }
00756   }
00757   
00758   
00759   return;
00760 }

void Extrapolate2D_Simple::BeamNuePred (  )  [private, virtual]

Reimplemented from Extrapolate2D.

Definition at line 761 of file Extrapolate2D_Simple.cxx.

References FD_RecoVsPID, Background::kBNueCC, and Extrapolate2D::Pred.

00762 {
00763   Background::Background_t bg = Background::kBNueCC;
00764   Pred[bg]->Add(FD_RecoVsPID[bg]);
00765   
00766   return;
00767 }

void Extrapolate2D_Simple::FarNearPred ( Background::Background_t  bg  )  [private, virtual]

Reimplemented from Extrapolate2D.

Definition at line 676 of file Extrapolate2D_Simple.cxx.

References Extrapolate2D::FNRatio, Background::kBNueCC, Background::kNC, Background::kNuMuCC, Extrapolate2D::NDData, and Extrapolate2D::Pred.

00677 {
00678   if(bg!=Background::kNuMuCC && bg!=Background::kNC && bg!=Background::kBNueCC)
00679   {
00680     cout<<"Can only use FarNearPred() for cc numu, nc and beam nues"<<endl;
00681     return;
00682   }
00683   
00684   Pred[bg]->Multiply(FNRatio[bg],NDData[bg],1,1);  
00685   
00686   return;
00687 }

void Extrapolate2D_Simple::OscillatePrediction (  )  [virtual]

Reimplemented from Extrapolate2D.

Definition at line 768 of file Extrapolate2D_Simple.cxx.

References OscCalc::GetOscParam(), Extrapolate2D::Init, Background::kBNueCC, Background::kNC, Background::kNueCC, Background::kNuMuCC, Background::kNuTauCC, OscPar::kTh13, Extrapolate2D::osc, Extrapolate2D::Oscillated, OscillatePrediction_NoSep(), OscillatePrediction_SepNuNuBar(), Extrapolate2D::Pred, Extrapolate2D::Pred_TotalBkgd, Extrapolate2D::PrintResult, and Extrapolate2D::UseSeparateNuNuBar.

00769 {
00770   if(!Init)
00771   {
00772     cout<<"Can't call OscillatePrediction(): The prediction wasn't properly initialized with GetPrediction()."<<endl;
00773     return;
00774   }
00775   
00776   if(UseSeparateNuNuBar)
00777   {
00778     OscillatePrediction_SepNuNuBar();
00779   }
00780   else
00781   {
00782     OscillatePrediction_NoSep();
00783   }
00784   
00785   if(PrintResult)
00786   {
00787     cout.precision(2);
00788     cout<<fixed;
00789     cout<<"sin^2(2Th13) = "<<TMath::Sin(2.*osc.GetOscParam(OscPar::kTh13))*TMath::Sin(2.*osc.GetOscParam(OscPar::kTh13))<<endl;
00790     cout<<"NC: "<<Pred[Background::kNC]->Integral()<<endl;
00791     cout<<"NuMuCC: "<<Pred[Background::kNuMuCC]->Integral()<<endl;
00792     cout<<"BNueCC: "<<Pred[Background::kBNueCC]->Integral()<<endl;
00793     cout<<"NuTauCC: "<<Pred[Background::kNuTauCC]->Integral()<<endl;
00794     cout<<"Total: "<<Pred_TotalBkgd->Integral()<<endl;
00795     cout<<"NueCC: "<<Pred[Background::kNueCC]->Integral()<<endl;
00796   }
00797   
00798   Oscillated=true;
00799   
00800   return;
00801 }

void Extrapolate2D_Simple::OscillatePrediction_NoSep (  )  [private]

Reimplemented from Extrapolate2D.

Definition at line 845 of file Extrapolate2D_Simple.cxx.

References Extrapolate2D::FD_Eff, Extrapolate2D::FD_True2Reco_Fid, it, OscPar::kNuAntiNu, Background::kNueCC, OscCalc::MuToElec(), Extrapolate2D::nPID, Extrapolate2D::nReco, Extrapolate2D::nTrue, Extrapolate2D::osc, Extrapolate2D::Pred, Extrapolate2D::Pred_CC_Fid, Extrapolate2D::Set1DPredHists(), OscCalc::SetOscParam(), and Extrapolate2D::XSecWeight.

Referenced by OscillatePrediction().

00846 {
00847   Background::Background_t bg = Background::kNueCC;
00848   Pred[bg]->Reset("ICE");
00849   
00850   osc.SetOscParam(OscPar::kNuAntiNu,1);//assuming neutrino probability
00851   
00852   int ip,ir,it;
00853   double temp,sum,E;
00854   for(ip=0;ip<nPID;ip++)
00855   {
00856     for(ir=0;ir<nReco;ir++)
00857     {
00858       sum=0;
00859       
00860       for(it=0;it<nTrue;it++)
00861       {
00862         E = Pred_CC_Fid->GetXaxis()->GetBinCenter(it+1);
00863         
00864         temp = Pred_CC_Fid->GetBinContent(it+1)*XSecWeight[bg]->GetBinContent(it+1)*FD_True2Reco_Fid[bg]->GetBinContent(ir+1,it+1)*FD_Eff[bg]->GetBinContent(ip+1,ir+1);
00865         
00866         temp*=osc.MuToElec(E);
00867         
00868         sum+=temp;
00869       }
00870       Pred[bg]->SetBinContent(ip+1,ir+1,sum);
00871     }
00872   }  
00873   
00874   Set1DPredHists();
00875   
00876   return;
00877 }

void Extrapolate2D_Simple::OscillatePrediction_SepNuNuBar (  )  [private]

Reimplemented from Extrapolate2D.

Definition at line 802 of file Extrapolate2D_Simple.cxx.

References MuELoss::e, it, OscPar::kNuAntiNu, Background::kNueCC, OscCalc::MuToElec(), Extrapolate2D::NominalOscProb, Extrapolate2D::NominalOscProb_NuBar, Extrapolate2D::nPID, Extrapolate2D::nReco, Extrapolate2D::nTrue, Extrapolate2D::osc, Extrapolate2D::Pred, Extrapolate2D::Pred_CC_Fid, Extrapolate2D::Pred_Nu_3D, Extrapolate2D::Pred_NuBar_3D, Extrapolate2D::qNuMuToNue, Extrapolate2D::Set1DPredHists(), and OscCalc::SetOscParam().

Referenced by OscillatePrediction().

00803 {
00804   Background::Background_t bg = Background::kNueCC;
00805   Pred[bg]->Reset("ICE");
00806   
00807   int ip,ir,it;
00808   double temp,sum,E;
00809   for(ip=0;ip<nPID;ip++)
00810   {
00811     for(ir=0;ir<nReco;ir++)
00812     {
00813       sum=0;
00814       
00815       for(it=0;it<nTrue;it++)
00816       {
00817         E = Pred_CC_Fid->GetXaxis()->GetBinCenter(it+1);
00818         
00819         //nu
00820         temp=0;
00821         osc.SetOscParam(OscPar::kNuAntiNu,1);
00822         if(NominalOscProb[qNuMuToNue]->GetBinContent(it+1)>1e-20)
00823         {
00824           temp = Pred_Nu_3D[qNuMuToNue]->GetBinContent(ip+1,ir+1,it+1)*osc.MuToElec(E)/NominalOscProb[qNuMuToNue]->GetBinContent(it+1);
00825         }
00826         sum+=temp;
00827         
00828         //nubar
00829         temp=0;
00830         osc.SetOscParam(OscPar::kNuAntiNu,-1);
00831         if(NominalOscProb_NuBar[qNuMuToNue]->GetBinContent(it+1)>1e-20)
00832         {
00833           temp = Pred_NuBar_3D[qNuMuToNue]->GetBinContent(ip+1,ir+1,it+1)*osc.MuToElec(E)/NominalOscProb_NuBar[qNuMuToNue]->GetBinContent(it+1);
00834         }
00835         sum+=temp;
00836       }
00837       Pred[bg]->SetBinContent(ip+1,ir+1,sum);
00838     }
00839   }  
00840   
00841   Set1DPredHists();
00842   
00843   return;
00844 }

void Extrapolate2D_Simple::ReadFiles (  )  [private, virtual]

Reimplemented from Extrapolate2D.

Definition at line 662 of file Extrapolate2D_Simple.cxx.

References ReadFNFile(), ReadFNFileNo3D(), ReadNDDataFile(), Extrapolate2D::ReadXSecFile(), and UseInputWithNo3D.

00663 {
00664   ReadNDDataFile();
00665   if(UseInputWithNo3D)
00666   {
00667     ReadFNFileNo3D();
00668   }
00669   else
00670   {
00671     ReadFNFile();
00672   }
00673   ReadXSecFile();
00674   return;
00675 }

void Extrapolate2D_Simple::ReadFNFile (  )  [private, virtual]

Reimplemented from Extrapolate2D.

Definition at line 143 of file Extrapolate2D_Simple.cxx.

References Extrapolate2D::DeltaCP, Extrapolate2D::DeltaMSq12, Extrapolate2D::DeltaMSq23, Extrapolate2D::FD_Eff, Extrapolate2D::FD_Eff_CC, Extrapolate2D::FD_Nu_TrueVsRecoVsPID, Extrapolate2D::FD_NuBar_TrueVsRecoVsPID, Extrapolate2D::FD_Purity_CC, Extrapolate2D::FD_Reco2True_CClike, Extrapolate2D::FD_Reco_CClike, FD_RecoVsPID, Extrapolate2D::FD_True2Reco_Fid, Extrapolate2D::FD_True_Fid_NueCC, Extrapolate2D::FD_True_Fid_NuTauCC, Extrapolate2D::FD_TrueVsReco_CClike, Extrapolate2D::FD_TrueVsReco_CClike_NuMuCC, Extrapolate2D::FD_TrueVsReco_Fid, Extrapolate2D::FD_TrueVsReco_Fid_NueCC, Extrapolate2D::FD_TrueVsReco_Fid_NuMuCC, Extrapolate2D::FD_TrueVsReco_Fid_NuTauCC, Extrapolate2D::FD_TrueVsRecoVsPID, Extrapolate2D::FN_infile, Extrapolate2D::FNRatio, Form(), gSystem(), it, Background::kBNueCC, OscPar::kDelta, OscPar::kDeltaM12, OscPar::kDeltaM23, Background::kNC, Background::kNueCC, Background::kNuMuCC, Background::kNuTauCC, OscPar::kTh12, OscPar::kTh13, OscPar::kTh23, Extrapolate2D::ND_Reco_CClike, ND_RecoVsPID, Extrapolate2D::ND_TrueVsReco_CClike, Extrapolate2D::ND_TrueVsReco_CClike_NuMuCC, Extrapolate2D::ND_TrueVsReco_Fid, Extrapolate2D::ND_TrueVsReco_Fid_NuMuCC, Extrapolate2D::NDData_Reco_CClike, Extrapolate2D::nPID, Extrapolate2D::nPOTFar, Extrapolate2D::nPOTNear, Extrapolate2D::nReco, Extrapolate2D::nRecoCC, Extrapolate2D::nTrue, Extrapolate2D::osc, Extrapolate2D::PID, Extrapolate2D::PIDEdges, Extrapolate2D::qNuMuToNue, Extrapolate2D::ReadError, Extrapolate2D::RebinE, RebinInputHists(), Extrapolate2D::RebinP, Extrapolate2D::RecoCCEdges, Extrapolate2D::RecoEdges, Extrapolate2D::SetNominalOscProb(), OscCalc::SetOscParam(), Extrapolate2D::Theta12, Extrapolate2D::Theta13, Extrapolate2D::Theta23, Extrapolate2D::TrueEdges, and Extrapolate2D::UseSeparateNuNuBar.

Referenced by ReadFiles().

00144 {
00145   if(ReadError) return;
00146   
00147   FD_RecoVsPID.clear();
00148   FD_True2Reco_Fid.clear();
00149   FD_Eff.clear();
00150   FNRatio.clear();
00151   
00152   if(gSystem->AccessPathName(gSystem->ExpandPathName(FN_infile.c_str())))
00153   {
00154     cout<<"Failure to read F/N file."<<endl;
00155     ReadError = true;
00156     return;
00157   }
00158   
00159   TFile *f = new TFile(FN_infile.c_str(),"READ");
00160   
00161   double np,fp;
00162   TTree *tree = (TTree*)f->Get("paramtree");
00163   tree->SetBranchAddress("nearPOT",&np);
00164   tree->SetBranchAddress("farPOT",&fp);
00165   tree->SetBranchAddress("Theta12",&Theta12);
00166   tree->SetBranchAddress("Theta13",&Theta13);
00167   tree->SetBranchAddress("Theta23",&Theta23);
00168   tree->SetBranchAddress("DeltaMSq23",&DeltaMSq23);
00169   tree->SetBranchAddress("DeltaMSq12",&DeltaMSq12);
00170   tree->SetBranchAddress("DeltaCP",&DeltaCP);
00171   tree->GetEntry(0);
00172   
00173   osc.SetOscParam(OscPar::kTh12,Theta12);
00174   osc.SetOscParam(OscPar::kTh13,Theta13);
00175   osc.SetOscParam(OscPar::kTh23,Theta23);
00176   osc.SetOscParam(OscPar::kDeltaM23,DeltaMSq23);
00177   osc.SetOscParam(OscPar::kDeltaM12,DeltaMSq12);
00178   osc.SetOscParam(OscPar::kDelta,DeltaCP);
00179   SetNominalOscProb();
00180   
00181   TH3D *h3;
00182   
00183   h3 = (TH3D*)f->Get(Form("FDMC/TrueVsRecoVs%s_NC",PID.c_str()));
00184   FD_RecoVsPID[Background::kNC] = (TH2D*)h3->Project3D("yx");
00185   FD_RecoVsPID[Background::kNC]->SetName("FD_RecoVsPID_NC");
00186   
00187   h3 = (TH3D*)f->Get(Form("FDMC/TrueVsRecoVs%s_NuMuToNuMu",PID.c_str()));
00188   FD_RecoVsPID[Background::kNuMuCC] = (TH2D*)h3->Project3D("yx");
00189   FD_RecoVsPID[Background::kNuMuCC]->SetName("FD_RecoVsPID_NuMuCC");
00190   h3 = (TH3D*)f->Get(Form("FDMC/TrueVsRecoVs%s_BNueToNuMu",PID.c_str()));
00191   FD_RecoVsPID[Background::kNuMuCC]->Add((TH2D*)h3->Project3D("yx"));
00192   
00193   h3 = (TH3D*)f->Get(Form("FDMC/TrueVsRecoVs%s_BNueToBNue",PID.c_str()));
00194   FD_RecoVsPID[Background::kBNueCC] = (TH2D*)h3->Project3D("yx");
00195   FD_RecoVsPID[Background::kBNueCC]->SetName("FD_RecoVsPID_BNueCC");
00196   
00197   h3 = (TH3D*)f->Get(Form("FDMC/TrueVsRecoVs%s_NuMuToNue",PID.c_str()));
00198   FD_RecoVsPID[Background::kNueCC] = (TH2D*)h3->Project3D("yx");
00199   FD_RecoVsPID[Background::kNueCC]->SetName("FD_RecoVsPID_NueCC");
00200   
00201   h3 = (TH3D*)f->Get(Form("FDMC/TrueVsRecoVs%s_NuMuToNuTau",PID.c_str()));
00202   FD_RecoVsPID[Background::kNuTauCC] = (TH2D*)h3->Project3D("yx");
00203   FD_RecoVsPID[Background::kNuTauCC]->SetName("FD_RecoVsPID_NuTauCC");
00204   h3 = (TH3D*)f->Get(Form("FDMC/TrueVsRecoVs%s_BNueToNuTau",PID.c_str()));
00205   FD_RecoVsPID[Background::kNuTauCC]->Add((TH2D*)h3->Project3D("yx"));
00206   
00207   if(f->Read("FDMC_Nu")!=0 && f->Read("FDMC_NuBar")!=0)//if these directories exists, then we can do separate nu and nubars
00208   {
00209     UseSeparateNuNuBar = true;
00210   }
00211   else
00212   {
00213     cout<<"Warning: FDMC_Nu and FDMC_NuBar directories not found, so nus and nubars will be combined."<<endl;
00214   }
00215   
00216   if(UseSeparateNuNuBar)
00217   {
00218     FD_TrueVsRecoVsPID[qNuMuToNue] = (TH3D*)f->Get(Form("FDMC/TrueVsRecoVs%s_NuMuToNue",PID.c_str()));
00219     FD_TrueVsRecoVsPID[qNuMuToNue]->SetName(Form("FD_TrueVsRecoVs%s_NuMuToNue",PID.c_str()));
00220     
00221     FD_Nu_TrueVsRecoVsPID[qNuMuToNue] = (TH3D*)f->Get(Form("FDMC_Nu/TrueVsRecoVs%s_NuMuToNue",PID.c_str()));
00222     FD_Nu_TrueVsRecoVsPID[qNuMuToNue]->SetName(Form("FD_Nu_TrueVsRecoVs%s_NuMuToNue",PID.c_str()));
00223     
00224     FD_NuBar_TrueVsRecoVsPID[qNuMuToNue] = (TH3D*)f->Get(Form("FDMC_NuBar/TrueVsRecoVs%s_NuMuToNue",PID.c_str()));
00225     FD_NuBar_TrueVsRecoVsPID[qNuMuToNue]->SetName(Form("FD_NuBar_TrueVsRecoVs%s_NuMuToNue",PID.c_str()));
00226   }
00227   
00228   FD_TrueVsReco_Fid = (TH2D*)f->Get("FDMC/TrueVsReco_Fid");
00229   FD_TrueVsReco_Fid_NuMuCC = (TH2D*)f->Get("FDMC/TrueVsReco_Fid_NuMuCC");
00230   FD_TrueVsReco_CClike = (TH2D*)f->Get("FDMC/TrueVsReco_CClike");
00231   FD_TrueVsReco_CClike_NuMuCC = (TH2D*)f->Get("FDMC/TrueVsReco_CClike_NuMuCC");
00232   
00233   FD_TrueVsReco_Fid_NueCC = (TH2D*)f->Get("FDMC/TrueVsReco_Fid_NueCC");
00234   FD_TrueVsReco_Fid_NuTauCC = (TH2D*)f->Get("FDMC/TrueVsReco_Fid_NuTauCC");
00235   FD_True_Fid_NueCC = (TH1D*)f->Get("FDMC/True_Fid_NueCC");
00236   FD_True_Fid_NuTauCC = (TH1D*)f->Get("FDMC/True_Fid_NuTauCC");
00237   
00238   h3 = (TH3D*)f->Get(Form("NDMC/TrueVsRecoVs%s_NC",PID.c_str()));
00239   ND_RecoVsPID[Background::kNC] = (TH2D*)h3->Project3D("yx");
00240   ND_RecoVsPID[Background::kNC]->SetName("ND_RecoVsPID_NC");
00241   h3 = (TH3D*)f->Get(Form("NDMC/TrueVsRecoVs%s_NuMuToNuMu",PID.c_str()));
00242   ND_RecoVsPID[Background::kNuMuCC] = (TH2D*)h3->Project3D("yx");
00243   ND_RecoVsPID[Background::kNuMuCC]->SetName("ND_RecoVsPID_NuMuCC");
00244   h3 = (TH3D*)f->Get(Form("NDMC/TrueVsRecoVs%s_BNueToBNue",PID.c_str()));
00245   ND_RecoVsPID[Background::kBNueCC] = (TH2D*)h3->Project3D("yx");
00246   ND_RecoVsPID[Background::kBNueCC]->SetName("ND_RecoVsPID_BNueCC");
00247   
00248   ND_TrueVsReco_Fid = (TH2D*)f->Get("NDMC/TrueVsReco_Fid");
00249   ND_TrueVsReco_Fid_NuMuCC = (TH2D*)f->Get("NDMC/TrueVsReco_Fid_NuMuCC");
00250   ND_TrueVsReco_CClike = (TH2D*)f->Get("NDMC/TrueVsReco_CClike");
00251   ND_TrueVsReco_CClike_NuMuCC = (TH2D*)f->Get("NDMC/TrueVsReco_CClike_NuMuCC");
00252   
00253   NDData_Reco_CClike = (TH1D*)f->Get("NDData/Reco_CClike");
00254   
00255   FD_RecoVsPID[Background::kNC]->Scale(nPOTFar/fp);
00256   FD_RecoVsPID[Background::kNuMuCC]->Scale(nPOTFar/fp);
00257   FD_RecoVsPID[Background::kBNueCC]->Scale(nPOTFar/fp);
00258   FD_RecoVsPID[Background::kNueCC]->Scale(nPOTFar/fp);
00259   FD_RecoVsPID[Background::kNuTauCC]->Scale(nPOTFar/fp);
00260   
00261   FD_TrueVsReco_Fid->Scale(nPOTFar/fp);
00262   FD_TrueVsReco_Fid_NuMuCC->Scale(nPOTFar/fp);
00263   FD_TrueVsReco_CClike->Scale(nPOTFar/fp);
00264   FD_TrueVsReco_CClike_NuMuCC->Scale(nPOTFar/fp);
00265   
00266   FD_TrueVsReco_Fid_NueCC->Scale(nPOTFar/fp);
00267   FD_TrueVsReco_Fid_NuTauCC->Scale(nPOTFar/fp);
00268   FD_True_Fid_NueCC->Scale(nPOTFar/fp);
00269   FD_True_Fid_NuTauCC->Scale(nPOTFar/fp);
00270   
00271   ND_RecoVsPID[Background::kNC]->Scale(nPOTNear/np);
00272   ND_RecoVsPID[Background::kNuMuCC]->Scale(nPOTNear/np);
00273   ND_RecoVsPID[Background::kBNueCC]->Scale(nPOTNear/np);
00274   
00275   ND_TrueVsReco_Fid->Scale(nPOTNear/np);
00276   ND_TrueVsReco_Fid_NuMuCC->Scale(nPOTNear/np);
00277   ND_TrueVsReco_CClike->Scale(nPOTNear/np);
00278   ND_TrueVsReco_CClike_NuMuCC->Scale(nPOTNear/np);
00279   
00280   NDData_Reco_CClike->Scale(nPOTNear/np);
00281   
00282   double *r = new double[nReco+1];
00283   double *p = new double[nPID+1];
00284   double *t = new double[nTrue+1];
00285   double *rcc = new double[nRecoCC+1];
00286   int i;
00287   for(i=0;i<nReco+1;i++)
00288   {
00289     r[i] = RecoEdges.at(i);
00290   }
00291   for(i=0;i<nPID+1;i++)
00292   {
00293     p[i] = PIDEdges.at(i);
00294   }
00295   for(i=0;i<nTrue+1;i++)
00296   {
00297     t[i] = TrueEdges.at(i);
00298   }
00299   for(i=0;i<nRecoCC+1;i++)
00300   {
00301     rcc[i] = RecoCCEdges.at(i);
00302   }
00303   
00304   if(FD_RecoVsPID[Background::kNC]->GetNbinsX()!=nPID)
00305   {
00306     RebinP = true;
00307   }
00308   if(FD_RecoVsPID[Background::kNC]->GetNbinsY()!=nReco)
00309   {
00310     RebinE = true;
00311   }
00312   
00313   if(RebinE || RebinP)
00314   {
00315     RebinInputHists();
00316   }
00317   
00318   int ip,ir,it;
00319   double temp;
00320   
00321   TH1D *h1;
00322   
00323   FNRatio[Background::kNuMuCC] = (TH2D*)FD_RecoVsPID[Background::kNuMuCC]->Clone("FNRatio_NuMuCC");
00324   FNRatio[Background::kNC] = (TH2D*)FD_RecoVsPID[Background::kNC]->Clone("FNRatio_NC");
00325   FNRatio[Background::kBNueCC] = (TH2D*)FD_RecoVsPID[Background::kBNueCC]->Clone("FNRatio_BNueCC");
00326   
00327   FNRatio[Background::kNuMuCC]->Divide(ND_RecoVsPID[Background::kNuMuCC]);
00328   FNRatio[Background::kNC]->Divide(ND_RecoVsPID[Background::kNC]);
00329   FNRatio[Background::kBNueCC]->Divide(ND_RecoVsPID[Background::kBNueCC]);
00330   
00331   ND_Reco_CClike = ND_TrueVsReco_CClike->ProjectionX("ND_Reco_CClike");
00332   
00333   FD_Reco_CClike = FD_TrueVsReco_CClike->ProjectionX("FD_Reco_CClike");
00334   FD_Reco2True_CClike = new TH2D("FD_Reco2True_CClike","",nRecoCC,rcc,nTrue,t);
00335   for(ir=0;ir<nRecoCC;ir++)
00336   {
00337     for(it=0;it<nTrue;it++)
00338     {
00339       temp=0;
00340       if(FD_Reco_CClike->GetBinContent(ir+1)>0)
00341       {
00342         temp = FD_TrueVsReco_CClike->GetBinContent(ir+1,it+1)/FD_Reco_CClike->GetBinContent(ir+1);
00343       }
00344       FD_Reco2True_CClike->SetBinContent(ir+1,it+1,temp);
00345     }
00346   }
00347   
00348   FD_Purity_CC = new TH1D("FD_Purity_CC","",nTrue,t);
00349   FD_Eff_CC = new TH1D("FD_Eff_CC","",nTrue,t);
00350   TH1D *FD_True_CClike = FD_TrueVsReco_CClike->ProjectionY("FD_True_CClike");
00351   TH1D *FD_True_CClike_NuMuCC = FD_TrueVsReco_CClike_NuMuCC->ProjectionY("FD_True_CClike_NuMuCC");
00352   TH1D *FD_True_Fid_NuMuCC = FD_TrueVsReco_Fid_NuMuCC->ProjectionY("FD_True_Fid_NuMuCC");
00353   FD_Purity_CC->Divide(FD_True_CClike_NuMuCC,FD_True_CClike,1,1);
00354   FD_Eff_CC->Divide(FD_True_CClike_NuMuCC,FD_True_Fid_NuMuCC,1,1);
00355   
00356   FD_True2Reco_Fid[Background::kNueCC] = new TH2D("FD_True2Reco_Fid_NueCC","",nReco,r,nTrue,t);
00357   for(it=0;it<nTrue;it++)
00358   {
00359     for(ir=0;ir<nReco;ir++)
00360     {
00361       temp=0;
00362       if(FD_True_Fid_NueCC->GetBinContent(it+1)>0)
00363       {
00364         temp = FD_TrueVsReco_Fid_NueCC->GetBinContent(ir+1,it+1)/FD_True_Fid_NueCC->GetBinContent(it+1);
00365       }
00366       FD_True2Reco_Fid[Background::kNueCC]->SetBinContent(ir+1,it+1,temp);
00367     }
00368   }
00369   
00370   FD_True2Reco_Fid[Background::kNuTauCC] = new TH2D("FD_True2Reco_Fid_NuTauCC","",nReco,r,nTrue,t);
00371   for(it=0;it<nTrue;it++)
00372   {
00373     for(ir=0;ir<nReco;ir++)
00374     {
00375       temp=0;
00376       if(FD_True_Fid_NuTauCC->GetBinContent(it+1)>0)
00377       {
00378         temp = FD_TrueVsReco_Fid_NuTauCC->GetBinContent(ir+1,it+1)/FD_True_Fid_NuTauCC->GetBinContent(it+1);
00379       }
00380       FD_True2Reco_Fid[Background::kNuTauCC]->SetBinContent(ir+1,it+1,temp);
00381     }
00382   }
00383   
00384   FD_Eff[Background::kNueCC] = new TH2D("FD_Eff_NueCC","",nPID,p,nReco,r);
00385   h1 = FD_TrueVsReco_Fid_NueCC->ProjectionX();
00386   for(ip=0;ip<nPID;ip++)
00387   {
00388     for(ir=0;ir<nReco;ir++)
00389     {
00390       temp=0;
00391       if(h1->GetBinContent(ir+1)>0)
00392       {
00393         temp = FD_RecoVsPID[Background::kNueCC]->GetBinContent(ip+1,ir+1)/h1->GetBinContent(ir+1);
00394       }
00395       FD_Eff[Background::kNueCC]->SetBinContent(ip+1,ir+1,temp);
00396     }
00397   }
00398   
00399   FD_Eff[Background::kNuTauCC] = new TH2D("FD_Eff_NuTauCC","",nPID,p,nReco,r);
00400   h1 = FD_TrueVsReco_Fid_NuTauCC->ProjectionX();
00401   for(ip=0;ip<nPID;ip++)
00402   {
00403     for(ir=0;ir<nReco;ir++)
00404     {
00405       temp=0;
00406       if(h1->GetBinContent(ir+1)>0)
00407       {
00408         temp = FD_RecoVsPID[Background::kNuTauCC]->GetBinContent(ip+1,ir+1)/h1->GetBinContent(ir+1);
00409       }
00410       FD_Eff[Background::kNuTauCC]->SetBinContent(ip+1,ir+1,temp);
00411     }
00412   }
00413   
00414   delete [] r;
00415   delete [] p;
00416   delete [] t;
00417   
00418   return;
00419 }

void Extrapolate2D_Simple::ReadFNFileNo3D (  )  [private]

Definition at line 420 of file Extrapolate2D_Simple.cxx.

References Extrapolate2D::DeltaCP, Extrapolate2D::DeltaMSq12, Extrapolate2D::DeltaMSq23, Extrapolate2D::FD_Eff, Extrapolate2D::FD_Eff_CC, Extrapolate2D::FD_Purity_CC, Extrapolate2D::FD_Reco2True_CClike, Extrapolate2D::FD_Reco_CClike, FD_RecoVsPID, Extrapolate2D::FD_True2Reco_Fid, Extrapolate2D::FD_True_Fid_NueCC, Extrapolate2D::FD_True_Fid_NuTauCC, Extrapolate2D::FD_TrueVsReco_CClike, Extrapolate2D::FD_TrueVsReco_CClike_NuMuCC, Extrapolate2D::FD_TrueVsReco_Fid, Extrapolate2D::FD_TrueVsReco_Fid_NueCC, Extrapolate2D::FD_TrueVsReco_Fid_NuMuCC, Extrapolate2D::FD_TrueVsReco_Fid_NuTauCC, Extrapolate2D::FN_infile, Extrapolate2D::FNRatio, Form(), gSystem(), it, Background::kBNueCC, OscPar::kDelta, OscPar::kDeltaM12, OscPar::kDeltaM23, Background::kNC, Background::kNueCC, Background::kNuMuCC, Background::kNuTauCC, OscPar::kTh12, OscPar::kTh13, OscPar::kTh23, Extrapolate2D::ND_Reco_CClike, ND_RecoVsPID, Extrapolate2D::ND_TrueVsReco_CClike, Extrapolate2D::ND_TrueVsReco_CClike_NuMuCC, Extrapolate2D::ND_TrueVsReco_Fid, Extrapolate2D::ND_TrueVsReco_Fid_NuMuCC, Extrapolate2D::NDData_Reco_CClike, Extrapolate2D::nPID, Extrapolate2D::nPOTFar, Extrapolate2D::nPOTNear, Extrapolate2D::nReco, Extrapolate2D::nRecoCC, Extrapolate2D::nTrue, Extrapolate2D::osc, Extrapolate2D::PID, Extrapolate2D::PIDEdges, Extrapolate2D::ReadError, Extrapolate2D::RebinE, RebinInputHists(), Extrapolate2D::RebinP, Extrapolate2D::RecoCCEdges, Extrapolate2D::RecoEdges, Extrapolate2D::SetNominalOscProb(), OscCalc::SetOscParam(), Extrapolate2D::Theta12, Extrapolate2D::Theta13, Extrapolate2D::Theta23, and Extrapolate2D::TrueEdges.

Referenced by ReadFiles().

00421 {
00422   if(ReadError) return;
00423   
00424   FD_RecoVsPID.clear();
00425   FD_True2Reco_Fid.clear();
00426   FD_Eff.clear();
00427   FNRatio.clear();
00428   
00429   if(gSystem->AccessPathName(gSystem->ExpandPathName(FN_infile.c_str())))
00430   {
00431     cout<<"Failure to read F/N file."<<endl;
00432     ReadError = true;
00433     return;
00434   }
00435   
00436   TFile *f = new TFile(FN_infile.c_str(),"READ");
00437   
00438   double np,fp;
00439   TTree *tree = (TTree*)f->Get("paramtree");
00440   tree->SetBranchAddress("nearPOT",&np);
00441   tree->SetBranchAddress("farPOT",&fp);
00442   tree->SetBranchAddress("Theta12",&Theta12);
00443   tree->SetBranchAddress("Theta13",&Theta13);
00444   tree->SetBranchAddress("Theta23",&Theta23);
00445   tree->SetBranchAddress("DeltaMSq23",&DeltaMSq23);
00446   tree->SetBranchAddress("DeltaMSq12",&DeltaMSq12);
00447   tree->SetBranchAddress("DeltaCP",&DeltaCP);
00448   tree->GetEntry(0);
00449   
00450   osc.SetOscParam(OscPar::kTh12,Theta12);
00451   osc.SetOscParam(OscPar::kTh13,Theta13);
00452   osc.SetOscParam(OscPar::kTh23,Theta23);
00453   osc.SetOscParam(OscPar::kDeltaM23,DeltaMSq23);
00454   osc.SetOscParam(OscPar::kDeltaM12,DeltaMSq12);
00455   osc.SetOscParam(OscPar::kDelta,DeltaCP);
00456   SetNominalOscProb();
00457   
00458   FD_RecoVsPID[Background::kNC] = (TH2D*)f->Get(Form("FDMC/RecoVs%s_NC",PID.c_str()));
00459   FD_RecoVsPID[Background::kNC]->SetName("FD_RecoVsPID_NC");
00460   
00461   FD_RecoVsPID[Background::kNuMuCC] = (TH2D*)f->Get(Form("FDMC/RecoVs%s_NuMuCC",PID.c_str()));
00462   FD_RecoVsPID[Background::kNuMuCC]->SetName("FD_RecoVsPID_NuMuCC");
00463   
00464   FD_RecoVsPID[Background::kBNueCC] = (TH2D*)f->Get(Form("FDMC/RecoVs%s_BNueCC",PID.c_str()));
00465   FD_RecoVsPID[Background::kBNueCC]->SetName("FD_RecoVsPID_BNueCC");
00466   
00467   FD_RecoVsPID[Background::kNueCC] = (TH2D*)f->Get(Form("FDMC/RecoVs%s_NueCC",PID.c_str()));
00468   FD_RecoVsPID[Background::kNueCC]->SetName("FD_RecoVsPID_NueCC");
00469   
00470   FD_RecoVsPID[Background::kNuTauCC] = (TH2D*)f->Get(Form("FDMC/RecoVs%s_NuTauCC",PID.c_str()));
00471   FD_RecoVsPID[Background::kNuTauCC]->SetName("FD_RecoVsPID_NuTauCC");
00472   
00473   FD_TrueVsReco_Fid = (TH2D*)f->Get("FDMC/TrueVsReco_Fid");
00474   FD_TrueVsReco_Fid_NuMuCC = (TH2D*)f->Get("FDMC/TrueVsReco_Fid_NuMuCC");
00475   FD_TrueVsReco_CClike = (TH2D*)f->Get("FDMC/TrueVsReco_CClike");
00476   FD_TrueVsReco_CClike_NuMuCC = (TH2D*)f->Get("FDMC/TrueVsReco_CClike_NuMuCC");
00477   
00478   FD_TrueVsReco_Fid_NueCC = (TH2D*)f->Get("FDMC/TrueVsReco_Fid_NueCC");
00479   FD_TrueVsReco_Fid_NuTauCC = (TH2D*)f->Get("FDMC/TrueVsReco_Fid_NuTauCC");
00480   FD_True_Fid_NueCC = (TH1D*)f->Get("FDMC/True_Fid_NueCC");
00481   FD_True_Fid_NuTauCC = (TH1D*)f->Get("FDMC/True_Fid_NuTauCC");
00482   
00483   ND_RecoVsPID[Background::kNC] = (TH2D*)f->Get(Form("NDMC/RecoVs%s_NC",PID.c_str()));
00484   ND_RecoVsPID[Background::kNC]->SetName("ND_RecoVsPID_NC");
00485   ND_RecoVsPID[Background::kNuMuCC] = (TH2D*)f->Get(Form("NDMC/RecoVs%s_NuMuCC",PID.c_str()));
00486   ND_RecoVsPID[Background::kNuMuCC]->SetName("ND_RecoVsPID_NuMuCC");
00487   ND_RecoVsPID[Background::kBNueCC] = (TH2D*)f->Get(Form("NDMC/RecoVs%s_BNueCC",PID.c_str()));
00488   ND_RecoVsPID[Background::kBNueCC]->SetName("ND_RecoVsPID_BNueCC");
00489   
00490   ND_TrueVsReco_Fid = (TH2D*)f->Get("NDMC/TrueVsReco_Fid");
00491   ND_TrueVsReco_Fid_NuMuCC = (TH2D*)f->Get("NDMC/TrueVsReco_Fid_NuMuCC");
00492   ND_TrueVsReco_CClike = (TH2D*)f->Get("NDMC/TrueVsReco_CClike");
00493   ND_TrueVsReco_CClike_NuMuCC = (TH2D*)f->Get("NDMC/TrueVsReco_CClike_NuMuCC");
00494   
00495   NDData_Reco_CClike = (TH1D*)f->Get("NDData/Reco_CClike");
00496   
00497   FD_RecoVsPID[Background::kNC]->Scale(nPOTFar/fp);
00498   FD_RecoVsPID[Background::kNuMuCC]->Scale(nPOTFar/fp);
00499   FD_RecoVsPID[Background::kBNueCC]->Scale(nPOTFar/fp);
00500   FD_RecoVsPID[Background::kNueCC]->Scale(nPOTFar/fp);
00501   FD_RecoVsPID[Background::kNuTauCC]->Scale(nPOTFar/fp);
00502   
00503   FD_TrueVsReco_Fid->Scale(nPOTFar/fp);
00504   FD_TrueVsReco_Fid_NuMuCC->Scale(nPOTFar/fp);
00505   FD_TrueVsReco_CClike->Scale(nPOTFar/fp);
00506   FD_TrueVsReco_CClike_NuMuCC->Scale(nPOTFar/fp);
00507   
00508   FD_TrueVsReco_Fid_NueCC->Scale(nPOTFar/fp);
00509   FD_TrueVsReco_Fid_NuTauCC->Scale(nPOTFar/fp);
00510   FD_True_Fid_NueCC->Scale(nPOTFar/fp);
00511   FD_True_Fid_NuTauCC->Scale(nPOTFar/fp);
00512   
00513   ND_RecoVsPID[Background::kNC]->Scale(nPOTNear/np);
00514   ND_RecoVsPID[Background::kNuMuCC]->Scale(nPOTNear/np);
00515   ND_RecoVsPID[Background::kBNueCC]->Scale(nPOTNear/np);
00516   
00517   ND_TrueVsReco_Fid->Scale(nPOTNear/np);
00518   ND_TrueVsReco_Fid_NuMuCC->Scale(nPOTNear/np);
00519   ND_TrueVsReco_CClike->Scale(nPOTNear/np);
00520   ND_TrueVsReco_CClike_NuMuCC->Scale(nPOTNear/np);
00521   
00522   NDData_Reco_CClike->Scale(nPOTNear/np);
00523   
00524   double *r = new double[nReco+1];
00525   double *p = new double[nPID+1];
00526   double *t = new double[nTrue+1];
00527   double *rcc = new double[nRecoCC+1];
00528   int i;
00529   for(i=0;i<nReco+1;i++)
00530   {
00531     r[i] = RecoEdges.at(i);
00532   }
00533   for(i=0;i<nPID+1;i++)
00534   {
00535     p[i] = PIDEdges.at(i);
00536   }
00537   for(i=0;i<nTrue+1;i++)
00538   {
00539     t[i] = TrueEdges.at(i);
00540   }
00541   for(i=0;i<nRecoCC+1;i++)
00542   {
00543     rcc[i] = RecoCCEdges.at(i);
00544   }
00545   
00546   if(FD_RecoVsPID[Background::kNC]->GetNbinsX()!=nPID)
00547   {
00548     RebinP = true;
00549   }
00550   if(FD_RecoVsPID[Background::kNC]->GetNbinsY()!=nReco)
00551   {
00552     RebinE = true;
00553   }
00554   
00555   if(RebinE || RebinP)
00556   {
00557     RebinInputHists();
00558   }
00559   
00560   int ip,ir,it;
00561   double temp;
00562   
00563   TH1D *h1;
00564   
00565   FNRatio[Background::kNuMuCC] = (TH2D*)FD_RecoVsPID[Background::kNuMuCC]->Clone("FNRatio_NuMuCC");
00566   FNRatio[Background::kNC] = (TH2D*)FD_RecoVsPID[Background::kNC]->Clone("FNRatio_NC");
00567   FNRatio[Background::kBNueCC] = (TH2D*)FD_RecoVsPID[Background::kBNueCC]->Clone("FNRatio_BNueCC");
00568   
00569   FNRatio[Background::kNuMuCC]->Divide(ND_RecoVsPID[Background::kNuMuCC]);
00570   FNRatio[Background::kNC]->Divide(ND_RecoVsPID[Background::kNC]);
00571   FNRatio[Background::kBNueCC]->Divide(ND_RecoVsPID[Background::kBNueCC]);
00572   
00573   ND_Reco_CClike = ND_TrueVsReco_CClike->ProjectionX("ND_Reco_CClike");
00574   
00575   FD_Reco_CClike = FD_TrueVsReco_CClike->ProjectionX("FD_Reco_CClike");
00576   FD_Reco2True_CClike = new TH2D("FD_Reco2True_CClike","",nRecoCC,rcc,nTrue,t);
00577   for(ir=0;ir<nRecoCC;ir++)
00578   {
00579     for(it=0;it<nTrue;it++)
00580     {
00581       temp=0;
00582       if(FD_Reco_CClike->GetBinContent(ir+1)>0)
00583       {
00584         temp = FD_TrueVsReco_CClike->GetBinContent(ir+1,it+1)/FD_Reco_CClike->GetBinContent(ir+1);
00585       }
00586       FD_Reco2True_CClike->SetBinContent(ir+1,it+1,temp);
00587     }
00588   }
00589   
00590   FD_Purity_CC = new TH1D("FD_Purity_CC","",nTrue,t);
00591   FD_Eff_CC = new TH1D("FD_Eff_CC","",nTrue,t);
00592   TH1D *FD_True_CClike = FD_TrueVsReco_CClike->ProjectionY("FD_True_CClike");
00593   TH1D *FD_True_CClike_NuMuCC = FD_TrueVsReco_CClike_NuMuCC->ProjectionY("FD_True_CClike_NuMuCC");
00594   TH1D *FD_True_Fid_NuMuCC = FD_TrueVsReco_Fid_NuMuCC->ProjectionY("FD_True_Fid_NuMuCC");
00595   FD_Purity_CC->Divide(FD_True_CClike_NuMuCC,FD_True_CClike,1,1);
00596   FD_Eff_CC->Divide(FD_True_CClike_NuMuCC,FD_True_Fid_NuMuCC,1,1);
00597   
00598   FD_True2Reco_Fid[Background::kNueCC] = new TH2D("FD_True2Reco_Fid_NueCC","",nReco,r,nTrue,t);
00599   for(it=0;it<nTrue;it++)
00600   {
00601     for(ir=0;ir<nReco;ir++)
00602     {
00603       temp=0;
00604       if(FD_True_Fid_NueCC->GetBinContent(it+1)>0)
00605       {
00606         temp = FD_TrueVsReco_Fid_NueCC->GetBinContent(ir+1,it+1)/FD_True_Fid_NueCC->GetBinContent(it+1);
00607       }
00608       FD_True2Reco_Fid[Background::kNueCC]->SetBinContent(ir+1,it+1,temp);
00609     }
00610   }
00611   
00612   FD_True2Reco_Fid[Background::kNuTauCC] = new TH2D("FD_True2Reco_Fid_NuTauCC","",nReco,r,nTrue,t);
00613   for(it=0;it<nTrue;it++)
00614   {
00615     for(ir=0;ir<nReco;ir++)
00616     {
00617       temp=0;
00618       if(FD_True_Fid_NuTauCC->GetBinContent(it+1)>0)
00619       {
00620         temp = FD_TrueVsReco_Fid_NuTauCC->GetBinContent(ir+1,it+1)/FD_True_Fid_NuTauCC->GetBinContent(it+1);
00621       }
00622       FD_True2Reco_Fid[Background::kNuTauCC]->SetBinContent(ir+1,it+1,temp);
00623     }
00624   }
00625   
00626   FD_Eff[Background::kNueCC] = new TH2D("FD_Eff_NueCC","",nPID,p,nReco,r);
00627   h1 = FD_TrueVsReco_Fid_NueCC->ProjectionX();
00628   for(ip=0;ip<nPID;ip++)
00629   {
00630     for(ir=0;ir<nReco;ir++)
00631     {
00632       temp=0;
00633       if(h1->GetBinContent(ir+1)>0)
00634       {
00635         temp = FD_RecoVsPID[Background::kNueCC]->GetBinContent(ip+1,ir+1)/h1->GetBinContent(ir+1);
00636       }
00637       FD_Eff[Background::kNueCC]->SetBinContent(ip+1,ir+1,temp);
00638     }
00639   }
00640   
00641   FD_Eff[Background::kNuTauCC] = new TH2D("FD_Eff_NuTauCC","",nPID,p,nReco,r);
00642   h1 = FD_TrueVsReco_Fid_NuTauCC->ProjectionX();
00643   for(ip=0;ip<nPID;ip++)
00644   {
00645     for(ir=0;ir<nReco;ir++)
00646     {
00647       temp=0;
00648       if(h1->GetBinContent(ir+1)>0)
00649       {
00650         temp = FD_RecoVsPID[Background::kNuTauCC]->GetBinContent(ip+1,ir+1)/h1->GetBinContent(ir+1);
00651       }
00652       FD_Eff[Background::kNuTauCC]->SetBinContent(ip+1,ir+1,temp);
00653     }
00654   }
00655   
00656   delete [] r;
00657   delete [] p;
00658   delete [] t;
00659   
00660   return;
00661 }

void Extrapolate2D_Simple::ReadNDDataFile (  )  [private, virtual]

Reimplemented from Extrapolate2D.

Definition at line 74 of file Extrapolate2D_Simple.cxx.

References Form(), gSystem(), Background::kBNueCC, Background::kNC, Background::kNuMuCC, Extrapolate2D::MBH, Extrapolate2D::NDData, Extrapolate2D::NDData_infile, NDData_Ratio, Extrapolate2D::NDData_Total, NDMC_BNueCC, NDMC_NC, NDMC_NuMuCC, NDMC_Total, Extrapolate2D::nPID, Extrapolate2D::nReco, Extrapolate2D::PID, Extrapolate2D::PIDEdges, Extrapolate2D::ReadError, MultiBinAnaHelper::Rebin2DHist(), Extrapolate2D::RebinE, Extrapolate2D::RebinP, and Extrapolate2D::RecoEdges.

Referenced by ReadFiles().

00075 {
00076   
00077   //should have file with 2d total nd data and nd mc and nd bnue mc component
00078   //rebin
00079   //subtract bnue from data and mc and take ratio
00080   //scale ndmc cc and nc by ratio
00081   
00082   if(gSystem->AccessPathName(gSystem->ExpandPathName(NDData_infile.c_str())))
00083   {
00084     cout<<"Failure to read ND data file."<<endl;
00085     ReadError = true;
00086     return;
00087   }
00088   
00089   double *r = new double[nReco+1];
00090   double *p = new double[nPID+1];
00091   int i;
00092   for(i=0;i<nReco+1;i++)
00093   {
00094     r[i] = RecoEdges.at(i);
00095   }
00096   for(i=0;i<nPID+1;i++)
00097   {
00098     p[i] = PIDEdges.at(i);
00099   }
00100   
00101   TFile *f = new TFile(gSystem->ExpandPathName(NDData_infile.c_str()),"READ");
00102   
00103   TH2D *h;
00104   
00105   NDData_Total = (TH2D*)f->Get(Form("NDData_Total_%s",PID.c_str()));
00106   NDMC_Total = (TH2D*)f->Get(Form("NDMC_Total_%s",PID.c_str()));
00107   NDMC_BNueCC = (TH2D*)f->Get(Form("NDMC_BNueCC_%s",PID.c_str()));
00108   NDMC_NuMuCC = (TH2D*)f->Get(Form("NDMC_NuMuCC_%s",PID.c_str()));
00109   NDMC_NC = (TH2D*)f->Get(Form("NDMC_NC_%s",PID.c_str()));
00110   
00111   if(NDData_Total->GetNbinsX()!=nPID)
00112   {
00113     RebinP = true;
00114   }
00115   if(NDData_Total->GetNbinsY()!=nReco)
00116   {
00117     RebinE = true;
00118   }
00119   
00120   if(RebinE || RebinP)
00121   {
00122     MBH.Rebin2DHist(NDData_Total,nPID,p,nReco,r);
00123     MBH.Rebin2DHist(NDMC_Total,nPID,p,nReco,r);
00124     MBH.Rebin2DHist(NDMC_BNueCC,nPID,p,nReco,r);
00125     MBH.Rebin2DHist(NDMC_NuMuCC,nPID,p,nReco,r);
00126     MBH.Rebin2DHist(NDMC_NC,nPID,p,nReco,r);
00127   }
00128   
00129   NDData_Ratio = (TH2D*)NDData_Total->Clone("NDData_Ratio");
00130   NDData_Ratio->Add(NDMC_BNueCC,-1.);
00131   h = (TH2D*)NDMC_Total->Clone("h");
00132   h->Add(NDMC_BNueCC,-1.);
00133   NDData_Ratio->Divide(h);
00134   
00135   NDData[Background::kBNueCC] = (TH2D*)NDMC_BNueCC->Clone("NDData_BNueCC");
00136   NDData[Background::kNC] = (TH2D*)NDMC_NC->Clone("NDData_NC");
00137   NDData[Background::kNC]->Multiply(NDData_Ratio);
00138   NDData[Background::kNuMuCC] = (TH2D*)NDMC_NuMuCC->Clone("NDData_NuMuCC");
00139   NDData[Background::kNuMuCC]->Multiply(NDData_Ratio);
00140   
00141   return;
00142 }

void Extrapolate2D_Simple::RebinInputHists (  )  [private, virtual]

Reimplemented from Extrapolate2D.

Definition at line 940 of file Extrapolate2D_Simple.cxx.

References Extrapolate2D::FD_Nu_TrueVsRecoVsPID, Extrapolate2D::FD_NuBar_TrueVsRecoVsPID, FD_RecoVsPID, Extrapolate2D::FD_TrueVsReco_Fid_NueCC, Extrapolate2D::FD_TrueVsReco_Fid_NuTauCC, Extrapolate2D::FD_TrueVsRecoVsPID, Extrapolate2D::FDComponents, Background::kNueCC, Background::kNuTauCC, Extrapolate2D::MBH, ND_RecoVsPID, Extrapolate2D::nPID, Extrapolate2D::nReco, Extrapolate2D::nTrue, Extrapolate2D::PIDEdges, Extrapolate2D::qNuMuToNue, MultiBinAnaHelper::Rebin2DHist(), MultiBinAnaHelper::Rebin3DHist(), Extrapolate2D::RecoEdges, Extrapolate2D::TrueEdges, and Extrapolate2D::UseSeparateNuNuBar.

Referenced by ReadFNFile(), and ReadFNFileNo3D().

00941 {
00942   double *r = new double[nReco+1];
00943   double *p = new double[nPID+1];
00944   double *t = new double[nTrue+1];
00945   int i;
00946   for(i=0;i<nReco+1;i++)
00947   {
00948     r[i] = RecoEdges.at(i);
00949   }
00950   for(i=0;i<nPID+1;i++)
00951   {
00952     p[i] = PIDEdges.at(i);
00953   }
00954   for(i=0;i<nTrue+1;i++)
00955   {
00956     t[i] = TrueEdges.at(i);
00957   }
00958   
00959   unsigned int j;
00960   Background::Background_t bg;
00961   for(j=0;j<FDComponents.size();j++)
00962   {
00963     bg = FDComponents.at(j);
00964     MBH.Rebin2DHist(FD_RecoVsPID[bg],nPID,p,nReco,r);
00965     if(bg!=Background::kNueCC && bg!=Background::kNuTauCC)
00966     {
00967       MBH.Rebin2DHist(ND_RecoVsPID[bg],nPID,p,nReco,r);
00968     }
00969   }
00970   MBH.Rebin2DHist(FD_TrueVsReco_Fid_NueCC,nReco,r,0,0);
00971   MBH.Rebin2DHist(FD_TrueVsReco_Fid_NuTauCC,nReco,r,0,0);
00972   
00973   if(UseSeparateNuNuBar)
00974   {
00975     MBH.Rebin3DHist(FD_TrueVsRecoVsPID[qNuMuToNue],nPID,p,nReco,r,0,0);
00976     MBH.Rebin3DHist(FD_Nu_TrueVsRecoVsPID[qNuMuToNue],nPID,p,nReco,r,0,0);
00977     MBH.Rebin3DHist(FD_NuBar_TrueVsRecoVsPID[qNuMuToNue],nPID,p,nReco,r,0,0);
00978   }
00979   
00980   return;
00981 }

void Extrapolate2D_Simple::SetupPredHists (  )  [private, virtual]

Reimplemented from Extrapolate2D.

Definition at line 878 of file Extrapolate2D_Simple.cxx.

References Background::AsString(), Extrapolate2D::FDComponents, Extrapolate2D::nPID, Extrapolate2D::nReco, Extrapolate2D::nTrue, Extrapolate2D::PIDEdges, Extrapolate2D::Pred, Extrapolate2D::Pred_3D, Extrapolate2D::Pred_CC_Fid, Extrapolate2D::Pred_Nu_3D, Extrapolate2D::Pred_NuBar_3D, Extrapolate2D::Pred_Signal_VsBinNumber, Extrapolate2D::Pred_TotalBkgd, Extrapolate2D::Pred_TotalBkgd_VsBinNumber, Extrapolate2D::qNuMuToNue, Extrapolate2D::qNuMuToNuTau, Extrapolate2D::RecoEdges, and Extrapolate2D::TrueEdges.

00879 {
00880   Pred_3D.clear();
00881   Pred_Nu_3D.clear();
00882   Pred_NuBar_3D.clear();
00883   Pred.clear();
00884   Pred_TotalBkgd = NULL;
00885   Pred_CC_Fid = NULL;
00886   Pred_TotalBkgd_VsBinNumber = NULL;
00887   Pred_Signal_VsBinNumber = NULL;
00888   
00889   double *r = new double[nReco+1];
00890   double *p = new double[nPID+1];
00891   double *t = new double[nTrue+1];
00892   int i;
00893   for(i=0;i<nReco+1;i++)
00894   {
00895     r[i] = RecoEdges.at(i);
00896   }
00897   for(i=0;i<nPID+1;i++)
00898   {
00899     p[i] = PIDEdges.at(i);
00900   }
00901   for(i=0;i<nTrue+1;i++)
00902   {
00903     t[i] = TrueEdges.at(i);
00904   }
00905   
00906   string name;
00907   
00908   //include these because there is enough info to calculate them (even without the 3D histograms) and it is useful in ErrorCalc
00909   Pred_3D[qNuMuToNue] = new TH3D("Pred_3D_NuMuToNue","",nPID,p,nReco,r,nTrue,t);
00910   Pred_3D[qNuMuToNuTau] = new TH3D("Pred_3D_NuMuToNuTau","",nPID,p,nReco,r,nTrue,t);
00911   
00912   Pred_Nu_3D[qNuMuToNue] = new TH3D("Pred_Nu_3D_NuMuToNue","",nPID,p,nReco,r,nTrue,t);
00913   Pred_Nu_3D[qNuMuToNuTau] = new TH3D("Pred_Nu_3D_NuMuToNuTau","",nPID,p,nReco,r,nTrue,t);
00914   
00915   Pred_NuBar_3D[qNuMuToNue] = new TH3D("Pred_NuBar_3D_NuMuToNue","",nPID,p,nReco,r,nTrue,t);
00916   Pred_NuBar_3D[qNuMuToNuTau] = new TH3D("Pred_NuBar_3D_NuMuToNuTau","",nPID,p,nReco,r,nTrue,t);
00917   
00918   TH2D *h2;
00919   for(unsigned int j=0;j<FDComponents.size();j++)
00920   {
00921     name = "Pred_" + string(Background::AsString(FDComponents[j]));
00922     h2 = new TH2D(name.c_str(),"",nPID,p,nReco,r);
00923     Pred[FDComponents[j]] = h2;
00924   }
00925   
00926   Pred_TotalBkgd = new TH2D("Pred_TotalBkgd","",nPID,p,nReco,r);
00927   
00928   Pred_CC_Fid = new TH1D("Pred_CC_Fid","",nTrue,t);
00929   
00930   int totbin = nReco*nPID;
00931   Pred_TotalBkgd_VsBinNumber = new TH1D("Pred_TotalBkgd_VsBinNumber","",totbin,-0.5,totbin-0.5);
00932   Pred_Signal_VsBinNumber = new TH1D("Pred_Signal_VsBinNumber","",totbin,-0.5,totbin-0.5);
00933   
00934   delete [] r;
00935   delete [] p;
00936   delete [] t;
00937   
00938   return;
00939 }

void Extrapolate2D_Simple::SetUseInputWithNo3DHists (  )  [inline]

Definition at line 27 of file Extrapolate2D_Simple.h.

References UseInputWithNo3D.

00027 { UseInputWithNo3D = true; };


Member Data Documentation

Definition at line 51 of file Extrapolate2D_Simple.h.

Referenced by BeamNuePred(), ReadFNFile(), ReadFNFileNo3D(), and RebinInputHists().

Definition at line 54 of file Extrapolate2D_Simple.h.

Referenced by ReadFNFile(), ReadFNFileNo3D(), and RebinInputHists().

Definition at line 61 of file Extrapolate2D_Simple.h.

Referenced by ReadNDDataFile().

Definition at line 58 of file Extrapolate2D_Simple.h.

Referenced by ReadNDDataFile().

Definition at line 60 of file Extrapolate2D_Simple.h.

Referenced by ReadNDDataFile().

Definition at line 59 of file Extrapolate2D_Simple.h.

Referenced by ReadNDDataFile().

Definition at line 57 of file Extrapolate2D_Simple.h.

Referenced by ReadNDDataFile().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1