From a63d132a389f6a85d79e4176a55d1ef0a6de4c27 Mon Sep 17 00:00:00 2001 From: No Results FoundPlease broaden your search parameters and try again Date: Tue, 2 Jul 2024 11:16:17 -0500 Subject: [PATCH 1/8] new plugin for the trigger menu generation --- CMakeLists.txt | 8 ++-- .../TablePluginDataFormats/CMakeLists.txt | 2 +- ...erTableFromJSON.h => TriggerConfigTable.h} | 10 ++--- ...N_table.cc => TriggerConfigTable_table.cc} | 42 ++++++++++++------- 4 files changed, 38 insertions(+), 24 deletions(-) rename otsdaq-mu2e-trigger/TablePluginDataFormats/{TriggerTableFromJSON.h => TriggerConfigTable.h} (75%) rename otsdaq-mu2e-trigger/TablePluginDataFormats/{TriggerTableFromJSON_table.cc => TriggerConfigTable_table.cc} (87%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82465ca..4581a76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,11 +29,13 @@ cet_set_compiler_flags(DIAGS VIGILANT #cet_report_compiler_flags() # these are minimum required versions, not the actual product versions -find_package(otsdaq_mu2e 1.02.00 REQUIRED) +#find_package(otsdaq_mu2e 1.02.00 REQUIRED) +find_package(XMLRPC COMPONENTS c++2 client abyss-server REQUIRED EXPORT) +find_package(otsdaq 2.08.00 REQUIRED) # Mu2e Offline Extra setup -include_directories($ENV{BTRK_INC} $ENV{KINKAL_INC}) -link_directories($ENV{BTRK_LIB} $ENV{KINKAL_LIB}) +#include_directories($ENV{BTRK_INC} $ENV{KINKAL_INC}) +#link_directories($ENV{BTRK_LIB} $ENV{KINKAL_LIB}) # XDAQ Extra setup include_directories($ENV{XDAQ_INC} $ENV{XDAQ_INC}/linux) diff --git a/otsdaq-mu2e-trigger/TablePluginDataFormats/CMakeLists.txt b/otsdaq-mu2e-trigger/TablePluginDataFormats/CMakeLists.txt index cd2a005..a9fb416 100644 --- a/otsdaq-mu2e-trigger/TablePluginDataFormats/CMakeLists.txt +++ b/otsdaq-mu2e-trigger/TablePluginDataFormats/CMakeLists.txt @@ -4,7 +4,7 @@ include(otsdaq::table) cet_build_plugin(TopLevelTriggerTable otsdaq::table LIBRARIES REG ) -cet_build_plugin(TriggerTableFromJSON otsdaq::table LIBRARIES REG +cet_build_plugin(TriggerConfigTable otsdaq::table LIBRARIES REG ) diff --git a/otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerTableFromJSON.h b/otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerConfigTable.h similarity index 75% rename from otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerTableFromJSON.h rename to otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerConfigTable.h index 1d0767a..0192b94 100644 --- a/otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerTableFromJSON.h +++ b/otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerConfigTable.h @@ -1,5 +1,5 @@ -#ifndef _ots_TriggerTableFromJSON_h_ -#define _ots_TriggerTableFromJSON_h_ +#ifndef _ots_TriggerConfigTable_h_ +#define _ots_TriggerConfigTable_h_ #include "otsdaq/TableCore/TableBase.h" #include "otsdaq/ConfigurationInterface/ConfigurationManager.h" @@ -10,13 +10,13 @@ namespace ots { - class TriggerTableFromJSON : public TableBase + class TriggerConfigTable : public TableBase { public: - TriggerTableFromJSON(void); - virtual ~TriggerTableFromJSON(void); + TriggerConfigTable(void); + virtual ~TriggerConfigTable(void); //Methods void init (ConfigurationManager *configManager); diff --git a/otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerTableFromJSON_table.cc b/otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerConfigTable_table.cc similarity index 87% rename from otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerTableFromJSON_table.cc rename to otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerConfigTable_table.cc index 3a21c25..4d80d50 100644 --- a/otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerTableFromJSON_table.cc +++ b/otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerConfigTable_table.cc @@ -1,4 +1,4 @@ -#include "otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerTableFromJSON.h" +#include "otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerConfigTable.h" #include "otsdaq/Macros/TablePluginMacros.h" #include "otsdaq/ConfigurationInterface/ConfigurationManager.h" //#include "otsdaq/tools/otsdaq_load_json_document.cc" @@ -26,23 +26,23 @@ using namespace ots; #define __COUT__ __COUT_TYPE__(TLVL_DEBUG+10) << __COUT_HDR__ //======================================================================================================================== -TriggerTableFromJSON::TriggerTableFromJSON(void) - : TableBase("TriggerTableFromJSON") +TriggerConfigTable::TriggerConfigTable(void) + : TableBase("TriggerConfigTable") { ////////////////////////////////////////////////////////////////////// //WARNING: the names used in C++ MUST match the Table INFO // ////////////////////////////////////////////////////////////////////// - __COUT__ <<"[TriggerTableFromJSON::TriggerTableFromJSON] Initializing the TriggerTableFromJSON plugin..." << __E__; + __COUT__ <<"[TriggerConfigTable::TriggerConfigTable] Initializing the TriggerConfigTable plugin..." << __E__; // exit(0); __COUT__ << StringMacros::stackTrace() << __E__; } //end constructor //======================================================================================================================== -TriggerTableFromJSON::~TriggerTableFromJSON(void) +TriggerConfigTable::~TriggerConfigTable(void) {} //======================================================================================================================== -void TriggerTableFromJSON::init(ConfigurationManager* configManager) +void TriggerConfigTable::init(ConfigurationManager* configManager) { isFirstAppInContext_ = configManager->isOwnerFirstAppInContext(); @@ -57,22 +57,34 @@ void TriggerTableFromJSON::init(ConfigurationManager* configManager) trigEpilogsDir = ARTDAQ_FCL_PATH + fcl_dir; mkdir(trigEpilogsDir.c_str(), 0755); + auto childrenMap = configManager->__SELF_NODE__.getChildren(); + __COUT__ <<"printing children content"<<__E__; + __COUT__ <<"children map size"< Date: Tue, 3 Feb 2026 15:05:42 -0600 Subject: [PATCH 2/8] trace severity and clangify --- .../TablePlugins/TriggerConfigTable.h | 31 +- .../TablePlugins/TriggerConfigTable_table.cc | 504 +++++++++--------- 2 files changed, 267 insertions(+), 268 deletions(-) diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h index 0192b94..374b27e 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h @@ -1,31 +1,30 @@ #ifndef _ots_TriggerConfigTable_h_ #define _ots_TriggerConfigTable_h_ -#include "otsdaq/TableCore/TableBase.h" -#include "otsdaq/ConfigurationInterface/ConfigurationManager.h" -#include +#include // std::fstream #include -#include // std::fstream +#include +#include "otsdaq/ConfigurationInterface/ConfigurationManager.h" +#include "otsdaq/TableCore/TableBase.h" namespace ots { - class TriggerConfigTable : public TableBase +// clang-format off +class TriggerConfigTable : public TableBase { - -public: - + public: TriggerConfigTable(void); virtual ~TriggerConfigTable(void); //Methods - void init (ConfigurationManager *configManager); - void createTriggerMenuFiles (std::ofstream& EpilogFclFile, std::string& EpilogDir, std::string& TrigPath, ots::ConfigurationTree ConfTree); - std::string GetModuleNameFromPath (std::string &TrigPath); - - -private: - bool isFirstAppInContext_; + void init (ConfigurationManager* configManager); + void createTriggerMenuFiles (std::ofstream& EpilogFclFile, + std::string& EpilogDir, + std::string& TrigPath, + ots::ConfigurationTree ConfTree); + std::string GetModuleNameFromPath (std::string& TrigPath); }; -} +// clang-format on +} // namespace ots #endif diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc index 4d80d50..cb927da 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc @@ -1,283 +1,283 @@ -#include "otsdaq-mu2e-trigger/TablePluginDataFormats/TriggerConfigTable.h" -#include "otsdaq/Macros/TablePluginMacros.h" +#include "otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h" #include "otsdaq/ConfigurationInterface/ConfigurationManager.h" +#include "otsdaq/Macros/TablePluginMacros.h" //#include "otsdaq/tools/otsdaq_load_json_document.cc" -#include -#include // std::fstream #include -#include //for mkdir +#include //for mkdir +#include // std::fstream +#include #include using namespace ots; - -#define ARTDAQ_FCL_PATH std::string(getenv("OTS_SCRATCH")) + "/TriggerConfigurations/" -#define ARTDAQ_FILE_PREAMBLE "boardReader" +#define ARTDAQ_FCL_PATH std::string(getenv("OTS_SCRATCH")) + "/TriggerConfigurations/" +#define ARTDAQ_FILE_PREAMBLE "boardReader" //helpers -#define OUT out << tabStr << commentStr -#define PUSHTAB tabStr += "\t" -#define POPTAB tabStr.resize(tabStr.size()-1) -#define PUSHCOMMENT commentStr += "# " -#define POPCOMMENT commentStr.resize(commentStr.size()-2) +#define OUT out << tabStr << commentStr +#define PUSHTAB tabStr += "\t" +#define POPTAB tabStr.resize(tabStr.size() - 1) +#define PUSHCOMMENT commentStr += "# " +#define POPCOMMENT commentStr.resize(commentStr.size() - 2) -#undef __COUT__ -#define __COUT__ __COUT_TYPE__(TLVL_DEBUG+10) << __COUT_HDR__ +#undef __COUTS__(10) +#define __COUTS__(10) __COUT_TYPE__(TLVL_DEBUG + 10) << __COUT_HDR__ //======================================================================================================================== -TriggerConfigTable::TriggerConfigTable(void) - : TableBase("TriggerConfigTable") +TriggerConfigTable::TriggerConfigTable(void) : TableBase("TriggerConfigTable") { - ////////////////////////////////////////////////////////////////////// - //WARNING: the names used in C++ MUST match the Table INFO // - ////////////////////////////////////////////////////////////////////// - __COUT__ <<"[TriggerConfigTable::TriggerConfigTable] Initializing the TriggerConfigTable plugin..." << __E__; - // exit(0); - __COUT__ << StringMacros::stackTrace() << __E__; -} //end constructor + ////////////////////////////////////////////////////////////////////// + //WARNING: the names used in C++ MUST match the Table INFO // + ////////////////////////////////////////////////////////////////////// + __COUTS__(10) << "[TriggerConfigTable::TriggerConfigTable] Initializing the " + "TriggerConfigTable plugin..." + << __E__; + // exit(0); + __COUTS__(10) << StringMacros::stackTrace() << __E__; +} //end constructor //======================================================================================================================== -TriggerConfigTable::~TriggerConfigTable(void) -{} +TriggerConfigTable::~TriggerConfigTable(void) {} //======================================================================================================================== void TriggerConfigTable::init(ConfigurationManager* configManager) { - isFirstAppInContext_ = configManager->isOwnerFirstAppInContext(); - - __COUTV__(isFirstAppInContext_); - if(!isFirstAppInContext_) return; - - //make directory just in case - mkdir((ARTDAQ_FCL_PATH).c_str(), 0755); - - std::string trigEpilogsDir; - std::string fcl_dir = "TriggerEpilogs"; - trigEpilogsDir = ARTDAQ_FCL_PATH + fcl_dir; - mkdir(trigEpilogsDir.c_str(), 0755); - - auto childrenMap = configManager->__SELF_NODE__.getChildren(); - __COUT__ <<"printing children content"<<__E__; - __COUT__ <<"children map size"<__SELF_NODE__ << std::endl; - - // auto childrenMap = configManager->__SELF_NODE__.getChildren(); - // __COUT__ <<"printing children content"<<__E__; - // __COUT__ <<"children map size"< list_of_pathIDs; - - // for (auto &triggerPathPair : triggerPaths) - // { - // __COUT__ << "internal LOOP" << __E__; - // __COUT__ << "Trigger Path '" << triggerPathPair.first << "'" << __E__; - // __COUT__ << "Trigger Name '" << triggerPathPair.second.getNode("TriggerName").getValue() << "'" << __E__; - - // std::string trigger_status = triggerPathPair.second.getNode("Status").getValue(); - // if (trigger_status == "Off"){ - // __COUT__ << "Trigger status is Off" << __E__; - // continue; - // } - // ots::ConfigurationTree singlePath = triggerPathPair.second.getNode("LinkToTriggerTable"); - // __COUT__ << "singlePath : " << singlePath << __E__; - // __COUT__ << "singlePath.isDisconnected : " << singlePath.isDisconnected() << __E__; - // // __COUT__ << "singlePath.getNode : " << StringMacros::vectorToString(singlePath.getChildrenNames()) << __E__; - // // __COUT__ << "singlePath.getConfigurationManager " << singlePath.getConfigurationManager() << __E__; - // // __COUT__ << "singlePath.getConfigurationManager()->getTableByName " << singlePath.getConfigurationManager()->getTableByName("TriggerParameterTable") << __E__; - - - // std::string triggerType = triggerPathPair.second.getNode("TriggerType").getValue(); - // int pathID = triggerPathPair.second.getNode("PathID").getValue(); - - // __COUT__ << "Trigger Type '" << triggerType << "'" << __E__; - - // //create the fcl housing the trigger-path configurations - // epilogName = trigEpilogsDir + "/" + triggerPathPair.first + ".fcl"; - // allPathsFile << "#include \"Trigger_epilogs/" << triggerPathPair.first<<".fcl\"" << __E__; - // //we need to append the line where we instantiate the given TriggerPath - // // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ @sequence::Trigger.paths."<< triggerPathPair.first<< " ]\n" << __E__; - // // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ makeSD, CaloDigiMaker, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]\n" << __E__; - // //allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ dtcEventVerifier, artFragFromDTCEvents, makeSD, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]" << __E__; - // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ artFragFromDTCEvents, makeSD, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]" << __E__; - // allPathsFile << "art.physics.trigger_paths["<< pathID <<"] : " << triggerPathPair.first << "_trigger \n"<< __E__; - - // epilogFclFile.open(epilogName.c_str()); - - // //check if the pathID is already usd by another trigger chain - // for (auto & id : list_of_pathIDs){ - // if (id == pathID){ - // __SS__ << "Attempt to use twice the same PathID : "<< pathID << std::endl; - // __COUT_ERR__ << ss.str() << std::endl; - // __SS_THROW__; - // } - // } - - // //create the directory that will house all the epilogs of a given triggerPath - // std::string singlePathEpilogsDir, singlePathPairFclName; - // // singlePathEpilogsDir = "%sTrigger_epilogs/%s", (ARTDAQ_FCL_PATH).c_str(), triggerPathPair.first.c_str()); - // singlePathEpilogsDir = ARTDAQ_FCL_PATH + "Trigger_epilogs/" + triggerPathPair.first; - // mkdir(singlePathEpilogsDir.c_str(), 0755); - // __COUT__ << "single path epilogs dir " << singlePathEpilogsDir << __E__; - - // //set the general prescale factor at the beginning of the path - // createPrescaleEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, triggerPathPair.second); //singlePath); - - // if (triggerType == "TrackSeed") - // { - // //to set up the Tracking filters we need to loop over the children of the corresponding node - // createTrackingFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); - // } - // else if (triggerType == "Helix") - // { - // singlePath.getNode("LinkToDigiFilterParameterTable"); - // createHelixFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); - // } - // else if (triggerType == "DigiCount") - // { - // createDigiCountFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); - // } - - // __COUT__ <<" closing epilogFclFile" <<__E__; - - // epilogFclFile.close(); - // __COUT__ << "epilogFclFile closed... " << __E__; - - // ++counter; - // __COUT__ <<"counter = " << counter <<", map-size = " << children_map_size <<__E__; - // // if (counter == children_map_size-2) break; - // }//end loop over triggerPathPair - - // __COUT__ <<" end of main LOOP" <<__E__; - - // }//end loop over topLevelPair - - // __COUT__ << "loop completed closed... " << __E__; - - - // triggerFclFile.close(); - // __COUT__ << "triggerFclFile closed... " << __E__; - + isFirstAppInContext_ = configManager->isOwnerFirstAppInContext(); + + __COUTV__(isFirstAppInContext_); + if(!isFirstAppInContext_) + return; + + //make directory just in case + mkdir((ARTDAQ_FCL_PATH).c_str(), 0755); + + std::string trigEpilogsDir; + std::string fcl_dir = "TriggerEpilogs"; + trigEpilogsDir = ARTDAQ_FCL_PATH + fcl_dir; + mkdir(trigEpilogsDir.c_str(), 0755); + + auto childrenMap = configManager->__SELF_NODE__.getChildren(); + __COUTS__(10) << "printing children content" << __E__; + __COUTS__(10) << "children map size" << childrenMap.size() << __E__; + + auto& topLevelPair = childrenMap.at(0); + __COUTS__(10) << "Main table name '" << topLevelPair.first << "'" << __E__; + auto triggerMenuName = topLevelPair.second.getNode("TriggerDocName").getValue(); + auto triggerMenuVersion = topLevelPair.second.getNode("TriggerConfigTag").getValue(); + + //now download from MONGO-Db the trigger table to be used + std::string getTableFromMongoDb = "otsdaq_load_json_document "; + std::string triggerTableName = triggerMenuName; //" testTriggerDoc "; + std::string triggerTableVersion = triggerMenuVersion; //" 6 "; + std::string outputFileName = ARTDAQ_FCL_PATH + "/physMenu.json"; + + getTableFromMongoDb += + triggerTableName + " " + triggerTableVersion + " " + outputFileName; + __COUTS__(10) << "otsdaq_load_json command: " << getTableFromMongoDb << __E__; + ; + system(getTableFromMongoDb.c_str()); + + __COUTS__(10) << StringMacros::stackTrace() << __E__; + + std::string command = + "python ${SPACK_ENV}/mu2e-trig-config/python/generateMenuFromJSON.py"; + std::string menuFile = " -mf " + outputFileName; + std::string output = " -o " + trigEpilogsDir; + std::string evtMode = " -evtMode all"; + + command += menuFile + output + evtMode; + system(command.c_str()); + + // //create the fcl file + // std::ofstream triggerFclFile, epilogFclFile, subEpilogFclFile, allPathsFile; + // std::string fclFileName, skelethonName, allPathsFileName; + // std::string epilogName; + // //skelethon to clone + // // skelethonName = Form("%s/main.fcl", (ARTDAQ_FCL_PATH).c_str()); + // skelethonName = ARTDAQ_FCL_PATH + "/main.fcl" ; + // //file to be edited + // // fclFileName = Form("%s/runTriggerExample.fcl", (ARTDAQ_FCL_PATH).c_str()); + // fclFileName = ARTDAQ_FCL_PATH+"/runTriggerExample.fcl"; + + // //file that will house all the includes necessary to run the trigger paths + // allPathsFileName = trigEpilogsDir+ "/allPaths.fcl"; + + // std::ifstream mainFclFile; + // mainFclFile .open(skelethonName); + // triggerFclFile.open(fclFileName); + // allPathsFile .open(allPathsFileName); + + // std::string line; + // while (std::getline(mainFclFile, line, '\n') ) triggerFclFile << line << '\n'; + + // //we need to append the line where include the fcl that will contain all the trigger paths + // triggerFclFile << "#include \"Trigger_epilogs/allPaths.fcl\""<<__E__; + + // __COUTS__(10) << "*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*" << std::endl; + // __COUTS__(10) << configManager->__SELF_NODE__ << std::endl; + + // auto childrenMap = configManager->__SELF_NODE__.getChildren(); + // __COUTS__(10) <<"printing children content"<<__E__; + // __COUTS__(10) <<"children map size"< list_of_pathIDs; + + // for (auto &triggerPathPair : triggerPaths) + // { + // __COUTS__(10) << "internal LOOP" << __E__; + // __COUTS__(10) << "Trigger Path '" << triggerPathPair.first << "'" << __E__; + // __COUTS__(10) << "Trigger Name '" << triggerPathPair.second.getNode("TriggerName").getValue() << "'" << __E__; + + // std::string trigger_status = triggerPathPair.second.getNode("Status").getValue(); + // if (trigger_status == "Off"){ + // __COUTS__(10) << "Trigger status is Off" << __E__; + // continue; + // } + // ots::ConfigurationTree singlePath = triggerPathPair.second.getNode("LinkToTriggerTable"); + // __COUTS__(10) << "singlePath : " << singlePath << __E__; + // __COUTS__(10) << "singlePath.isDisconnected : " << singlePath.isDisconnected() << __E__; + // // __COUTS__(10) << "singlePath.getNode : " << StringMacros::vectorToString(singlePath.getChildrenNames()) << __E__; + // // __COUTS__(10) << "singlePath.getConfigurationManager " << singlePath.getConfigurationManager() << __E__; + // // __COUTS__(10) << "singlePath.getConfigurationManager()->getTableByName " << singlePath.getConfigurationManager()->getTableByName("TriggerParameterTable") << __E__; + + // std::string triggerType = triggerPathPair.second.getNode("TriggerType").getValue(); + // int pathID = triggerPathPair.second.getNode("PathID").getValue(); + + // __COUTS__(10) << "Trigger Type '" << triggerType << "'" << __E__; + + // //create the fcl housing the trigger-path configurations + // epilogName = trigEpilogsDir + "/" + triggerPathPair.first + ".fcl"; + // allPathsFile << "#include \"Trigger_epilogs/" << triggerPathPair.first<<".fcl\"" << __E__; + // //we need to append the line where we instantiate the given TriggerPath + // // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ @sequence::Trigger.paths."<< triggerPathPair.first<< " ]\n" << __E__; + // // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ makeSD, CaloDigiMaker, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]\n" << __E__; + // //allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ dtcEventVerifier, artFragFromDTCEvents, makeSD, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]" << __E__; + // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ artFragFromDTCEvents, makeSD, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]" << __E__; + // allPathsFile << "art.physics.trigger_paths["<< pathID <<"] : " << triggerPathPair.first << "_trigger \n"<< __E__; + + // epilogFclFile.open(epilogName.c_str()); + + // //check if the pathID is already usd by another trigger chain + // for (auto & id : list_of_pathIDs){ + // if (id == pathID){ + // __SS__ << "Attempt to use twice the same PathID : "<< pathID << std::endl; + // __COUT_ERR__ << ss.str() << std::endl; + // __SS_THROW__; + // } + // } + + // //create the directory that will house all the epilogs of a given triggerPath + // std::string singlePathEpilogsDir, singlePathPairFclName; + // // singlePathEpilogsDir = "%sTrigger_epilogs/%s", (ARTDAQ_FCL_PATH).c_str(), triggerPathPair.first.c_str()); + // singlePathEpilogsDir = ARTDAQ_FCL_PATH + "Trigger_epilogs/" + triggerPathPair.first; + // mkdir(singlePathEpilogsDir.c_str(), 0755); + // __COUTS__(10) << "single path epilogs dir " << singlePathEpilogsDir << __E__; + + // //set the general prescale factor at the beginning of the path + // createPrescaleEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, triggerPathPair.second); //singlePath); + + // if (triggerType == "TrackSeed") + // { + // //to set up the Tracking filters we need to loop over the children of the corresponding node + // createTrackingFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); + // } + // else if (triggerType == "Helix") + // { + // singlePath.getNode("LinkToDigiFilterParameterTable"); + // createHelixFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); + // } + // else if (triggerType == "DigiCount") + // { + // createDigiCountFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); + // } + + // __COUTS__(10) <<" closing epilogFclFile" <<__E__; + + // epilogFclFile.close(); + // __COUTS__(10) << "epilogFclFile closed... " << __E__; + + // ++counter; + // __COUTS__(10) <<"counter = " << counter <<", map-size = " << children_map_size <<__E__; + // // if (counter == children_map_size-2) break; + // }//end loop over triggerPathPair + + // __COUTS__(10) <<" end of main LOOP" <<__E__; + + // }//end loop over topLevelPair + + // __COUTS__(10) << "loop completed closed... " << __E__; + + // triggerFclFile.close(); + // __COUTS__(10) << "triggerFclFile closed... " << __E__; } - //---------------------------------------------------------------------------------------------------- // this function creates a string usde to set the module names in a given trigPath //---------------------------------------------------------------------------------------------------- -std::string TriggerConfigTable::GetModuleNameFromPath(std::string &TrigPath) +std::string TriggerConfigTable::GetModuleNameFromPath(std::string& TrigPath) { - std::string del("_"); - std::string name(TrigPath); - std::string newName = ""; - __COUT__ << "TrigPath = " << TrigPath << __E__; - - auto pos = name.find(del); - if(pos == std::string::npos) { - newName = name; - }else { - newName = name.substr(0,pos); - name.erase(0, pos+del.length()); - __COUT__ << "newName = " < Date: Tue, 3 Feb 2026 15:22:55 -0600 Subject: [PATCH 4/8] Sanitize values for system call --- .../TablePlugins/TriggerConfigTable_table.cc | 188 ++++-------------- 1 file changed, 35 insertions(+), 153 deletions(-) diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc index 27413b9..7595f69 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc @@ -28,8 +28,8 @@ TriggerConfigTable::TriggerConfigTable(void) : TableBase("TriggerConfigTable") //WARNING: the names used in C++ MUST match the Table INFO // ////////////////////////////////////////////////////////////////////// __COUTS__(10) << "[TriggerConfigTable::TriggerConfigTable] Initializing the " - "TriggerConfigTable plugin..." - << __E__; + "TriggerConfigTable plugin..." + << __E__; // exit(0); __COUTS__(10) << StringMacros::stackTrace() << __E__; } //end constructor @@ -63,16 +63,40 @@ void TriggerConfigTable::init(ConfigurationManager* configManager) //now download from MONGO-Db the trigger table to be used std::string getTableFromMongoDb = "otsdaq_load_json_document "; - std::string triggerTableName = topLevelPair.second.getNode("TriggerDocName").getValue(); //" testTriggerDoc "; - std::string triggerTableVersion = topLevelPair.second.getNode("TriggerConfigTag").getValue(); //" 6 "; - std::string outputFileName = ARTDAQ_FCL_PATH + "/physMenu.json"; + std::string triggerTableName = + topLevelPair.second.getNode("TriggerDocName").getValue(); //" testTriggerDoc "; + std::string triggerTableVersion = + topLevelPair.second.getNode("TriggerConfigTag").getValue(); //" 6 "; + std::string outputFileName = ARTDAQ_FCL_PATH + "/physMenu.json"; + + //sanitize values for system call + for(size_t c = 0; c < triggerTableName.size(); ++c) + if(!((triggerTableName[c] >= 'a' && triggerTableName[c] <= 'z') || + (triggerTableName[c] >= 'A' && triggerTableName[c] <= 'Z') || + (triggerTableName[c] >= '0' && triggerTableName[c] <= '9') || + triggerTableName[c] >= '_' || triggerTableName[c] <= '-')) + { + __SS__ << "Illegal character found in triggerTableName '" << triggerTableName + << "' ... only alpha-numeric, dashes, and underscores allowed." + << __E__; + __SS_THROW__; + } + + for(size_t c = 0; c < triggerTableVersion.size(); ++c) + if(!((triggerTableVersion[c] >= '0' && triggerTableVersion[c] <= '9'))) + { + __SS__ << "Illegal character found in triggerTableVersion '" + << triggerTableVersion << "' ... only numeric characters allowed." + << __E__; + __SS_THROW__; + } getTableFromMongoDb += triggerTableName + " " + triggerTableVersion + " " + outputFileName; __COUTS__(10) << "otsdaq_load_json command: " << getTableFromMongoDb << __E__; - + int statusCode = system(getTableFromMongoDb.c_str()); - __COUTVS__(10,statusCode); + __COUTVS__(10, statusCode); __COUTS__(10) << StringMacros::stackTrace() << __E__; @@ -84,152 +108,9 @@ void TriggerConfigTable::init(ConfigurationManager* configManager) command += menuFile + output + evtMode; statusCode = system(command.c_str()); - __COUTVS__(10,statusCode); - - // //create the fcl file - // std::ofstream triggerFclFile, epilogFclFile, subEpilogFclFile, allPathsFile; - // std::string fclFileName, skelethonName, allPathsFileName; - // std::string epilogName; - // //skelethon to clone - // // skelethonName = Form("%s/main.fcl", (ARTDAQ_FCL_PATH).c_str()); - // skelethonName = ARTDAQ_FCL_PATH + "/main.fcl" ; - // //file to be edited - // // fclFileName = Form("%s/runTriggerExample.fcl", (ARTDAQ_FCL_PATH).c_str()); - // fclFileName = ARTDAQ_FCL_PATH+"/runTriggerExample.fcl"; - - // //file that will house all the includes necessary to run the trigger paths - // allPathsFileName = trigEpilogsDir+ "/allPaths.fcl"; - - // std::ifstream mainFclFile; - // mainFclFile .open(skelethonName); - // triggerFclFile.open(fclFileName); - // allPathsFile .open(allPathsFileName); - - // std::string line; - // while (std::getline(mainFclFile, line, '\n') ) triggerFclFile << line << '\n'; - - // //we need to append the line where include the fcl that will contain all the trigger paths - // triggerFclFile << "#include \"Trigger_epilogs/allPaths.fcl\""<<__E__; - - // __COUTS__(10) << "*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*" << std::endl; - // __COUTS__(10) << configManager->__SELF_NODE__ << std::endl; - - // auto childrenMap = configManager->__SELF_NODE__.getChildren(); - // __COUTS__(10) <<"printing children content"<<__E__; - // __COUTS__(10) <<"children map size"< list_of_pathIDs; - - // for (auto &triggerPathPair : triggerPaths) - // { - // __COUTS__(10) << "internal LOOP" << __E__; - // __COUTS__(10) << "Trigger Path '" << triggerPathPair.first << "'" << __E__; - // __COUTS__(10) << "Trigger Name '" << triggerPathPair.second.getNode("TriggerName").getValue() << "'" << __E__; - - // std::string trigger_status = triggerPathPair.second.getNode("Status").getValue(); - // if (trigger_status == "Off"){ - // __COUTS__(10) << "Trigger status is Off" << __E__; - // continue; - // } - // ots::ConfigurationTree singlePath = triggerPathPair.second.getNode("LinkToTriggerTable"); - // __COUTS__(10) << "singlePath : " << singlePath << __E__; - // __COUTS__(10) << "singlePath.isDisconnected : " << singlePath.isDisconnected() << __E__; - // // __COUTS__(10) << "singlePath.getNode : " << StringMacros::vectorToString(singlePath.getChildrenNames()) << __E__; - // // __COUTS__(10) << "singlePath.getConfigurationManager " << singlePath.getConfigurationManager() << __E__; - // // __COUTS__(10) << "singlePath.getConfigurationManager()->getTableByName " << singlePath.getConfigurationManager()->getTableByName("TriggerParameterTable") << __E__; + __COUTVS__(10, statusCode); - // std::string triggerType = triggerPathPair.second.getNode("TriggerType").getValue(); - // int pathID = triggerPathPair.second.getNode("PathID").getValue(); - - // __COUTS__(10) << "Trigger Type '" << triggerType << "'" << __E__; - - // //create the fcl housing the trigger-path configurations - // epilogName = trigEpilogsDir + "/" + triggerPathPair.first + ".fcl"; - // allPathsFile << "#include \"Trigger_epilogs/" << triggerPathPair.first<<".fcl\"" << __E__; - // //we need to append the line where we instantiate the given TriggerPath - // // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ @sequence::Trigger.paths."<< triggerPathPair.first<< " ]\n" << __E__; - // // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ makeSD, CaloDigiMaker, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]\n" << __E__; - // //allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ dtcEventVerifier, artFragFromDTCEvents, makeSD, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]" << __E__; - // allPathsFile << "art.physics." << triggerPathPair.first << "_trigger : [ artFragFromDTCEvents, makeSD, @sequence::Trigger.paths."<< triggerPathPair.first<< " ]" << __E__; - // allPathsFile << "art.physics.trigger_paths["<< pathID <<"] : " << triggerPathPair.first << "_trigger \n"<< __E__; - - // epilogFclFile.open(epilogName.c_str()); - - // //check if the pathID is already usd by another trigger chain - // for (auto & id : list_of_pathIDs){ - // if (id == pathID){ - // __SS__ << "Attempt to use twice the same PathID : "<< pathID << std::endl; - // __COUT_ERR__ << ss.str() << std::endl; - // __SS_THROW__; - // } - // } - - // //create the directory that will house all the epilogs of a given triggerPath - // std::string singlePathEpilogsDir, singlePathPairFclName; - // // singlePathEpilogsDir = "%sTrigger_epilogs/%s", (ARTDAQ_FCL_PATH).c_str(), triggerPathPair.first.c_str()); - // singlePathEpilogsDir = ARTDAQ_FCL_PATH + "Trigger_epilogs/" + triggerPathPair.first; - // mkdir(singlePathEpilogsDir.c_str(), 0755); - // __COUTS__(10) << "single path epilogs dir " << singlePathEpilogsDir << __E__; - - // //set the general prescale factor at the beginning of the path - // createPrescaleEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, triggerPathPair.second); //singlePath); - - // if (triggerType == "TrackSeed") - // { - // //to set up the Tracking filters we need to loop over the children of the corresponding node - // createTrackingFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); - // } - // else if (triggerType == "Helix") - // { - // singlePath.getNode("LinkToDigiFilterParameterTable"); - // createHelixFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); - // } - // else if (triggerType == "DigiCount") - // { - // createDigiCountFiltersEpilog (epilogFclFile, singlePathEpilogsDir, triggerPathPair.first, singlePath); - // } - - // __COUTS__(10) <<" closing epilogFclFile" <<__E__; - - // epilogFclFile.close(); - // __COUTS__(10) << "epilogFclFile closed... " << __E__; - - // ++counter; - // __COUTS__(10) <<"counter = " << counter <<", map-size = " << children_map_size <<__E__; - // // if (counter == children_map_size-2) break; - // }//end loop over triggerPathPair - - // __COUTS__(10) <<" end of main LOOP" <<__E__; - - // }//end loop over topLevelPair - - // __COUTS__(10) << "loop completed closed... " << __E__; - - // triggerFclFile.close(); - // __COUTS__(10) << "triggerFclFile closed... " << __E__; -} +} //end init() //---------------------------------------------------------------------------------------------------- // this function creates a string usde to set the module names in a given trigPath @@ -270,7 +151,8 @@ std::string TriggerConfigTable::GetModuleNameFromPath(std::string& TrigPath) newName += token; } name.erase(0, pos + del.length()); - __COUTS__(10) << "[while ] newName = " << newName << ", name = " << name << __E__; + __COUTS__(10) << "[while ] newName = " << newName << ", name = " << name + << __E__; } while(name.length() > 0); //name.find(del) != std::string::npos); } From 6b46ca6ca5f84dc2b03ffa8fb56265f971e5e6aa Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Tue, 3 Feb 2026 15:23:48 -0600 Subject: [PATCH 5/8] Deleted stale functions --- .../TablePlugins/TriggerConfigTable.h | 5 -- .../TablePlugins/TriggerConfigTable_table.cc | 47 ------------------- 2 files changed, 52 deletions(-) diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h index 374b27e..db1d90a 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h @@ -19,11 +19,6 @@ class TriggerConfigTable : public TableBase //Methods void init (ConfigurationManager* configManager); - void createTriggerMenuFiles (std::ofstream& EpilogFclFile, - std::string& EpilogDir, - std::string& TrigPath, - ots::ConfigurationTree ConfTree); - std::string GetModuleNameFromPath (std::string& TrigPath); }; // clang-format on } // namespace ots diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc index 7595f69..23dee42 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc @@ -112,51 +112,4 @@ void TriggerConfigTable::init(ConfigurationManager* configManager) } //end init() -//---------------------------------------------------------------------------------------------------- -// this function creates a string usde to set the module names in a given trigPath -//---------------------------------------------------------------------------------------------------- -std::string TriggerConfigTable::GetModuleNameFromPath(std::string& TrigPath) -{ - std::string del("_"); - std::string name(TrigPath); - std::string newName = ""; - __COUTS__(10) << "TrigPath = " << TrigPath << __E__; - - auto pos = name.find(del); - if(pos == std::string::npos) - { - newName = name; - } - else - { - newName = name.substr(0, pos); - name.erase(0, pos + del.length()); - __COUTS__(10) << "newName = " << newName << ", name = " << name << __E__; - - //while(name.length() >0) - do - { - auto pos = name.find(del); - std::string token = name.substr(0, pos); - if((pos == std::string::npos) && (name.length() > 0)) - { - token = name; - name = ""; - } - if((newName != "") && - (token.find("timing") == - std::string::npos)) //convert to upper case the first letter - { - token[0] = token[0] - 32; - newName += token; - } - name.erase(0, pos + del.length()); - __COUTS__(10) << "[while ] newName = " << newName << ", name = " << name - << __E__; - - } while(name.length() > 0); //name.find(del) != std::string::npos); - } - return newName; -} - DEFINE_OTS_TABLE(TriggerConfigTable) From d545027360335966f567583265b0402978b18ea2 Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Tue, 3 Feb 2026 15:36:59 -0600 Subject: [PATCH 6/8] Sanitize bug fix --- .../TablePlugins/TriggerConfigTable_table.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc index 23dee42..7d8c650 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc @@ -58,6 +58,13 @@ void TriggerConfigTable::init(ConfigurationManager* configManager) __COUTS__(10) << "printing children content" << __E__; __COUTS__(10) << "children map size" << childrenMap.size() << __E__; + if(childrenMap.empty()) + { + __SS__ << "There is no record in the table '" << configManager->__SELF_NODE__.getTableName() + << "' - the first record is required to define the Trigger Menu document and tag!" << __E__; + __SS_THROW__; + } + auto& topLevelPair = childrenMap.at(0); __COUTS__(10) << "Main table name '" << topLevelPair.first << "'" << __E__; @@ -74,7 +81,7 @@ void TriggerConfigTable::init(ConfigurationManager* configManager) if(!((triggerTableName[c] >= 'a' && triggerTableName[c] <= 'z') || (triggerTableName[c] >= 'A' && triggerTableName[c] <= 'Z') || (triggerTableName[c] >= '0' && triggerTableName[c] <= '9') || - triggerTableName[c] >= '_' || triggerTableName[c] <= '-')) + triggerTableName[c] == '_' || triggerTableName[c] == '-')) { __SS__ << "Illegal character found in triggerTableName '" << triggerTableName << "' ... only alpha-numeric, dashes, and underscores allowed." From ed9bd2b312fb9205d5d136c20e8b25217d6bab81 Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Thu, 5 Feb 2026 09:18:53 -0600 Subject: [PATCH 7/8] Checkpoint in tests at MC2 --- .../TablePlugins/TriggerConfigTable.h | 6 +- .../TablePlugins/TriggerConfigTable_table.cc | 58 +++++++++++++++---- 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h index db1d90a..d40d716 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable.h @@ -18,7 +18,11 @@ class TriggerConfigTable : public TableBase virtual ~TriggerConfigTable(void); //Methods - void init (ConfigurationManager* configManager); + void init (ConfigurationManager* configManager) override; + void initPrereqsForARTDAQ (const ConfigurationManager* configManager) override; + + std::mutex prereqsGeneratedMutex_; + bool prereqsGenerated_ = false; }; // clang-format on } // namespace ots diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc index 7d8c650..d3c1375 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc @@ -40,12 +40,39 @@ TriggerConfigTable::~TriggerConfigTable(void) {} //======================================================================================================================== void TriggerConfigTable::init(ConfigurationManager* configManager) { + __COUTS__(10) << "*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*" << __E__; + __COUTS__(10) << configManager->__SELF_NODE__ << __E__; + isFirstAppInContext_ = configManager->isOwnerFirstAppInContext(); __COUTV__(isFirstAppInContext_); if(!isFirstAppInContext_) return; +} //end init() +//======================================================================================================================== +void TriggerConfigTable::initPrereqsForARTDAQ(const ConfigurationManager* configManager) +{ + __COUTS__(50) << "initPrereqsForARTDAQ()" << __E__; + __COUTS__(51) << StringMacros::stackTrace() << __E__; + + bool needToGenerate = false; + //lock for scope to check if need to generate in this thread + std::lock_guard lock(prereqsGeneratedMutex_); + if(!prereqsGenerated_) + needToGenerate = true; + + + if(!needToGenerate) //then wait for generation + { + __COUTS__(10) << "initPrereqsForARTDAQ() already generated!" << __E__; + return; //done! + } + + __COUTS__(10) << "initPrereqsForARTDAQ() generating!" << __E__; + __COUTS__(11) << StringMacros::stackTrace() << __E__; + + //make directory just in case mkdir((ARTDAQ_FCL_PATH).c_str(), 0755); @@ -55,7 +82,6 @@ void TriggerConfigTable::init(ConfigurationManager* configManager) mkdir(trigEpilogsDir.c_str(), 0755); auto childrenMap = configManager->__SELF_NODE__.getChildren(); - __COUTS__(10) << "printing children content" << __E__; __COUTS__(10) << "children map size" << childrenMap.size() << __E__; if(childrenMap.empty()) @@ -69,7 +95,6 @@ void TriggerConfigTable::init(ConfigurationManager* configManager) __COUTS__(10) << "Main table name '" << topLevelPair.first << "'" << __E__; //now download from MONGO-Db the trigger table to be used - std::string getTableFromMongoDb = "otsdaq_load_json_document "; std::string triggerTableName = topLevelPair.second.getNode("TriggerDocName").getValue(); //" testTriggerDoc "; std::string triggerTableVersion = @@ -98,25 +123,38 @@ void TriggerConfigTable::init(ConfigurationManager* configManager) __SS_THROW__; } + std::string getTableFromMongoDb = "otsdaq_load_json_document "; getTableFromMongoDb += triggerTableName + " " + triggerTableVersion + " " + outputFileName; __COUTS__(10) << "otsdaq_load_json command: " << getTableFromMongoDb << __E__; - int statusCode = system(getTableFromMongoDb.c_str()); - __COUTVS__(10, statusCode); + std::string laodJsonResult = StringMacros::exec(getTableFromMongoDb.c_str()); + __COUTVS__(10, laodJsonResult.size()); + __COUT_MULTI__(10, laodJsonResult); - __COUTS__(10) << StringMacros::stackTrace() << __E__; - std::string command = - "python ${SPACK_ENV}/mu2e-trig-config/python/generateMenuFromJSON.py"; std::string menuFile = " -mf " + outputFileName; std::string output = " -o " + trigEpilogsDir; std::string evtMode = " -evtMode all"; + std::string command = + "python generateMenuFromJSON.py"; command += menuFile + output + evtMode; - statusCode = system(command.c_str()); - __COUTVS__(10, statusCode); + __COUTS__(10) << "generateMenuFromJSON command: " << command << __E__; + std::string genMenuResult = StringMacros::exec(command.c_str()); + __COUTVS__(10, genMenuResult.size()); + __COUT_MULTI__(10, genMenuResult); + if(1 || genMenuResult == "") + { + command = + "python $OTSDAQ_DIR/python/generateMenuFromJSON.py"; + command += menuFile + output + evtMode; + __COUTS__(10) << "generateMenuFromJSON command tk2: " << command << __E__; + __COUTVS__(10, genMenuResult.size()); + __COUT_MULTI__(10, genMenuResult); + } -} //end init() + prereqsGenerated_ = true; +} //end initPrereqsForARTDAQ() DEFINE_OTS_TABLE(TriggerConfigTable) From 739197a39b22a0261fcb0a00daac1354fca602a6 Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Thu, 5 Feb 2026 09:21:59 -0600 Subject: [PATCH 8/8] Checkpoint at MC2 --- otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc index d3c1375..32814ce 100644 --- a/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc +++ b/otsdaq-mu2e-trigger/TablePlugins/TriggerConfigTable_table.cc @@ -150,6 +150,7 @@ void TriggerConfigTable::initPrereqsForARTDAQ(const ConfigurationManager* config "python $OTSDAQ_DIR/python/generateMenuFromJSON.py"; command += menuFile + output + evtMode; __COUTS__(10) << "generateMenuFromJSON command tk2: " << command << __E__; + genMenuResult = StringMacros::exec(command.c_str()); __COUTVS__(10, genMenuResult.size()); __COUT_MULTI__(10, genMenuResult); }