diff --git a/src/Electron/ElectronScattering_DurhamData.cxx b/src/Electron/ElectronScattering_DurhamData.cxx index d75630e..944223e 100644 --- a/src/Electron/ElectronScattering_DurhamData.cxx +++ b/src/Electron/ElectronScattering_DurhamData.cxx @@ -1,331 +1,338 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #include "ElectronScattering_DurhamData.h" //******************************************************************** ElectronScattering_DurhamData::ElectronScattering_DurhamData(nuiskey samplekey) { //******************************************************************** // Sample overview --------------------------------------------------- std::string descrip = "Electron Scattering Durham Data sample. \n" \ "Target: Multiple \n" \ "Flux: Energy should match data being handled \n" \ "Signal: Any event with an electron in the final state \n"; fSettings = LoadSampleSettings(samplekey); fSettings.SetDescription(descrip); fSettings.DefineAllowedSpecies("electron"); fSettings.SetTitle("Electron"); fSettings.SetAllowedTypes("FIX,FREE,SHAPE/DIAG/NORM/MASK", "FIX/DIAG"); fSettings.SetXTitle("q0"); fSettings.SetYTitle("#sigma"); FinaliseSampleSettings(); // Scaling Setup --------------------------------------------------- // ScaleFactor automatically setup for DiffXSec/cm2/Nucleon // fScaleFactor = ((GetEventHistogram()->Integral("width") * 1E-38 / (fNEvents + 0.)) / TotalIntegratedFlux()); fScaleFactor = 1.0; - + // Plot Setup ------------------------------------------------------- SetDataFromName(fSettings.GetS("name")); SetCovarFromDiagonal(); // Finish up FinaliseMeasurement(); }; //******************************************************************** void ElectronScattering_DurhamData::SetDataFromName(std::string name) { //******************************************************************** // Data Should be given in the format // Electron_Z_A_Energy_Theta_Source std::vector<std::string> splitstring = GeneralUtils::ParseToStr(name, "_"); std::string zstring = splitstring[1]; std::string astring = splitstring[2]; std::string estring = splitstring[3]; std::string tstring = splitstring[4]; std::string sstring = splitstring[5]; fYCenter = GeneralUtils::StrToDbl(tstring); fZCenter = GeneralUtils::StrToDbl(estring); // Create effective E and Theta bin Edges std::vector<double> thetabinedges; std::vector<double> ebinedges; int nthetabins = FitPar::Config().GetParI("Electron_NThetaBins"); int nebins = FitPar::Config().GetParI("Electron_NEnergyBins"); double thetawidth = FitPar::Config().GetParD("Electron_ThetaWidth"); double ewidth = FitPar::Config().GetParD("Electron_EnergyWidth"); for (int i = -nthetabins; i <= nthetabins; i++) { thetabinedges.push_back( fYCenter + thetawidth * (double(i)) ); } for (int i = -nebins; i <= nebins; i++) { ebinedges.push_back( fZCenter + ewidth * (double(i)) ); } // Determine target std::string target = ""; if (!zstring.compare("6") && !astring.compare("12")) target = "12C.dat"; else { ERR(FTL) << "Target not supported in electron scattering module!" << std::endl; throw; } // Fill Data Points std::string line; std::ifstream mask( (FitPar::GetDataBase() + "/Electron/" + target).c_str() , ifstream::in); int i = 0; std::vector<double> pointx; std::vector<double> errorx; std::vector<double> pointy; std::vector<double> errory; while (std::getline(mask >> std::ws, line, '\n')) { // std::cout << "Line = " << line << std::endl; if (line.empty()) continue; std::vector<std::string> lineentries = GeneralUtils::ParseToStr(line, " "); // std::cout << "Checking : " << line << std::endl; if (zstring.compare(lineentries[0])) continue; if (astring.compare(lineentries[1])) continue; if (estring.compare(lineentries[2])) continue; if (tstring.compare(lineentries[3])) continue; if (sstring.compare(lineentries[7])) continue; std::cout << "Registering data point : " << line << std::endl; std::cout << "Adding Graph Point : " << GeneralUtils::StrToDbl(lineentries[4]) << " " << GeneralUtils::StrToDbl(lineentries[5]) << std::endl; pointx.push_back(GeneralUtils::StrToDbl(lineentries[4])); errorx.push_back(0.0); pointy.push_back(GeneralUtils::StrToDbl(lineentries[5])); errory.push_back(GeneralUtils::StrToDbl(lineentries[6])); i++; } fDataGraph = new TGraphErrors(pointx.size(), &pointx[0], &pointy[0], &errorx[0], &errory[0]); // Now form an effective data and mc histogram std::vector<double> q0binedges; const double* x = fDataGraph->GetX(); // Loop over graph and get mid way point between each data point. for (int i = 0; i < fDataGraph->GetN(); i++) { std::cout << "X Point = " << x[i] << std::endl; if (i == 0) { // First point set lower width as half distance to point above q0binedges.push_back(x[0] - ((x[1] - x[0]) / 2.0)); } else if (i == fDataGraph->GetN() - 1) { // Last point set upper width as half distance to point above. q0binedges.push_back(x[i] - ((x[i] - x[i - 1]) / 2.0)); q0binedges.push_back(x[i] + ((x[i] - x[i - 1]) / 2.0)); } else { // Set half distance to point below q0binedges.push_back(x[i] - ((x[i] - x[i - 1]) / 2.0)); } } for (int i = 0; i < q0binedges.size(); i++) { std::cout << "Q0 Edge " << i << " = " << q0binedges[i] << std::endl; } for (int i = 0; i < ebinedges.size(); i++) { std::cout << "e Edge " << i << " = " << ebinedges[i] << std::endl; } for (int i = 0; i < thetabinedges.size(); i++) { std::cout << "theta Edge " << i << " = " << thetabinedges[i] << std::endl; } // Form the data hist, mchist, etc fDataHist = new TH1D("electron_data", "electron_data", q0binedges.size() - 1, &q0binedges[0]); fMCHist = (TH1D*) fDataHist->Clone("MC"); const double* y = fDataGraph->GetY(); const double* ey = fDataGraph->GetEY(); for (int i = 0; i < fDataGraph->GetN(); i++) { std::cout << "Setting Data Bin " << i + 1 << " to " << y[i] << " +- " << ey[i] << std::endl; fDataHist->SetBinContent(i + 1, y[i]); fDataHist->SetBinError(i + 1, ey[i]); fMCHist->SetBinContent(i + 1, 0.0); fMCHist->SetBinError(i + 1, 0.0); } fMCScan_Q0vsThetavsE = new TH3D("mc_q0vsthetavse", "mc_q0vsthetavse", q0binedges.size() - 1, &q0binedges[0], thetabinedges.size() - 1, &thetabinedges[0], ebinedges.size() - 1 , &ebinedges[0]); fMCScan_Q0vsThetavsE->Reset(); fMCScan_Q0vsTheta = new TH2D("mc_q0vstheta", "mc_q0vstheta", q0binedges.size() - 1, &q0binedges[0], thetabinedges.size() - 1, &thetabinedges[0]); fMCScan_Q0vsTheta->Reset(); fMCScan_Q0vsE = new TH2D("mc_q0vse", "mc_q0vse", q0binedges.size() - 1, &q0binedges[0], ebinedges.size() - 1 , &ebinedges[0]); fMCScan_Q0vsE->Reset(); } //******************************************************************** void ElectronScattering_DurhamData::FillEventVariables(FitEvent *event) { //******************************************************************** if (event->NumFSParticle(11) == 0) return; FitParticle* ein = event->PartInfo(0); FitParticle* eout = event->GetHMFSParticle(11); - double q0 = 0.0; + double q0 = fabs(ein->fP.E() - eout->fP.E()) / 1000.0; double E = ein->fP.E() / 1000.0; double theta = ein->fP.Vect().Angle(eout->fP.Vect()) * 180; fXVar = q0; fYVar = theta; fZVar = E; + std::cout << "Got Event " << q0 << " " << theta << " " << E << std::endl; + return; }; //******************************************************************** bool ElectronScattering_DurhamData::isSignal(FitEvent *event) { //******************************************************************** if (event->NumFSParticle(11) == 0) return false; - if (fXVar < fXLowLim or fXVar > fXHighLim) return false; - if (fYVar < fYLowLim or fYVar > fYHighLim) return false; - if (fZVar < fZLowLim or fZVar > fZHighLim) return false; + // if (fXVar < fXLowLim or fXVar > fXHighLim) return false; + // if (fYVar < fYLowLim or fYVar > fYHighLim) return false; + // if (fZVar < fZLowLim or fZVar > fZHighLim) return false; return true; }; //******************************************************************** void ElectronScattering_DurhamData::FillHistograms() { //******************************************************************** if (Signal) { - fMCScan_Q0vsThetavsE->Fill(fXVar, fYVar, fZVar, Weight); - } - + fMCScan_Q0vsThetavsE->Fill(fXVar, fYVar, fZVar); + + fMCHist->Fill(fXVar); + fMCScan_Q0vsTheta->Fill(fXVar, fYVar); + fMCScan_Q0vsE->Fill(fXVar, fZVar); +} } void ElectronScattering_DurhamData::ResetAll() { fMCScan_Q0vsThetavsE->Reset(); } void ElectronScattering_DurhamData::ApplyNormScale(double norm) { fMCScan_Q0vsThetavsE->Scale(1.0 / norm); fMCScan_Q0vsTheta->Scale(1.0 / norm); fMCScan_Q0vsE->Scale(1.0 / norm); fMCHist->Scale(1.0 / norm); } //******************************************************************** void ElectronScattering_DurhamData::ScaleEvents() { //******************************************************************** fMCScan_Q0vsThetavsE->Scale(fScaleFactor, "width"); - // // Project into fMCScan_Q0vsTheta - // for (int x = 0; x < fMCScan_Q0vsThetavsE->GetNbinsX(); x++) { - // for (int y = 0; y < fMCScan_Q0vsThetavsE->GetNbinsY(); y++) { - // double total = 0.; - // for (int z = 0; z < fMCScan_Q0vsThetavsE->GetNbinsZ(); z++) { - // double zwidth = fMCScan_Q0vsThetavsE->GetZaxis()->GetBinWidth(z + 1); - // total += fMCScan_Q0vsThetavsE->GetBinContent(x + 1, y + 1, z + 1) * zwidth; - // } - // fMCScan_Q0vsTheta->SetBinContent(x + 1, y + 1, total); - // } - // } - - // // Project into fMCScan_Q0vsE - // for (int x = 0; x < fMCScan_Q0vsThetavsE->GetNbinsX(); x++) { - // for (int z = 0; z < fMCScan_Q0vsThetavsE->GetNbinsZ(); z++) { - // double total = 0.; - // for (int y = 0; y < fMCScan_Q0vsThetavsE->GetNbinsY(); y++) { - // double ywidth = fMCScan_Q0vsThetavsE->GetYaxis()->GetBinWidth(y + 1); - // total += fMCScan_Q0vsThetavsE->GetBinContent(x + 1, y + 1, z + 1) * ywidth; - // } - // fMCScan_Q0vsE->SetBinContent(x + 1, z + 1, total); - // } - // } - - // // Project fMCScan_Q0vsTheta into MC Hist - // for (int x = 0; x < fMCScan_Q0vsTheta->GetNbinsX(); x++) { - // double total = 0.; - // for (int y = 0; y < fMCScan_Q0vsTheta->GetNbinsY(); y++) { - // double ywidth = fMCScan_Q0vsTheta->GetYaxis()->GetBinWidth(y + 1); - // total += fMCScan_Q0vsTheta->GetBinContent(x + 1, y + 1); - // } - // fMCHist->SetBinContent(x + 1, total); - // } + // Project into fMCScan_Q0vsTheta + for (int x = 0; x < fMCScan_Q0vsThetavsE->GetNbinsX(); x++) { + for (int y = 0; y < fMCScan_Q0vsThetavsE->GetNbinsY(); y++) { + double total = 0.; + for (int z = 0; z < fMCScan_Q0vsThetavsE->GetNbinsZ(); z++) { + double zwidth = fMCScan_Q0vsThetavsE->GetZaxis()->GetBinWidth(z + 1); + total += fMCScan_Q0vsThetavsE->GetBinContent(x + 1, y + 1, z + 1) * zwidth; + } + fMCScan_Q0vsTheta->SetBinContent(x + 1, y + 1, total); + } + } + + // Project into fMCScan_Q0vsE + for (int x = 0; x < fMCScan_Q0vsThetavsE->GetNbinsX(); x++) { + for (int z = 0; z < fMCScan_Q0vsThetavsE->GetNbinsZ(); z++) { + double total = 0.; + for (int y = 0; y < fMCScan_Q0vsThetavsE->GetNbinsY(); y++) { + double ywidth = fMCScan_Q0vsThetavsE->GetYaxis()->GetBinWidth(y + 1); + total += fMCScan_Q0vsThetavsE->GetBinContent(x + 1, y + 1, z + 1) * ywidth; + } + fMCScan_Q0vsE->SetBinContent(x + 1, z + 1, total); + } + } + + // Project fMCScan_Q0vsTheta into MC Hist + for (int x = 0; x < fMCScan_Q0vsTheta->GetNbinsX(); x++) { + double total = 0.; + for (int y = 0; y < fMCScan_Q0vsTheta->GetNbinsY(); y++) { + double ywidth = fMCScan_Q0vsTheta->GetYaxis()->GetBinWidth(y + 1); + total += fMCScan_Q0vsTheta->GetBinContent(x + 1, y + 1); + } + double xwidth = fMCScan_Q0vsTheta->GetXaxis()->GetBinWidth(x + 1); + fMCHist->SetBinContent(x + 1, total * xwidth); + } + + fMCHist->Scale(fDataHist->Integral() / fMCHist->Integral()); } //******************************************************************** int ElectronScattering_DurhamData::GetNDOF() { //******************************************************************** return fDataGraph->GetN(); } void ElectronScattering_DurhamData::Write(std::string drawOpts) { fMCScan_Q0vsThetavsE->Write(); fMCScan_Q0vsTheta->Write(); fMCScan_Q0vsE->Write(); - fMCHist->Write(); - - fDataHist->Write(); fDataGraph->Write(); + Measurement1D::Write(drawOpts); + } double ElectronScattering_DurhamData::GetLikelihood() { return 0.0; } void ElectronScattering_DurhamData::SetFitOptions(std::string opt) { return; } TH1D* ElectronScattering_DurhamData::GetMCHistogram(void) { return fMCHist; } TH1D* ElectronScattering_DurhamData::GetDataHistogram(void) { return fDataHist; } diff --git a/src/FCN/SampleList.cxx b/src/FCN/SampleList.cxx index e24cc3b..ffc8a7b 100644 --- a/src/FCN/SampleList.cxx +++ b/src/FCN/SampleList.cxx @@ -1,625 +1,631 @@ #include "SampleList.h" //! Functions to make it easier for samples to be created and handled. namespace SampleUtils { //! Create a given sample given its name, file, type, fakdata(fkdt) file and the //! current rw engine and push it back into the list fChain. MeasurementBase* CreateSample(std::string name, std::string file, std::string type, std::string fkdt, FitWeight* rw) { nuiskey samplekey = Config::CreateKey("sample"); samplekey.AddS("name", name); samplekey.AddS("input", file); samplekey.AddS("type", type); return CreateSample(samplekey); } MeasurementBase* CreateSample(nuiskey samplekey) { FitWeight* rw = FitBase::GetRW(); std::string name = samplekey.GetS("name"); std::string file = samplekey.GetS("input"); std::string type = samplekey.GetS("type"); std::string fkdt = ""; /* ANL CCQE Samples */ if (!name.compare("ANL_CCQE_XSec_1DEnu_nu") || !name.compare("ANL_CCQE_XSec_1DEnu_nu_PRD26") || !name.compare("ANL_CCQE_XSec_1DEnu_nu_PRL31") || !name.compare("ANL_CCQE_XSec_1DEnu_nu_PRD16")) { return (new ANL_CCQE_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("ANL_CCQE_Evt_1DQ2_nu") || !name.compare("ANL_CCQE_Evt_1DQ2_nu_PRL31") || !name.compare("ANL_CCQE_Evt_1DQ2_nu_PRD26") || !name.compare("ANL_CCQE_Evt_1DQ2_nu_PRD16")) { return (new ANL_CCQE_Evt_1DQ2_nu(samplekey)); /* ANL CC1ppip samples */ } else if (!name.compare("ANL_CC1ppip_XSec_1DEnu_nu") || !name.compare("ANL_CC1ppip_XSec_1DEnu_nu_W14Cut") || !name.compare("ANL_CC1ppip_XSec_1DEnu_nu_Uncorr") || !name.compare("ANL_CC1ppip_XSec_1DEnu_nu_W14Cut_Uncorr") || !name.compare("ANL_CC1ppip_XSec_1DEnu_nu_W16Cut_Uncorr")) { return (new ANL_CC1ppip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("ANL_CC1ppip_XSec_1DQ2_nu")) { return (new ANL_CC1ppip_XSec_1DQ2_nu(samplekey)); } else if (!name.compare("ANL_CC1ppip_Evt_1DQ2_nu") || !name.compare("ANL_CC1ppip_Evt_1DQ2_nu_W14Cut")) { return (new ANL_CC1ppip_Evt_1DQ2_nu(samplekey)); } else if (!name.compare("ANL_CC1ppip_Evt_1Dppi_nu")) { return (new ANL_CC1ppip_Evt_1Dppi_nu(samplekey)); } else if (!name.compare("ANL_CC1ppip_Evt_1Dthpr_nu")) { return (new ANL_CC1ppip_Evt_1Dthpr_nu(samplekey)); } else if (!name.compare("ANL_CC1ppip_Evt_1DcosmuStar_nu")) { return (new ANL_CC1ppip_Evt_1DcosmuStar_nu(samplekey)); } else if (!name.compare("ANL_CC1ppip_Evt_1DcosthAdler_nu")) { return (new ANL_CC1ppip_Evt_1DcosthAdler_nu(samplekey)); } else if (!name.compare("ANL_CC1ppip_Evt_1Dphi_nu")) { return (new ANL_CC1ppip_Evt_1Dphi_nu(samplekey)); /* ANL CC1npip sample */ } else if (!name.compare("ANL_CC1npip_XSec_1DEnu_nu") || !name.compare("ANL_CC1npip_XSec_1DEnu_nu_W14Cut") || !name.compare("ANL_CC1npip_XSec_1DEnu_nu_Uncorr") || !name.compare("ANL_CC1npip_XSec_1DEnu_nu_W14Cut_Uncorr") || !name.compare("ANL_CC1npip_XSec_1DEnu_nu_W16Cut_Uncorr")) { return (new ANL_CC1npip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("ANL_CC1npip_Evt_1DQ2_nu") || !name.compare("ANL_CC1npip_Evt_1DQ2_nu_W14Cut")) { return (new ANL_CC1npip_Evt_1DQ2_nu(samplekey)); } else if (!name.compare("ANL_CC1npip_Evt_1Dppi_nu")) { return (new ANL_CC1npip_Evt_1Dppi_nu(samplekey)); } else if (!name.compare("ANL_CC1npip_Evt_1DcosmuStar_nu")) { return (new ANL_CC1npip_Evt_1DcosmuStar_nu(samplekey)); /* ANL CC1pi0 sample */ } else if (!name.compare("ANL_CC1pi0_XSec_1DEnu_nu") || !name.compare("ANL_CC1pi0_XSec_1DEnu_nu_W14Cut") || !name.compare("ANL_CC1pi0_XSec_1DEnu_nu_Uncorr") || !name.compare("ANL_CC1pi0_XSec_1DEnu_nu_W14Cut_Uncorr") || !name.compare("ANL_CC1pi0_XSec_1DEnu_nu_W16Cut_Uncorr")) { return (new ANL_CC1pi0_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("ANL_CC1pi0_Evt_1DQ2_nu") || !name.compare("ANL_CC1pi0_Evt_1DQ2_nu_W14Cut")) { return (new ANL_CC1pi0_Evt_1DQ2_nu(samplekey)); } else if (!name.compare("ANL_CC1pi0_Evt_1DcosmuStar_nu")) { return (new ANL_CC1pi0_Evt_1DcosmuStar_nu(samplekey)); /* ANL NC1npip sample */ } else if (!name.compare("ANL_NC1npip_Evt_1Dppi_nu")) { return (new ANL_NC1npip_Evt_1Dppi_nu(samplekey)); /* ANL NC1ppim sample */ } else if (!name.compare("ANL_NC1ppim_XSec_1DEnu_nu")) { return (new ANL_NC1ppim_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("ANL_NC1ppim_Evt_1DcosmuStar_nu")) { return (new ANL_NC1ppim_Evt_1DcosmuStar_nu(samplekey)); /* ANL CC2pi sample */ } else if (!name.compare("ANL_CC2pi_1pim1pip_XSec_1DEnu_nu")) { return (new ANL_CC2pi_1pim1pip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pim1pip_Evt_1Dpmu_nu")) { return (new ANL_CC2pi_1pim1pip_Evt_1Dpmu_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pim1pip_Evt_1Dppip_nu")) { return (new ANL_CC2pi_1pim1pip_Evt_1Dppip_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pim1pip_Evt_1Dppim_nu")) { return (new ANL_CC2pi_1pim1pip_Evt_1Dppim_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pim1pip_Evt_1Dpprot_nu")) { return (new ANL_CC2pi_1pim1pip_Evt_1Dpprot_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pip_XSec_1DEnu_nu")) { return (new ANL_CC2pi_1pip1pip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pip_Evt_1Dpmu_nu")) { return (new ANL_CC2pi_1pip1pip_Evt_1Dpmu_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pip_Evt_1Dpneut_nu")) { return (new ANL_CC2pi_1pip1pip_Evt_1Dpneut_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pip_Evt_1DppipHigh_nu")) { return (new ANL_CC2pi_1pip1pip_Evt_1DppipHigh_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pip_Evt_1DppipLow_nu")) { return (new ANL_CC2pi_1pip1pip_Evt_1DppipLow_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pi0_XSec_1DEnu_nu")) { return (new ANL_CC2pi_1pip1pi0_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pi0_Evt_1Dpmu_nu")) { return (new ANL_CC2pi_1pip1pi0_Evt_1Dpmu_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pi0_Evt_1Dppip_nu")) { return (new ANL_CC2pi_1pip1pi0_Evt_1Dppip_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pi0_Evt_1Dppi0_nu")) { return (new ANL_CC2pi_1pip1pi0_Evt_1Dppi0_nu(samplekey)); } else if (!name.compare("ANL_CC2pi_1pip1pi0_Evt_1Dpprot_nu")) { return (new ANL_CC2pi_1pip1pi0_Evt_1Dpprot_nu(samplekey)); /* ArgoNeut Samples */ } else if (!name.compare("ArgoNeuT_CCInc_XSec_1Dpmu_antinu")) { return (new ArgoNeuT_CCInc_XSec_1Dpmu_antinu(samplekey)); } else if (!name.compare("ArgoNeuT_CCInc_XSec_1Dpmu_nu")) { return (new ArgoNeuT_CCInc_XSec_1Dpmu_nu(samplekey)); } else if (!name.compare("ArgoNeuT_CCInc_XSec_1Dthetamu_antinu")) { return (new ArgoNeuT_CCInc_XSec_1Dthetamu_antinu(samplekey)); } else if (!name.compare("ArgoNeuT_CCInc_XSec_1Dthetamu_nu")) { return (new ArgoNeuT_CCInc_XSec_1Dthetamu_nu(samplekey)); /* BNL Samples */ } else if (!name.compare("BNL_CCQE_XSec_1DEnu_nu")) { return (new BNL_CCQE_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("BNL_CCQE_Evt_1DQ2_nu")) { return (new BNL_CCQE_Evt_1DQ2_nu(samplekey)); /* BNL CC1ppip samples */ } else if (!name.compare("BNL_CC1ppip_XSec_1DEnu_nu") || !name.compare("BNL_CC1ppip_XSec_1DEnu_nu_Uncorr")) { return (new BNL_CC1ppip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("BNL_CC1ppip_Evt_1DQ2_nu") || !name.compare("BNL_CC1ppip_Evt_1DQ2_nu_W14Cut")) { return (new BNL_CC1ppip_Evt_1DQ2_nu(samplekey)); } else if (!name.compare("BNL_CC1ppip_Evt_1DcosthAdler_nu")) { return (new BNL_CC1ppip_Evt_1DcosthAdler_nu(samplekey)); } else if (!name.compare("BNL_CC1ppip_Evt_1Dphi_nu")) { return (new BNL_CC1ppip_Evt_1Dphi_nu(samplekey)); /* BNL CC1npip samples */ } else if (!name.compare("BNL_CC1npip_XSec_1DEnu_nu") || !name.compare("BNL_CC1npip_XSec_1DEnu_nu_Uncorr")) { return (new BNL_CC1npip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("BNL_CC1npip_Evt_1DQ2_nu")) { return (new BNL_CC1npip_Evt_1DQ2_nu(samplekey)); /* BNL CC1pi0 samples */ } else if (!name.compare("BNL_CC1pi0_XSec_1DEnu_nu")) { return (new BNL_CC1pi0_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("BNL_CC1pi0_Evt_1DQ2_nu")) { return (new BNL_CC1pi0_Evt_1DQ2_nu(samplekey)); /* FNAL Samples */ } else if (!name.compare("FNAL_CCQE_Evt_1DQ2_nu")) { return (new FNAL_CCQE_Evt_1DQ2_nu(samplekey)); /* FNAL CC1ppip */ } else if (!name.compare("FNAL_CC1ppip_XSec_1DEnu_nu")) { return (new FNAL_CC1ppip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("FNAL_CC1ppip_XSec_1DQ2_nu")) { return (new FNAL_CC1ppip_XSec_1DQ2_nu(samplekey)); } else if (!name.compare("FNAL_CC1ppip_Evt_1DQ2_nu")) { return (new FNAL_CC1ppip_Evt_1DQ2_nu(samplekey)); /* FNAL CC1ppim */ } else if (!name.compare("FNAL_CC1ppim_XSec_1DEnu_antinu")) { return (new FNAL_CC1ppim_XSec_1DEnu_antinu(samplekey)); /* BEBC Samples */ } else if (!name.compare("BEBC_CCQE_XSec_1DQ2_nu")) { return (new BEBC_CCQE_XSec_1DQ2_nu(samplekey)); /* BEBC CC1ppip samples */ } else if (!name.compare("BEBC_CC1ppip_XSec_1DEnu_nu")) { return (new BEBC_CC1ppip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("BEBC_CC1ppip_XSec_1DQ2_nu")) { return (new BEBC_CC1ppip_XSec_1DQ2_nu(samplekey)); /* BEBC CC1npip samples */ } else if (!name.compare("BEBC_CC1npip_XSec_1DEnu_nu")) { return (new BEBC_CC1npip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("BEBC_CC1npip_XSec_1DQ2_nu")) { return (new BEBC_CC1npip_XSec_1DQ2_nu(samplekey)); /* BEBC CC1pi0 samples */ } else if (!name.compare("BEBC_CC1pi0_XSec_1DEnu_nu")) { return (new BEBC_CC1pi0_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("BEBC_CC1pi0_XSec_1DQ2_nu")) { return (new BEBC_CC1pi0_XSec_1DQ2_nu(samplekey)); /* BEBC CC1npim samples */ } else if (!name.compare("BEBC_CC1npim_XSec_1DEnu_antinu")) { return (new BEBC_CC1npim_XSec_1DEnu_antinu(samplekey)); } else if (!name.compare("BEBC_CC1npim_XSec_1DQ2_antinu")) { return (new BEBC_CC1npim_XSec_1DQ2_antinu(samplekey)); /* BEBC CC1ppim samples */ } else if (!name.compare("BEBC_CC1ppim_XSec_1DEnu_antinu")) { return (new BEBC_CC1ppim_XSec_1DEnu_antinu(samplekey)); } else if (!name.compare("BEBC_CC1ppim_XSec_1DQ2_antinu")) { return (new BEBC_CC1ppim_XSec_1DQ2_antinu(samplekey)); /* GGM CC1ppip samples */ } else if (!name.compare("GGM_CC1ppip_XSec_1DEnu_nu")) { return (new GGM_CC1ppip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("GGM_CC1ppip_Evt_1DQ2_nu")) { return (new GGM_CC1ppip_Evt_1DQ2_nu(samplekey)); /* MiniBooNE Samples */ /* CCQE */ } else if (!name.compare("MiniBooNE_CCQE_XSec_1DQ2_nu") || !name.compare("MiniBooNE_CCQELike_XSec_1DQ2_nu")) { return (new MiniBooNE_CCQE_XSec_1DQ2_nu(samplekey)); } else if (!name.compare("MiniBooNE_CCQE_XSec_1DQ2_antinu") || !name.compare("MiniBooNE_CCQELike_XSec_1DQ2_antinu") || !name.compare("MiniBooNE_CCQE_CTarg_XSec_1DQ2_antinu")) { return (new MiniBooNE_CCQE_XSec_1DQ2_antinu(samplekey)); } else if (!name.compare("MiniBooNE_CCQE_XSec_2DTcos_nu") || !name.compare("MiniBooNE_CCQELike_XSec_2DTcos_nu")) { return (new MiniBooNE_CCQE_XSec_2DTcos_nu(samplekey)); } else if (!name.compare("MiniBooNE_CCQE_XSec_2DTcos_antinu") || !name.compare("MiniBooNE_CCQELike_XSec_2DTcos_antinu")) { return (new MiniBooNE_CCQE_XSec_2DTcos_antinu(samplekey)); /* MiniBooNE CC1pi+ */ // 1D } else if (!name.compare("MiniBooNE_CC1pip_XSec_1DEnu_nu")) { return (new MiniBooNE_CC1pip_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pip_XSec_1DQ2_nu")) { return (new MiniBooNE_CC1pip_XSec_1DQ2_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pip_XSec_1DTpi_nu")) { return (new MiniBooNE_CC1pip_XSec_1DTpi_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pip_XSec_1DTu_nu")) { return (new MiniBooNE_CC1pip_XSec_1DTu_nu(samplekey)); // 2D } else if (!name.compare("MiniBooNE_CC1pip_XSec_2DQ2Enu_nu")) { return (new MiniBooNE_CC1pip_XSec_2DQ2Enu_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pip_XSec_2DTpiCospi_nu")) { return (new MiniBooNE_CC1pip_XSec_2DTpiCospi_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pip_XSec_2DTpiEnu_nu")) { return (new MiniBooNE_CC1pip_XSec_2DTpiEnu_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pip_XSec_2DTuCosmu_nu")) { return (new MiniBooNE_CC1pip_XSec_2DTuCosmu_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pip_XSec_2DTuEnu_nu")) { return (new MiniBooNE_CC1pip_XSec_2DTuEnu_nu(samplekey)); /* MiniBooNE CC1pi0 */ } else if (!name.compare("MiniBooNE_CC1pi0_XSec_1DEnu_nu")) { return (new MiniBooNE_CC1pi0_XSec_1DEnu_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pi0_XSec_1DQ2_nu")) { return (new MiniBooNE_CC1pi0_XSec_1DQ2_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pi0_XSec_1DTu_nu")) { return (new MiniBooNE_CC1pi0_XSec_1DTu_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pi0_XSec_1Dcosmu_nu")) { return (new MiniBooNE_CC1pi0_XSec_1Dcosmu_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pi0_XSec_1Dcospi0_nu")) { return (new MiniBooNE_CC1pi0_XSec_1Dcospi0_nu(samplekey)); } else if (!name.compare("MiniBooNE_CC1pi0_XSec_1Dppi0_nu")) { return (new MiniBooNE_CC1pi0_XSec_1Dppi0_nu(samplekey)); } else if (!name.compare("MiniBooNE_NC1pi0_XSec_1Dcospi0_antinu") || !name.compare("MiniBooNE_NC1pi0_XSec_1Dcospi0_rhc")) { return (new MiniBooNE_NC1pi0_XSec_1Dcospi0_antinu(samplekey)); } else if (!name.compare("MiniBooNE_NC1pi0_XSec_1Dcospi0_nu") || !name.compare("MiniBooNE_NC1pi0_XSec_1Dcospi0_fhc")) { return (new MiniBooNE_NC1pi0_XSec_1Dcospi0_nu(samplekey)); } else if (!name.compare("MiniBooNE_NC1pi0_XSec_1Dppi0_antinu") || !name.compare("MiniBooNE_NC1pi0_XSec_1Dppi0_rhc")) { return (new MiniBooNE_NC1pi0_XSec_1Dppi0_antinu(samplekey)); } else if (!name.compare("MiniBooNE_NC1pi0_XSec_1Dppi0_nu") || !name.compare("MiniBooNE_NC1pi0_XSec_1Dppi0_fhc")) { return (new MiniBooNE_NC1pi0_XSec_1Dppi0_nu(samplekey)); /* MiniBooNE NCEL */ } else if (!name.compare("MiniBooNE_NCEL_XSec_Treco_nu")) { ERR(FTL) << "MiniBooNE_NCEL_XSec_Treco_nu not implemented in current interface." << std::endl; throw 5; // return (new MiniBooNE_NCEL_XSec_Treco_nu(file, rw, type, // fkdt)); /* MINERvA Samples */ } else if (!name.compare("MINERvA_CCQE_XSec_1DQ2_nu") || !name.compare("MINERvA_CCQE_XSec_1DQ2_nu_20deg") || !name.compare("MINERvA_CCQE_XSec_1DQ2_nu_oldflux") || !name.compare("MINERvA_CCQE_XSec_1DQ2_nu_20deg_oldflux")) { return ( - new MINERvA_CCQE_XSec_1DQ2_nu(name, file, rw, type, fkdt)); + new MINERvA_CCQE_XSec_1DQ2_nu(samplekey)); } else if (!name.compare("MINERvA_CCQE_XSec_1DQ2_antinu") || !name.compare("MINERvA_CCQE_XSec_1DQ2_antinu_20deg") || !name.compare("MINERvA_CCQE_XSec_1DQ2_antinu_oldflux") || !name.compare("MINERvA_CCQE_XSec_1DQ2_antinu_20deg_oldflux")) { return ( - new MINERvA_CCQE_XSec_1DQ2_antinu(name, file, rw, type, fkdt)); + new MINERvA_CCQE_XSec_1DQ2_antinu(samplekey)); } else if (!name.compare("MINERvA_CCQE_XSec_1DQ2_joint_oldflux") || !name.compare("MINERvA_CCQE_XSec_1DQ2_joint_20deg_oldflux") || !name.compare("MINERvA_CCQE_XSec_1DQ2_joint") || !name.compare("MINERvA_CCQE_XSec_1DQ2_joint_20deg")) { - return (new MINERvA_CCQE_XSec_1DQ2_joint(name, file, rw, type, fkdt)); + return (new MINERvA_CCQE_XSec_1DQ2_joint(samplekey)); } else if (!name.compare("MINERvA_CC0pi_XSec_1DEe_nue")) { return (new MINERvA_CC0pi_XSec_1DEe_nue(samplekey)); } else if (!name.compare("MINERvA_CC0pi_XSec_1DQ2_nue")) { return (new MINERvA_CC0pi_XSec_1DQ2_nue(samplekey)); } else if (!name.compare("MINERvA_CC0pi_XSec_1DThetae_nue")) { return ( new MINERvA_CC0pi_XSec_1DThetae_nue(samplekey)); } else if (!name.compare("MINERvA_CC0pi_XSec_1DQ2_nu_proton")) { return ( new MINERvA_CC0pi_XSec_1DQ2_nu_proton(samplekey)); /* CC1pi+ */ // DONE } else if (!name.compare("MINERvA_CC1pip_XSec_1DTpi_nu") || - !name.compare("MINERvA_CC1pip_XSec_1DTpi_nu_20deg")) { - return (new MINERvA_CC1pip_XSec_1DTpi_nu(name, file, rw, type, fkdt)); + !name.compare("MINERvA_CC1pip_XSec_1DTpi_nu_20deg") || + !name.compare("MINERvA_CC1pip_XSec_1DTpi_nu_fluxcorr") || + !name.compare("MINERvA_CC1pip_XSec_1DTpi_nu_20deg_fluxcorr") ) { + return (new MINERvA_CC1pip_XSec_1DTpi_nu(samplekey)); // DONE } else if (!name.compare("MINERvA_CC1pip_XSec_1Dth_nu") || - !name.compare("MINERvA_CC1pip_XSec_1Dth_nu_20deg")) { - return (new MINERvA_CC1pip_XSec_1Dth_nu(name, file, rw, type, fkdt)); + !name.compare("MINERvA_CC1pip_XSec_1Dth_nu_20deg") || + !name.compare("MINERvA_CC1pip_XSec_1Dth_nu_fluxcorr") || + !name.compare("MINERvA_CC1pip_XSec_1Dth_nu_20deg_fluxcorr")) { + return (new MINERvA_CC1pip_XSec_1Dth_nu(samplekey)); /* CCNpi+ */ - // DONE } else if (!name.compare("MINERvA_CCNpip_XSec_1Dth_nu") || !name.compare("MINERvA_CCNpip_XSec_1Dth_nu_2015") || !name.compare("MINERvA_CCNpip_XSec_1Dth_nu_2016") || - !name.compare("MINERvA_CCNpip_XSec_1Dth_nu_20deg")) { - return (new MINERvA_CCNpip_XSec_1Dth_nu(name, file, rw, type, fkdt)); + !name.compare("MINERvA_CCNpip_XSec_1Dth_nu_20deg") || + !name.compare("MINERvA_CCNpip_XSec_1Dth_nu_2015_fluxcorr") || + !name.compare("MINERvA_CCNpip_XSec_1Dth_nu_20deg_fluxcorr")) { + return (new MINERvA_CCNpip_XSec_1Dth_nu(samplekey)); -// Done } else if (!name.compare("MINERvA_CCNpip_XSec_1DTpi_nu") || !name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_2015") || !name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_2016") || - !name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_20deg")) { - return (new MINERvA_CCNpip_XSec_1DTpi_nu(name, file, rw, type, fkdt)); + !name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_20deg") || + !name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_2015_fluxcorr") || + !name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_20deg_fluxcorr")) { + return (new MINERvA_CCNpip_XSec_1DTpi_nu(samplekey)); // Done } else if (!name.compare("MINERvA_CCNpip_XSec_1Dthmu_nu")) { return (new MINERvA_CCNpip_XSec_1Dthmu_nu(file, rw, type, fkdt)); // Done } else if (!name.compare("MINERvA_CCNpip_XSec_1Dpmu_nu")) { return (new MINERvA_CCNpip_XSec_1Dpmu_nu(file, rw, type, fkdt)); // Done } else if (!name.compare("MINERvA_CCNpip_XSec_1DQ2_nu")) { return (new MINERvA_CCNpip_XSec_1DQ2_nu(file, rw, type, fkdt)); // Done } else if (!name.compare("MINERvA_CCNpip_XSec_1DEnu_nu")) { return (new MINERvA_CCNpip_XSec_1DEnu_nu(file, rw, type, fkdt)); /* CC1pi0 */ // Done } else if (!name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu") || !name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu_2015") || !name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu_2016")) { return ( new MINERvA_CC1pi0_XSec_1Dth_antinu(name, file, rw, type, fkdt)); } else if (!name.compare("MINERvA_CC1pi0_XSec_1Dppi0_antinu")) { return ( new MINERvA_CC1pi0_XSec_1Dppi0_antinu(file, rw, type, fkdt)); } else if (!name.compare("MINERvA_CC1pi0_XSec_1DTpi0_antinu")) { return ( new MINERvA_CC1pi0_XSec_1DTpi0_antinu(file, rw, type, fkdt)); // Done } else if (!name.compare("MINERvA_CC1pi0_XSec_1DQ2_antinu")) { return ( new MINERvA_CC1pi0_XSec_1DQ2_antinu(file, rw, type, fkdt)); // Done } else if (!name.compare("MINERvA_CC1pi0_XSec_1Dthmu_antinu")) { return ( new MINERvA_CC1pi0_XSec_1Dthmu_antinu(file, rw, type, fkdt)); // Done } else if (!name.compare("MINERvA_CC1pi0_XSec_1Dpmu_antinu")) { return ( new MINERvA_CC1pi0_XSec_1Dpmu_antinu(file, rw, type, fkdt)); // Done } else if (!name.compare("MINERvA_CC1pi0_XSec_1DEnu_antinu")) { return ( new MINERvA_CC1pi0_XSec_1DEnu_antinu(file, rw, type, fkdt)); /* CCINC */ } else if (!name.compare("MINERvA_CCinc_XSec_2DEavq3_nu")) { return (new MINERvA_CCinc_XSec_2DEavq3_nu(file, rw, type, fkdt)); } else if (!name.compare("MINERvA_CCinc_XSec_1Dx_ratio_C12_CH") || !name.compare("MINERvA_CCinc_XSec_1Dx_ratio_Fe56_CH") || !name.compare("MINERvA_CCinc_XSec_1Dx_ratio_Pb208_CH")) { return ( new MINERvA_CCinc_XSec_1Dx_ratio(name, file, rw, type, fkdt)); } else if (!name.compare("MINERvA_CCinc_XSec_1DEnu_ratio_C12_CH") || !name.compare("MINERvA_CCinc_XSec_1DEnu_ratio_Fe56_CH") || !name.compare("MINERvA_CCinc_XSec_1DEnu_ratio_Pb208_CH")) { return (new MINERvA_CCinc_XSec_1DEnu_ratio(samplekey)); /* T2K Samples */ } else if (!name.compare("T2K_CC0pi_XSec_2DPcos_nu") || !name.compare("T2K_CC0pi_XSec_2DPcos_nu_I") || !name.compare("T2K_CC0pi_XSec_2DPcos_nu_II")) { return (new T2K_CC0pi_XSec_2DPcos_nu(name, file, rw, type)); /* T2K CC1pi+ CH samples */ // Comment these out for now because we don't have the proper data /* } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dpmu_nu")) { return (new T2K_CC1pip_CH_XSec_1Dpmu_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dppi_nu")) { return (new T2K_CC1pip_CH_XSec_1Dppi_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_CH_XSec_1DQ2_nu")) { return (new T2K_CC1pip_CH_XSec_1DQ2_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dq3_nu")) { return (new T2K_CC1pip_CH_XSec_1Dq3_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthmupi_nu")) { return (new T2K_CC1pip_CH_XSec_1Dthmupi_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthpi_nu")) { return (new T2K_CC1pip_CH_XSec_1Dthpi_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthq3pi_nu")) { return (new T2K_CC1pip_CH_XSec_1Dthq3pi_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_CH_XSec_1DWrec_nu")) { return (new T2K_CC1pip_CH_XSec_1DWrec_nu(file, rw, type, fkdt)); */ /* T2K CC1pi+ H2O samples */ } else if (!name.compare("T2K_CC1pip_H2O_XSec_1DEnuDelta_nu")) { return (new T2K_CC1pip_H2O_XSec_1DEnuDelta_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_H2O_XSec_1DEnuMB_nu")) { return (new T2K_CC1pip_H2O_XSec_1DEnuMB_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dcosmu_nu")) { return (new T2K_CC1pip_H2O_XSec_1Dcosmu_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dcosmupi_nu")) { return (new T2K_CC1pip_H2O_XSec_1Dcosmupi_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dcospi_nu")) { return (new T2K_CC1pip_H2O_XSec_1Dcospi_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dpmu_nu")) { return (new T2K_CC1pip_H2O_XSec_1Dpmu_nu(file, rw, type, fkdt)); } else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dppi_nu")) { return (new T2K_CC1pip_H2O_XSec_1Dppi_nu(file, rw, type, fkdt)); /* T2K CC0pi + np CH samples */ } else if (!name.compare("T2K_CC0pinp_STV_XSec_1Ddpt_nu")) { return (new T2K_CC0pinp_STV_XSec_1Ddpt_nu(file, rw, type, fkdt)); /* K2K Samples */ /* NC1pi0 */ } else if (!name.compare("K2K_NC1pi0_Evt_1Dppi0_nu")) { return (new K2K_NC1pi0_Evt_1Dppi0_nu(samplekey)); /* Fake Studies */ } else if (name.find("ExpMultDist_CCQE_XSec_1D") != std::string::npos && name.find("_FakeStudy") != std::string::npos) { return ( new ExpMultDist_CCQE_XSec_1DVar_FakeStudy(name, file, rw, type, fkdt)); } else if (name.find("ExpMultDist_CCQE_XSec_2D") != std::string::npos && name.find("_FakeStudy") != std::string::npos) { return ( new ExpMultDist_CCQE_XSec_2DVar_FakeStudy(name, file, rw, type, fkdt)); } else if (name.find("GenericFlux_") != std::string::npos) { return (new GenericFlux_Tester(name, file, rw, type, fkdt)); } else if (!name.compare("ElectronFlux_FlatTree")) { return (new ElectronFlux_FlatTree(name, file, rw, type, fkdt)); } else if (name.find("ElectronData_") != std::string::npos) { return new ElectronScattering_DurhamData(samplekey); //<<<<<<< HEAD // } else if (name.find("MCStudy_KaonPreSelection") != std::string::npos) { // return (new MCStudy_KaonPreSelection(name, file, rw, type, fkdt)); //======= //} else if (name.find("MCStudy_KaonPreSelection") != std::string::npos) { //fChain->push_back(new MCStudy_KaonPreSelection(name, file, rw, type, fkdt)); //>>>>>>> 96ed014ac03821c4f771d6c484740e8b25350aa1 } else if (name.find("MuonValidation_") != std::string::npos) { return (new MCStudy_MuonValidation(name, file, rw, type, fkdt)); } else { ERR(FTL) << "Error: No such sample: " << name << std::endl; exit(-1); return NULL; } // Return NULL if no sample loaded. return NULL; } } diff --git a/src/MINERvA/MINERvA_CC1pip_XSec_1DTpi_nu.cxx b/src/MINERvA/MINERvA_CC1pip_XSec_1DTpi_nu.cxx index 676ae6c..a33be6c 100644 --- a/src/MINERvA/MINERvA_CC1pip_XSec_1DTpi_nu.cxx +++ b/src/MINERvA/MINERvA_CC1pip_XSec_1DTpi_nu.cxx @@ -1,90 +1,117 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #include "MINERvA_SignalDef.h" #include "MINERvA_CC1pip_XSec_1DTpi_nu.h" -// The constructor -MINERvA_CC1pip_XSec_1DTpi_nu::MINERvA_CC1pip_XSec_1DTpi_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile) { - - fName = name; - fPlotTitles = "; T_{#pi} (MeV); d#sigma/dT_{#pi} (cm^{2}/MeV/nucleon)"; - fFullPhaseSpace = fName.find("_20deg") == std::string::npos; - EnuMin = 1.5; - EnuMax = 10; - fIsDiag = false; - Measurement1D::SetupMeasurement(inputfile, type, rw, fakeDataFile); - - if (fFullPhaseSpace){ + +//******************************************************************** +MINERvA_CC1pip_XSec_1DTpi_nu::MINERvA_CC1pip_XSec_1DTpi_nu(nuiskey samplekey) { +//******************************************************************** + + // Sample overview --------------------------------------------------- + std::string descrip = "MINERvA_CC1pip_XSec_1DTpi_nu sample. \n" \ + "Target: CH \n" \ + "Flux: MINERvA Forward Horn Current nue + nuebar \n" \ + "Signal: Any event with 1 electron, any nucleons, and no other FS particles \n"; + + // Setup common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("T_{#pi} (MeV)"); + fSettings.SetYTitle("d#sigma/dT_{#pi} (cm^{2}/MeV/nucleon)"); + fSettings.SetAllowedTypes("FIX,FREE,SHAPE/DIAG,FULL/NORM/MASK", "FIX/FULL"); + fSettings.SetEnuRange(1.5, 10.0); + fSettings.DefineAllowedTargets("C,H"); + fSettings.DefineAllowedSpecies("numu"); + + fFullPhaseSpace = !fSettings.Found("name", "_20deg"); + fFluxCorrection = fSettings.Found("name","fluxcorr"); + fSettings.SetTitle("MINERvA_CC1pip_XSec_1DTpi_nu"); + fIsShape = fSettings.Found("type","shape"); + + if (fFullPhaseSpace) { if (fIsShape) { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_Tpi_shape.csv"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_Tpi_cov_shape.csv", fDataHist->GetNbinsX()); + fSettings.SetDataInput( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CC1pip/ccpip_Tpi_shape.csv"); + fSettings.SetCovarInput( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CC1pip/ccpip_Tpi_cov_shape.csv"); } else { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_Tpi.csv"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_Tpi_cov.csv", fDataHist->GetNbinsX()); + fSettings.SetDataInput( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CC1pip/ccpip_Tpi.csv"); + fSettings.SetCovarInput( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CC1pip/ccpip_Tpi_cov.csv"); } } else { - if (this->fIsShape) { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_Tpi_20_shape.csv"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_Tpi_20_cov_shape.csv", fDataHist->GetNbinsX()); + if (fIsShape) { + fSettings.SetDataInput( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CC1pip/ccpip_Tpi_20_shape.csv"); + fSettings.SetCovarInput( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CC1pip/ccpip_Tpi_20_cov_shape.csv"); } else { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_Tpi_20.csv"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_Tpi_20_cov.csv", fDataHist->GetNbinsX()); + fSettings.SetDataInput( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CC1pip/ccpip_Tpi_20.csv"); + fSettings.SetCovarInput( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CC1pip/ccpip_Tpi_20_cov.csv"); } } - this->SetupDefaultHist(); + FinaliseSampleSettings(); + + // Scaling Setup --------------------------------------------------- + // ScaleFactor automatically setup for DiffXSec/cm2/Nucleon + fScaleFactor = GetEventHistogram()->Integral("width") * double(1E-38) / double(fNEvents) / TotalIntegratedFlux("width"); + + // Plot Setup ------------------------------------------------------- + SetDataFromTextFile( fSettings.GetDataInput() ); + SetCorrelationFromTextFile( fSettings.GetCovarInput() ); // Scale the MINERvA data to account for the flux difference - for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { - fDataHist->SetBinContent(i+1, fDataHist->GetBinContent(i+1)*1.11); + if (fFluxCorrection) { + for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { + fDataHist->SetBinContent(i + 1, fDataHist->GetBinContent(i + 1) * 1.11); + } } - fScaleFactor = GetEventHistogram()->Integral("width")*double(1E-38)/double(fNEvents)/TotalIntegratedFlux("width"); - std::cout << "SF: " << fScaleFactor << std::endl; + // Final setup --------------------------------------------------- + FinaliseMeasurement(); + }; + void MINERvA_CC1pip_XSec_1DTpi_nu::FillEventVariables(FitEvent *event) { if (event->NumFSParticle(PhysConst::pdg_charged_pions) == 0 || event->NumFSParticle(13) == 0) return; TLorentzVector Pnu = event->GetNeutrinoIn()->fP; TLorentzVector Ppip = event->GetHMFSParticle(PhysConst::pdg_charged_pions)->fP; TLorentzVector Pmu = event->GetHMFSParticle(13)->fP; double hadMass = FitUtils::Wrec(Pnu, Pmu); double Tpi = -999; if (hadMass > 100 && hadMass < 1400) - Tpi = FitUtils::T(Ppip)*1000.; + Tpi = FitUtils::T(Ppip) * 1000.; fXVar = Tpi; return; }; //******************************************************************** bool MINERvA_CC1pip_XSec_1DTpi_nu::isSignal(FitEvent *event) { //******************************************************************** // Last true refers to that this is the restricted MINERvA phase space, in which only forward-going muons are accepted return SignalDef::isCC1pip_MINERvA(event, EnuMin, EnuMax, !fFullPhaseSpace); } diff --git a/src/MINERvA/MINERvA_CC1pip_XSec_1DTpi_nu.h b/src/MINERvA/MINERvA_CC1pip_XSec_1DTpi_nu.h index 3a5e0a7..1583ab1 100644 --- a/src/MINERvA/MINERvA_CC1pip_XSec_1DTpi_nu.h +++ b/src/MINERvA/MINERvA_CC1pip_XSec_1DTpi_nu.h @@ -1,37 +1,38 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #ifndef MINERVA_CC1PIP_XSEC_1DTPI_NU_H_SEEN #define MINERVA_CC1PIP_XSEC_1DTPI_NU_H_SEEN #include "Measurement1D.h" class MINERvA_CC1pip_XSec_1DTpi_nu : public Measurement1D { public: - MINERvA_CC1pip_XSec_1DTpi_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile); + MINERvA_CC1pip_XSec_1DTpi_nu(nuiskey samplekey); virtual ~MINERvA_CC1pip_XSec_1DTpi_nu() {}; void FillEventVariables(FitEvent *event); bool isSignal(FitEvent *event); bool fFullPhaseSpace; + bool fFluxCorrection; private: }; #endif diff --git a/src/MINERvA/MINERvA_CC1pip_XSec_1Dth_nu.cxx b/src/MINERvA/MINERvA_CC1pip_XSec_1Dth_nu.cxx index 3a7b7c1..b631ea4 100644 --- a/src/MINERvA/MINERvA_CC1pip_XSec_1Dth_nu.cxx +++ b/src/MINERvA/MINERvA_CC1pip_XSec_1Dth_nu.cxx @@ -1,92 +1,118 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #include "MINERvA_SignalDef.h" #include "MINERvA_CC1pip_XSec_1Dth_nu.h" -// The constructor -MINERvA_CC1pip_XSec_1Dth_nu::MINERvA_CC1pip_XSec_1Dth_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile){ - - fName = name; - fPlotTitles = "; #theta_{#pi} (degrees); d#sigma/d#theta_{#pi} (cm^{2}/degrees/nucleon)"; - fFullPhaseSpace = name.find("_20deg") == std::string::npos; - EnuMin = 1.5; - EnuMax = 10; - fIsDiag = false; - Measurement1D::SetupMeasurement(inputfile, type, rw, fakeDataFile); - - // Full Phase Space + + +//******************************************************************** +MINERvA_CC1pip_XSec_1Dth_nu::MINERvA_CC1pip_XSec_1Dth_nu(nuiskey samplekey) { +//******************************************************************** + + // Sample overview --------------------------------------------------- + std::string descrip = "MINERvA_CC1pip_XSec_1Dth_nu sample. \n" \ + "Target: CH \n" \ + "Flux: MINERvA Forward Horn Current nue + nuebar \n" \ + "Signal: Any event with 1 electron, any nucleons, and no other FS particles \n"; + + // Setup common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("#theta_{#pi} (degrees)"); + fSettings.SetYTitle("d#sigma/d#theta_{#pi} (cm^{2}/degrees/nucleon)"); + fSettings.SetAllowedTypes("FIX,FREE,SHAPE/DIAG,FULL/NORM/MASK", "FIX/FULL"); + fSettings.SetEnuRange(1.5, 10.0); + fSettings.DefineAllowedTargets("C,H"); + fSettings.DefineAllowedSpecies("numu"); + + fFullPhaseSpace = !fSettings.Found("name", "_20deg"); + fFluxCorrection = fSettings.Found("name","fluxcorr"); + fSettings.SetTitle("MINERvA_CC1pip_XSec_1Dth_nu"); + fIsShape = fSettings.Found("type","shape"); + if (fFullPhaseSpace){ if (fIsShape) { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_shape.csv"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_cov_shape.csv", fDataHist->GetNbinsX()); + fSettings.SetDataInput( GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_shape.csv"); + fSettings.SetCovarInput( GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_cov_shape.csv"); } else { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta.csv"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_cov.csv", fDataHist->GetNbinsX()); + fSettings.SetDataInput( GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta.csv"); + fSettings.SetCovarInput( GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_cov.csv"); } // Restricted Phase Space } else { if (fIsShape) { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_20_shape.csv"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_20_cov_shape.csv", fDataHist->GetNbinsX()); + fSettings.SetDataInput( GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_20_shape.csv"); + fSettings.SetCovarInput( GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_20_cov_shape.csv"); } else { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_20.csv"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_20_cov.csv", fDataHist->GetNbinsX()); + fSettings.SetDataInput( GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_20.csv"); + fSettings.SetCovarInput( GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CC1pip/ccpip_theta_20_cov.csv"); } } - this->SetupDefaultHist(); + FinaliseSampleSettings(); + + // Scaling Setup --------------------------------------------------- + // ScaleFactor automatically setup for DiffXSec/cm2/Nucleon + fScaleFactor = GetEventHistogram()->Integral("width") * double(1E-38) / double(fNEvents) / TotalIntegratedFlux("width"); + + // Plot Setup ------------------------------------------------------- + SetDataFromTextFile( fSettings.GetDataInput() ); + SetCorrelationFromTextFile( fSettings.GetCovarInput() ); - // Adjust MINERvA data to flux correction; roughly a 11% normalisation increase in data - // Please change when MINERvA releases new data! - for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { - fDataHist->SetBinContent(i+1, fDataHist->GetBinContent(i+1)*1.11); + // Scale the MINERvA data to account for the flux difference + if (fFluxCorrection) { + for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { + fDataHist->SetBinContent(i + 1, fDataHist->GetBinContent(i + 1) * 1.11); + } } - fScaleFactor = GetEventHistogram()->Integral("width")*double(1E-38)/double(fNEvents)/TotalIntegratedFlux("width"); + // Final setup --------------------------------------------------- + FinaliseMeasurement(); + }; void MINERvA_CC1pip_XSec_1Dth_nu::FillEventVariables(FitEvent *event) { if (event->NumFSParticle(PhysConst::pdg_charged_pions) == 0 || event->NumFSParticle(13) == 0) return; TLorentzVector Pnu = event->GetNeutrinoIn()->fP; TLorentzVector Ppip = event->GetHMFSParticle(PhysConst::pdg_charged_pions)->fP; TLorentzVector Pmu = event->GetHMFSParticle(13)->fP; double hadMass = FitUtils::Wrec(Pnu, Pmu); double th = -999; if (hadMass > 100 && hadMass < 1400) th = (180./M_PI)*FitUtils::th(Pnu, Ppip); fXVar = th; return; }; //******************************************************************** bool MINERvA_CC1pip_XSec_1Dth_nu::isSignal(FitEvent *event) { //******************************************************************** // Last false refers to that this is NOT the restricted MINERvA phase space, in which only forward-going muons are accepted return SignalDef::isCC1pip_MINERvA(event, EnuMin, EnuMax, !fFullPhaseSpace); } diff --git a/src/MINERvA/MINERvA_CC1pip_XSec_1Dth_nu.h b/src/MINERvA/MINERvA_CC1pip_XSec_1Dth_nu.h index 45aac69..c669c77 100644 --- a/src/MINERvA/MINERvA_CC1pip_XSec_1Dth_nu.h +++ b/src/MINERvA/MINERvA_CC1pip_XSec_1Dth_nu.h @@ -1,37 +1,38 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #ifndef MINERVA_CC1PIP_XSEC_1DTH_NU_H_SEEN #define MINERVA_CC1PIP_XSEC_1DTH_NU_H_SEEN #include "Measurement1D.h" class MINERvA_CC1pip_XSec_1Dth_nu : public Measurement1D { public: - MINERvA_CC1pip_XSec_1Dth_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile); + MINERvA_CC1pip_XSec_1Dth_nu(nuiskey samplekey); virtual ~MINERvA_CC1pip_XSec_1Dth_nu() {}; void FillEventVariables(FitEvent *event); bool isSignal(FitEvent *event); bool fFullPhaseSpace; + bool fFluxCorrection; private: }; #endif diff --git a/src/MINERvA/MINERvA_CCNpip_XSec_1DTpi_nu.cxx b/src/MINERvA/MINERvA_CCNpip_XSec_1DTpi_nu.cxx index 073845c..7788cd8 100644 --- a/src/MINERvA/MINERvA_CCNpip_XSec_1DTpi_nu.cxx +++ b/src/MINERvA/MINERvA_CCNpip_XSec_1DTpi_nu.cxx @@ -1,286 +1,273 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #include "MINERvA_SignalDef.h" - #include "MINERvA_CCNpip_XSec_1DTpi_nu.h" //******************************************************************** -// The constructor -MINERvA_CCNpip_XSec_1DTpi_nu::MINERvA_CCNpip_XSec_1DTpi_nu( - std::string name, std::string inputfile, FitWeight *rw, std::string type, - std::string fakeDataFile) { +MINERvA_CCNpip_XSec_1DTpi_nu::MINERvA_CCNpip_XSec_1DTpi_nu(nuiskey samplekey) { //******************************************************************** - fName = name; - fPlotTitles = - "; T_{#pi} (MeV); (1/T#Phi) dN_{#pi}/dT_{#pi} (cm^{2}/MeV/nucleon)"; - fFullPhaseSpace = fName.find("_20deg") == std::string::npos; - fUpdatedData = fName.find("2015") == std::string::npos; - EnuMin = 1.5; - EnuMax = 10; - fIsDiag = false; - - // Reserve length 3 for the number of pions - TpiVect.reserve(3); - - // Lots of good data from MINERvA, thanks! + // Sample overview --------------------------------------------------- + std::string descrip = "MINERvA_CCNpip_XSec_1DTpi_nu sample. \n" \ + "Target: CH \n" \ + "Flux: MINERvA Forward Horn Current nue + nuebar \n" \ + "Signal: Any event with 1 electron, any nucleons, and no other FS particles \n"; + + // Setup common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("T_{#pi} (MeV)"); + fSettings.SetYTitle("(1/T#Phi) dN_{#pi}/dT_{#pi} (cm^{2}/MeV/nucleon)"); + fSettings.SetAllowedTypes("FIX,FREE,SHAPE/DIAG,FULL/NORM/MASK", "FIX/FULL"); + fSettings.SetEnuRange(1.5, 10.0); + fSettings.DefineAllowedTargets("C,H"); + fSettings.DefineAllowedSpecies("numu"); + + fFullPhaseSpace = !fSettings.Found("name", "_20deg"); + fFluxCorrection = fSettings.Found("name", "fluxcorr"); + fUpdatedData = !fSettings.Found("name", "2015"); + fSettings.SetTitle("MINERvA_CCNpip_XSec_1DTpi_nu"); + + FinaliseSampleSettings(); + + // Scaling Setup --------------------------------------------------- + // ScaleFactor automatically setup for DiffXSec/cm2/Nucleon + fScaleFactor = GetEventHistogram()->Integral("width") * double(1E-38) / double(fNEvents) / TotalIntegratedFlux("width"); + + // Plot Setup ------------------------------------------------------- // Full Phase Space if (fFullPhaseSpace) { // 2016 release if (fUpdatedData) { - this->SetDataValues( - GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2016/nu-ccNpi+-xsec-pion-kinetic-energy.csv"); + SetDataFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2016/nu-ccNpi+-xsec-pion-kinetic-energy.csv"); // MINERvA has the error quoted as a percentage of the cross-section // Need to make this into an absolute error before we go from correlation // matrix -> covariance matrix since it depends on the error in the ith // bin for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { - fDataHist->SetBinError(i + 1, - fDataHist->GetBinContent(i + 1) * - (fDataHist->GetBinError(i + 1) / 100.)); + fDataHist->SetBinError(i + 1, fDataHist->GetBinContent(i + 1) * (fDataHist->GetBinError(i + 1) / 100.)); } // This is a correlation matrix, not covariance matrix, so needs to be // converted - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2016/" - "nu-ccNpi+-correlation-pion-kinetic-" - "energy.csv", - fDataHist->GetNbinsX()); + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2016/nu-ccNpi+-correlation-pion-kinetic-energy.csv"); + // 2015 release } else { // If we're doing shape only if (fIsShape) { - fName += "_shape"; - this->SetDataValues( - GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_shape.txt"); - this->SetCovarMatrixFromCorrText( - GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_shape_cov.txt", - fDataHist->GetNbinsX()); + SetDataFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_shape.txt"); + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_shape_cov.txt"); + // If we're doing full cross-section } else { - this->SetDataValues(GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi.txt"); - this->SetCovarMatrixFromCorrText( - GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_cov.txt", - fDataHist->GetNbinsX()); + SetDataFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi.txt"); + SetCorrelationFromTextFile( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_cov.txt"); } - // Adjust MINERvA data to flux correction; roughly a 11% normalisation - // increase in data - for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { - fDataHist->SetBinContent(i + 1, fDataHist->GetBinContent(i + 1) * 1.11); - } } // Restricted Phase Space } else { // Only 2015 data released restricted muon phase space cross-section // unfortunately if (fUpdatedData) { - LOG(SAM) << fName << " has no updated 2016 data for restricted phase " - "space! Using 2015 data." - << std::endl; - fUpdatedData = false; + ERR(FTL) << fName << " has no updated 2016 data for restricted phase space! Using 2015 data." << std::endl; + throw; } // If we're using the shape only data if (fIsShape) { - this->SetDataValues( - GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_20deg_shape.txt"); - this->SetCovarMatrixFromCorrText( - GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_20deg_shape_cov.txt", - fDataHist->GetNbinsX()); + SetDataFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_20deg_shape.txt"); + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_20deg_shape_cov.txt"); + // Or total cross-section } else { - this->SetDataValues( - GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_20deg.txt"); - this->SetCovarMatrixFromCorrText( - GeneralUtils::GetTopLevelDir() + - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_20deg_cov.txt", - fDataHist->GetNbinsX()); + SetDataFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_20deg.txt"); + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_Tpi_20deg_cov.txt"); } + } - // Adjust 2015 MINERvA data to account for flux correction; roughly a 11% - // normalisation increase in data + // Scale the MINERvA data to account for the flux difference + // Adjust MINERvA data to flux correction; roughly a 11% normalisation increase in data + // Please change when MINERvA releases new data! + if (fFluxCorrection) { for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { fDataHist->SetBinContent(i + 1, fDataHist->GetBinContent(i + 1) * 1.11); } } - Measurement1D::SetupMeasurement(inputfile, type, rw, fakeDataFile); - Measurement1D::SetupDefaultHist(); - - onePions = (TH1D *)(fDataHist->Clone()); - twoPions = (TH1D *)(fDataHist->Clone()); - threePions = (TH1D *)(fDataHist->Clone()); - morePions = (TH1D *)(fDataHist->Clone()); - - onePions->SetNameTitle((fName + "_1pions").c_str(), - (fName + "_1pions" + fPlotTitles).c_str()); - twoPions->SetNameTitle((fName + "_2pions").c_str(), - (fName + "_2pions;" + fPlotTitles).c_str()); - threePions->SetNameTitle((fName + "_3pions").c_str(), - (fName + "_3pions" + fPlotTitles).c_str()); - morePions->SetNameTitle((fName + "_4pions").c_str(), - (fName + "_4pions" + fPlotTitles).c_str()); - - fScaleFactor = GetEventHistogram()->Integral("width") * double(1E-38) / - double(fNEvents) / TotalIntegratedFlux("width"); + // Make some auxillary helper plots + onePions = (TH1D*)(fDataHist->Clone()); + onePions->SetNameTitle((fName + "_1pions").c_str(), (fName + "_1pions" + fPlotTitles).c_str()); + SetAutoProcessTH1(onePions, kCMD_Reset, kCMD_Scale, kCMD_Norm); + + twoPions = (TH1D*)(fDataHist->Clone()); + twoPions->SetNameTitle((fName + "_2pions").c_str(), (fName + "_2pions;" + fPlotTitles).c_str()); + SetAutoProcessTH1(twoPions, kCMD_Reset, kCMD_Scale, kCMD_Norm); + + threePions = (TH1D*)(fDataHist->Clone()); + threePions->SetNameTitle((fName + "_3pions").c_str(), (fName + "_3pions" + fPlotTitles).c_str()); + SetAutoProcessTH1(threePions, kCMD_Reset, kCMD_Scale, kCMD_Norm); + + morePions = (TH1D*)(fDataHist->Clone()); + morePions->SetNameTitle((fName + "_4pions").c_str(), (fName + "_4pions" + fPlotTitles).c_str()); + SetAutoProcessTH1(morePions, kCMD_Reset, kCMD_Scale, kCMD_Norm); + + // Reserve length 3 for the number of pions + // We fill once per pion found in the event, so can fill multiple times for one event + TpiVect.reserve(3); + + // Final setup --------------------------------------------------- + FinaliseMeasurement(); + }; //******************************************************************** // Here we have to fill for every pion we find in the event void MINERvA_CCNpip_XSec_1DTpi_nu::FillEventVariables(FitEvent *event) { //******************************************************************** if (event->NumFSParticle(211) == 0 && event->NumFSParticle(-211) == 0) return; if (event->NumFSParticle(13) == 0) return; // Clear out the vectors TpiVect.clear(); TLorentzVector Pnu = event->GetNeutrinoIn()->fP; TLorentzVector Pmu = event->GetHMFSParticle(13)->fP; double hadMass = FitUtils::Wrec(Pnu, Pmu); if (hadMass < 1800) { // Loop over the particle stack for (unsigned int j = 2; j < event->Npart(); ++j) { // Only include alive particles if (!(event->PartInfo(j))->fIsAlive && (event->PartInfo(j))->fNEUTStatusCode != 0) continue; int PID = (event->PartInfo(j))->fPID; // Pick up the charged pions in the event if (abs(PID) == 211) { double ppi = FitUtils::T(event->PartInfo(j)->fP) * 1000.; TpiVect.push_back(ppi); } } } fXVar = 0; return; }; //******************************************************************** // The last bool refers to if we're using restricted phase space or not bool MINERvA_CCNpip_XSec_1DTpi_nu::isSignal(FitEvent *event) { //******************************************************************** // Last false refers to that this is NOT the restricted MINERvA phase space, // in which only forward-going muons are accepted return SignalDef::isCCNpip_MINERvA(event, EnuMin, EnuMax, !fFullPhaseSpace); } //******************************************************************** // Need to override FillHistograms() here because we fill the histogram N_pion // times void MINERvA_CCNpip_XSec_1DTpi_nu::FillHistograms() { //******************************************************************** if (Signal) { unsigned int nPions = TpiVect.size(); // Need to loop over all the pions in the sample for (size_t k = 0; k < nPions; ++k) { double tpi = TpiVect[k]; this->fMCHist->Fill(tpi, Weight); this->fMCFine->Fill(tpi, Weight); this->fMCStat->Fill(tpi, 1.0); if (nPions == 1) { onePions->Fill(tpi, Weight); } else if (nPions == 2) { twoPions->Fill(tpi, Weight); } else if (nPions == 3) { threePions->Fill(tpi, Weight); } else if (nPions > 3) { morePions->Fill(tpi, Weight); } PlotUtils::FillNeutModeArray(fMCHist_PDG, Mode, tpi, Weight); } } } //******************************************************************** void MINERvA_CCNpip_XSec_1DTpi_nu::ScaleEvents() { //******************************************************************** Measurement1D::ScaleEvents(); onePions->Scale(this->fScaleFactor, "width"); twoPions->Scale(this->fScaleFactor, "width"); threePions->Scale(this->fScaleFactor, "width"); morePions->Scale(this->fScaleFactor, "width"); return; } //******************************************************************** void MINERvA_CCNpip_XSec_1DTpi_nu::Write(std::string drawOpts) { //******************************************************************** Measurement1D::Write(drawOpts); // Draw the npions stack onePions->SetTitle("1#pi"); onePions->SetLineColor(kBlack); // onePions->SetFillStyle(0); onePions->SetFillColor(onePions->GetLineColor()); twoPions->SetTitle("2#pi"); twoPions->SetLineColor(kRed); // twoPions->SetFillStyle(0); twoPions->SetFillColor(twoPions->GetLineColor()); threePions->SetTitle("3#pi"); threePions->SetLineColor(kGreen); // threePions->SetFillStyle(0); threePions->SetFillColor(threePions->GetLineColor()); morePions->SetTitle(">3#pi"); morePions->SetLineColor(kBlue); // morePions->SetFillStyle(0); morePions->SetFillColor(morePions->GetLineColor()); THStack pionStack = THStack((fName + "_pionStack").c_str(), (fName + "_pionStack").c_str()); pionStack.Add(onePions); pionStack.Add(twoPions); pionStack.Add(threePions); pionStack.Add(morePions); pionStack.Write(); return; } diff --git a/src/MINERvA/MINERvA_CCNpip_XSec_1DTpi_nu.h b/src/MINERvA/MINERvA_CCNpip_XSec_1DTpi_nu.h index 47f13b7..8691b63 100644 --- a/src/MINERvA/MINERvA_CCNpip_XSec_1DTpi_nu.h +++ b/src/MINERvA/MINERvA_CCNpip_XSec_1DTpi_nu.h @@ -1,48 +1,49 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #ifndef MINERVA_CCNPIP_XSEC_1DTPI_NU_H_SEEN #define MINERVA_CCNPIP_XSEC_1DTPI_NU_H_SEEN #include "Measurement1D.h" class MINERvA_CCNpip_XSec_1DTpi_nu : public Measurement1D { public: - MINERvA_CCNpip_XSec_1DTpi_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile); + MINERvA_CCNpip_XSec_1DTpi_nu(nuiskey samplekey); virtual ~MINERvA_CCNpip_XSec_1DTpi_nu() {}; void FillEventVariables(FitEvent *event); void FillHistograms(); bool isSignal(FitEvent *event); void ScaleEvents(); void Write(std::string drawOpts); bool fFullPhaseSpace; bool fUpdatedData; + bool fFluxCorrection; private: std::vector<double> TpiVect; TH1D *onePions; TH1D *twoPions; TH1D *threePions; TH1D *morePions; }; #endif diff --git a/src/MINERvA/MINERvA_CCNpip_XSec_1Dth_nu.cxx b/src/MINERvA/MINERvA_CCNpip_XSec_1Dth_nu.cxx index 608a7c1..be97e21 100644 --- a/src/MINERvA/MINERvA_CCNpip_XSec_1Dth_nu.cxx +++ b/src/MINERvA/MINERvA_CCNpip_XSec_1Dth_nu.cxx @@ -1,255 +1,261 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #include "MINERvA_SignalDef.h" #include "MINERvA_CCNpip_XSec_1Dth_nu.h" + //******************************************************************** -// The constructor -MINERvA_CCNpip_XSec_1Dth_nu::MINERvA_CCNpip_XSec_1Dth_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile){ +MINERvA_CCNpip_XSec_1Dth_nu::MINERvA_CCNpip_XSec_1Dth_nu(nuiskey samplekey) { //******************************************************************** - fName = name; - fPlotTitles = "; #theta_{#pi} (degrees); (1/T#Phi) dN_{#pi}/d#theta_{#pi} (cm^{2}/degrees/nucleon)"; - - // If we have full phase space we won't find 20deg in name - fFullPhaseSpace = (fName.find("_20deg") == std::string::npos); - // If we have updated data we won't have 2015 in name - fUpdatedData = fName.find("2015") == std::string::npos; - - EnuMin = 1.5; - EnuMax = 10; - fIsDiag = false; - - // Reserve length 3 for the number of pions - // We fill once per pion found in the event, so can fill multiple times for one event - thVect.reserve(3); - - // So here is all the data we want to read in, pfoaw! - // Same W cut for all releases - + // Sample overview --------------------------------------------------- + std::string descrip = "MINERvA_CCNpip_XSec_1Dth_nu sample. \n" \ + "Target: CH \n" \ + "Flux: MINERvA Forward Horn Current nue + nuebar \n" \ + "Signal: Any event with 1 electron, any nucleons, and no other FS particles \n"; + + // Setup common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("#theta_{#pi} (degrees)"); + fSettings.SetYTitle("(1/T#Phi) dN_{#pi}/d#theta_{#pi} (cm^{2}/degrees/nucleon)"); + fSettings.SetAllowedTypes("FIX,FREE,SHAPE/DIAG,FULL/NORM/MASK", "FIX/FULL"); + fSettings.SetEnuRange(1.5, 10.0); + fSettings.DefineAllowedTargets("C,H"); + fSettings.DefineAllowedSpecies("numu"); + + fFullPhaseSpace = !fSettings.Found("name", "_20deg"); + fFluxCorrection = fSettings.Found("name", "fluxcorr"); + fUpdatedData = !fSettings.Found("name", "2015"); + fSettings.SetTitle("MINERvA_CCNpip_XSec_1Dth_nu"); + + FinaliseSampleSettings(); + + // Scaling Setup --------------------------------------------------- + // ScaleFactor automatically setup for DiffXSec/cm2/Nucleon + fScaleFactor = GetEventHistogram()->Integral("width") * double(1E-38) / double(fNEvents) / TotalIntegratedFlux("width"); + + // Plot Setup ------------------------------------------------------- // Full Phase Space if (fFullPhaseSpace) { // 2016 release data if (fUpdatedData) { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CCNpip/2016/nu-ccNpi+-xsec-pion-angle.csv"); + SetDataFromTextFile( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2016/nu-ccNpi+-xsec-pion-angle.csv"); // MINERvA has the error quoted as a percentage of the cross-section // Need to make this into an absolute error before we go from correlation matrix -> covariance matrix since it depends on the error in the ith bin - for (int i = 0; i < fDataHist->GetNbinsX()+1; i++) { - fDataHist->SetBinError(i+1, fDataHist->GetBinContent(i+1)*(fDataHist->GetBinError(i+1)/100.)); + for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { + fDataHist->SetBinError(i + 1, fDataHist->GetBinContent(i + 1) * (fDataHist->GetBinError(i + 1) / 100.)); } // This is a correlation matrix! but it's all fixed in SetCovarMatrixFromText - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CCNpip/2016/nu-ccNpi+-correlation-pion-angle.csv", fDataHist->GetNbinsX()); - // 2015 release data + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2016/nu-ccNpi+-correlation-pion-angle.csv"); + + // 2015 release data } else { // 2015 release allows for shape comparisons if (fIsShape) { - fName += "_shape"; - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_shape.txt"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_shape_cov.txt", fDataHist->GetNbinsX()); + SetDataFromTextFile( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_shape.txt"); + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_shape_cov.txt"); } else { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th.txt"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_cov.txt", fDataHist->GetNbinsX()); + SetDataFromTextFile( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th.txt"); + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_cov.txt"); } - // Adjust MINERvA data to flux correction; roughly a 11% normalisation increase in data - // Please change when MINERvA releases new data! - for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { - fDataHist->SetBinContent(i+1, fDataHist->GetBinContent(i+1)*1.11); - } } - // Restricted Phase Space Data + // Restricted Phase Space Data } else { // 2016 release data unfortunately not released in 20degree forward-going, revert to 2015 data - if (fUpdatedData){ - LOG(SAM) << fName << " has no updated 2016 data for restricted phase space! Using 2015 data." << std::endl; - fUpdatedData = false; + if (fUpdatedData) { + ERR(FTL) << fName << " has no updated 2016 data for restricted phase space! Using 2015 data." << std::endl; + throw; } // Only 2015 20deg data if (fIsShape) { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_20deg_shape.txt"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+ - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_20deg_shape_cov.txt", fDataHist->GetNbinsX()); + SetDataFromTextFile( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_20deg_shape.txt"); + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_20deg_shape_cov.txt"); } else { - this->SetDataValues(GeneralUtils::GetTopLevelDir()+"/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_20deg.txt"); - this->SetCovarMatrixFromCorrText(GeneralUtils::GetTopLevelDir()+ - "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_20deg_cov.txt", fDataHist->GetNbinsX()); + SetDataFromTextFile( GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_20deg.txt"); + SetCorrelationFromTextFile(GeneralUtils::GetTopLevelDir() + "/data/MINERvA/CCNpip/2015/MINERvA_CCNpi_th_20deg_cov.txt"); } } - Measurement1D::SetupMeasurement(inputfile, type, rw, fakeDataFile); - Measurement1D::SetupDefaultHist(); + // Scale the MINERvA data to account for the flux difference + // Adjust MINERvA data to flux correction; roughly a 11% normalisation increase in data + // Please change when MINERvA releases new data! + if (fFluxCorrection) { + for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) { + fDataHist->SetBinContent(i + 1, fDataHist->GetBinContent(i + 1) * 1.11); + } + } // Make some auxillary helper plots onePions = (TH1D*)(fDataHist->Clone()); + onePions->SetNameTitle((fName + "_1pions").c_str(), (fName + "_1pions" + fPlotTitles).c_str()); + SetAutoProcessTH1(onePions, kCMD_Reset, kCMD_Scale, kCMD_Norm); + twoPions = (TH1D*)(fDataHist->Clone()); + twoPions->SetNameTitle((fName + "_2pions").c_str(), (fName + "_2pions;" + fPlotTitles).c_str()); + SetAutoProcessTH1(twoPions, kCMD_Reset, kCMD_Scale, kCMD_Norm); + threePions = (TH1D*)(fDataHist->Clone()); + threePions->SetNameTitle((fName + "_3pions").c_str(), (fName + "_3pions" + fPlotTitles).c_str()); + SetAutoProcessTH1(threePions, kCMD_Reset, kCMD_Scale, kCMD_Norm); + morePions = (TH1D*)(fDataHist->Clone()); + morePions->SetNameTitle((fName + "_4pions").c_str(), (fName + "_4pions" + fPlotTitles).c_str()); + SetAutoProcessTH1(morePions, kCMD_Reset, kCMD_Scale, kCMD_Norm); - onePions->SetNameTitle((fName+"_1pions").c_str(), (fName+"_1pions"+fPlotTitles).c_str()); - twoPions->SetNameTitle((fName+"_2pions").c_str(), (fName+"_2pions;"+fPlotTitles).c_str()); - threePions->SetNameTitle((fName+"_3pions").c_str(), (fName+"_3pions"+fPlotTitles).c_str()); - morePions->SetNameTitle((fName+"_4pions").c_str(), (fName+"_4pions"+fPlotTitles).c_str()); + // Reserve length 3 for the number of pions + // We fill once per pion found in the event, so can fill multiple times for one event + thVect.reserve(3); + // Final setup --------------------------------------------------- + FinaliseMeasurement(); - fScaleFactor = GetEventHistogram()->Integral("width")*double(1E-38)/double(fNEvents)/TotalIntegratedFlux("width"); }; // ******************************************** // Fill the event variables // Here we want to fill the angle for every pion we can find in the event void MINERvA_CCNpip_XSec_1Dth_nu::FillEventVariables(FitEvent *event) { // ******************************************** thVect.clear(); if (event->NumFSParticle(211) == 0 && event->NumFSParticle(-211) == 0) return; if (event->NumFSParticle(13) == 0) return; TLorentzVector Pnu = event->GetNeutrinoIn()->fP; TLorentzVector Pmu = event->GetHMFSParticle(13)->fP; double hadMass = FitUtils::Wrec(Pnu, Pmu); if (hadMass < 1800) { TLorentzVector Ppip; // Loop over the particle stack for (unsigned int j = 2; j < event->Npart(); ++j) { // Only include alive particles if (!(event->PartInfo(j))->fIsAlive && (event->PartInfo(j))->fNEUTStatusCode != 0) continue; int PID = (event->PartInfo(j))->fPID; // Select highest momentum (energy) charged pion if (abs(PID) == 211) { Ppip = (event->PartInfo(j))->fP; - double th = (180./M_PI)*FitUtils::th(Pnu, Ppip); + double th = (180. / M_PI) * FitUtils::th(Pnu, Ppip); thVect.push_back(th); } } } fXVar = 0; return; }; //******************************************************************** // The signal definition for MINERvA CCNpi+ // Last bool refers to if we're selecting on the full phase space or not bool MINERvA_CCNpip_XSec_1Dth_nu::isSignal(FitEvent *event) { //******************************************************************** return SignalDef::isCCNpip_MINERvA(event, EnuMin, EnuMax, !fFullPhaseSpace); } //******************************************************************** // Need to override FillHistograms() here because we fill the histogram N_pion times void MINERvA_CCNpip_XSec_1Dth_nu::FillHistograms() { //******************************************************************** - if (Signal){ + if (Signal) { unsigned int nPions = thVect.size(); // Need to loop over all the pions in the event for (size_t k = 0; k < nPions; ++k) { double th = thVect[k]; this->fMCHist->Fill(th, Weight); this->fMCFine->Fill(th, Weight); this->fMCStat->Fill(th, 1.0); if (nPions == 1) { onePions->Fill(th, Weight); } else if (nPions == 2) { twoPions->Fill(th, Weight); } else if (nPions == 3) { threePions->Fill(th, Weight); } else if (nPions > 3) { morePions->Fill(th, Weight); } PlotUtils::FillNeutModeArray(fMCHist_PDG, Mode, th, Weight); } } return; } //******************************************************************** -void MINERvA_CCNpip_XSec_1Dth_nu::ScaleEvents() { - //******************************************************************** - Measurement1D::ScaleEvents(); - - onePions->Scale(this->fScaleFactor, "width"); - twoPions->Scale(this->fScaleFactor, "width"); - threePions->Scale(this->fScaleFactor, "width"); - morePions->Scale(this->fScaleFactor, "width"); - - return; -} - -//******************************************************************** void MINERvA_CCNpip_XSec_1Dth_nu::Write(std::string drawOpts) { //******************************************************************** Measurement1D::Write(drawOpts); // Draw the npions stack onePions->SetTitle("1#pi"); onePions->SetLineColor(kBlack); //onePions->SetFillStyle(0); onePions->SetFillColor(onePions->GetLineColor()); twoPions->SetTitle("2#pi"); twoPions->SetLineColor(kRed); //twoPions->SetFillStyle(0); twoPions->SetFillColor(twoPions->GetLineColor()); threePions->SetTitle("3#pi"); threePions->SetLineColor(kGreen); //threePions->SetFillStyle(0); threePions->SetFillColor(threePions->GetLineColor()); morePions->SetTitle(">3#pi"); morePions->SetLineColor(kBlue); //morePions->SetFillStyle(0); morePions->SetFillColor(morePions->GetLineColor()); - THStack pionStack = THStack((fName+"_pionStack").c_str(), (fName+"_pionStack").c_str()); + THStack pionStack = THStack((fName + "_pionStack").c_str(), (fName + "_pionStack").c_str()); pionStack.Add(onePions); pionStack.Add(twoPions); pionStack.Add(threePions); pionStack.Add(morePions); pionStack.Write(); return; } diff --git a/src/MINERvA/MINERvA_CCNpip_XSec_1Dth_nu.h b/src/MINERvA/MINERvA_CCNpip_XSec_1Dth_nu.h index 882811b..84e1e6c 100644 --- a/src/MINERvA/MINERvA_CCNpip_XSec_1Dth_nu.h +++ b/src/MINERvA/MINERvA_CCNpip_XSec_1Dth_nu.h @@ -1,49 +1,49 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #ifndef MINERVA_CCNPIP_XSEC_1DTH_NU_H_SEEN #define MINERVA_CCNPIP_XSEC_1DTH_NU_H_SEEN #include "Measurement1D.h" class MINERvA_CCNpip_XSec_1Dth_nu : public Measurement1D { public: - MINERvA_CCNpip_XSec_1Dth_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile); + MINERvA_CCNpip_XSec_1Dth_nu(nuiskey samplekey); virtual ~MINERvA_CCNpip_XSec_1Dth_nu() {}; void FillEventVariables(FitEvent *event); void FillHistograms(); bool isSignal(FitEvent *event); - void ScaleEvents(); void Write(std::string drawOpt); bool fFullPhaseSpace; bool fUpdatedData; + bool fFluxCorrection; private: bool isNew; TH1D *onePions; TH1D *twoPions; TH1D *threePions; TH1D *morePions; std::vector<double> thVect; }; #endif diff --git a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_antinu.cxx b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_antinu.cxx index ee32c05..f5a7f84 100644 --- a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_antinu.cxx +++ b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_antinu.cxx @@ -1,123 +1,146 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #include "MINERvA_SignalDef.h" #include "MINERvA_CCQE_XSec_1DQ2_antinu.h" + //******************************************************************** -MINERvA_CCQE_XSec_1DQ2_antinu::MINERvA_CCQE_XSec_1DQ2_antinu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile){ +MINERvA_CCQE_XSec_1DQ2_antinu::MINERvA_CCQE_XSec_1DQ2_antinu(nuiskey samplekey) { //******************************************************************** - // Setup Measurement Defaults - fName = name; - fPlotTitles = "; Q^{2}_{QE} (GeV^{2}); d#sigma/dQ_{QE}^{2} (cm^{2}/GeV^{2})"; - isFluxFix = name.find("_oldflux") == std::string::npos; - fullphasespace = name.find("_20deg") == std::string::npos; - EnuMin = 1.5; - EnuMax = 10.; - fNormError = 0.110; - fAllowedTypes = "FIX,FREE,SHAPE/DIAG,FULL/NORM"; - fDefaultTypes = "FIX/FULL"; - Measurement1D::SetupMeasurement(inputfile, type, rw, fakeDataFile); - - // Setup the Data Plots - std::string basedir = FitPar::GetDataBase()+"/MINERvA/CCQE/"; + // Sample overview --------------------------------------------------- + std::string descrip = "MINERvA_CCQE_XSec_1DQ2_antinu sample. \n" \ + "Target: CH \n" \ + "Flux: MINERvA Forward Horn Current nue + nuebar \n" \ + "Signal: Any event with 1 electron, any nucleons, and no other FS particles \n"; + + // Setup common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("Q^{2}_{QE} (GeV^{2})"); + fSettings.SetYTitle("d#sigma/dQ_{QE}^{2} (cm^{2}/GeV^{2})"); + fSettings.SetAllowedTypes("FIX,FREE,SHAPE/DIAG,FULL/NORM/MASK", "FIX/FULL"); + fSettings.SetEnuRange(1.5, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + isFluxFix = !fSettings.Found("name", "_oldflux"); + fullphasespace = !fSettings.Found("name", "_20deg"); + + // CCQELike plot information + fSettings.SetTitle("MINERvA_CCQE_XSec_1DQ2_antinu"); + + std::string basedir = FitPar::GetDataBase() + "/MINERvA/CCQE/"; std::string datafilename = ""; std::string covarfilename = ""; // Full Phase Space - if (fullphasespace){ + if (fullphasespace) { - if (isFluxFix){ - if (fIsShape){ + if (isFluxFix) { + if (fIsShape) { ERR(WRN) << "SHAPE likelihood comparison not available for MINERvA " << "datasets with fixed flux information. NUISANCE will scale MC to match " << "data normalization but full covariance will be used. " << std::endl; } datafilename = "Q2QE_numubar_data_fluxfix.txt"; covarfilename = "Q2QE_numubar_covar_fluxfix.txt"; } else { - if (fIsShape){ - datafilename = "Q2QE_numubar_data_SHAPE-extracted.txt"; - covarfilename = "Q2QE_numubar_covar_SHAPE-extracted.txt"; + if (fIsShape) { + datafilename = "Q2QE_numubar_data_SHAPE-extracted.txt"; + covarfilename = "Q2QE_numubar_covar_SHAPE-extracted.txt"; } else { - datafilename = "Q2QE_numubar_data.txt"; - covarfilename = "Q2QE_numubar_covar.txt"; + datafilename = "Q2QE_numubar_data.txt"; + covarfilename = "Q2QE_numubar_covar.txt"; } } - // Restricted Phase Space + // Restricted Phase Space } else { - if (isFluxFix){ - if (fIsShape){ + if (isFluxFix) { + if (fIsShape) { ERR(WRN) << "SHAPE likelihood comparison not available for MINERvA " << "datasets with fixed flux information. NUISANCE will scale MC to match " << "data normalization but full covariance will be used. " << std::endl; } datafilename = "20deg_Q2QE_numubar_data_fluxfix.txt"; covarfilename = "20deg_Q2QE_numubar_covar_fluxfix.txt"; } else { - if (fIsShape){ - datafilename = "20deg_Q2QE_numubar_data_SHAPE-extracted.txt"; - covarfilename = "20deg_Q2QE_numubar_covar_SHAPE-extracted.txt"; + if (fIsShape) { + datafilename = "20deg_Q2QE_numubar_data_SHAPE-extracted.txt"; + covarfilename = "20deg_Q2QE_numubar_covar_SHAPE-extracted.txt"; } else { - datafilename = "20deg_Q2QE_numubar_data.txt"; - covarfilename = "20deg_Q2QE_numubar_covar.txt"; + datafilename = "20deg_Q2QE_numubar_data.txt"; + covarfilename = "20deg_Q2QE_numubar_covar.txt"; } } } - this->SetDataValues( basedir + datafilename ); - this->SetCovarMatrixFromText( basedir + covarfilename, 8 ); + fSettings.SetDataInput( basedir + datafilename ); + fSettings.SetCovarInput( basedir + covarfilename ); + fSettings.DefineAllowedSpecies("numu"); - // Setup Default MC Histograms - this->SetupDefaultHist(); + FinaliseSampleSettings(); + + // Scaling Setup --------------------------------------------------- + // ScaleFactor automatically setup for DiffXSec/cm2/Nucleon + fScaleFactor = (GetEventHistogram()->Integral("width") * 1E-38 / (fNEvents + 0.)) * 13. / 7. / TotalIntegratedFlux(); + + // Plot Setup ------------------------------------------------------- + SetDataFromTextFile( fSettings.GetDataInput() ); + + if (!isFluxFix or !fullphasespace) { + SetCorrelationFromTextFile( fSettings.GetCovarInput() ); + ScaleCovar(1E76); + } else { + SetCovarFromTextFile( fSettings.GetCovarInput() ); + } - // Set Scale Factor (EventHist/nucleons) * NNucl / NNeutons - fScaleFactor = (GetEventHistogram()->Integral("width")*1E-38/(fNEvents+0.))*13./7./this->TotalIntegratedFlux(); + // Final setup --------------------------------------------------- + FinaliseMeasurement(); }; //******************************************************************** -void MINERvA_CCQE_XSec_1DQ2_antinu::FillEventVariables(FitEvent *event){ +void MINERvA_CCQE_XSec_1DQ2_antinu::FillEventVariables(FitEvent *event) { //******************************************************************** if (event->NumFSParticle(-13) == 0) return; TLorentzVector Pnu = event->GetNeutrinoIn()->fP; TLorentzVector Pmu = event->GetHMFSParticle(-13)->fP; double ThetaMu = Pnu.Vect().Angle(Pmu.Vect()); - double q2qe = FitUtils::Q2QErec(Pmu, cos(ThetaMu), 30.,true); + double q2qe = FitUtils::Q2QErec(Pmu, cos(ThetaMu), 30., true); fXVar = q2qe; return; } //******************************************************************** -bool MINERvA_CCQE_XSec_1DQ2_antinu::isSignal(FitEvent *event){ +bool MINERvA_CCQE_XSec_1DQ2_antinu::isSignal(FitEvent *event) { //******************************************************************* return SignalDef::isCCQEnumubar_MINERvA(event, EnuMin, EnuMax, fullphasespace); } diff --git a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_antinu.h b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_antinu.h index 32e9e4b..6a4990f 100644 --- a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_antinu.h +++ b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_antinu.h @@ -1,42 +1,42 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #ifndef MINERVA_CCQE_XSec_1DQ2_antinu_H_SEEN #define MINERVA_CCQE_XSec_1DQ2_antinu_H_SEEN #include "Measurement1D.h" //******************************************************************** class MINERvA_CCQE_XSec_1DQ2_antinu : public Measurement1D { //******************************************************************** public: - MINERvA_CCQE_XSec_1DQ2_antinu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile); + MINERvA_CCQE_XSec_1DQ2_antinu(nuiskey samplekey); virtual ~MINERvA_CCQE_XSec_1DQ2_antinu() {}; // Functions for handling each neut event void FillEventVariables(FitEvent *event); bool isSignal(FitEvent *event); private: bool isFluxFix, fullphasespace; }; #endif diff --git a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_joint.cxx b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_joint.cxx index 65ec63d..15944dc 100644 --- a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_joint.cxx +++ b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_joint.cxx @@ -1,164 +1,191 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #include "MINERvA_SignalDef.h" - #include "MINERvA_CCQE_XSec_1DQ2_joint.h" //******************************************************************** -MINERvA_CCQE_XSec_1DQ2_joint::MINERvA_CCQE_XSec_1DQ2_joint(std::string name, std::string inputfiles, FitWeight *rw, std::string type, std::string fakeDataFile){ +MINERvA_CCQE_XSec_1DQ2_joint::MINERvA_CCQE_XSec_1DQ2_joint(nuiskey samplekey) { //******************************************************************** - // Setup The Measurement - fName = name; - nBins = 16; - fPlotTitles = "; Q^{2}_{QE} (GeV^{2}); d#sigma/dQ_{QE}^{2} (cm^{2}/GeV^{2})"; - isFluxFix = name.find("_oldflux") == std::string::npos; - fullphasespace = name.find("_20deg") == std::string::npos; - fIsRatio = false; + // Sample overview --------------------------------------------------- + std::string descrip = "MINERvA_CCQE_XSec_1DQ2_joint sample. \n" \ + "Target: CH \n" \ + "Flux: MINERvA Forward Horn Current nue + nuebar \n" \ + "Signal: Any event with 1 electron, any nucleons, and no other FS particles \n"; + + // Setup common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("Q^{2}_{QE} (GeV^{2})"); + fSettings.SetYTitle("d#sigma/dQ_{QE}^{2} (cm^{2}/GeV^{2})"); + fSettings.SetAllowedTypes("FIX,FREE,SHAPE/DIAG,FULL/NORM/MASK", "FIX/FULL"); + fSettings.SetEnuRange(1.5, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + isFluxFix = !fSettings.Found("name", "_oldflux"); + fullphasespace = !fSettings.Found("name", "_20deg"); + nBins = 16; + fIsRatio = false; fIsSummed = false; fSaveSubMeas = true; - SetupMeasurement(inputfiles, type, rw, fakeDataFile); - // Get parsed input files - if (fSubInFiles.size() != 2) ERR(FTL) << "MINERvA Joint requires input files in format: antinu;nu"<<std::endl; - std::string inFileAntineutrino = fSubInFiles.at(0); - std::string inFileNeutrino = fSubInFiles.at(1); + // CCQELike plot information + fSettings.SetTitle("MINERvA_CCQE_XSec_1DQ2_joint"); - // Push classes back into list for processing loop - fSubChain.push_back(MIN_anu); - fSubChain.push_back(MIN_nu); - - // Setup the Data input - std::string basedir = FitPar::GetDataBase()+"/MINERvA/CCQE/"; + std::string basedir = FitPar::GetDataBase() + "/MINERvA/CCQE/"; std::string datafilename = ""; std::string covarfilename = ""; std::string neutrinoclass = ""; std::string antineutrinoclass = ""; // Full Phase Space - if (fullphasespace){ + if (fullphasespace) { - if (isFluxFix){ + if (isFluxFix) { if (fIsShape) { - ERR(WRN) << "SHAPE likelihood comparison not available for MINERvA " - << "datasets with fixed flux information. NUISANCE will scale MC to match " - << "data normalization but full covariance will be used. " << std::endl; - } + ERR(WRN) << "SHAPE likelihood comparison not available for MINERvA " + << "datasets with fixed flux information. NUISANCE will scale MC to match " + << "data normalization but full covariance will be used. " << std::endl; + } datafilename = "Q2QE_joint_data_fluxfix.txt"; covarfilename = "Q2QE_joint_covar_fluxfix.txt"; neutrinoclass = "MINERvA_CCQE_XSec_1DQ2_nu_newflux"; antineutrinoclass = "MINERvA_CCQE_XSec_1DQ2_antinu_newflux"; } else { - if (fIsShape){ + if (fIsShape) { datafilename = "Q2QE_joint_dataa_SHAPE-extracted.txt"; covarfilename = "Q2QE_joint_covara_SHAPE-extracted.txt"; } else { datafilename = "Q2QE_joint_data.txt"; covarfilename = "Q2QE_joint_covar.txt"; } neutrinoclass = "MINERvA_CCQE_XSec_1DQ2_nu"; antineutrinoclass = "MINERvA_CCQE_XSec_1DQ2_antinu"; } - // Restricted Phase Space + // Restricted Phase Space } else { - if (isFluxFix){ + if (isFluxFix) { if (fIsShape) { - ERR(WRN) << "SHAPE likelihood comparison not available for MINERvA " - << "datasets with fixed flux information. NUISANCE will scale MC to match " - << "data normalization but full covariance will be used. " << std::endl; - } + ERR(WRN) << "SHAPE likelihood comparison not available for MINERvA " + << "datasets with fixed flux information. NUISANCE will scale MC to match " + << "data normalization but full covariance will be used. " << std::endl; + } datafilename = "20deg_Q2QE_joint_data_fluxfix.txt"; covarfilename = "20deg_Q2QE_joint_covar_fluxfix.txt"; neutrinoclass = "MINERvA_CCQE_XSec_1DQ2_nu_20deg_newflux"; antineutrinoclass = "MINERvA_CCQE_XSec_1DQ2_antinu_20deg_newflux"; } else { - if (fIsShape){ + if (fIsShape) { datafilename = "20deg_Q2QE_joint_dataa_SHAPE-extracted.txt"; covarfilename = "20deg_Q2QE_joint_covara_SHAPE-extracted.txt"; } else { datafilename = "20deg_Q2QE_joint_data.txt"; covarfilename = "20deg_Q2QE_joint_covar.txt"; } neutrinoclass = "MINERvA_CCQE_XSec_1DQ2_nu_20deg"; antineutrinoclass = "MINERvA_CCQE_XSec_1DQ2_antinu_20deg"; } } - // Setup Data - this->SetDataFromTextFile( basedir + datafilename ); - this->SetCovarFromTextFile( basedir + covarfilename ); + fSettings.SetDataInput( basedir + datafilename ); + fSettings.SetCovarInput( basedir + covarfilename ); + fSettings.DefineAllowedSpecies("numu,numub"); - // Setup Experiments - MIN_anu = new MINERvA_CCQE_XSec_1DQ2_antinu(antineutrinoclass, inFileAntineutrino, rw, type, fakeDataFile); - MIN_nu = new MINERvA_CCQE_XSec_1DQ2_nu (neutrinoclass, inFileNeutrino, rw, type, fakeDataFile); + // Get parsed input files + if (fSubInFiles.size() != 2) ERR(FTL) << "MINERvA Joint requires input files in format: antinu;nu" << std::endl; + std::string inFileAntineutrino = fSubInFiles.at(0); + std::string inFileNeutrino = fSubInFiles.at(1); + + // Push classes back into list for processing loop + fSubChain.push_back(MIN_anu); + fSubChain.push_back(MIN_nu); + + + FinaliseSampleSettings(); + + // Plot Setup ------------------------------------------------------- + SetDataFromTextFile( fSettings.GetDataInput() ); + SetCovarFromTextFile( fSettings.GetCovarInput() ); + + // Setup Sub classes + nuiskey antinukey = Config::CreateKey("sample"); + antinukey.SetS("name", antineutrinoclass); + antinukey.SetS("input", inFileAntineutrino); + antinukey.SetS("type", fSettings.GetS("type")); + MIN_anu = new MINERvA_CCQE_XSec_1DQ2_antinu(antinukey); + + nuiskey nukey = Config::CreateKey("sample"); + nukey.SetS("name", neutrinoclass); + nukey.SetS("input", inFileNeutrino); + nukey.SetS("type", fSettings.GetS("type")); + MIN_nu = new MINERvA_CCQE_XSec_1DQ2_nu(nukey); // Add to chain for processing this->fSubChain.clear(); this->fSubChain.push_back(MIN_anu); this->fSubChain.push_back(MIN_nu); - // Setup Default MC Hists - SetupDefaultHist(); - + // Final setup --------------------------------------------------- + FinaliseMeasurement(); }; //******************************************************************** -void MINERvA_CCQE_XSec_1DQ2_joint::MakePlots(){ +void MINERvA_CCQE_XSec_1DQ2_joint::MakePlots() { //******************************************************************** UInt_t sample = 0; - for (std::vector<MeasurementBase*>::const_iterator expIter = fSubChain.begin(); expIter != fSubChain.end(); expIter++){ + for (std::vector<MeasurementBase*>::const_iterator expIter = fSubChain.begin(); expIter != fSubChain.end(); expIter++) { MeasurementBase* exp = static_cast<MeasurementBase*>(*expIter); - if (sample == 0){ + if (sample == 0) { MIN_anu = static_cast<MINERvA_CCQE_XSec_1DQ2_antinu*>(exp); TH1D* MIN_anu_mc = (TH1D*) MIN_anu->GetMCList().at(0); - for (int i = 0; i < 8; i++){ - std::cout << "Adding MIN_anu_MC " << i+1 << " : " << i+1 << " " << MIN_anu_mc->GetBinContent(i+1) << std::endl; - fMCHist->SetBinContent(i+1, MIN_anu_mc->GetBinContent(i+1)); - fMCHist->SetBinError(i+1, MIN_anu_mc->GetBinError(i+1)); + for (int i = 0; i < 8; i++) { + std::cout << "Adding MIN_anu_MC " << i + 1 << " : " << i + 1 << " " << MIN_anu_mc->GetBinContent(i + 1) << std::endl; + fMCHist->SetBinContent(i + 1, MIN_anu_mc->GetBinContent(i + 1)); + fMCHist->SetBinError(i + 1, MIN_anu_mc->GetBinError(i + 1)); } - } else if (sample == 1){ + } else if (sample == 1) { MIN_nu = static_cast<MINERvA_CCQE_XSec_1DQ2_nu*>(exp); TH1D* MIN_nu_mc = (TH1D*) MIN_nu->GetMCList().at(0); - for (int i = 0; i < 8; i++){ - std::cout << "Adding MIN_nu_MC " << i+1+8 << " : " << i+1 << " " << MIN_nu_mc->GetBinContent(i+1) << std::endl; - fMCHist->SetBinContent(i+1+8, MIN_nu_mc->GetBinContent(i+1)); - fMCHist ->SetBinError(i+1+8, MIN_nu_mc->GetBinError(i+1)); + for (int i = 0; i < 8; i++) { + std::cout << "Adding MIN_nu_MC " << i + 1 + 8 << " : " << i + 1 << " " << MIN_nu_mc->GetBinContent(i + 1) << std::endl; + fMCHist->SetBinContent(i + 1 + 8, MIN_nu_mc->GetBinContent(i + 1)); + fMCHist ->SetBinError(i + 1 + 8, MIN_nu_mc->GetBinError(i + 1)); } } sample++; } return; } diff --git a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_joint.h b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_joint.h index af42670..e74f055 100644 --- a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_joint.h +++ b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_joint.h @@ -1,50 +1,50 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #ifndef MINERVA_1DQ2_joint_H_SEEN #define MINERVA_1DQ2_joint_H_SEEN // Fit Includes #include "MeasurementBase.h" #include "JointMeas1D.h" #include "MINERvA_CCQE_XSec_1DQ2_nu.h" #include "MINERvA_CCQE_XSec_1DQ2_antinu.h" class MINERvA_CCQE_XSec_1DQ2_joint : public JointMeas1D { public: - MINERvA_CCQE_XSec_1DQ2_joint(std::string name, std::string inputfiles, FitWeight *rw, std::string type, std::string fakeDataFile); + MINERvA_CCQE_XSec_1DQ2_joint(nuiskey samplekey); virtual ~MINERvA_CCQE_XSec_1DQ2_joint() {}; void MakePlots(); private: // This is a dummy, the signal is defined separately for each sample! bool isSignal(){return false;}; bool isFluxFix, fullphasespace; // Need to have the neutrino and anti-neutrino objects here MINERvA_CCQE_XSec_1DQ2_nu * MIN_nu; MINERvA_CCQE_XSec_1DQ2_antinu * MIN_anu; Int_t nBins; }; #endif diff --git a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_nu.cxx b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_nu.cxx index f4f8d4a..e4d3716 100644 --- a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_nu.cxx +++ b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_nu.cxx @@ -1,138 +1,148 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #include "MINERvA_SignalDef.h" - #include "MINERvA_CCQE_XSec_1DQ2_nu.h" //******************************************************************** -MINERvA_CCQE_XSec_1DQ2_nu::MINERvA_CCQE_XSec_1DQ2_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile){ +MINERvA_CCQE_XSec_1DQ2_nu::MINERvA_CCQE_XSec_1DQ2_nu(nuiskey samplekey) { //******************************************************************** - // Measurement Defaults - fName = name; - fPlotTitles = "; Q^{2}_{QE} (GeV^{2}); d#sigma/dQ_{QE}^{2} (cm^{2}/GeV^{2})"; - isFluxFix = name.find("_oldflux") == std::string::npos; - fullphasespace = name.find("_20deg") == std::string::npos; - EnuMin = 1.5; - EnuMax = 10.; - fNormError = 0.101; - fAllowedTypes = "FIX,FREE,SHAPE/DIAG,FULL/NORM"; - fDefaultTypes = "FIX/FULL"; - Measurement1D::SetupMeasurement(inputfile, type, rw, fakeDataFile); - - // Setup the Data Plots - std::string basedir = FitPar::GetDataBase()+"/MINERvA/CCQE/"; + // Sample overview --------------------------------------------------- + std::string descrip = "MINERvA_CCQE_XSec_1DQ2_nu sample. \n" \ + "Target: CH \n" \ + "Flux: MINERvA Forward Horn Current nue + nuebar \n" \ + "Signal: Any event with 1 electron, any nucleons, and no other FS particles \n"; + + // Setup common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("Q^{2}_{QE} (GeV^{2})"); + fSettings.SetYTitle("d#sigma/dQ_{QE}^{2} (cm^{2}/GeV^{2})"); + fSettings.SetAllowedTypes("FIX,FREE,SHAPE/DIAG,FULL/NORM/MASK", "FIX/FULL"); + fSettings.SetEnuRange(1.5, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + isFluxFix = !fSettings.Found("name", "_oldflux"); + fullphasespace = !fSettings.Found("name", "_20deg"); + + // CCQELike plot information + fSettings.SetTitle("MINERvA_CCQE_XSec_1DQ2_nu"); + + std::string basedir = FitPar::GetDataBase() + "/MINERvA/CCQE/"; std::string datafilename = ""; std::string covarfilename = ""; // Full Phase Space - if (fullphasespace){ + if (fullphasespace) { - if (isFluxFix){ - if (fIsShape){ + if (isFluxFix) { + if (fIsShape) { ERR(WRN) << "SHAPE likelihood comparison not available for MINERvA " << "datasets with fixed flux information. NUISANCE will scale MC to match " << "data normalization but full covariance will be used. " << std::endl; } datafilename = "Q2QE_numu_data_fluxfix.txt"; covarfilename = "Q2QE_numu_covar_fluxfix.txt"; } else { - if (fIsShape){ - datafilename = "Q2QE_numu_data_SHAPE-extracted.txt"; - covarfilename = "Q2QE_numu_covar_SHAPE-extracted.txt"; + if (fIsShape) { + datafilename = "Q2QE_numu_data_SHAPE-extracted.txt"; + covarfilename = "Q2QE_numu_covar_SHAPE-extracted.txt"; } else { - datafilename = "Q2QE_numu_data.txt"; - covarfilename = "Q2QE_numu_covar.txt"; + datafilename = "Q2QE_numu_data.txt"; + covarfilename = "Q2QE_numu_covar.txt"; } } - // Restricted Phase Space + // Restricted Phase Space } else { - if (isFluxFix){ - if (fIsShape){ + if (isFluxFix) { + if (fIsShape) { ERR(WRN) << "SHAPE likelihood comparison not available for MINERvA " << "datasets with fixed flux information. NUISANCE will scale MC to match " << "data normalization but full covariance will be used. " << std::endl; } datafilename = "20deg_Q2QE_numu_data_fluxfix.txt"; covarfilename = "20deg_Q2QE_numu_covar_fluxfix.txt"; } else { - if (fIsShape){ - datafilename = "20deg_Q2QE_numu_data_SHAPE-extracted.txt"; - covarfilename = "20deg_Q2QE_numu_covar_SHAPE-extracted.txt"; + if (fIsShape) { + datafilename = "20deg_Q2QE_numu_data_SHAPE-extracted.txt"; + covarfilename = "20deg_Q2QE_numu_covar_SHAPE-extracted.txt"; } else { - datafilename = "20deg_Q2QE_numu_data.txt"; - covarfilename = "20deg_Q2QE_numu_covar.txt"; + datafilename = "20deg_Q2QE_numu_data.txt"; + covarfilename = "20deg_Q2QE_numu_covar.txt"; } } } - this->SetDataValues( basedir + datafilename ); - this->SetCovarMatrixFromText( basedir + covarfilename, 8 ); - - // Quick Fix for Correl/Covar Issues only for old data - if (!isFluxFix or !fullphasespace){ - fCorrel = (TMatrixDSym*)fFullCovar->Clone(); - delete fFullCovar; - delete covar; - delete fDecomp; - fFullCovar = StatUtils::GetCovarFromCorrel(fCorrel,fDataHist); - (*fFullCovar) *= 1E76; - } + fSettings.SetDataInput( basedir + datafilename ); + fSettings.SetCovarInput( basedir + covarfilename ); + fSettings.DefineAllowedSpecies("numu"); - covar = StatUtils::GetInvert(fFullCovar); - fDecomp = StatUtils::GetDecomp(fFullCovar); + FinaliseSampleSettings(); - // Setup Default MC Histograms - this->SetupDefaultHist(); + // Scaling Setup --------------------------------------------------- + // ScaleFactor automatically setup for DiffXSec/cm2/Nucleon + fScaleFactor = (GetEventHistogram()->Integral("width") * 1E-38 * 13.0 / 6.0 / (fNEvents + 0.)) / TotalIntegratedFlux(); - // Set Scale Factor (EventHist/nucleons) * NNucl / NNeutons - fScaleFactor = (GetEventHistogram()->Integral("width")*1E-38*13.0/6.0/(fNEvents+0.))/this->TotalIntegratedFlux(); + // Plot Setup ------------------------------------------------------- + SetDataFromTextFile( fSettings.GetDataInput() ); + + if (!isFluxFix or !fullphasespace){ + SetCorrelationFromTextFile( fSettings.GetCovarInput() ); + ScaleCovar(1E76); + } else { + SetCovarFromTextFile( fSettings.GetCovarInput() ); + } + + // Final setup --------------------------------------------------- + FinaliseMeasurement(); }; + + //******************************************************************** -void MINERvA_CCQE_XSec_1DQ2_nu::FillEventVariables(FitEvent *event){ +void MINERvA_CCQE_XSec_1DQ2_nu::FillEventVariables(FitEvent *event) { //******************************************************************** if (event->NumFSParticle(13) == 0) return; TLorentzVector Pnu = event->GetNeutrinoIn()->fP; TLorentzVector Pmu = event->GetHMFSParticle(13)->fP; double ThetaMu = Pnu.Vect().Angle(Pmu.Vect()); - double q2qe = FitUtils::Q2QErec(Pmu, cos(ThetaMu), 34.,true); + double q2qe = FitUtils::Q2QErec(Pmu, cos(ThetaMu), 34., true); // Set binning variable fXVar = q2qe; return; } //******************************************************************** -bool MINERvA_CCQE_XSec_1DQ2_nu::isSignal(FitEvent *event){ +bool MINERvA_CCQE_XSec_1DQ2_nu::isSignal(FitEvent *event) { //******************************************************************* return SignalDef::isCCQEnumu_MINERvA(event, EnuMin, EnuMax, fullphasespace); } diff --git a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_nu.h b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_nu.h index 5134e15..8ab8bbe 100644 --- a/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_nu.h +++ b/src/MINERvA/MINERvA_CCQE_XSec_1DQ2_nu.h @@ -1,62 +1,62 @@ // Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret /******************************************************************************* * This file is part of NUISANCE. * * NUISANCE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NUISANCE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NUISANCE. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ #ifndef MINERVA_1DQ2_nu_H_SEEN #define MINERVA_1DQ2_nu_H_SEEN #include "Measurement1D.h" ///\brief MINERvA CCQE+2p2h Analysis : Q2 Distribution /// ///\n Ref: ///\n Input: CH events generated with at least CCQE+2p2h interaction modes with flux given in Ref. //******************************************************************** class MINERvA_CCQE_XSec_1DQ2_nu : public Measurement1D { //******************************************************************** public: ///\brief Setup data histograms and full covariance matrix ///\n Available fit options: FIX,FREE,SHAPE/FULL,DIAG/NORM/MASK ///\n Sample is given as /neutron. /// ///\n Valid Sample Names: ///\n 1. MINERvA_CCQE_XSec_1DQ2_nu - Latest update full phase space ///\n 2. MINERvA_CCQE_XSec_1DQ2_nu_20deg - Latest update restricted phase space ///\n 3. MINERvA_CCQE_XSec_1DQ2_nu_oldflux - Old flux from original release, full phase space ///\n 4. MINERvA_CCQE_XSec_1DQ2_nu_20deg_oldflux - Old flux from original release, restricted phase space - MINERvA_CCQE_XSec_1DQ2_nu(std::string name, std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile); + MINERvA_CCQE_XSec_1DQ2_nu(nuiskey samplekey); virtual ~MINERvA_CCQE_XSec_1DQ2_nu() {}; ///\brief Signal is True CCQE+2p2h /// ///\n 1. True Mode == 1 or 2 ///\n 2. 1.5 < Enu < 10.0 ///\n 3. Muon Angle < 20deg (Restricted PS) bool isSignal(FitEvent* event); ///\brief Determine Q2 from the muon void FillEventVariables(FitEvent *event); private: bool isFluxFix; /// Flag for using updated flux bool fullphasespace; /// Flag for restricting phase space }; #endif