Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atmospheric Binning Updates #42

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/Samples/AtmSample_nueselec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SampleType: "Atm"
# Bounds: [ 50.0, 1244.0 ]
Binning:
XVarStr: "RecoCosineZ"
XVarBins: [-1, -0.78, -0.29, 0.31, 0.80, 1]
XVarBins: [-1, -0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.8, 1]
YVarStr: "RecoNeutrinoEnergy"
YVarBins: [0, 0.11, 0.19, 0.33, 0.62, 1.34, 3.35, 16.28, 1e8]
SampleBools:
Expand Down
2 changes: 1 addition & 1 deletion configs/Samples/AtmSample_numuselec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SampleType: "Atm"
# Bounds: [ 50.0, 1244.0 ]
Binning:
XVarStr: "RecoCosineZ"
XVarBins: [-1, -0.77, -0.26, 0.33, 0.81, 1]
XVarBins: [-1, -0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.8, 1]
YVarStr: "RecoNeutrinoEnergy"
YVarBins: [0, 0.19, 0.25, 0.37, 0.72, 1.31, 2.34, 4.47, 12.01, 1e8]
SampleBools:
Expand Down
11 changes: 7 additions & 4 deletions src/EventRates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "samplePDFDUNE/MaCh3DUNEFactory.h"
#include "samplePDFDUNE/StructsDUNE.h"

void Write1DHistogramsToFile(std::string OutFileName, std::vector<TH1D*> Histograms) {
void Write1DHistogramsToFile(std::string OutFileName, std::vector<TH1*> Histograms) {
auto OutputFile = std::unique_ptr<TFile>(TFile::Open(OutFileName.c_str(), "RECREATE"));
OutputFile->cd();
for(auto Hist : Histograms){
Expand All @@ -24,7 +24,7 @@ void Write1DHistogramsToFile(std::string OutFileName, std::vector<TH1D*> Histogr
OutputFile->Close();
}

void Write1DHistogramsToPdf(std::string OutFileName, std::vector<TH1D*> Histograms) {
void Write1DHistogramsToPdf(std::string OutFileName, std::vector<TH1*> Histograms) {
//Remove root from end of file
OutFileName.erase(OutFileName.find('.'));
OutFileName+=".pdf";
Expand Down Expand Up @@ -55,10 +55,13 @@ int main(int argc, char * argv[]) {
//###############################################################################################################################
//Perform reweight and print total integral

std::vector<TH1D*> DUNEHists;
std::vector<TH1*> DUNEHists;
for(auto Sample : DUNEPdfs){
Sample->reweight();
DUNEHists.push_back(Sample->get1DHist());
if (Sample->GetNDim() == 1)
DUNEHists.push_back(Sample->get1DHist());
else if (Sample->GetNDim() == 2)
DUNEHists.push_back(Sample->get2DHist());

std::string EventRateString = fmt::format("{:.2f}", Sample->get1DHist()->Integral());
MACH3LOG_INFO("Event rate for {} : {:<5}", Sample->GetName(), EventRateString);
Expand Down
12 changes: 9 additions & 3 deletions src/LikelihoodScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ int main(int argc, char * argv[]) {
//###############################################################################################################################
//Perform reweight, print total integral, and set data

std::vector<TH1D*> DUNEHists;
std::vector<TH1*> DUNEHists;
for(auto Sample : DUNEPdfs){
Sample->reweight();
DUNEHists.push_back(Sample->get1DHist());
if (Sample->GetNDim() == 1)
DUNEHists.push_back(Sample->get1DHist());
else if (Sample->GetNDim() == 2)
DUNEHists.push_back(Sample->get2DHist());

MACH3LOG_INFO("Event rate for {} : {:<5.2f}", Sample->GetName(), Sample->get1DHist()->Integral());
Sample->addData(DUNEHists.back());
if (Sample->GetNDim() == 1)
Sample->addData((TH2D*)DUNEHists.back());
else if (Sample->GetNDim() == 2)
Sample->addData((TH2D*)DUNEHists.back());
}
std::unique_ptr<FitterBase> MaCh3Fitter = std::make_unique<mcmc>(FitManager);

Expand Down
6 changes: 5 additions & 1 deletion src/SigmaVariation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ int main(int argc, char * argv[]) {
File->cd((ParName+"/"+SampleName).c_str());

DUNEPdfs[iSample]->reweight();
TH1* Hist = DUNEPdfs[iSample]->get1DHist();
TH1* Hist;
if (DUNEPdfs[iSample]->GetNDim() == 1)
Hist = DUNEPdfs[iSample]->get1DHist();
else if (DUNEPdfs[iSample]->GetNDim() == 2)
Hist = DUNEPdfs[iSample]->get2DHist();
MACH3LOG_INFO("\t\t\tSample : {:<30} - Integral : {:<10}",SampleName,Hist->Integral());

Hist->Write(Form("Variation_%i",(int)iSigVar));
Expand Down