Skip to content

Commit

Permalink
adding in intialisation of some members to be BAD_INT to help with fu…
Browse files Browse the repository at this point in the history
…ture debugging, so they're not just initialised to random numbers. Also tiny indent fixes and adding a static cast from an enum to an int
  • Loading branch information
EdAtkin committed Nov 18, 2024
1 parent 9147690 commit ddd79cb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
31 changes: 16 additions & 15 deletions samplePDF/samplePDFFDBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,8 @@ void samplePDFFDBase::SetupNormParameters(){
std::cout << "FOUND " << xsec_norms.size() << " norm parameters that affect this sample" << std::endl;

if(!XsecCov){
MACH3LOG_ERROR("XsecCov is not setup!");
throw MaCh3Exception(__FILE__ , __LINE__ );
MACH3LOG_ERROR("XsecCov is not setup!");
throw MaCh3Exception(__FILE__ , __LINE__ );
}

// Assign xsec norm bins in MCSamples tree
Expand Down Expand Up @@ -1333,25 +1333,25 @@ void samplePDFFDBase::SetupNuOscillator() {
}
}
std::sort(EnergyArray.begin(),EnergyArray.end());

NuOscProbCalcers[iSample]->SetEnergyArrayInCalcer(EnergyArray);

//============================================================================
//DB Atmospheric only part
if (MCSamples[iSample].rw_truecz != NULL) { //Can only happen if truecz has been initialised within the experiment specific code
std::vector<_float_> CosineZArray;
for (int iEvent=0;iEvent<(int)MCSamples[iSample].nEvents;iEvent++) {
//DB Remove NC events from the arrays which are handed to the NuOscillator objects
if (!MCSamples[iSample].isNC[iEvent]) {
CosineZArray.push_back(*(MCSamples[iSample].rw_truecz[iEvent]));
}
}
std::sort(CosineZArray.begin(),CosineZArray.end());
NuOscProbCalcers[iSample]->SetCosineZArrayInCalcer(CosineZArray);
std::vector<_float_> CosineZArray;
for (int iEvent=0;iEvent<(int)MCSamples[iSample].nEvents;iEvent++) {
//DB Remove NC events from the arrays which are handed to the NuOscillator objects
if (!MCSamples[iSample].isNC[iEvent]) {
CosineZArray.push_back(*(MCSamples[iSample].rw_truecz[iEvent]));
}
}
std::sort(CosineZArray.begin(),CosineZArray.end());

NuOscProbCalcers[iSample]->SetCosineZArrayInCalcer(CosineZArray);
}
//============================================================================

}

NuOscProbCalcers[iSample]->Setup();
Expand Down Expand Up @@ -1407,7 +1407,7 @@ void samplePDFFDBase::SetupNuOscillator() {
}

//Assuming that if the generated neutrino is antineutrino, the detected flavour will also be antineutrino
if (MCSamples[iSample].nupdgunosc[iEvent]<0) {
if (static_cast<int>(MCSamples[iSample].nupdgunosc[iEvent]) < 0) {
InitFlav *= -1;
FinalFlav *= -1;
}
Expand Down Expand Up @@ -1598,6 +1598,7 @@ void samplePDFFDBase::InitialiseSplineObject() {
splineFile->PrintArrayDimension();
splineFile->CountNumberOfLoadedSplines(false, 1);
splineFile->TransferToMonolith();
//splineFile->cleanUpMemory();

MACH3LOG_INFO("--------------------------------");
MACH3LOG_INFO("Setup Far Detector splines");
Expand Down
10 changes: 5 additions & 5 deletions samplePDF/samplePDFFDBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ class samplePDFFDBase : public samplePDFBase
//DB Covariance Objects
//ETA - All experiments will need an xsec, det and osc cov
//these should be added to samplePDFBase to be honest
covarianceXsec *XsecCov;
covarianceOsc *OscCov;
covarianceXsec *XsecCov = nullptr;
covarianceOsc *OscCov = nullptr;

//===============================================================================

/// @brief Keep track of the dimensions of the sample binning
int nDimensions;
int nDimensions = _BAD_INT_;
/// @brief A unique ID for each sample based on powers of two for quick binary operator comparisons
int SampleDetID;
int SampleDetID = _BAD_INT_;
/// holds "TrueNeutrinoEnergy" and the strings used for the sample binning.
std::vector<std::string> SplineBinnedVars;

Expand All @@ -224,7 +224,7 @@ class samplePDFFDBase : public samplePDFBase
//What gets used in IsEventSelected, which gets set equal to user input plus
//all the vectors in StoreSelection
/// @brief the Number of selections in the
int NSelections;
int NSelections = _BAD_INT_;

/// @brief What gets pulled from config options, these are constant after loading in
/// this is of length 3: 0th index is the value, 1st is lower bound, 2nd is upper bound
Expand Down

0 comments on commit ddd79cb

Please sign in to comment.