diff --git a/src/T2K/T2K_CC0pinp_ifk_XSec_3Dinfp_nu.cxx b/src/T2K/T2K_CC0pinp_ifk_XSec_3Dinfp_nu.cxx
index bd1a4a4..78a22d5 100644
--- a/src/T2K/T2K_CC0pinp_ifk_XSec_3Dinfp_nu.cxx
+++ b/src/T2K/T2K_CC0pinp_ifk_XSec_3Dinfp_nu.cxx
@@ -1,188 +1,187 @@
// 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 "T2K_SignalDef.h"
#include "T2K_CC0pinp_ifk_XSec_3Dinfp_nu.h"
//********************************************************************
T2K_CC0pinp_ifk_XSec_3Dinfp_nu::T2K_CC0pinp_ifk_XSec_3Dinfp_nu(nuiskey samplekey) {
//********************************************************************
// Sample overview ---------------------------------------------------
std::string descrip = "T2K_CC0pinp_ifk_XSec_3Dinfp_nu sample. \n" \
"Target: CH \n" \
"Flux: T2K 2.5 degree off-axis (ND280) \n" \
"Signal: CC0piNp (N>=1) with p_p>450MeV and cthp>0.4 \n";
// Setup common settings
fSettings = LoadSampleSettings(samplekey);
fSettings.SetDescription(descrip);
fSettings.SetXTitle("#Delta p");
fSettings.SetYTitle("p_#mu");
fSettings.SetZTitle("cos#theta_{#mu}");
//fSettings.SetZTitle("d^{2}#sigma/dP_{#mu}dcos#theta_{#mu} (cm^{2}/GeV)");
fSettings.SetAllowedTypes("FULL,DIAG/FREE,SHAPE,FIX/SYSTCOV/STATCOV","FIX/FULL");
fSettings.SetEnuRange(0.0, 10.0);
fSettings.DefineAllowedTargets("C,H");
fAnalysis = 1;
outOfBoundsMC = 0.0;
// CCQELike plot information
fSettings.SetTitle("T2K_CC0pinp_ifk_XSec_3Dinfp_nu");
fSettings.DefineAllowedSpecies("numu");
FinaliseSampleSettings();
// Scaling Setup ---------------------------------------------------
// ScaleFactor automatically setup for DiffXSec/cm2/Nucleon
fScaleFactor = ((GetEventHistogram()->Integral("width")/(fNEvents+0.)) / (TotalIntegratedFlux()));
//fScaleFactor = ((GetEventHistogram()->Integral("width")/(fNEvents+0.)) * 10 / (TotalIntegratedFlux()));
fSettings.SetDataInput( FitPar::GetDataBase() + "/T2K/CC0pi/STV/infkResults_origBin.root;result_p" );
SetDataFromRootFile( fSettings.GetDataInput() );
fSettings.SetCovarInput( FitPar::GetDataBase() + "/T2K/CC0pi/STV/infkResults_origBin.root;cor_p" );
SetCorrelationFromRootFile(fSettings.GetCovarInput() );
//SetCovarFromRootFile(FitPar::GetDataBase() + "/T2K/CC0pi/infkResults_origBin.root", "cov_p" );
// Setup Histograms
SetHistograms();
// Final setup ---------------------------------------------------
FinaliseMeasurement();
};
bool T2K_CC0pinp_ifk_XSec_3Dinfp_nu::isSignal(FitEvent *event){
return SignalDef::isT2K_CC0pi_ifk(event, EnuMin, EnuMax);
};
void T2K_CC0pinp_ifk_XSec_3Dinfp_nu::FillEventVariables(FitEvent* event){
if (event->NumFSParticle(13) == 0 || event->NumFSParticle(2212) == 0)
return;
TLorentzVector Pnu = event->GetNeutrinoIn()->fP;
TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector Pp = event->GetHMFSParticle(2212)->fP;
double pmu = Pmu.Vect().Mag()/1000.;
- double pp = Pp.Vect().Mag()/1000.;
double CosThetaMu = cos(Pnu.Vect().Angle(Pmu.Vect()));
- double delta_p = pp-FitUtils::ppInfK(Pmu, CosThetaMu, 25, true);
+ double delta_p = Pp.Vect().Mag()/1000. - FitUtils::ppInfK(Pmu, CosThetaMu, 25, true);
fXVar = delta_p;
fYVar = pmu;
fZVar = CosThetaMu;
return;
};
void T2K_CC0pinp_ifk_XSec_3Dinfp_nu::FillHistograms(){
Measurement1D::FillHistograms();
if (Signal){
FillMCSlice( fXVar, fYVar, fZVar, Weight );
}
}
void T2K_CC0pinp_ifk_XSec_3Dinfp_nu::ConvertEventRates(){
for (int i = 0; i < 7; i++){
fMCHist_Slices[i]->GetSumw2();
}
// Do standard conversion.
Measurement1D::ConvertEventRates();
// First scale MC slices also by their width in Y and Z
//MCHist_Slices[0]->Scale(1.0 / 1.00);
//MCHist_Slices[1]->Scale(1.0 / 0.60);
//MCHist_Slices[2]->Scale(1.0 / 0.10);
//MCHist_Slices[3]->Scale(1.0 / 0.10);
// Now Convert into 1D list
fMCHist->Reset();
//The first bin in the histogram in underflow, so set this and start bincount at 1
fMCHist->SetBinContent(1, outOfBoundsMC);
int bincount = 1;
for (int i = 0; i < 7; i++){
for (int j = 0; j < fDataHist_Slices[i]->GetNbinsX(); j++){
fMCHist->SetBinContent(bincount+1, fMCHist_Slices[i]->GetBinContent(j+1));
//fMCHist->SetBinError(bincount+1, fMCHist_Slices[i]->GetBinError(j+1));
bincount++;
}
}
return;
}
void T2K_CC0pinp_ifk_XSec_3Dinfp_nu::FillMCSlice(double x, double y, double z, double w){
// x is delta_p
// y is pmu
// z is CosThetaMu
if (z <= -0.6) fMCHist_Slices[0]->Fill(x,w);
else if (z >= -0.6 and z < 0.0 and y < 0.25) fMCHist_Slices[1]->Fill(x,w);
else if (z >= -0.6 and z < 0.0 and y > 0.25) fMCHist_Slices[2]->Fill(x,w);
else if (z >= 0.0 and y < 0.25) fMCHist_Slices[3]->Fill(x,w);
else if (z >= 0.0 and z < 0.8 and y >= 0.25) fMCHist_Slices[4]->Fill(x,w);
else if (z >= 0.8 and z < 1.0 and y >= 0.25 and y < 0.75) fMCHist_Slices[5]->Fill(x,w);
else if (z >= 0.8 and z < 1.0 and y >= 0.75) fMCHist_Slices[6]->Fill(x,w);
else outOfBoundsMC += w;
}
void T2K_CC0pinp_ifk_XSec_3Dinfp_nu::SetHistograms(){
// Read in 1D Data Histograms
fInputFile = new TFile( (FitPar::GetDataBase() + "/T2K/CC0pi/STV/infkResults_origBin.root").c_str(),"READ");
//fInputFile->ls();
// Read in 1D Data
fDataHist = (TH1D*) fInputFile->Get("result_p");
fDataHist->SetNameTitle("T2K_CC0pinp_ifk_XSec_3Dinfp_nu_data", "T2K_CC0pinp_ifk_XSec_3Dinfp_nu_data");
SetAutoProcessTH1(fDataHist,kCMD_Write);
// Read in 2D Data Slices and Make MC Slices
for (int i = 0; i < 7; i++){ //both y and z slices
// Get Data Histogram
//fInputFile->ls();
fDataHist_Slices.push_back((TH1D*)fInputFile->Get(Form("resultBin%i_p",i))->Clone());
fDataHist_Slices[i]->SetNameTitle(Form("T2K_CC0pinp_ifk_XSec_3Dinfp_nu_data_Slice%i",i), (Form("T2K_CC0pinp_ifk_XSec_3Dinfp_nu_data_Slice%i",i)));
// Make MC Clones
fMCHist_Slices.push_back((TH1D*) fDataHist_Slices[i]->Clone());
fMCHist_Slices[i]->SetNameTitle(Form("T2K_CC0pinp_ifk_XSec_3Dinfp_nu_MC_Slice%i",i), (Form("T2K_CC0pinp_ifk_XSec_3Dinfp_nu_MC_Slice%i",i)));
SetAutoProcessTH1(fDataHist_Slices[i],kCMD_Write);
SetAutoProcessTH1(fMCHist_Slices[i]);
fMCHist_Slices[i]->Reset();
}
return;
};
diff --git a/src/T2K/T2K_SignalDef.cxx b/src/T2K/T2K_SignalDef.cxx
index 815f313..f6b4e7d 100644
--- a/src/T2K/T2K_SignalDef.cxx
+++ b/src/T2K/T2K_SignalDef.cxx
@@ -1,310 +1,310 @@
// 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 "FitUtils.h"
#include "T2K_SignalDef.h"
namespace SignalDef {
// T2K H2O signal definition
bool isCC1pip_T2K_H2O(FitEvent *event, double EnuMin,
double EnuMax) {
if (!isCC1pi(event, 14, 211, EnuMin, EnuMax)) return false;
TLorentzVector Pnu = event->GetHMISParticle(14)->fP;
TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector Ppip = event->GetHMFSParticle(211)->fP;
double p_mu = FitUtils::p(Pmu) * 1000;
double p_pi = FitUtils::p(Ppip) * 1000;
double cos_th_mu = cos(FitUtils::th(Pnu, Pmu));
double cos_th_pi = cos(FitUtils::th(Pnu, Ppip));
if (p_mu <= 200 || p_pi <= 200 || cos_th_mu <= 0.3 || cos_th_pi <= 0.3) {
return false;
}
return true;
};
// ******************************************************
// T2K CC1pi+ CH analysis (Raquel's thesis)
// Has different phase space cuts depending on if using Michel tag or not
//
// Essentially consists of two samples: one sample which has Michel e (which we
// can't get pion direction from); this covers backwards angles quite well.
// Measurements including this sample does not have include pion kinematics cuts
// one sample which has PID in FGD and TPC
// and no Michel e. These are mostly
// forward-going so require a pion
// kinematics cut
//
// Essentially, cuts are:
// 1 negative muon
// 1 positive pion
// Any number of nucleons
// No other particles in the final state
//
// MOVE T2K
bool isCC1pip_T2K_CH(FitEvent *event, double EnuMin, double EnuMax,
bool MichelElectron) {
// ******************************************************
if (!isCC1pi(event, 14, 211, EnuMin, EnuMax)) return false;
TLorentzVector Pnu = event->GetHMISParticle(14)->fP;
TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector Ppip = event->GetHMFSParticle(211)->fP;
// If this event passes the criteria on particle counting, enforce the T2K
// ND280 phase space constraints
// Will be different if Michel tag sample is included or not
// Essentially, if there's a Michel tag we don't cut on the pion variables
double p_mu = FitUtils::p(Pmu) * 1000;
double p_pi = FitUtils::p(Ppip) * 1000;
double cos_th_mu = cos(FitUtils::th(Pnu, Pmu));
double cos_th_pi = cos(FitUtils::th(Pnu, Ppip));
// If we're using Michel e- requirement we only care about the muon restricted
// phase space and use full pion phase space
if (MichelElectron) {
// Make the cuts on the muon variables
if (p_mu <= 200 || cos_th_mu <= 0.2) {
return false;
} else {
return true;
}
// If we aren't using Michel e- (i.e. we use directional information from
// pion) we need to impose the phase space cuts on the muon AND the pion)
} else {
// Make the cuts on muon and pion variables
if (p_mu <= 200 || p_pi <= 200 || cos_th_mu <= 0.2 || cos_th_pi <= 0.2) {
return false;
} else {
return true;
}
}
// Default to false; should never fire
return false;
};
bool isT2K_CC0pi(FitEvent *event, double EnuMin, double EnuMax,
bool forwardgoing) {
// Require a numu CC0pi event
if (!isCC0pi(event, 14, EnuMin, EnuMax)) return false;
TLorentzVector Pnu = event->GetHMISParticle(14)->fP;
TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
double CosThetaMu = cos(Pnu.Vect().Angle(Pmu.Vect()));
double p_mu = Pmu.Vect().Mag();
// If we're doing a restricted phase space, Analysis II asks for:
// Cos(theta_mu) > 0.0 and p_mu > 200 MeV
if (forwardgoing) {
if (CosThetaMu < 0.0 || p_mu < 200) return false;
}
return true;
}
bool isT2K_CC0pi1p(FitEvent *event, double EnuMin, double EnuMax) {
// Require a numu CC0pi event
if (!isCC0pi(event, 14, EnuMin, EnuMax)) return false;
// Require at least one FS proton
if (event->NumFSParticle(2212) == 0) return false;
TLorentzVector pnu = event->GetHMISParticle(14)->fP;
TLorentzVector pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector pp = event->GetHMFSParticle(2212)->fP;
// Proton phase space
if (pp.Vect().Mag() < 500) {
return false;
}
//Need exactly one proton with 500 MeV or more momentum
std::vector protons = event->GetAllFSProton();
int nProtonsAboveThresh=0;
- for(int i=0; ip()>500) nProtonsAboveThresh++;
}
if(nProtonsAboveThresh!=1) return false;
return true;
}
//CC0pi antinu in the P0D - TN328
bool isT2K_CC0piAnuP0D(FitEvent *event, double EnuMin, double EnuMax) {
// Require a anumu CC0pi event
if (!isCC0pi(event, -14, EnuMin, EnuMax)) return false;
TLorentzVector pnu = event->GetHMISParticle(-14)->fP;
TLorentzVector pmu = event->GetHMFSParticle(-13)->fP;
double Pmu = pmu.Vect().Mag();
double CosThetaMu = cos(pnu.Vect().Angle(pmu.Vect()));
// Muon phase space
if (Pmu < 400 || Pmu > 3410) return false;
if (Pmu < 530 && CosThetaMu<0.85) return false;
if (Pmu < 670 && CosThetaMu<0.88) return false;
if (Pmu < 800 && CosThetaMu<0.9) return false;
if (Pmu < 1000 && CosThetaMu<0.91) return false;
if (Pmu < 1380 && CosThetaMu<0.92) return false;
if (Pmu < 2010 && CosThetaMu<0.95) return false;
return true;
}
bool isT2K_CC0piNp(FitEvent *event, double EnuMin, double EnuMax) {
// Require a numu CC0pi event
if (!isCC0pi(event, 14, EnuMin, EnuMax)) return false;
// Require at least one FS proton
if (event->NumFSParticle(2212) == 0) return false;
TLorentzVector pnu = event->GetHMISParticle(14)->fP;
TLorentzVector pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector pp = event->GetHMFSParticle(2212)->fP;
// Proton phase space
if (pp.Vect().Mag() < 500) {
return false;
}
//Need exactly one proton with 500 MeV or more momentum
std::vector protons = event->GetAllFSProton();
int nProtonsAboveThresh=0;
- for(int i=0; ip()>500) nProtonsAboveThresh++;
}
if(nProtonsAboveThresh<2) return false;
return true;
}
bool isT2K_CC0pi0p(FitEvent *event, double EnuMin, double EnuMax) {
// Require a numu CC0pi event
if (!isCC0pi(event, 14, EnuMin, EnuMax)) return false;
// Require at least one FS proton
if (event->NumFSParticle(2212) == 0) return false;
TLorentzVector pnu = event->GetHMISParticle(14)->fP;
TLorentzVector pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector pp = event->GetHMFSParticle(2212)->fP;
// Proton phase space
if (pp.Vect().Mag() > 500) {
return false;
}
return true;
}
bool isT2K_CC0pi_STV(FitEvent *event, double EnuMin, double EnuMax) {
// Require a numu CC0pi event
if (!isCC0pi(event, 14, EnuMin, EnuMax)) return false;
// Require at least one FS proton
if (event->NumFSParticle(2212) == 0) return false;
TLorentzVector pnu = event->GetHMISParticle(14)->fP;
TLorentzVector pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector pp = event->GetHMFSParticle(2212)->fP;
// Muon phase space
// Pmu > 250 MeV, cos(theta_mu) > -0.6 (Sweet phase space!)
if ((pmu.Vect().Mag() < 250) || cos(pnu.Vect().Angle(pmu.Vect())) < -0.6) {
return false;
}
// Proton phase space
// Pprot > 450 MeV, cos(theta_proton) > 0.4
if ((pp.Vect().Mag() < 450) || (pp.Vect().Mag() > 1E3) ||
(cos(pnu.Vect().Angle(pp.Vect())) < 0.4)) {
return false;
}
return true;
}
bool isT2K_CC0pi_ifk(FitEvent *event, double EnuMin, double EnuMax) {
// Require a numu CC0pi event
if (!isCC0pi(event, 14, EnuMin, EnuMax)) return false;
// Require at least one FS proton
if (event->NumFSParticle(2212) == 0) return false;
TLorentzVector pnu = event->GetHMISParticle(14)->fP;
TLorentzVector pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector pp = event->GetHMFSParticle(2212)->fP;
// Proton phase space
// Pprot > 450 MeV, cos(theta_proton) > 0.4
if ((pp.Vect().Mag() < 450) || (cos(pnu.Vect().Angle(pp.Vect())) < 0.4)) {
return false;
}
return true;
}
bool isT2K_CC0pi_1bin(FitEvent *event, double EnuMin, double EnuMax) {
// Require a numu CC0pi event
if (!isCC0pi(event, 14, EnuMin, EnuMax)) return false;
// Require at least one FS proton
if (event->NumFSParticle(2212) == 0) return false;
TLorentzVector pnu = event->GetHMISParticle(14)->fP;
TLorentzVector pmu = event->GetHMFSParticle(13)->fP;
TLorentzVector pp = event->GetHMFSParticle(2212)->fP;
// Muon phase space
//if ((pmu.Vect().Mag() < 250) || cos(pnu.Vect().Angle(pmu.Vect())) < -0.6) {
// return false;
//}
// Proton phase space
if ((pp.Vect().Mag() < 450) || (cos(pnu.Vect().Angle(pp.Vect())) < 0.4)) {
return false;
}
return true;
}
}