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

Draft: Picker24/feature/globalbin vectors kineparamtidy #12

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Merge branch 'develop' into picker24/feature/globalbin_vectors_kinepa…
…ramtidy
Luke Pickering committed Oct 18, 2024
commit cf20d4c60be984ea5402e3c0b0991d92dc4aa682
4 changes: 2 additions & 2 deletions samplePDFDUNE/samplePDFDUNEAtm.cpp
Original file line number Diff line number Diff line change
@@ -148,8 +148,8 @@ double const &samplePDFDUNEAtm::ReturnKinematicParameterByReference(int Kinemati
case kRecoCosZ:
return (dunemcSamples[iSample].rw_theta[iEvent]);
default:
std::cerr << "Unknown KinematicParameter:" << KinematicParameter << std::endl;
throw;
MACH3LOG_ERROR("Unknown KinematicParameter: {}",KinematicParameter);
throw MaCh3Exception(__FILE__, __LINE__);
}
}

25 changes: 9 additions & 16 deletions samplePDFDUNE/samplePDFDUNEBeamFD.cpp
Original file line number Diff line number Diff line change
@@ -197,23 +197,25 @@ void samplePDFDUNEBeamFD::SetupWeightPointers() {


int samplePDFDUNEBeamFD::setupExperimentMC(int iSample) {

auto &duneobj = dunemcSamples[iSample];

int nutype = sample_nutype[iSample];
int oscnutype = sample_oscnutype[iSample];
bool signal = sample_signal[iSample];

std::cout << "-------------------------------------------------------------------" << std::endl;
MACH3LOG_INFO("input file: {}", mtuple_files[iSample].native());
MACH3LOG_INFO("-------------------------------------------------------------------");
MACH3LOG_INFO("input file: {}", mc_files[iSample].native());

_sampleFile = new TFile(mtuple_files[iSample].c_str(), "READ");
_sampleFile = new TFile(mc_files[iSample].c_str(), "READ");
_data = (TTree*)_sampleFile->Get("caf");

if(_data){
MACH3LOG_INFO("Found \"caf\" tree in {}", mtuple_files[iSample].native());
MACH3LOG_INFO("Found \"caf\" tree in {}", mc_files[iSample].native());
MACH3LOG_INFO("With number of entries: {}", _data->GetEntries());
}
else{
MACH3LOG_ERROR("Could not find \"caf\" tree in {}", mtuple_files[iSample].native());
MACH3LOG_ERROR("Could not find \"caf\" tree in {}", mc_files[iSample].native());
throw MaCh3Exception(__FILE__, __LINE__);
}

@@ -301,17 +303,11 @@ int samplePDFDUNEBeamFD::setupExperimentMC(int iSample) {
duneobj.norm_s = norm->GetBinContent(1);
duneobj.pot_s = pot/norm->GetBinContent(2);

std::cout<< "pot_s = " << duneobj.pot_s << std::endl;
std::cout<< "norm_s = " << duneobj.norm_s << std::endl;

duneobj.nEvents = _data->GetEntries();
duneobj.nutype = nutype;
duneobj.oscnutype = oscnutype;
duneobj.signal = signal;

std::cout << "signal: " << duneobj.signal << std::endl;
std::cout << "nevents: " << duneobj.nEvents << std::endl;

// allocate memory for dunemc variables
duneobj.rw_cvnnumu.resize(duneobj.nEvents);
duneobj.rw_cvnnue.resize(duneobj.nEvents);
@@ -602,7 +598,6 @@ double const& samplePDFDUNEBeamFD::ReturnKinematicParameterByReference(int Kinem
int iEvent) {
switch (KinematicParameter) {
case kERecQE: {

constexpr double V = 0; // 0 binding energy for now
constexpr double mn = 939.565; // neutron mass
constexpr double mp = 938.272; // proton mass
@@ -718,10 +713,8 @@ std::string samplePDFDUNEBeamFD::ReturnStringFromKinematicParameter(
case kEHadRec:
return "EHadRec";
default: {
std::stringstream ss;
ss << "[ERROR]: " << __FILE__ << ":" << __LINE__
<< "failed to get string from parameter id: " << KinematicParameter;
throw std::runtime_error(ss.str());
MACH3LOG_ERROR("Did not recognise Kinematic Parameter type...");
throw MaCh3Exception(__FILE__, __LINE__);
}
}
}
1 change: 1 addition & 0 deletions samplePDFDUNE/samplePDFDUNEBeamFD.h
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ class samplePDFDUNEBeamFD : virtual public samplePDFFDBase

int ReturnKinematicParameterFromString(std::string KinematicParameterStr);
std::string ReturnStringFromKinematicParameter(int KinematicParameterStr);

//DB functions which could be initialised to do something which is non-trivial
double CalcXsecWeightFunc(int iSample, int iEvent) {return 1.;}
void applyShifts(int iSample, int iEvent);
8 changes: 4 additions & 4 deletions samplePDFDUNE/samplePDFDUNEBeamND.cpp
Original file line number Diff line number Diff line change
@@ -171,17 +171,17 @@ int samplePDFDUNEBeamND::setupExperimentMC(int iSample) {
bool signal = sample_signal[iSample];

std::cout << "-------------------------------------------------------------------" << std::endl;
std::cout << "input file: " << mtuple_files[iSample] << std::endl;
std::cout << "input file: " << mc_files[iSample] << std::endl;

_sampleFile = new TFile(mtuple_files[iSample].c_str(), "READ");
_sampleFile = new TFile(mc_files[iSample].c_str(), "READ");
_data = (TTree*)_sampleFile->Get("caf");

if(_data){
std::cout << "Found mtuple tree is " << mtuple_files[iSample] << std::endl;
std::cout << "Found mtuple tree is " << mc_files[iSample] << std::endl;
std::cout << "N of entries: " << _data->GetEntries() << std::endl;
}
else{
MACH3LOG_ERROR("Could not find \"caf\" tree in {}", mc_files[iSample]);
MACH3LOG_ERROR("Could not find \"caf\" tree in {}", mc_files[iSample].native());
throw MaCh3Exception(__FILE__, __LINE__);
}

15 changes: 9 additions & 6 deletions samplePDFDUNE/samplePDFDUNEBeamNDGar.cpp
Original file line number Diff line number Diff line change
@@ -37,7 +37,6 @@ void samplePDFDUNEBeamNDGar::SetupSplines() {
return;
}


void samplePDFDUNEBeamNDGar::SetupWeightPointers() {
for (int i = 0; i < (int)dunendgarmcSamples.size(); ++i) {
for (int j = 0; j < dunendgarmcSamples[i].nEvents; ++j) {
@@ -59,15 +58,19 @@ int samplePDFDUNEBeamNDGar::setupExperimentMC(int iSample) {
int oscnutype = sample_oscnutype[iSample];
bool signal = sample_signal[iSample];

std::cout << "-------------------------------------------------------------------" << std::endl;
std::cout << "input file: " << mtuple_files[iSample] << std::endl;
MACH3LOG_INFO("-------------------------------------------------------------------");
MACH3LOG_INFO("Input File: {}", mc_files.at(iSample).native());

_sampleFile = new TFile(mtuple_files[iSample].c_str(), "READ");
_sampleFile = new TFile(mc_files.at(iSample).c_str(), "READ");
_data = (TTree*)_sampleFile->Get("cafTree");

if(_data){
std::cout << "Found mtuple tree is " << mtuple_files[iSample] << std::endl;
std::cout << "N of entries: " << _data->GetEntries() << std::endl;
MACH3LOG_INFO("Found \"caf\" tree in {}", mc_files[iSample].native());
MACH3LOG_INFO("With number of entries: {}", _data->GetEntries());
}
else{
MACH3LOG_ERROR("Could not find \"caf\" tree in {}", mc_files[iSample].native());
throw MaCh3Exception(__FILE__, __LINE__);
}

_data->SetBranchStatus("*", 1);
You are viewing a condensed version of this merge commit. You can view the full changes here.