diff --git a/CMakeLists.txt b/CMakeLists.txt index b31f11c..1e0a760 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,14 +55,16 @@ DefineEnabledRequiredSwitch(UseCUDAProb3Linear 0) DefineEnabledRequiredSwitch(UseProb3ppLinear 0) DefineEnabledRequiredSwitch(UseProbGPULinear 0) DefineEnabledRequiredSwitch(UseNuFASTLinear 0) +DefineEnabledRequiredSwitch(UseNuSQUIDSLinear 0) # KS: NuFastLinear by default -if(UseCUDAProb3 EQUAL 0 AND - UseCUDAProb3Linear EQUAL 0 AND - UseProb3ppLinear EQUAL 0 AND - UseProbGPULinear EQUAL 0 AND - UseNuFASTLinear EQUAL 0) - set(UseNuFASTLinear 1) +if(UseCUDAProb3 EQUAL 0 AND + UseCUDAProb3Linear EQUAL 0 AND + UseProb3ppLinear EQUAL 0 AND + UseProbGPULinear EQUAL 0 AND + UseNuFASTLinear EQUAL 0 AND + UseNuSQUIDSLinear EQUAL 0) + set(UseNuFASTLinear 1) endif() LIST(APPEND ALL_Engines @@ -71,6 +73,7 @@ LIST(APPEND ALL_Engines Prob3ppLinear ProbGPULinear NuFASTLinear + NuSQUIDSLinear ) cmessage(STATUS "NuOscillator Features: ") foreach(f ${ALL_Engines}) @@ -252,6 +255,48 @@ if(${UseNuFASTLinear} EQUAL 1) target_compile_definitions(NuOscillatorCompilerOptions INTERFACE UseNuFASTLinear=1) endif() +if(${UseNuSQUIDSLinear} EQUAL 1) + find_package(GSL REQUIRED) + find_package(HDF5 REQUIRED) + + include(ExternalProject) + + ExternalProject_Add(SQUIDS + GIT_REPOSITORY https://github.com/jsalvado/SQuIDS.git + GIT_TAG master + BINARY_DIR = + CONFIGURE_HANDLED_BY_BUILD true + CONFIGURE_COMMAND /configure --with-gsl=${GSL_ROOT_DIR} --prefix= + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + + SET(SQUIDS_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/SQUIDS-prefix/include) + SET(SQUIDS_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/SQUIDS-prefix/lib) + + add_library(SQUIDS::SQUIDS SHARED IMPORTED) + set_target_properties(SQUIDS::SQUIDS PROPERTIES IMPORTED_LOCATION ${SQUIDS_LIB_DIR}/libSQuIDS.so) + + ExternalProject_Add(NUSQUIDS + GIT_REPOSITORY https://github.com/arguelles/nuSQuIDS.git + GIT_TAG master + BINARY_DIR = + CONFIGURE_HANDLED_BY_BUILD true + CONFIGURE_COMMAND /configure --with-gsl=${GSL_ROOT_DIR} --with-hdf5=${HDF5_INCLUDE_DIRS}/../ --with-squids=${CMAKE_CURRENT_BINARY_DIR}/SQUIDS-prefix --prefix= + BUILD_COMMAND make examples + INSTALL_COMMAND make install + ) + + SET(NUSQUIDS_SRC_DIR ${CMAKE_CURRENT_BINARY_DIR}/NUSQUIDS-prefix/src/NUSQUIDS/) + SET(NUSQUIDS_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/NUSQUIDS-prefix/include/) + SET(NUSQUIDS_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/NUSQUIDS-prefix/lib/) + + add_library(NUSQUIDS::NUSQUIDS SHARED IMPORTED) + set_target_properties(NUSQUIDS::NUSQUIDS PROPERTIES IMPORTED_LOCATION ${NUSQUIDS_LIB_DIR}/libnuSQuIDS.so) + + target_compile_definitions(NuOscillatorCompilerOptions INTERFACE UseNuSQUIDSLinear=1) +endif() + if(${UseGPU} EQUAL 1) target_compile_definitions(NuOscillatorCompilerOptions INTERFACE UseGPU=1) else() diff --git a/Configs/Binned_NuSQUIDSLinear.yaml b/Configs/Binned_NuSQUIDSLinear.yaml new file mode 100644 index 0000000..e671f5d --- /dev/null +++ b/Configs/Binned_NuSQUIDSLinear.yaml @@ -0,0 +1,22 @@ +General: + Verbosity: "NONE" + CosineZIgnored: false + CalculationType: "Binned" + +Binned: + FileName: "./Inputs/ExampleAtmosphericBinning.root" + EnergyAxisHistName: "EnergyAxisBinning" + CosineZAxisHistName: "CosineZAxisBinning" + +OscProbCalcerSetup: + ImplementationName: "NuSQUIDSLinear" + OscChannelMapping: + - Entry: "Electron:Electron" + - Entry: "Electron:Muon" + - Entry: "Electron:Tau" + - Entry: "Muon:Electron" + - Entry: "Muon:Muon" + - Entry: "Muon:Tau" + - Entry: "Tau:Electron" + - Entry: "Tau:Muon" + - Entry: "Tau:Tau" \ No newline at end of file diff --git a/Configs/OscProbCalcerConfigs/NuSQUIDSLinear.yaml b/Configs/OscProbCalcerConfigs/NuSQUIDSLinear.yaml new file mode 100644 index 0000000..e347a51 --- /dev/null +++ b/Configs/OscProbCalcerConfigs/NuSQUIDSLinear.yaml @@ -0,0 +1,15 @@ +General: + Verbosity: "NONE" + +OscProbCalcerSetup: + ImplementationName: "NuSQUIDSLinear" + OscChannelMapping: + - Entry: "Electron:Electron" + - Entry: "Electron:Muon" + - Entry: "Electron:Tau" + - Entry: "Muon:Electron" + - Entry: "Muon:Muon" + - Entry: "Muon:Tau" + - Entry: "Tau:Electron" + - Entry: "Tau:Muon" + - Entry: "Tau:Tau" diff --git a/Configs/Unbinned_NuSQUIDSLinear.yaml b/Configs/Unbinned_NuSQUIDSLinear.yaml new file mode 100644 index 0000000..204ed3b --- /dev/null +++ b/Configs/Unbinned_NuSQUIDSLinear.yaml @@ -0,0 +1,17 @@ +General: + Verbosity: "NONE" + CosineZIgnored: false + CalculationType: "Unbinned" + +OscProbCalcerSetup: + ImplementationName: "NuSQUIDSLinear" + OscChannelMapping: + - Entry: "Electron:Electron" + - Entry: "Electron:Muon" + - Entry: "Electron:Tau" + - Entry: "Muon:Electron" + - Entry: "Muon:Muon" + - Entry: "Muon:Tau" + - Entry: "Tau:Electron" + - Entry: "Tau:Muon" + - Entry: "Tau:Tau" \ No newline at end of file diff --git a/Constants/OscillatorConstants.h b/Constants/OscillatorConstants.h index 620c961..abeb20d 100644 --- a/Constants/OscillatorConstants.h +++ b/Constants/OscillatorConstants.h @@ -100,6 +100,10 @@ inline std::vector ReturnKnownConfigs() { #if UseNuFASTLinear == 1 ConfigNames.push_back("./Configs/Binned_NuFASTLinear.yaml"); +#endif + +#if UseNuSQUIDSLinear == 1 + ConfigNames.push_back("./Configs/Binned_NuSQUIDSLinear.yaml"); #endif return ConfigNames; diff --git a/Docs/DockerFiles/Alma9/Dockerfile b/Docs/DockerFiles/Alma9/Dockerfile index ea8b5c1..24d41e2 100755 --- a/Docs/DockerFiles/Alma9/Dockerfile +++ b/Docs/DockerFiles/Alma9/Dockerfile @@ -24,7 +24,7 @@ RUN git checkout ${NUOSCILLATOR_VERSION} RUN mkdir -p ${NuOscillator_INSTALL_DIR} WORKDIR ${NuOscillator_INSTALL_DIR} -RUN cmake -DUseGPU=0 -DUseMultithreading=1 -DUseDoubles=1 -DUseCUDAProb3=0 -DUseCUDAProb3Linear=1 -DUseProb3ppLinear=1 -DUseNuFASTLinear=1 -DUseProbGPULinear=0 ${NuOscillator_WORK_DIR} +RUN cmake -DUseGPU=0 -DUseMultithreading=1 -DUseDoubles=1 -DUseCUDAProb3=0 -DUseCUDAProb3Linear=1 -DUseProb3ppLinear=1 -DUseNuFASTLinear=1 -DUseProbGPULinear=0 -DUseNuSQUIDSLinear=1 ${NuOscillator_WORK_DIR} RUN make VERBOSE=1 && make install # KS: Need to set them here, otherwise container using this container will not be able to find NuOscillator diff --git a/OscProbCalcer/CMakeLists.txt b/OscProbCalcer/CMakeLists.txt index 1538085..dcc63a8 100644 --- a/OscProbCalcer/CMakeLists.txt +++ b/OscProbCalcer/CMakeLists.txt @@ -5,72 +5,88 @@ add_library(OscProbCalcer SHARED OscProbCalcerBase.cpp OscProbCalcerFactory.cpp) target_link_libraries(OscProbCalcer yaml-cpp NuOscillatorCompilerOptions) target_include_directories(OscProbCalcer PUBLIC - $ - $ + $ + $ ) install(TARGETS yaml-cpp - EXPORT NuOscillator-targets - LIBRARY DESTINATION lib/ - PUBLIC_HEADER DESTINATION include/yaml-cpp - ) + EXPORT NuOscillator-targets + LIBRARY DESTINATION lib/ + PUBLIC_HEADER DESTINATION include/yaml-cpp +) install(DIRECTORY ${yaml-cpp_SOURCE_DIR}/include/ - DESTINATION include/ + DESTINATION include/ ) if(${UseCUDAProb3} EQUAL 1) - target_sources(OscProbCalcer PRIVATE OscProbCalcer_CUDAProb3.cpp) - if(${UseGPU} EQUAL 1) - set_source_files_properties(OscProbCalcer_CUDAProb3.cpp PROPERTIES LANGUAGE CUDA) - endif() - target_include_directories(OscProbCalcer PRIVATE ${CUDAProb3_SOURCE_DIR}) - list(APPEND HEADERS OscProbCalcer_CUDAProb3.h) + target_sources(OscProbCalcer PRIVATE OscProbCalcer_CUDAProb3.cpp) + if(${UseGPU} EQUAL 1) + set_source_files_properties(OscProbCalcer_CUDAProb3.cpp PROPERTIES LANGUAGE CUDA) + endif() + target_include_directories(OscProbCalcer PRIVATE ${CUDAProb3_SOURCE_DIR}) + list(APPEND HEADERS OscProbCalcer_CUDAProb3.h) endif() if(${UseCUDAProb3Linear} EQUAL 1) - target_link_libraries(OscProbCalcer CUDAProb3Beam) - target_sources(OscProbCalcer PRIVATE OscProbCalcer_CUDAProb3Linear.cpp) - if(${UseGPU} EQUAL 1) - set_source_files_properties(OscProbCalcer_CUDAProb3Linear.cpp PROPERTIES LANGUAGE CUDA) - target_include_directories(OscProbCalcer PRIVATE ${CUDAProb3_SOURCE_DIR}) - endif() - list(APPEND HEADERS OscProbCalcer_CUDAProb3Linear.h) + target_link_libraries(OscProbCalcer CUDAProb3Beam) + target_sources(OscProbCalcer PRIVATE OscProbCalcer_CUDAProb3Linear.cpp) + if(${UseGPU} EQUAL 1) + set_source_files_properties(OscProbCalcer_CUDAProb3Linear.cpp PROPERTIES LANGUAGE CUDA) + target_include_directories(OscProbCalcer PRIVATE ${CUDAProb3_SOURCE_DIR}) + endif() + list(APPEND HEADERS OscProbCalcer_CUDAProb3Linear.h) endif() if(${UseProbGPULinear} EQUAL 1) - target_link_libraries(OscProbCalcer ProbGPU) - set_property(TARGET ProbGPU PROPERTY CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES}) - target_sources(OscProbCalcer PRIVATE OscProbCalcer_ProbGPULinear.cpp) - list(APPEND HEADERS OscProbCalcer_ProbGPULinear.h) + target_link_libraries(OscProbCalcer ProbGPU) + set_property(TARGET ProbGPU PROPERTY CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES}) + target_sources(OscProbCalcer PRIVATE OscProbCalcer_ProbGPULinear.cpp) + list(APPEND HEADERS OscProbCalcer_ProbGPULinear.h) endif() if(${UseProb3ppLinear} EQUAL 1) - target_link_libraries(OscProbCalcer Prob3plusplus) - target_sources(OscProbCalcer PRIVATE OscProbCalcer_Prob3ppLinear.cpp) - list(APPEND HEADERS OscProbCalcer_Prob3ppLinear.h) + target_link_libraries(OscProbCalcer Prob3plusplus) + target_sources(OscProbCalcer PRIVATE OscProbCalcer_Prob3ppLinear.cpp) + list(APPEND HEADERS OscProbCalcer_Prob3ppLinear.h) endif() if(${UseNuFASTLinear} EQUAL 1) - include_directories(${NuFAST_SOURCE_DIR}) - target_sources(OscProbCalcer PRIVATE OscProbCalcer_NuFASTLinear.cpp) - list(APPEND HEADERS OscProbCalcer_NuFASTLinear.h) + include_directories(${NuFAST_SOURCE_DIR}) + target_sources(OscProbCalcer PRIVATE OscProbCalcer_NuFASTLinear.cpp) + list(APPEND HEADERS OscProbCalcer_NuFASTLinear.h) +endif() + +if(${UseNuSQUIDSLinear} EQUAL 1) + include_directories(${SQUIDS_INC_DIR}) + include_directories(${NUSQUIDS_INC_DIR}) + include_directories(${NUSQUIDS_SRC_DIR}) + + set(NUSQUIDSEXAMPLES nuSQUIDSDecoh.o) + + target_link_libraries(OscProbCalcer GSL::gsl GSL::gslcblas HDF5::HDF5 SQUIDS::SQUIDS NUSQUIDS::NUSQUIDS) + foreach(VAR ${NUSQUIDSEXAMPLES}) + target_link_libraries(OscProbCalcer ${NUSQUIDS_SRC_DIR}/build/${VAR}) + endforeach(VAR) + target_sources(OscProbCalcer PRIVATE OscProbCalcer_NuSQUIDSLinear.cpp) + list(APPEND HEADERS OscProbCalcer_NuSQUIDSLinear.h) + endif() if (${UseGPU} EQUAL 1) - set_target_properties(OscProbCalcer PROPERTIES - CUDA_SEPARABLE_COMPILATION ON - LINKER_LANGUAGE CUDA - EXPORT_NAME OscProbCalcer) + set_target_properties(OscProbCalcer PROPERTIES + CUDA_SEPARABLE_COMPILATION ON + LINKER_LANGUAGE CUDA + EXPORT_NAME OscProbCalcer) endif() set_target_properties(OscProbCalcer PROPERTIES - PUBLIC_HEADER "${HEADERS}" - EXPORT_NAME OscProbCalcer) + PUBLIC_HEADER "${HEADERS}" + EXPORT_NAME OscProbCalcer) install(TARGETS OscProbCalcer - EXPORT NuOscillator-targets - LIBRARY DESTINATION lib/ - PUBLIC_HEADER DESTINATION include/OscProbCalcer) + EXPORT NuOscillator-targets + LIBRARY DESTINATION lib/ + PUBLIC_HEADER DESTINATION include/OscProbCalcer) add_library(OscProbCalcer::OscProbCalcer ALIAS OscProbCalcer) diff --git a/OscProbCalcer/OscProbCalcerFactory.cpp b/OscProbCalcer/OscProbCalcerFactory.cpp index 8edb415..c17275a 100644 --- a/OscProbCalcer/OscProbCalcerFactory.cpp +++ b/OscProbCalcer/OscProbCalcerFactory.cpp @@ -20,6 +20,10 @@ #include "OscProbCalcer/OscProbCalcer_NuFASTLinear.h" #endif +#if UseNuSQUIDSLinear==1 +#include "OscProbCalcer/OscProbCalcer_NuSQUIDSLinear.h" +#endif + #include OscProbCalcerFactory::OscProbCalcerFactory() { @@ -94,6 +98,17 @@ OscProbCalcerBase* OscProbCalcerFactory::CreateOscProbCalcer(YAML::Node OscProbC throw; #endif } + + else if (OscProbCalcerImplementationToCreate == "NuSQUIDSLinear") { +#if UseNuSQUIDSLinear==1 + OscProbCalcerNuSQUIDSLinear* NuSQUIDSLinear = new OscProbCalcerNuSQUIDSLinear(OscProbCalcerConfig); + Calcer = (OscProbCalcerBase*)NuSQUIDSLinear; + if (Verbose >= NuOscillator::INFO) {std::cout << "Initalised OscProbCalcer Implementation:" << Calcer->ReturnImplementationName() << " in OscProbCalcerFactory object" << std::endl;} +#else + std::cerr << "OscProbCalcerFactory was requsted to create " << OscProbCalcerImplementationToCreate << " OscProbCalcer but Use" << OscProbCalcerImplementationToCreate << " is undefined. Indicates problem in setup" << std::endl; + throw; +#endif + } else { std::cerr << "OscProbCalcerFactory was requsted to create " << OscProbCalcerImplementationToCreate << " OscProbCalcer but this is not implemented within " << __FILE__ << std::endl; diff --git a/OscProbCalcer/OscProbCalcer_NuSQUIDSLinear.cpp b/OscProbCalcer/OscProbCalcer_NuSQUIDSLinear.cpp new file mode 100644 index 0000000..8730287 --- /dev/null +++ b/OscProbCalcer/OscProbCalcer_NuSQUIDSLinear.cpp @@ -0,0 +1,121 @@ +#include "OscProbCalcer_NuSQUIDSLinear.h" + +#include + +#include "nuSQuIDS/nuSQuIDS.h" +#include "examples/Decoherence/nuSQUIDSDecoh.h" + +OscProbCalcerNuSQUIDSLinear::OscProbCalcerNuSQUIDSLinear(YAML::Node Config_) : OscProbCalcerBase(Config_) +{ + //======= + //Grab information from the config + + //======= + + fNOscParams = kNOscParams; + + fNNeutrinoTypes = 2; + InitialiseNeutrinoTypesArray(fNNeutrinoTypes); + fNeutrinoTypes[0] = Nu; + fNeutrinoTypes[1] = Nubar; + + // This implementation only considers linear propagation, thus no requirement to set cosineZ array + IgnoreCosineZBinning(true); + + squids::Const units; + unsigned int numneu = 3; + nusquids::nuSQUIDSDecoh nus(nusquids::logspace(1.e2*units.GeV,1.e6*units.GeV,200),numneu,nusquids::neutrino,true); + + //Here we define the trajectory that the particle follows and the object for more examples + // of how construct a track and object look body_track example. + //zenith angle, neutrinos crossing the earth + double phi = acos(0.); + //Declaration of the body, EarthAtm is one of the predefined bodies + std::shared_ptr earth_atm = std::make_shared(); + //Definition of the track, in encodes the trajectory inside the body, here is declared with the zenith angle. + auto track_atm = std::make_shared(earth_atm->MakeTrack(phi)); + //We set this in the nusSQuID object. + nus.Set_Body(earth_atm); + nus.Set_Track(track_atm); + + // set mixing angles and masses + nus.Set_MixingAngle(0,1,0.563942); + nus.Set_MixingAngle(0,2,0.154085); + nus.Set_MixingAngle(1,2,0.785398); + nus.Set_SquareMassDifference(1,7.65e-05); + nus.Set_SquareMassDifference(2,0.00247); + + //Here we set the maximum size for the integration step, important for fast or sharp variations of the density. + nus.Set_h_max( 500.0*units.km ); + + //We set the GSL step function + nus.Set_GSL_step(gsl_odeiv2_step_rk4); + + //Setting the numerical precision of gsl integrator. + nus.Set_rel_error(1.0e-5); + nus.Set_abs_error(1.0e-5); + + //Construct the initial state + //E_range is an array that contains all the energies. + nusquids::marray E_range = nus.GetERange(); + //Array that contains the initial state of the system, fist component is energy and second every one of the flavors + nusquids::marray inistate{E_range.size(),numneu}; + double N0 = 1.0e18; + //Se a power low spectra for the muon neutrinos (k==1), other flavors to 0.0 + for ( int i = 0 ; i < inistate.extent(0); i++){ + for ( int k = 0; k < inistate.extent(1); k ++){ + inistate[i][k] = (k == 1) ? N0*pow(E_range[i],-2) : 0.0; + } + } + + //Set the initial state in nuSQuIDS object + nus.Set_initial_state(inistate,nusquids::flavor); + + //Set the decoherence model and parameters + nus.Set_DecoherenceGammaMatrix(nusquids::nuSQUIDSDecoh::DecoherenceModel::RandomizeState, 9.48e-18*units.eV); + nus.Set_DecoherenceGammaEnergyDependence(2); + nus.Set_DecoherenceGammaEnergyScale(1.0*units.TeV); + + //Propagate the neutrinos in the earth for the path defined in path + nus.EvolveState(); + + std::cout << std::endl << "Writing the outputs..." << std::endl; + + //number of energies we want the result, notice that this can be larger than the number of the internal grid of + //the nuSQuIDS object, a linear interpolation between the quantum density matrices in the interaction picture is used + //and vacuum oscillations are solved analytically for the given energy. + int Nen =1000; + double lEmin=2; + double lEmax=6; + + std::cout << "# log10(E) E flux_i fluxRatio_i . . . ." << std::endl; + for(double lE=lEmin; lE& OscParams) { +} + +int OscProbCalcerNuSQUIDSLinear::ReturnWeightArrayIndex(int NuTypeIndex, int OscChanIndex, int EnergyIndex, int CosineZIndex) { + int IndexToReturn = NuTypeIndex*fNOscillationChannels*fNEnergyPoints + OscChanIndex*fNEnergyPoints + EnergyIndex; + return IndexToReturn; +} + +long OscProbCalcerNuSQUIDSLinear::DefineWeightArraySize() { + long nCalculationPoints = fNEnergyPoints * fNOscillationChannels * fNNeutrinoTypes; + return nCalculationPoints; +} diff --git a/OscProbCalcer/OscProbCalcer_NuSQUIDSLinear.h b/OscProbCalcer/OscProbCalcer_NuSQUIDSLinear.h new file mode 100644 index 0000000..3d0b3b2 --- /dev/null +++ b/OscProbCalcer/OscProbCalcer_NuSQUIDSLinear.h @@ -0,0 +1,92 @@ +#ifndef __OSCILLATOR_NUSQUIDSLINEAR_H__ +#define __OSCILLATOR_NUSQUIDSLINEAR_H__ + +#include "OscProbCalcerBase.h" + +/** + * @file OscProbCalcer_NuSQUIDSLinear.h + * + * @class OscProbCalcerNuSQUIDSLinear + * + * @brief Oscillation calculation engine for linear propagation in NuSQUIDS. + */ +class OscProbCalcerNuSQUIDSLinear : public OscProbCalcerBase { + public: + + /** + * @brief Default constructor + * + * @param Config_ YAML::Node to setup the OscProbCalcerNuSQUIDSLinear() instance + */ + OscProbCalcerNuSQUIDSLinear(YAML::Node Config_); + + /** + * @brief Constructor which takes a file path, creates a YAML::Node and calls the default constructor + * + * @param ConfigName_ File path to config + */ + OscProbCalcerNuSQUIDSLinear(std::string ConfigName_) : OscProbCalcerNuSQUIDSLinear(YAML::LoadFile(ConfigName_)) {} + + /** + * @brief Destructor + */ + virtual ~OscProbCalcerNuSQUIDSLinear(); + + // ======================================================================================================================================================================== + // Functions which need implementation specific code + + /** + * @brief Setup NuSQUIDS specific variables + */ + void SetupPropagator() override; + + /** + * @brief Calculate some oscillation probabilities for a particular oscillation parameter set + * + * Calculator oscillation probabilities in NuSQUIDS. This function both calculates and stores + * the oscillation probabilities in #fWeightArray. + * + * @param OscParams The parameter set to calculate oscillation probabilities at + */ + void CalculateProbabilities(const std::vector& OscParams) override; + + /** + * @brief Return implementation specific index in the weight array for a specific combination of neutrino oscillation channel, energy and cosine zenith + * + * @param NuTypeIndex The index in #fNeutrinoTypes (neutrino/antinuetrino) to return the pointer for + * @param OscChanIndex The index in #fOscillationChannels to return the pointer for + * @param EnergyIndex The index in #fEnergyArray to return the pointer for + * @param CosineZIndex The index in #fCosineZArray to return the pointer for + * + * @return Index in #fWeightArray which corresponds to the given inputs + */ + int ReturnWeightArrayIndex(int NuTypeIndex, int OscNuIndex, int EnergyIndex, int CosineZIndex=-1) override; + + /** + * @brief Define the size of fWeightArray + * + * This is implementation specific because because NuSQUIDS is setup to calculate all oscillation channels together, whilst others calculate only a single oscillation channel. + * + * @return Length that #fWeightArray should be initialised to + */ + long DefineWeightArraySize() override; + + // ======================================================================================================================================================================== + // Functions which help setup implementation specific code + + // ======================================================================================================================================================================== + // Variables which are needed for implementation specific code + + /** + * @brief Definition of oscillation parameters which are expected in this ProbGPU implementation + */ + enum OscParams{kTH12, kTH23, kTH13, kDM12, kDM23, kDCP, kPATHL, kDENS, kELECDENS, kNOscParams}; + + /** + * @brief Define the neutrino and antineutrino values expected by this implementation + */ + enum NuType{Nu=1,Nubar=-1}; + +}; + +#endif diff --git a/Setup.sh b/Setup.sh index e0d2ab5..8a26f0e 100644 --- a/Setup.sh +++ b/Setup.sh @@ -1,4 +1,11 @@ source /cvmfs/larsoft.opensciencegrid.org/spack-packages/setup-env.sh -spack load root@6.28.06 + spack load gcc@12.2.0 spack load cmake +spack load root@6.28.06 +source /cvmfs/larsoft.opensciencegrid.org/spack-packages/opt/spack/linux-almalinux9-x86_64_v2/gcc-12.2.0/root-6.28.12-sfwfmqorvxttrxgfrfhoq5kplou2pddd/bin/thisroot.sh + +spack load hdf5 +spack load gsl + +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/cvmfs/larsoft.opensciencegrid.org/spack-packages/opt/spack/linux-almalinux9-x86_64_v2/gcc-11.4.1/gsl-2.7.1-e6a2ujxmdumzrhuug4b5yk6om4mefz2u/lib diff --git a/cmake/Templates/setup.NuOscillator.sh.in b/cmake/Templates/setup.NuOscillator.sh.in index bc102e4..4d88e5f 100644 --- a/cmake/Templates/setup.NuOscillator.sh.in +++ b/cmake/Templates/setup.NuOscillator.sh.in @@ -63,5 +63,7 @@ export CUDAProb3_DIR=@CUDAProb3_SOURCE_DIR@ add_to_PATH ${NUOSCILLATOR_ROOT}/bin add_to_LD_LIBRARY_PATH ${NUOSCILLATOR_ROOT}/lib +add_to_LD_LIBRARY_PATH @SQUIDS_LIB_DIR@ +add_to_LD_LIBRARY_PATH @NUSQUIDS_LIB_DIR@ unset SETUPDIR