diff --git a/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dpmu_nu.cxx b/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dpmu_nu.cxx new file mode 100644 index 0000000..6627f13 --- /dev/null +++ b/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dpmu_nu.cxx @@ -0,0 +1,100 @@ +// 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 . +*******************************************************************************/ + +#include "SciBooNE_CCCOH_1TRK_1Dpmu_nu.h" + +SciBooNE_CCCOH_1TRK_1Dpmu_nu::SciBooNE_CCCOH_1TRK_1Dpmu_nu(nuiskey samplekey){ + + // Sample overview + std::string descrip = "SciBooNE CC-coherent 1pion no VA.\n" \ + "Target: CH \n" \ + "Flux: SciBooNE FHC numu \n"; + + // Common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("p_{#mu} (GeV)"); + fSettings.SetYTitle("Entries"); + this->SetFitOptions("NOWIDTH"); + fSettings.SetEnuRange(0.0, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + fSettings.SetTitle("SciBooNE CCCOH"); + fSettings.SetDataInput( FitPar::GetDataBase()+"/SciBooNE/SB_COH_Fig7.30a_pmu.csv"); + fSettings.SetHasExtraHistograms(true); + fSettings.DefineAllowedSpecies("numu"); + + SetDataFromTextFile(fSettings.GetDataInput()); + FinaliseSampleSettings(); + + // Setup Plots + if (SciBooNEUtils::GetUseZackEff()) + this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu_ZACK.root", "Ratio2DBSCC"); + else this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu.root", "stopped_muon_eff"); + this->protonEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_proton_nu.root", "Ratio2DRS"); + + this->fMCStack = new SciBooNEUtils::ModeStack2(fSettings.Name() + "_Stack", + "Mode breakdown" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + this->fPIDStack = new SciBooNEUtils::MainPIDStack(fSettings.Name() + "_MainPID", + "Main PID" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + SetAutoProcessTH1(fMCStack); + SetAutoProcessTH1(fPIDStack); + + double nTargets = 10.6E6/13.*6.022E23; + this->fScaleFactor = GetEventHistogram()->Integral()*13.*1E-38/double(fNEvents)*nTargets; + + FinaliseMeasurement(); + +}; + +void SciBooNE_CCCOH_1TRK_1Dpmu_nu::FillEventVariables(FitEvent *event){ + + pmu = 0; + this->mainIndex = SciBooNEUtils::GetMainTrack(event, this->muonStopEff, this->protonEff, this->mainTrack, this->Weight); + SciBooNEUtils::GetOtherTrackInfo(event, this->mainIndex, this->nProtons, this->nPiMus, this->nVertex, this->secondTrack); + + if (this->mainTrack){ + pmu = FitUtils::p(this->mainTrack);//SciBooNEUtils::smear_p(this->mainTrack); + } + + if (pmu < 0) pmu = 0;//return; + // Set X Variables + fXVar = pmu; + return; +}; + + +bool SciBooNE_CCCOH_1TRK_1Dpmu_nu::isSignal(FitEvent *event){ + if (!this->mainTrack) return false; + if (this->nProtons+this->nPiMus != 0) return false; + return true; +}; + + + +void SciBooNE_CCCOH_1TRK_1Dpmu_nu::FillExtraHistograms(MeasurementVariableBox* vars, double weight){ + + if (Signal){ + fMCStack->Fill(Mode, fXVar, weight); + fPIDStack->Fill(this->mainTrack->fPID, fXVar, weight); + } + return; +}; diff --git a/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dpmu_nu.h b/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dpmu_nu.h new file mode 100644 index 0000000..8478dbf --- /dev/null +++ b/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dpmu_nu.h @@ -0,0 +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 . +*******************************************************************************/ + +// This class corresponds to Fig 7.30 (bottom right) from Hiraide's thesis +#ifndef SCIBOONE_CCCOH_1TRK_1DPMU_NU_H_SEEN +#define SCIBOONE_CCCOH_1TRK_1DPMU_NU_H_SEEN + +#include "Measurement1D.h" +#include "SciBooNEUtils.h" + +//******************************************************************** +class SciBooNE_CCCOH_1TRK_1Dpmu_nu : public Measurement1D { +//******************************************************************** + +public: + + SciBooNE_CCCOH_1TRK_1Dpmu_nu(nuiskey samplekey); + virtual ~SciBooNE_CCCOH_1TRK_1Dpmu_nu() {}; + + void FillEventVariables(FitEvent *event); + bool isSignal(FitEvent *event); + void FillExtraHistograms(MeasurementVariableBox* vars, double weight); + SciBooNEUtils::ModeStack2 *fMCStack; + SciBooNEUtils::MainPIDStack *fPIDStack; + + private: + double pmu; ///. +*******************************************************************************/ + +#include "SciBooNE_CCCOH_1TRK_1Dthetamu_nu.h" + +SciBooNE_CCCOH_1TRK_1Dthetamu_nu::SciBooNE_CCCOH_1TRK_1Dthetamu_nu(nuiskey samplekey){ + + // Sample overview + std::string descrip = "SciBooNE CC-coherent 1pion no VA.\n" \ + "Target: CH \n" \ + "Flux: SciBooNE FHC numu \n"; + + // Common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("cos#theta_{#mu}"); + fSettings.SetYTitle("Entries"); + this->SetFitOptions("NOWIDTH"); + fSettings.SetEnuRange(0.0, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + fSettings.SetTitle("SciBooNE CCCOH proton"); + fSettings.SetDataInput( FitPar::GetDataBase()+"/SciBooNE/SB_COH_Fig7.30a_thetamu.csv"); + fSettings.SetHasExtraHistograms(true); + fSettings.DefineAllowedSpecies("numu"); + + SetDataFromTextFile(fSettings.GetDataInput()); + FinaliseSampleSettings(); + + // Setup Plots + if (SciBooNEUtils::GetUseZackEff()) + this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu_ZACK.root", "Ratio2DBSCC"); + else this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu.root", "stopped_muon_eff"); + this->protonEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_proton_nu.root", "Ratio2DRS"); + + this->fMCStack = new SciBooNEUtils::ModeStack2(fSettings.Name() + "_Stack", + "Mode breakdown" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + this->fPIDStack = new SciBooNEUtils::MainPIDStack(fSettings.Name() + "_MainPID", + "Main PID" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + SetAutoProcessTH1(fMCStack); + SetAutoProcessTH1(fPIDStack); + + double nTargets = 10.6E6/13.*6.022E23; + this->fScaleFactor = GetEventHistogram()->Integral()*13.*1E-38/double(fNEvents)*nTargets; + + FinaliseMeasurement(); + +}; + +void SciBooNE_CCCOH_1TRK_1Dthetamu_nu::FillEventVariables(FitEvent *event){ + + thetamu = 0; + this->mainIndex = SciBooNEUtils::GetMainTrack(event, this->muonStopEff, this->protonEff, this->mainTrack, this->Weight); + SciBooNEUtils::GetOtherTrackInfo(event, this->mainIndex, this->nProtons, this->nPiMus, this->nVertex, this->secondTrack); + FitParticle *nu = event->GetNeutrinoIn(); + + if (this->mainTrack){ + thetamu = cos(SciBooNEUtils::smear_th(nu,this->mainTrack)); + } + + if (thetamu < 0) thetamu = 0;//return; + // Set X Variables + fXVar = thetamu; + return; +}; + + +bool SciBooNE_CCCOH_1TRK_1Dthetamu_nu::isSignal(FitEvent *event){ + if (!this->mainTrack) return false; + if (this->nProtons+this->nPiMus != 0) return false; + return true; +}; + + +void SciBooNE_CCCOH_1TRK_1Dthetamu_nu::FillExtraHistograms(MeasurementVariableBox* vars, double weight){ + + if (Signal){ + fMCStack->Fill(Mode, fXVar, weight); + fPIDStack->Fill(this->mainTrack->fPID, fXVar, weight); + } + return; +}; diff --git a/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dthetamu_nu.h b/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dthetamu_nu.h new file mode 100644 index 0000000..7351af4 --- /dev/null +++ b/src/SciBooNE/SciBooNE_CCCOH_1TRK_1Dthetamu_nu.h @@ -0,0 +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 . +*******************************************************************************/ + +// This class corresponds to Fig 7.30 (bottom left) from Hiride's thesis +#ifndef SCIBOONE_CCCOH_1TRK_1DTHETAMU_NU_H_SEEN +#define SCIBOONE_CCCOH_1TRK_1DTHETAMU_NU_H_SEEN + +#include "Measurement1D.h" +#include "SciBooNEUtils.h" + +//******************************************************************** +class SciBooNE_CCCOH_1TRK_1Dthetamu_nu : public Measurement1D { +//******************************************************************** + +public: + + SciBooNE_CCCOH_1TRK_1Dthetamu_nu(nuiskey samplekey); + virtual ~SciBooNE_CCCOH_1TRK_1Dthetamu_nu() {}; + + void FillEventVariables(FitEvent *event); + bool isSignal(FitEvent *event); + void FillExtraHistograms(MeasurementVariableBox* vars, double weight); + SciBooNEUtils::ModeStack2 *fMCStack; + SciBooNEUtils::MainPIDStack *fPIDStack; + + private: + double thetamu; ///. +*******************************************************************************/ + +#include "SciBooNE_CCCOH_MuPiVA_1Dpmu_nu.h" + +SciBooNE_CCCOH_MuPiVA_1Dpmu_nu::SciBooNE_CCCOH_MuPiVA_1Dpmu_nu(nuiskey samplekey){ + + // Sample overview + std::string descrip = "SciBooNE CC-coherent 1pion no VA.\n" \ + "Target: CH \n" \ + "Flux: SciBooNE FHC numu \n"; + + // Common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("p_{#mu} (GeV)"); + fSettings.SetYTitle("Entries"); + this->SetFitOptions("NOWIDTH"); + fSettings.SetEnuRange(0.0, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + fSettings.SetTitle("SciBooNE CCCOH"); + fSettings.SetDataInput( FitPar::GetDataBase()+"/SciBooNE/SB_COH_Fig7.30c_pmu.csv"); + fSettings.SetHasExtraHistograms(true); + fSettings.DefineAllowedSpecies("numu"); + + SetDataFromTextFile(fSettings.GetDataInput()); + FinaliseSampleSettings(); + + // Setup Plots + if (SciBooNEUtils::GetUseZackEff()) + this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu_ZACK.root", "Ratio2DBSCC"); + else this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu.root", "stopped_muon_eff"); + this->protonEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_proton_nu.root", "Ratio2DRS"); + + this->fMCStack = new SciBooNEUtils::ModeStack2(fSettings.Name() + "_Stack", + "Mode breakdown" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + this->fPIDStack = new SciBooNEUtils::MainPIDStack(fSettings.Name() + "_MainPID", + "Main PID" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + SetAutoProcessTH1(fMCStack); + SetAutoProcessTH1(fPIDStack); + + double nTargets = 10.6E6/13.*6.022E23; + this->fScaleFactor = GetEventHistogram()->Integral()*13.*1E-38/double(fNEvents)*nTargets; + + FinaliseMeasurement(); + +}; + +void SciBooNE_CCCOH_MuPiVA_1Dpmu_nu::FillEventVariables(FitEvent *event){ + + pmu = 0; + this->mainIndex = SciBooNEUtils::GetMainTrack(event, this->muonStopEff, this->protonEff, this->mainTrack, this->Weight); + SciBooNEUtils::GetOtherTrackInfo(event, this->mainIndex, this->nProtons, this->nPiMus, this->nVertex, this->secondTrack); + + if (this->mainTrack){ + pmu = FitUtils::p(this->mainTrack);//SciBooNEUtils::smear_p(this->mainTrack); + } + + if (pmu < 0) pmu = 0;//return; + // Set X Variables + fXVar = pmu; + return; +}; + + +bool SciBooNE_CCCOH_MuPiVA_1Dpmu_nu::isSignal(FitEvent *event){ + + if (!this->mainTrack || !this->secondTrack) return false; + if (this->nPiMus + this->nProtons != 1) return false; + if (this->nVertex == 0) return false; + + double misIDProb = SciBooNEUtils::ProtonMisIDProb(FitUtils::p(this->secondTrack)); + + if (SciBooNEUtils::isProton(this->mainTrack)) this->Weight *= 0.1; + if (this->nProtons == 1) this->Weight *= misIDProb; + if (this->nPiMus == 1) this->Weight *= (1 - misIDProb); + return true; +}; + + +void SciBooNE_CCCOH_MuPiVA_1Dpmu_nu::FillExtraHistograms(MeasurementVariableBox* vars, double weight){ + + if (Signal){ + fMCStack->Fill(Mode, fXVar, weight); + fPIDStack->Fill(this->mainTrack->fPID, fXVar, weight); + } + return; +}; diff --git a/src/SciBooNE/SciBooNE_CCCOH_MuPiVA_1Dpmu_nu.h b/src/SciBooNE/SciBooNE_CCCOH_MuPiVA_1Dpmu_nu.h new file mode 100644 index 0000000..8ace090 --- /dev/null +++ b/src/SciBooNE/SciBooNE_CCCOH_MuPiVA_1Dpmu_nu.h @@ -0,0 +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 . +*******************************************************************************/ + +// This class corresponds to Fig 7.30 (bottom right) from Hiraide's thesis +#ifndef SCIBOONE_CCCOH_MUPIVA_1DPMU_NU_H_SEEN +#define SCIBOONE_CCCOH_MUPIVA_1DPMU_NU_H_SEEN + +#include "Measurement1D.h" +#include "SciBooNEUtils.h" + +//******************************************************************** +class SciBooNE_CCCOH_MuPiVA_1Dpmu_nu : public Measurement1D { +//******************************************************************** + +public: + + SciBooNE_CCCOH_MuPiVA_1Dpmu_nu(nuiskey samplekey); + virtual ~SciBooNE_CCCOH_MuPiVA_1Dpmu_nu() {}; + + void FillEventVariables(FitEvent *event); + bool isSignal(FitEvent *event); + void FillExtraHistograms(MeasurementVariableBox* vars, double weight); + SciBooNEUtils::ModeStack2 *fMCStack; + SciBooNEUtils::MainPIDStack *fPIDStack; + + private: + double pmu; ///. +*******************************************************************************/ + +#include "SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu.h" + +SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu::SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu(nuiskey samplekey){ + + // Sample overview + std::string descrip = "SciBooNE CC-coherent 1pion no VA.\n" \ + "Target: CH \n" \ + "Flux: SciBooNE FHC numu \n"; + + // Common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("cos#theta_{#mu}"); + fSettings.SetYTitle("Entries"); + this->SetFitOptions("NOWIDTH"); + fSettings.SetEnuRange(0.0, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + fSettings.SetTitle("SciBooNE CCCOH proton"); + fSettings.SetDataInput( FitPar::GetDataBase()+"/SciBooNE/SB_COH_Fig7.30c_thetamu.csv"); + fSettings.SetHasExtraHistograms(true); + fSettings.DefineAllowedSpecies("numu"); + + SetDataFromTextFile(fSettings.GetDataInput()); + FinaliseSampleSettings(); + + // Setup Plots + if (SciBooNEUtils::GetUseZackEff()) + this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu_ZACK.root", "Ratio2DBSCC"); + else this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu.root", "stopped_muon_eff"); + this->protonEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_proton_nu.root", "Ratio2DRS"); + + this->fMCStack = new SciBooNEUtils::ModeStack2(fSettings.Name() + "_Stack", + "Mode breakdown" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + this->fPIDStack = new SciBooNEUtils::MainPIDStack(fSettings.Name() + "_MainPID", + "Main PID" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + SetAutoProcessTH1(fMCStack); + SetAutoProcessTH1(fPIDStack); + + double nTargets = 10.6E6/13.*6.022E23; + this->fScaleFactor = GetEventHistogram()->Integral()*13.*1E-38/double(fNEvents)*nTargets; + + FinaliseMeasurement(); + +}; + +void SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu::FillEventVariables(FitEvent *event){ + + thetamu = 0; + this->mainIndex = SciBooNEUtils::GetMainTrack(event, this->muonStopEff, this->protonEff, this->mainTrack, this->Weight); + SciBooNEUtils::GetOtherTrackInfo(event, this->mainIndex, this->nProtons, this->nPiMus, this->nVertex, this->secondTrack); + FitParticle *nu = event->GetNeutrinoIn(); + + if (this->mainTrack){ + thetamu = cos(SciBooNEUtils::smear_th(nu,this->mainTrack)); + } + + if (thetamu < 0) thetamu = 0;//return; + // Set X Variables + fXVar = thetamu; + return; +}; + + +bool SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu::isSignal(FitEvent *event){ + + if (!this->mainTrack || !this->secondTrack) return false; + if (this->nPiMus + this->nProtons != 1) return false; + if (this->nVertex == 0) return false; + + double misIDProb = SciBooNEUtils::ProtonMisIDProb(FitUtils::p(this->secondTrack)); + + if (SciBooNEUtils::isProton(this->mainTrack)) this->Weight *= 0.1; + if (this->nProtons == 1) this->Weight *= misIDProb; + if (this->nPiMus == 1) this->Weight *= (1 - misIDProb); + return true; +}; + + +void SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu::FillExtraHistograms(MeasurementVariableBox* vars, double weight){ + + if (Signal){ + fMCStack->Fill(Mode, fXVar, weight); + fPIDStack->Fill(this->mainTrack->fPID, fXVar, weight); + } + return; +}; diff --git a/src/SciBooNE/SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu.h b/src/SciBooNE/SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu.h new file mode 100644 index 0000000..aea7231 --- /dev/null +++ b/src/SciBooNE/SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu.h @@ -0,0 +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 . +*******************************************************************************/ + +// This class corresponds to Fig 7.30 (bottom left) from Hiride's thesis +#ifndef SCIBOONE_CCCOH_MUPIVA_1DTHETAMU_NU_H_SEEN +#define SCIBOONE_CCCOH_MUPIVA_1DTHETAMU_NU_H_SEEN + +#include "Measurement1D.h" +#include "SciBooNEUtils.h" + +//******************************************************************** +class SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu : public Measurement1D { +//******************************************************************** + +public: + + SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu(nuiskey samplekey); + virtual ~SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu() {}; + + void FillEventVariables(FitEvent *event); + bool isSignal(FitEvent *event); + void FillExtraHistograms(MeasurementVariableBox* vars, double weight); + SciBooNEUtils::ModeStack2 *fMCStack; + SciBooNEUtils::MainPIDStack *fPIDStack; + + private: + double thetamu; ///. +*******************************************************************************/ + +#include "SciBooNE_CCCOH_MuPr_1Dpmu_nu.h" + +SciBooNE_CCCOH_MuPr_1Dpmu_nu::SciBooNE_CCCOH_MuPr_1Dpmu_nu(nuiskey samplekey){ + + // Sample overview + std::string descrip = "SciBooNE CC-coherent 1pion no VA.\n" \ + "Target: CH \n" \ + "Flux: SciBooNE FHC numu \n"; + + // Common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("p_{#mu} (GeV)"); + fSettings.SetYTitle("Entries"); + this->SetFitOptions("NOWIDTH"); + fSettings.SetEnuRange(0.0, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + fSettings.SetTitle("SciBooNE CCCOH"); + fSettings.SetDataInput( FitPar::GetDataBase()+"/SciBooNE/SB_COH_Fig7.30b_pmu.csv"); + fSettings.SetHasExtraHistograms(true); + fSettings.DefineAllowedSpecies("numu"); + + SetDataFromTextFile(fSettings.GetDataInput()); + FinaliseSampleSettings(); + + // Setup Plots + if (SciBooNEUtils::GetUseZackEff()) + this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu_ZACK.root", "Ratio2DBSCC"); + else this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu.root", "stopped_muon_eff"); + this->protonEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_proton_nu.root", "Ratio2DRS"); + + this->fMCStack = new SciBooNEUtils::ModeStack2(fSettings.Name() + "_Stack", + "Mode breakdown" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + this->fPIDStack = new SciBooNEUtils::MainPIDStack(fSettings.Name() + "_MainPID", + "Main PID" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + SetAutoProcessTH1(fMCStack); + SetAutoProcessTH1(fPIDStack); + + double nTargets = 10.6E6/13.*6.022E23; + this->fScaleFactor = GetEventHistogram()->Integral()*13.*1E-38/double(fNEvents)*nTargets; + + FinaliseMeasurement(); + +}; + +void SciBooNE_CCCOH_MuPr_1Dpmu_nu::FillEventVariables(FitEvent *event){ + + pmu = 0; + this->mainIndex = SciBooNEUtils::GetMainTrack(event, this->muonStopEff, this->protonEff, this->mainTrack, this->Weight); + SciBooNEUtils::GetOtherTrackInfo(event, this->mainIndex, this->nProtons, this->nPiMus, this->nVertex, this->secondTrack); + + if (this->mainTrack){ + pmu = FitUtils::p(this->mainTrack);//SciBooNEUtils::smear_p(this->mainTrack); + } + + if (pmu < 0) pmu = 0;//return; + // Set X Variables + fXVar = pmu; + return; +}; + + +bool SciBooNE_CCCOH_MuPr_1Dpmu_nu::isSignal(FitEvent *event){ + + if (!this->mainTrack) return false; + if (this->nPiMus + this->nProtons != 1) return false; + + double misIDProb = SciBooNEUtils::ProtonMisIDProb(FitUtils::p(this->secondTrack)); + + if (SciBooNEUtils::isProton(this->mainTrack)) this->Weight *= 0.1; + if (this->nProtons == 1) this->Weight *= (1 - misIDProb); + if (this->nPiMus == 1) this->Weight *= misIDProb; + return true; +}; + + + +void SciBooNE_CCCOH_MuPr_1Dpmu_nu::FillExtraHistograms(MeasurementVariableBox* vars, double weight){ + + if (Signal){ + fMCStack->Fill(Mode, fXVar, weight); + fPIDStack->Fill(this->mainTrack->fPID, fXVar, weight); + } + return; +}; diff --git a/src/SciBooNE/SciBooNE_CCCOH_MuPr_1Dpmu_nu.h b/src/SciBooNE/SciBooNE_CCCOH_MuPr_1Dpmu_nu.h new file mode 100644 index 0000000..fe26dca --- /dev/null +++ b/src/SciBooNE/SciBooNE_CCCOH_MuPr_1Dpmu_nu.h @@ -0,0 +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 . +*******************************************************************************/ + +// This class corresponds to Fig 7.30 (bottom right) from Hiraide's thesis +#ifndef SCIBOONE_CCCOH_MUPR_1DPMU_NU_H_SEEN +#define SCIBOONE_CCCOH_MUPR_1DPMU_NU_H_SEEN + +#include "Measurement1D.h" +#include "SciBooNEUtils.h" + +//******************************************************************** +class SciBooNE_CCCOH_MuPr_1Dpmu_nu : public Measurement1D { +//******************************************************************** + +public: + + SciBooNE_CCCOH_MuPr_1Dpmu_nu(nuiskey samplekey); + virtual ~SciBooNE_CCCOH_MuPr_1Dpmu_nu() {}; + + void FillEventVariables(FitEvent *event); + bool isSignal(FitEvent *event); + void FillExtraHistograms(MeasurementVariableBox* vars, double weight); + SciBooNEUtils::ModeStack2 *fMCStack; + SciBooNEUtils::MainPIDStack *fPIDStack; + + private: + double pmu; ///. +*******************************************************************************/ + +#include "SciBooNE_CCCOH_MuPr_1Dthetamu_nu.h" + +SciBooNE_CCCOH_MuPr_1Dthetamu_nu::SciBooNE_CCCOH_MuPr_1Dthetamu_nu(nuiskey samplekey){ + + // Sample overview + std::string descrip = "SciBooNE CC-coherent 1pion no VA.\n" \ + "Target: CH \n" \ + "Flux: SciBooNE FHC numu \n"; + + // Common settings + fSettings = LoadSampleSettings(samplekey); + fSettings.SetDescription(descrip); + fSettings.SetXTitle("cos#theta_{#mu}"); + fSettings.SetYTitle("Entries"); + this->SetFitOptions("NOWIDTH"); + fSettings.SetEnuRange(0.0, 10.0); + fSettings.DefineAllowedTargets("C,H"); + + fSettings.SetTitle("SciBooNE CCCOH proton"); + fSettings.SetDataInput( FitPar::GetDataBase()+"/SciBooNE/SB_COH_Fig7.30b_thetamu.csv"); + fSettings.SetHasExtraHistograms(true); + fSettings.DefineAllowedSpecies("numu"); + + SetDataFromTextFile(fSettings.GetDataInput()); + FinaliseSampleSettings(); + + // Setup Plots + if (SciBooNEUtils::GetUseZackEff()) + this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu_ZACK.root", "Ratio2DBSCC"); + else this->muonStopEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_stopped_muon_eff_nu.root", "stopped_muon_eff"); + this->protonEff = PlotUtils::GetTH2DFromRootFile(FitPar::GetDataBase()+"/SciBooNE/SciBooNE_proton_nu.root", "Ratio2DRS"); + + this->fMCStack = new SciBooNEUtils::ModeStack2(fSettings.Name() + "_Stack", + "Mode breakdown" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + this->fPIDStack = new SciBooNEUtils::MainPIDStack(fSettings.Name() + "_MainPID", + "Main PID" + fSettings.PlotTitles(), + PlotUtils::GetTH1DFromFile(fSettings.GetDataInput(), fSettings.GetName())); + SetAutoProcessTH1(fMCStack); + SetAutoProcessTH1(fPIDStack); + + double nTargets = 10.6E6/13.*6.022E23; + this->fScaleFactor = GetEventHistogram()->Integral()*13.*1E-38/double(fNEvents)*nTargets; + + FinaliseMeasurement(); + +}; + +void SciBooNE_CCCOH_MuPr_1Dthetamu_nu::FillEventVariables(FitEvent *event){ + + thetamu = 0; + this->mainIndex = SciBooNEUtils::GetMainTrack(event, this->muonStopEff, this->protonEff, this->mainTrack, this->Weight); + SciBooNEUtils::GetOtherTrackInfo(event, this->mainIndex, this->nProtons, this->nPiMus, this->nVertex, this->secondTrack); + FitParticle *nu = event->GetNeutrinoIn(); + + if (this->mainTrack){ + thetamu = cos(SciBooNEUtils::smear_th(nu,this->mainTrack)); + } + + if (thetamu < 0) thetamu = 0;//return; + // Set X Variables + fXVar = thetamu; + return; +}; + + +bool SciBooNE_CCCOH_MuPr_1Dthetamu_nu::isSignal(FitEvent *event){ + + if (!this->mainTrack) return false; + if (this->nPiMus + this->nProtons != 1) return false; + + double misIDProb = SciBooNEUtils::ProtonMisIDProb(FitUtils::p(this->secondTrack)); + + if (SciBooNEUtils::isProton(this->mainTrack)) this->Weight *= 0.1; + if (this->nProtons == 1) this->Weight *= (1 - misIDProb); + if (this->nPiMus == 1) this->Weight *= misIDProb; + return true; +}; + + +void SciBooNE_CCCOH_MuPr_1Dthetamu_nu::FillExtraHistograms(MeasurementVariableBox* vars, double weight){ + + if (Signal){ + fMCStack->Fill(Mode, fXVar, weight); + fPIDStack->Fill(this->mainTrack->fPID, fXVar, weight); + } + return; +}; diff --git a/src/SciBooNE/SciBooNE_CCCOH_MuPr_1Dthetamu_nu.h b/src/SciBooNE/SciBooNE_CCCOH_MuPr_1Dthetamu_nu.h new file mode 100644 index 0000000..d0084f8 --- /dev/null +++ b/src/SciBooNE/SciBooNE_CCCOH_MuPr_1Dthetamu_nu.h @@ -0,0 +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 . +*******************************************************************************/ + +// This class corresponds to Fig 7.30 (bottom left) from Hiride's thesis +#ifndef SCIBOONE_CCCOH_MUPR_1DTHETAMU_NU_H_SEEN +#define SCIBOONE_CCCOH_MUPR_1DTHETAMU_NU_H_SEEN + +#include "Measurement1D.h" +#include "SciBooNEUtils.h" + +//******************************************************************** +class SciBooNE_CCCOH_MuPr_1Dthetamu_nu : public Measurement1D { +//******************************************************************** + +public: + + SciBooNE_CCCOH_MuPr_1Dthetamu_nu(nuiskey samplekey); + virtual ~SciBooNE_CCCOH_MuPr_1Dthetamu_nu() {}; + + void FillEventVariables(FitEvent *event); + bool isSignal(FitEvent *event); + void FillExtraHistograms(MeasurementVariableBox* vars, double weight); + SciBooNEUtils::ModeStack2 *fMCStack; + SciBooNEUtils::MainPIDStack *fPIDStack; + + private: + double thetamu; ///