diff --git a/meson.build b/meson.build index dae9a4d0..21129acc 100644 --- a/meson.build +++ b/meson.build @@ -22,6 +22,14 @@ project_description = 'Implementation Guardian of Analysis Algorithms' # initialize binding languanges add_languages('fortran', native: false, required: get_option('bind_fortran')) +# check built-in build options +if get_option('libdir') != 'lib' + warning('build option "libdir" = "' + get_option('libdir') + '", which is not "lib"; if you experience any issues, please report them') +endif +if get_option('datadir') != 'share' + error('build option "datadir" must be "share", but it is set to "' + get_option('datadir') + '"') +endif + # meson modules pkg = import('pkgconfig') fs = import('fs') @@ -124,6 +132,7 @@ if ROOT_dep.found() '-lGenVector', '-lROOTDataFrame', '-lROOTVecOps', + '-lTMVA', '-lTreePlayer', ] ROOT_dep_link_args_for_validators = [ @@ -141,6 +150,7 @@ project_inc = include_directories('src') project_libs = [] project_deps = declare_dependency(dependencies: [ fmt_dep, yamlcpp_dep, hipo_dep ] ) # do NOT include ROOT here project_etc = get_option('sysconfdir') / meson.project_name() +project_data = get_option('datadir') / meson.project_name() project_test_env = environment() project_pkg_vars = [ 'bindir=' + '${prefix}' / get_option('bindir'), @@ -171,7 +181,9 @@ project_test_env.set( # set preprocessor macros add_project_arguments( - '-DIGUANA_ETCDIR="' + get_option('prefix') / project_etc + '"', + '-DIGUANA_PREFIX="' + get_option('prefix') + '"', + '-DIGUANA_ETCDIR="' + project_etc + '"', + '-DIGUANA_DATADIR="' + project_data + '"', language: ['cpp'], ) diff --git a/meson/minimum-version.sh b/meson/minimum-version.sh index 99176508..ba8c2d7e 100755 --- a/meson/minimum-version.sh +++ b/meson/minimum-version.sh @@ -32,7 +32,7 @@ case $dep in [ "$cmd" = "src" ] && echo "ERROR: command '$cmd' is not used for '$dep'" >&2 && exit 1 ;; root|ROOT) - result_meson='>=6.28' + result_meson='>=6.26' [ "$cmd" = "ALA" ] && echo "ERROR: command '$cmd' is not used for '$dep'" >&2 && exit 1 result_src='https://root.cern/download/root_v6.28.12.source.tar.gz' ;; diff --git a/src/iguana/algorithms/Algorithm.cc b/src/iguana/algorithms/Algorithm.cc index 900e03eb..d845ff89 100644 --- a/src/iguana/algorithms/Algorithm.cc +++ b/src/iguana/algorithms/Algorithm.cc @@ -112,6 +112,17 @@ namespace iguana { /////////////////////////////////////////////////////////////////////////////// + std::string Algorithm::GetDataFile(std::string const& name) + { + if(!m_datafile_reader) { + m_datafile_reader = std::make_unique(ConfigFileReader::ConvertAlgoNameToConfigDir(m_class_name), "data|" + m_name); + m_datafile_reader->SetLogLevel(m_log->GetLevel()); + } + return m_datafile_reader->FindFile(name); + } + + /////////////////////////////////////////////////////////////////////////////// + void Algorithm::ParseYAMLConfig() { if(!m_yaml_config) { diff --git a/src/iguana/algorithms/Algorithm.h b/src/iguana/algorithms/Algorithm.h index 7c198aa2..77f6e814 100644 --- a/src/iguana/algorithms/Algorithm.h +++ b/src/iguana/algorithms/Algorithm.h @@ -8,6 +8,7 @@ #include "iguana/algorithms/AlgorithmBoilerplate.h" #include "iguana/services/YAMLReader.h" +#include "iguana/services/DataFileReader.h" namespace iguana { @@ -136,6 +137,11 @@ namespace iguana { /// @param name the directory name void SetConfigDirectory(std::string const& name); + /// Get the full path to a data file, such as a machine-learning model + /// @param name the name of the file; if found in the user's current working directory (`./`), that will be the file that is used; + /// otherwise the _installed_ file (in `$IGUANA/share/`) will be used by default + std::string GetDataFile(std::string const& name); + protected: // methods /// Parse YAML configuration files. Sets `m_yaml_config`. @@ -226,6 +232,9 @@ namespace iguana { /// YAML reader std::unique_ptr m_yaml_config; + + /// Data file reader + std::unique_ptr m_datafile_reader; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/src/iguana/algorithms/clas12/LeptonIDFilter/Algorithm.cc b/src/iguana/algorithms/clas12/LeptonIDFilter/Algorithm.cc new file mode 100644 index 00000000..d1e31599 --- /dev/null +++ b/src/iguana/algorithms/clas12/LeptonIDFilter/Algorithm.cc @@ -0,0 +1,152 @@ +#include "Algorithm.h" + +#include +#include + +namespace iguana::clas12 { + + REGISTER_IGUANA_ALGORITHM(LeptonIDFilter , "clas12::LeptonIDFilter"); + + void LeptonIDFilter::Start(hipo::banklist& banks) + { + //Get configuration + ParseYAMLConfig(); + o_pid = GetOptionScalar("pid");//Obtain pid from config file (+11/-11) + o_weightfile = GetOptionScalar("weightfile");//Obtain weightfile from config file + o_cut = GetOptionScalar("cut"); + + // load the weights file + o_weightfile_fullpath = GetDataFile(o_weightfile); + m_log->Debug("Loaded weight file {}", o_weightfile_fullpath); + + //Get Banks that we are going to use + b_particle = GetBankIndex(banks, "REC::Particle"); + b_calorimeter = GetBankIndex(banks, "REC::Calorimeter"); + + + } + + + void LeptonIDFilter::Run(hipo::banklist& banks) const + { + auto& particleBank = GetBank(banks, b_particle, "REC::Particle"); + auto& calorimeterBank = GetBank(banks, b_calorimeter, "REC::Calorimeter"); + + ShowBank(particleBank, Logger::Header("INPUT PARTICLES")); + + // + particleBank.getMutableRowList().filter([this,&particleBank,&calorimeterBank](auto bank, auto row) { + auto lepton_pindex = FindLepton(particleBank); + auto lepton_vars=GetLeptonIDVariables(lepton_pindex,particleBank,calorimeterBank); + lepton_vars.score=CalculateScore(lepton_vars); + + return Filter(lepton_vars.score); + }); + + // dump the modified bank + ShowBank(particleBank, Logger::Header("OUTPUT PARTICLES")); + + } + + + int LeptonIDFilter::FindLepton(hipo::bank const& particle_bank) const{ + int lepton_pindex= -1; + for(int row = 0; row < particle_bank.getRows(); row++) { + auto status = particle_bank.getShort("status", row); + if(particle_bank.getInt("pid", row) == o_pid && abs(status)>=2000 && abs(status)<4000) { + lepton_pindex=row; + break; + } + } + if(lepton_pindex >= 0) + m_log->Debug("Found lepton: pindex={}", lepton_pindex); + else + m_log->Debug("Lepton not found"); + return lepton_pindex; + } + + LeptonIDVars LeptonIDFilter::GetLeptonIDVariables(int const plepton, hipo::bank const& particle_bank, hipo::bank const& calorimeter_bank) const{ + + double px = particle_bank.getFloat("px", plepton); + double py = particle_bank.getFloat("py", plepton); + double pz = particle_bank.getFloat("pz", plepton); + double E = std::sqrt(std::pow(px, 2) + std::pow(py, 2) + std::pow(pz, 2) + std::pow(0.000511, 2)); + ROOT::Math::PxPyPzMVector vec_lepton(px, py, pz, E); + + LeptonIDVars lepton; + + lepton.P =vec_lepton.P(); + lepton.Theta=vec_lepton.Theta(); + lepton.Phi =vec_lepton.Phi(); + + m_log->Debug("Variables obtained from particle bank"); + + + lepton.m2pcal=-1; + lepton.m2ecin=-1; + lepton.m2ecout=-1; + + for(int row = 0; row < calorimeter_bank.getRows(); row++) { + auto pindex = calorimeter_bank.getShort("pindex",row); + auto layer = calorimeter_bank.getByte("layer",row); + auto energy = calorimeter_bank.getFloat("energy",row); + auto m2u = calorimeter_bank.getFloat("m2u",row); + auto m2v = calorimeter_bank.getFloat("m2v",row); + auto m2w = calorimeter_bank.getFloat("m2w",row); + + if(pindex==plepton && layer==1) { + lepton.SFpcal=energy/vec_lepton.P(); + lepton.m2pcal=(m2u+m2v+m2w)/3; + } + + if(pindex==plepton && layer==4) { + lepton.SFecin=energy/vec_lepton.P(); + lepton.m2ecin=(m2u+m2v+m2w)/3; + } + if(pindex==plepton && layer==7) { + lepton.SFecout=energy/vec_lepton.P(); + lepton.m2ecout=(m2u+m2v+m2w)/3; + } + + } + + + m_log->Debug("Variables obtained from calorimeter bank"); + + return lepton; + + } + + double LeptonIDFilter::CalculateScore(LeptonIDVars lepton_vars) const{ + + ///Assing variables from lepton_vars for TMVA method + P=lepton_vars.P; + Theta=lepton_vars.Theta; + Phi=lepton_vars.Phi; + PCAL=lepton_vars.SFpcal; + ECIN=lepton_vars.SFecin; + ECOUT=lepton_vars.SFecout; + m2PCAL=lepton_vars.m2pcal; + m2ECIN=lepton_vars.m2ecin; + m2ECOUT=lepton_vars.m2ecout; + + m_log->Debug("Add variables to readerTMVA"); + auto score=readerTMVA->EvaluateMVA("BDT"); + + return score; + } + + bool LeptonIDFilter::Filter(double score) const{ + if(score>=o_cut) + return true; + else + return false; + } + + + + void LeptonIDFilter::Stop() + { + } + +} diff --git a/src/iguana/algorithms/clas12/LeptonIDFilter/Algorithm.h b/src/iguana/algorithms/clas12/LeptonIDFilter/Algorithm.h new file mode 100644 index 00000000..5c776923 --- /dev/null +++ b/src/iguana/algorithms/clas12/LeptonIDFilter/Algorithm.h @@ -0,0 +1,137 @@ +#pragma once + +#include "iguana/algorithms/Algorithm.h" +#include + +///Struct to store variables + struct LeptonIDVars { + /// @brief momentum + double P; + /// @brief Theta angle + double Theta; + /// @brief Phi angle + double Phi; + /// @brief Sampling fraction on the PCAL + double SFpcal; + /// @brief Sampling fraction on the ECIN + double SFecin; + /// @brief Sampling fraction on the ECOUT + double SFecout; + /// @brief Second-momenta of PCAL + double m2pcal; + /// @brief Second-momenta of ECIN + double m2ecin; + /// @brief Second-momenta of ECOUT + double m2ecout; + /// @brief Score + double score; + }; + +namespace iguana::clas12 { + /// + /// @brief_algo Filter the leptons from the pion contamination using TMVA models + /// + /// For each lepton, either positron or electron, it takes some variables from `REC::Particle` (P, Theta and Phi) and `REC::Particle` (Sampling fraction and second moments). + /// Using those variables, it call the TMVA method using the weight file, and it computes a score. By a pplying a cut to the score we can separate leptons from pions. + /// + /// @begin_doc_algo{clas12::LeptonIDFilter | Filter} + /// @input_banks{REC::Particle,REC::Calorimeter} + /// @end_doc + /// + /// @begin_doc_config + /// @config_param{o_pid | int | PID of the particle; -11 for positrons and 11 for electrons} + /// @config_param{o_weightfile | std::string | Location of the weight file of the classifier} + /// @config_param{o_cut | double | Value of the score to apply the cut. The algorith will keep all particles that have a score grater than ths value} + /// @end_doc + class LeptonIDFilter : public Algorithm + { + + DEFINE_IGUANA_ALGORITHM(LeptonIDFilter, clas12::LeptonIDFilter) + + public: + + void Start(hipo::banklist& banks) override; + void Run(hipo::banklist& banks) const override; + void Stop() override; + + /// **FindLepton function**: returns the pindex of the lepton + /// @param particle_bank the particle bank + /// @returns pindex of the lepton, -1 if there is no lepton + int FindLepton(hipo::bank const& particle_bank) const; + + + /// **GetLeptonIDVariables function**: Using the pindex retrieves the necessary variables from banks + /// @param plepton pindex of the lepton + /// @param particle_bank the particle bank + /// @param calorimeter_bank the calorimeter bank + /// @returns LeptonIDVars, the variables required for identification + LeptonIDVars GetLeptonIDVariables(int const plepton, hipo::bank const& particle_bank, hipo::bank const& calorimeter_bank) const; + + + /// **CalculateScore function**: Using the LeptonIDVars variables calculate the score + /// @param lepton_vars LeptonIDVars variables + /// @returns double, the score + double CalculateScore(LeptonIDVars lepton_vars) const; + + /// **Filter function**: Returns true if the particle passed the cut + /// @param score the score obtained from the CalculateScore function + /// @returns bool, true if score>=cut, false otherwise + bool Filter(double score) const; + + //Create TMVA reader + TMVA::Reader *readerTMVA = new TMVA::Reader(); + + ///Set of variables for the reader + ///Momentum + Float_t P; + ///Theta angle + Float_t Theta; + ///Phi angle + Float_t Phi; + ///Sampling fraction on the PCAL + Float_t PCAL; + ///Sampling fraction on the ECIN + Float_t ECIN; + ///Sampling fraction on the ECOUT + Float_t ECOUT; + ///Second-momenta of PCAL + Float_t m2PCAL; + ///Second-momenta of ECIN + Float_t m2ECIN; + ///Second-momenta of ECOUT + Float_t m2ECOUT; + + /// @brief Add variables to the readerTMVA + readerTMVA->AddVariable( "P",&P ); + readerTMVA->AddVariable( "Theta",&Theta); + readerTMVA->AddVariable( "Phi",&Phi); + readerTMVA->AddVariable( "SFPCAL",&PCAL); + readerTMVA->AddVariable( "SFECIN",&ECIN); + readerTMVA->AddVariable( "SFECOUT",&ECOUT ); + readerTMVA->AddVariable( "m2PCAL",&m2PCAL); + readerTMVA->AddVariable( "m2ECIN",&m2ECIN); + readerTMVA->AddVariable( "m2ECOUT",&m2ECOUT); + + readerTMVA->BookMVA( "BDT", o_weightfile_fullpath ); + + + private: + + + /// `hipo::banklist` + hipo::banklist::size_type b_particle; + hipo::banklist::size_type b_calorimeter; + + + + + /// pid of the lepton + int o_pid; + /// Location of the weight file + std::string o_weightfile; + std::string o_weightfile_fullpath; + /// Value of the cut + double o_cut; + }; + +} diff --git a/src/iguana/algorithms/clas12/LeptonIDFilter/Config.yaml b/src/iguana/algorithms/clas12/LeptonIDFilter/Config.yaml new file mode 100644 index 00000000..0c116994 --- /dev/null +++ b/src/iguana/algorithms/clas12/LeptonIDFilter/Config.yaml @@ -0,0 +1,4 @@ +clas12::LeptonIDFilter: + pid: -11 + weightfile: "weights/9_BDT_positrons_S19.weights.xml" + cut: 0.0 diff --git a/src/iguana/algorithms/clas12/LeptonIDFilter/weights/9_BDT_positrons_S19.weights.xml b/src/iguana/algorithms/clas12/LeptonIDFilter/weights/9_BDT_positrons_S19.weights.xml new file mode 100644 index 00000000..f4b4ac60 --- /dev/null +++ b/src/iguana/algorithms/clas12/LeptonIDFilter/weights/9_BDT_positrons_S19.weights.xml @@ -0,0 +1,13538 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/iguana/algorithms/meson.build b/src/iguana/algorithms/meson.build index 6628d396..1dd88905 100644 --- a/src/iguana/algorithms/meson.build +++ b/src/iguana/algorithms/meson.build @@ -27,6 +27,7 @@ algo_dict = [ # 'validator_needs_ROOT': bool # whether this validator needs ROOT or not (default=true) # 'add_algorithm_sources': list[str] # list of additional algorithm source files (default=[]) # 'add_algorithm_headers': list[str] # list of additional algorithm header files (default=[]) +# 'add_algorithm_data': list[str] # list of additional files to install (default=[]) # 'add_validator_sources': list[str] # list of additional validator source files (default=[]) # 'add_validator_headers': list[str] # list of additional validator header files (default=[]) # 'test_args': { dict[str], # if excluded, tests won't run for this algorithm @@ -97,12 +98,23 @@ algo_dict += [ 'algorithm_needs_ROOT': true, 'has_validator': true, 'test_args': { 'banks': ['REC::Particle', 'REC::Calorimeter', 'RUN::config'] }, - } + }, + { + 'name': 'clas12::LeptonIDFilter', + 'has_c_bindings': false, + 'algorithm_needs_ROOT': true, + 'has_validator': false, + 'add_algorithm_data': [ + 'weights/9_BDT_positrons_S19.weights.xml', + ], + 'test_args': { 'banks': ['REC::Particle', 'REC::Calorimeter'] }, + }, ] # make lists of objects to build; inclusion depends on whether ROOT is needed or not, and if we have ROOT algo_sources = [] algo_headers = [] +algo_data = [] algo_configs = [] vdor_sources = [] vdor_headers = [] @@ -120,7 +132,7 @@ foreach algo : algo_dict # algorithms: if (algo_needs_ROOT and ROOT_dep.found()) or not algo_needs_ROOT - # sources and headers + # sources, headers, and data algo_sources += algo_dir / 'Algorithm.cc' algo_headers += algo_dir / 'Algorithm.h' foreach src_file : algo.get('add_algorithm_sources', []) @@ -129,6 +141,9 @@ foreach algo : algo_dict foreach src_file : algo.get('add_algorithm_headers', []) algo_headers += algo_dir / src_file endforeach + foreach src_file : algo.get('add_algorithm_data', []) + algo_data += algo_dir / src_file + endforeach # C/Fortran bindings if get_option('bind_fortran') @@ -182,6 +197,13 @@ install_headers( subdir: meson.project_name() / 'algorithms', preserve_path: true, ) +foreach algo_datum : algo_data + install_data( + algo_data, + install_dir: project_data / 'algorithms', + preserve_path: true, + ) +endforeach project_libs += algo_lib # build and install validators diff --git a/src/iguana/services/ConfigFileReader.cc b/src/iguana/services/ConfigFileReader.cc index a97fd0b9..86e0500a 100644 --- a/src/iguana/services/ConfigFileReader.cc +++ b/src/iguana/services/ConfigFileReader.cc @@ -5,35 +5,37 @@ namespace iguana { - ConfigFileReader::ConfigFileReader(std::string_view name) + ConfigFileReader::ConfigFileReader(std::string_view name, bool set_default_dirs) : Object(name) { - // the algorithms need to know where the config files are; - // first, add config files from installation prefix; since this - // is added first, it's the lowest priority in the configuration - // search path - AddDirectory(GetConfigInstallationPrefix()); - // next, add `IGUANA_CONFIG_PATH` paths, which provides: - // - user override of the configuration path(s) - // - a fallback, if `GetConfigInstallationPrefix` is wrong, which happens - // if the Iguana installation is relocated - auto user_paths_env_var = std::getenv("IGUANA_CONFIG_PATH"); - if(user_paths_env_var != nullptr) { - std::istringstream user_paths_stream(user_paths_env_var); - std::string user_path_token; - decltype(m_directories) user_paths; - while(getline(user_paths_stream, user_path_token, ':')) // tokenize `IGUANA_CONFIG_PATH` - user_paths.push_front(user_path_token); - for(auto const& user_path : user_paths) // add the paths in the correct order - AddDirectory(user_path); - // after these default paths have been added, the user - // may still override by calling `AddDirectory` etc. themselves + if(set_default_dirs) { + // the algorithms need to know where the config files are; + // first, add config files from installation prefix; since this + // is added first, it's the lowest priority in the configuration + // search path + AddDirectory(GetConfigInstallationPrefix()); + // next, add `IGUANA_CONFIG_PATH` paths, which provides: + // - user override of the configuration path(s) + // - a fallback, if `GetConfigInstallationPrefix` is wrong, which happens + // if the Iguana installation is relocated + auto user_paths_env_var = std::getenv("IGUANA_CONFIG_PATH"); + if(user_paths_env_var != nullptr) { + std::istringstream user_paths_stream(user_paths_env_var); + std::string user_path_token; + decltype(m_directories) user_paths; + while(getline(user_paths_stream, user_path_token, ':')) // tokenize `IGUANA_CONFIG_PATH` + user_paths.push_front(user_path_token); + for(auto const& user_path : user_paths) // add the paths in the correct order + AddDirectory(user_path); + // after these default paths have been added, the user + // may still override by calling `AddDirectory` etc. themselves + } } } std::string ConfigFileReader::GetConfigInstallationPrefix() { - return IGUANA_ETCDIR; + return std::string(IGUANA_PREFIX) + "/" + std::string(IGUANA_ETCDIR); } void ConfigFileReader::AddDirectory(std::string const& dir) @@ -88,13 +90,18 @@ namespace iguana { throw std::runtime_error("configuration file not found"); } - std::string ConfigFileReader::ConvertAlgoNameToConfigName(std::string_view algo_name, std::string_view ext) + std::string ConfigFileReader::ConvertAlgoNameToConfigDir(std::string_view algo_name) { std::string result = std::string(algo_name); std::string::size_type it = 0; while((it = result.find("::", it)) != std::string::npos) result.replace(it, 2, "/"); - return "algorithms/" + result + "/Config." + std::string(ext); + return "algorithms/" + result; + } + + std::string ConfigFileReader::ConvertAlgoNameToConfigName(std::string_view algo_name, std::string_view ext) + { + return ConvertAlgoNameToConfigDir(algo_name) + "/Config." + std::string(ext); } } diff --git a/src/iguana/services/ConfigFileReader.h b/src/iguana/services/ConfigFileReader.h index 6df04ad5..c37979ad 100644 --- a/src/iguana/services/ConfigFileReader.h +++ b/src/iguana/services/ConfigFileReader.h @@ -12,7 +12,8 @@ namespace iguana { public: /// @param name the name of this configuration file handler - ConfigFileReader(std::string_view name = "config"); + /// @param set_default_dirs if true, add the default configuration directories + ConfigFileReader(std::string_view name = "config", bool set_default_dirs = true); /// Get the config files' _fixed_ installation prefix /// @warning if the Iguana installation is _relocated_, this directory will **not** be correct, @@ -42,6 +43,11 @@ namespace iguana { /// @return the found configuration file (with the directory) std::string FindFile(std::string const& name); + /// Convert a full algorithm name to its corresponding default config file subdirectory + /// @param algo_name the algorithm name + /// @return the config file subdirectory + static std::string ConvertAlgoNameToConfigDir(std::string_view algo_name); + /// Convert a full algorithm name to its corresponding default config file name /// @param algo_name the algorithm name /// @param ext the file extension diff --git a/src/iguana/services/DataFileReader.cc b/src/iguana/services/DataFileReader.cc new file mode 100644 index 00000000..4e1f18e4 --- /dev/null +++ b/src/iguana/services/DataFileReader.cc @@ -0,0 +1,15 @@ +#include "DataFileReader.h" + +namespace iguana { + DataFileReader::DataFileReader(std::string_view datadir_subdir, std::string_view name) : ConfigFileReader(name, false) + { + // first, add the "fallback" directory; this is the lowest priority directory, relying + // on the environment variable '$IGUANA', in case the higher-priority, build-time path fails + auto user_prefix = std::getenv("IGUANA"); + if(user_prefix != nullptr) + AddDirectory(std::string(user_prefix) + "/" + std::string(IGUANA_DATADIR) + "/" + std::string(datadir_subdir)); + // then add the hard-coded path, which is set at build time; if Iguana installation is + // relocated, this path will be wrong and the above fallback will be used instead + AddDirectory(std::string(IGUANA_PREFIX) + "/" + std::string(IGUANA_DATADIR) + "/" + std::string(datadir_subdir)); + } +} diff --git a/src/iguana/services/DataFileReader.h b/src/iguana/services/DataFileReader.h new file mode 100644 index 00000000..a2d31143 --- /dev/null +++ b/src/iguana/services/DataFileReader.h @@ -0,0 +1,19 @@ +#pragma once + +#include "ConfigFileReader.h" + +namespace iguana { + + /// @brief A data file reader, for example, weights files for machine learning-dependent algorithms + class DataFileReader : public ConfigFileReader + { + + public: + + /// @param datadir_subdir the subdirectory within build option `datadir` where the file may be found + /// @param name of this reader (for `Logger`) + DataFileReader(std::string_view datadir_subdir = "", std::string_view name = "data_file"); + ~DataFileReader() {} + + }; +} diff --git a/src/iguana/services/meson.build b/src/iguana/services/meson.build index 805fc072..3867dbec 100644 --- a/src/iguana/services/meson.build +++ b/src/iguana/services/meson.build @@ -3,6 +3,7 @@ services_sources = [ 'Object.cc', 'ConfigFileReader.cc', 'YAMLReader.cc', + 'DataFileReader.cc', ] services_public_headers = [ @@ -10,6 +11,7 @@ services_public_headers = [ 'Object.h', 'ConfigFileReader.h', 'YAMLReader.h', + 'DataFileReader.h', ] services_lib = shared_library( diff --git a/src/iguana/tests/meson.build b/src/iguana/tests/meson.build index d525f5c4..5621f325 100644 --- a/src/iguana/tests/meson.build +++ b/src/iguana/tests/meson.build @@ -43,6 +43,7 @@ foreach algo : algo_dict suite: ['algorithm'], args: test_args + [ '-n', get_option('test_num_events') ], env: project_test_env, + timeout: 120, ) benchmark( 'benchmark-algorithm-' + test_name_algo,