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

Feature core 1.2.0 #235

Merged
merged 24 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b49ae75
minor changes to the setup of the FD class, including adding in the s…
EdAtkin Nov 7, 2024
0451980
removing SetXSecCov and also some members related to functional param…
EdAtkin Nov 7, 2024
94d798f
removing SetXsecCov as we don't want to make the xsec cov able to be …
EdAtkin Nov 7, 2024
192e77b
minor changes to samplePDFFDBase updating with what's in develop
EdAtkin Nov 8, 2024
98a1776
adding in nupdg and nupdgosc and removing checks on osc channel as we…
EdAtkin Nov 13, 2024
9147690
small tidy up in the spline code, removing some nulls and changing th…
EdAtkin Nov 18, 2024
ddd79cb
adding in intialisation of some members to be BAD_INT to help with fu…
EdAtkin Nov 18, 2024
8611ffb
removing setosccov and passing via the constructor,there are checks o…
EdAtkin Nov 18, 2024
465e3c6
Adding in a method to get the spline interpolation type for splines w…
EdAtkin Nov 20, 2024
d85168c
fixing merge conflicts
EdAtkin Nov 29, 2024
47fbec8
fixing small merge conflicts
EdAtkin Nov 29, 2024
f90a084
changing so that nupdg and nupdgunosc are done event-by-event and rem…
EdAtkin Dec 4, 2024
8650ac2
small change to use static cast for spline binning reading
EdAtkin Dec 4, 2024
1a81ad9
fixing some annoying indentation that was off
EdAtkin Dec 4, 2024
919088d
Merge branch 'develop' of github.com:mach3-software/MaCh3 into featur…
EdAtkin Dec 4, 2024
2892e4a
using AppliesToDetId rather than doing my own binary check
EdAtkin Dec 5, 2024
142490d
adding in a function to convert NuPDGs to a NuOscillator type
EdAtkin Dec 5, 2024
963cc1c
updating factory method to not include SetXsecCov, since it's templat…
EdAtkin Dec 5, 2024
a3cc638
forgot to also remove the SetOscCov call since this is also passed vi…
EdAtkin Dec 5, 2024
716622e
adding the actual implemenation which was missing before
EdAtkin Dec 5, 2024
1b9c1cb
fix python
KSkwarczynski Dec 5, 2024
1a4f7c5
fix so that if a null osc_cov is used the oscillation weights for NC …
EdAtkin Dec 6, 2024
8a9197e
Merge branch 'feature_core_1.2.0' of github.com:mach3-software/MaCh3 …
EdAtkin Dec 6, 2024
fd57d00
adding in pragmas to ignore float-conversion flags for the NuOscillat…
EdAtkin Dec 6, 2024
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
22 changes: 21 additions & 1 deletion covariance/covarianceXsec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "covariance/covarianceXsec.h"
#include "samplePDF/Structs.h"

// ********************************************
// ETA - YAML constructor
Expand Down Expand Up @@ -114,10 +115,29 @@ const std::vector<std::string> covarianceXsec::GetSplineParsNamesFromDetID(const
for (auto &pair : _fSystToGlobalSystIndexMap[SystType::kSpline]) {
auto &SplineIndex = pair.first;
auto &SystIndex = pair.second;
if ((GetParDetID(SystIndex) & DetID )){
if (AppliesToDetID(SystIndex, DetID)) { //If parameter applies to required DetID
returnVec.push_back(_fSplineNames.at(SplineIndex));
}

}
return returnVec;
}

const std::vector<SplineInterpolation> covarianceXsec::GetSplineInterpolationFromDetID(const int DetID) {
std::vector<SplineInterpolation> returnVec;
for (auto &pair : _fSystToGlobalSystIndexMap[SystType::kSpline]) {
auto &SplineIndex = pair.first;
auto &SystIndex = pair.second;

if (AppliesToDetID(SystIndex, DetID)) { //If parameter applies to required DetID
returnVec.push_back(SplineParams.at(SplineIndex)._SplineInterpolationType);
}

// if ((GetParDetID(SystIndex) & DetID )){
// returnVec.push_back(SplineParams.at(SplineIndex)._SplineInterpolationType);
// }
}

return returnVec;
}

Expand Down
2 changes: 2 additions & 0 deletions covariance/covarianceXsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class covarianceXsec : public covarianceBase {
/// @brief Get interpolation type for a given parameter
/// @param i spline parameter index, not confuse with global index
inline SplineInterpolation GetParSplineInterpolation(const int i) {return SplineParams.at(i)._SplineInterpolationType;}
/// @brief Get the interpolation types for splines affecting a particular DetID
const std::vector<SplineInterpolation> GetSplineInterpolationFromDetID(int DetID);
/// @brief Get the name of the spline associated with the spline at index i
/// @param i spline parameter index, not to be confused with global index
std::string GetParSplineName(const int i) {return _fSplineNames[i];}
Expand Down
4 changes: 1 addition & 3 deletions mcmc/MaCh3Factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ std::vector<SampleType*> MaCh3SamplePDFFactory(const std::vector<std::string>& S
for (size_t i = 0; i < SampleConfig.size(); ++i)
{
// Instantiate the sample using the specified class type
SampleType* Sample = new SampleType(SampleConfig[i], xsec);
Sample->SetXsecCov(xsec);
if (osc != nullptr) Sample->SetOscCov(osc);
SampleType* Sample = new SampleType(SampleConfig[i], xsec, osc);
Sample->reweight();

// Obtain sample name and create a TString version for histogram naming
Expand Down
13 changes: 0 additions & 13 deletions python/samplePDF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,6 @@ void initSamplePDF(py::module &m){
py::arg("mc_version"),
py::arg("xsec_cov")
)

.def(
"set_xsec_cov",
&samplePDFFDBase::SetXsecCov,
"Set the cross section covariance matrix object."
)

.def(
"set_osc_cov",
&samplePDFFDBase::SetOscCov,
"Set the oscillation parameter covariance matrix object."
)

;

/* Not sure if this will be needed in future versions of MaCh3 so leaving commented for now
Expand Down
6 changes: 2 additions & 4 deletions samplePDF/FarDetectorCoreInfoStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ struct FarDetectorCoreInfo {

~FarDetectorCoreInfo(){ delete [] isNC; }

int nutype; // 2 = numu/signue | -2 = numub | 1 = nue | -1 = nueb
int oscnutype;
int nupdg;
int nupdgUnosc;
bool signal; // true if signue
int nEvents; // how many MC events are there
double ChannelIndex;
std::string flavourName;

std::vector<int*> Target; // target the interaction was on
std::vector<const int*> nupdg;
std::vector<const int*> nupdgUnosc;

int SampleDetID;

Expand Down
31 changes: 31 additions & 0 deletions samplePDF/Structs.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#include "samplePDF/Structs.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#include "Constants/OscillatorConstants.h"
#pragma GCC diagnostic pop

#include "TList.h"
#include "TObjArray.h"
#include "manager/MaCh3Logger.h"

namespace MaCh3Utils {

Expand Down Expand Up @@ -71,6 +77,31 @@ namespace MaCh3Utils {
return 0;
}

int PDGToNuOscillatorFlavour(int NuPdg){
int NuOscillatorFlavour = _BAD_INT_;
switch(std::abs(NuPdg)){
case NuPDG::kNue:
NuOscillatorFlavour = NuOscillator::kElectron;
break;
case NuPDG::kNumu:
NuOscillatorFlavour = NuOscillator::kMuon;
break;
case NuPDG::kNutau:
NuOscillatorFlavour = NuOscillator::kTau;
break;
default:
MACH3LOG_ERROR("Unknown Nuetrino PDG {}, cannot convert to NuOscillator type", NuPdg);
break;
}

//This is very cheeky but if the PDG is negative then multiply the PDG by -1
// This is consistent with the treatment that NuOscillator expects as enums only
// exist for the generic matter flavour and not the anti-matter version
if(NuPdg < 0){NuOscillatorFlavour *= -1;}

return NuOscillatorFlavour;
}


//DB Anything added here must be of the form 2^X, where X is an integer
//
Expand Down
7 changes: 7 additions & 0 deletions samplePDF/Structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ namespace MaCh3Utils {
/// @brief Return mass for given PDG
double GetMassFromPDG(int PDG);
// ***************************

// ***************************
/// @brief Convert from PDG flavour to NuOscillator type
/// beware that in the case of anti-neutrinos the NuOscillator
/// type simply gets multiplied by -1
int PDGToNuOscillatorFlavour(int PDG);
// ***************************

extern std::unordered_map<int,int> KnownDetIDsMap;
extern int nKnownDetIDs;
Expand Down
Loading
Loading