diff --git a/Control/AthOnnx/AthOnnxComps/src/OnnxRuntimeSvc.cxx b/Control/AthOnnx/AthOnnxComps/src/OnnxRuntimeSvc.cxx index c45e2dba6faad8383bb56cdf2305882e00b6e0e3..7f510e9121d0f67d9c02154b24a2ec377af85526 100644 --- a/Control/AthOnnx/AthOnnxComps/src/OnnxRuntimeSvc.cxx +++ b/Control/AthOnnx/AthOnnxComps/src/OnnxRuntimeSvc.cxx @@ -2,7 +2,7 @@ // Local include(s). #include "OnnxRuntimeSvc.h" -#include <core/session/onnxruntime_c_api.h> +#include <onnxruntime_c_api.h> namespace AthOnnx { OnnxRuntimeSvc::OnnxRuntimeSvc(const std::string& name, ISvcLocator* svc) : diff --git a/Control/AthOnnx/AthOnnxComps/src/OnnxRuntimeSvc.h b/Control/AthOnnx/AthOnnxComps/src/OnnxRuntimeSvc.h index 9f90bc998f65963e95aafedd4fc5dd41f2a312ff..2e5588673c7e88e69097e533a9bcd1cff47d8cca 100644 --- a/Control/AthOnnx/AthOnnxComps/src/OnnxRuntimeSvc.h +++ b/Control/AthOnnx/AthOnnxComps/src/OnnxRuntimeSvc.h @@ -10,7 +10,7 @@ #include <AsgServices/AsgService.h> // ONNX include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> // System include(s). #include <memory> diff --git a/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeInferenceTool.h b/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeInferenceTool.h index f43466ea25ac7beb814221f715b530e283cd8c77..1f3faff5182d86a526427f7f9c08fc32e6062a09 100644 --- a/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeInferenceTool.h +++ b/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeInferenceTool.h @@ -6,7 +6,7 @@ #include "GaudiKernel/IAlgTool.h" #include <memory> -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> namespace AthOnnx { @@ -15,12 +15,12 @@ namespace AthOnnx { * @brief Interface class for creating Onnx Runtime sessions. * @details Interface class for creating Onnx Runtime sessions. * It is thread safe, supports models with various number of inputs and outputs, - * supports models with dynamic batch size, and usess . It defines a standardized procedure to + * supports models with dynamic batch size, and usess . It defines a standardized procedure to * perform Onnx Runtime inference. The procedure is as follows, assuming the tool `m_onnxTool` is created and initialized: - * 1. create input tensors from the input data: + * 1. create input tensors from the input data: * ```c++ * std::vector<Ort::Value> inputTensors; - * std::vector<float> inputData_1; // The input data is filled by users, possibly from the event information. + * std::vector<float> inputData_1; // The input data is filled by users, possibly from the event information. * int64_t batchSize = m_onnxTool->getBatchSize(inputData_1.size(), 0); // The batch size is determined by the input data size to support dynamic batch size. * m_onnxTool->addInput(inputTensors, inputData_1, 0, batchSize); * std::vector<int64_t> inputData_2; // Some models may have multiple inputs. Add inputs one by one. @@ -38,24 +38,24 @@ namespace AthOnnx { * m_onnxTool->inference(inputTensors, outputTensors); * ``` * 4. Model outputs will be automatically filled to outputData. - * - * + * + * * @author Xiangyang Ju <xju@cern.ch> */ - class IOnnxRuntimeInferenceTool : virtual public IAlgTool + class IOnnxRuntimeInferenceTool : virtual public IAlgTool { public: virtual ~IOnnxRuntimeInferenceTool() = default; - + // @name InterfaceID DeclareInterfaceID(IOnnxRuntimeInferenceTool, 1, 0); /** - * @brief set batch size. - * @details If the model has dynamic batch size, + * @brief set batch size. + * @details If the model has dynamic batch size, * the batchSize value will be set to both input shapes and output shapes - */ + */ virtual void setBatchSize(int64_t batchSize) = 0; /** @@ -63,7 +63,7 @@ namespace AthOnnx { * @param dataSize the size of the input data, like std::vector<T>::size() * @param idx the index of the input node * @return the batch size, which equals to dataSize / size of the rest dimensions. - */ + */ virtual int64_t getBatchSize(int64_t dataSize, int idx = 0) const = 0; /** diff --git a/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeSessionTool.h b/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeSessionTool.h index 4d94e68a840ea27896c436adc81c312cdc99a379..9fc6b05987d11f29362bb8d08da77961b9eaaec8 100644 --- a/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeSessionTool.h +++ b/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeSessionTool.h @@ -5,22 +5,22 @@ // Gaudi include(s). #include "GaudiKernel/IAlgTool.h" -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> namespace AthOnnx { // class IAlgTool // // Interface class for creating Onnx Runtime sessions. - // + // // @author Xiangyang Ju <xju@cern.ch> // - class IOnnxRuntimeSessionTool : virtual public IAlgTool + class IOnnxRuntimeSessionTool : virtual public IAlgTool { public: virtual ~IOnnxRuntimeSessionTool() = default; - + // @name InterfaceID DeclareInterfaceID(IOnnxRuntimeSessionTool, 1, 0); diff --git a/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeSvc.h b/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeSvc.h index b546392b55b40111169cd90d40a473f28d24e886..9f3eb3980641f7fdb8376d390560e32d5eb155ed 100644 --- a/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeSvc.h +++ b/Control/AthOnnx/AthOnnxInterfaces/AthOnnxInterfaces/IOnnxRuntimeSvc.h @@ -7,7 +7,7 @@ #include <AsgServices/IAsgService.h> // Onnx include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> /// Namespace holding all of the Onnx Runtime example code diff --git a/Control/AthOnnx/AthOnnxUtils/AthOnnxUtils/OnnxUtils.h b/Control/AthOnnx/AthOnnxUtils/AthOnnxUtils/OnnxUtils.h index 83ced9501c30d5278a5ac557d61ab66203e5f678..26df9c700d9add0eff688b35e343c1ab68a3e116 100644 --- a/Control/AthOnnx/AthOnnxUtils/AthOnnxUtils/OnnxUtils.h +++ b/Control/AthOnnx/AthOnnxUtils/AthOnnxUtils/OnnxUtils.h @@ -7,7 +7,7 @@ #include <vector> // Onnx Runtime include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> namespace AthOnnx { @@ -21,7 +21,7 @@ inline std::vector<T> flattenNestedVectors( const std::vector<std::vector<T>>& f // 1. Compute the total size required. int total_size = 0; for (const auto& feature : features) total_size += feature.size(); - + std::vector<T> flatten1D; flatten1D.reserve(total_size); @@ -39,7 +39,7 @@ inline std::vector<T> flattenNestedVectors( const std::vector<std::vector<T>>& f // the dataShape and nodeNames will be updated. void getInputNodeInfo( const Ort::Session& session, - std::vector<std::vector<int64_t> >& dataShape, + std::vector<std::vector<int64_t> >& dataShape, std::vector<std::string>& nodeNames); // @brief Get the output data shape and node names (in the computational graph) from the onnx model @@ -49,13 +49,13 @@ void getInputNodeInfo( // the dataShape and nodeNames will be updated. void getOutputNodeInfo( const Ort::Session& session, - std::vector<std::vector<int64_t> >& dataShape, + std::vector<std::vector<int64_t> >& dataShape, std::vector<std::string>& nodeNames); // Heleper function to get node info void getNodeInfo( const Ort::Session& session, - std::vector<std::vector<int64_t> >& dataShape, + std::vector<std::vector<int64_t> >& dataShape, std::vector<std::string>& nodeNames, bool isInput ); @@ -66,12 +66,12 @@ int64_t getTensorSize(const std::vector<int64_t>& dataShape); // Inference with IO binding. Better for performance, particularly for GPUs. // See https://onnxruntime.ai/docs/performance/tune-performance/iobinding.html -void inferenceWithIOBinding(Ort::Session& session, +void inferenceWithIOBinding(Ort::Session& session, const std::vector<std::string>& inputNames, const std::vector<Ort::Value>& inputData, const std::vector<std::string>& outputNames, const std::vector<Ort::Value>& outputData -); +); // @brief Create a tensor from a vector of data and its shape. Ort::Value createTensor(std::vector<float>& data, const std::vector<int64_t>& dataShape); diff --git a/Control/AthOnnxruntimeService/AthOnnxruntimeService/IONNXRuntimeSvc.h b/Control/AthOnnxruntimeService/AthOnnxruntimeService/IONNXRuntimeSvc.h index cae4f26e3049de47af10d15061c9aca59cd934ea..6c39f0a628c4245fef0d33c585c6000966d9c994 100644 --- a/Control/AthOnnxruntimeService/AthOnnxruntimeService/IONNXRuntimeSvc.h +++ b/Control/AthOnnxruntimeService/AthOnnxruntimeService/IONNXRuntimeSvc.h @@ -1,5 +1,5 @@ // Dear emacs, this is -*- c++ -*- -// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration #ifndef ATHEXONNXRUNTIME_IONNXRUNTIMESVC_H #define ATHEXONNXRUNTIME_IONNXRUNTIMESVC_H @@ -7,7 +7,7 @@ #include <AsgServices/IAsgService.h> // ONNX include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> /// Namespace holding all of the ONNX Runtime example code diff --git a/Control/AthOnnxruntimeService/AthOnnxruntimeService/ONNXRuntimeSvc.h b/Control/AthOnnxruntimeService/AthOnnxruntimeService/ONNXRuntimeSvc.h index 475c36f9dfd6a2b5b19c9983528587fb9acd0fc9..3c4e527f0a42fb853ddf13ae49cbbdcd9a722799 100644 --- a/Control/AthOnnxruntimeService/AthOnnxruntimeService/ONNXRuntimeSvc.h +++ b/Control/AthOnnxruntimeService/AthOnnxruntimeService/ONNXRuntimeSvc.h @@ -1,5 +1,5 @@ // Dear emacs, this is -*- c++ -*- -// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration #ifndef ATHONNXRUNTIMESERVICE_ONNXRUNTIMESVC_H #define ATHONNXRUNTIMESERVICE_ONNXRUNTIMESVC_H @@ -10,7 +10,7 @@ #include <AsgServices/AsgService.h> // ONNX include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> // System include(s). #include <memory> diff --git a/Control/AthOnnxruntimeUtils/AthOnnxruntimeUtils/OnnxUtils.h b/Control/AthOnnxruntimeUtils/AthOnnxruntimeUtils/OnnxUtils.h index 19f24b7a83f9704e267ff0ac695280577351f9fc..25cfcfbb70b9b60ed77d9f971bee6e883fa785e5 100644 --- a/Control/AthOnnxruntimeUtils/AthOnnxruntimeUtils/OnnxUtils.h +++ b/Control/AthOnnxruntimeUtils/AthOnnxruntimeUtils/OnnxUtils.h @@ -1,10 +1,10 @@ // Dear emacs, this is -*- c++ -*- -// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration #ifndef ONNX_UTILS_H #define ONNX_UTILS_H #include <string> -#include <iostream> +#include <iostream> #include <fstream> #include <arpa/inet.h> #include <vector> @@ -12,7 +12,7 @@ #include <tuple> // ONNX Runtime include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> // Local include(s). #include "AthOnnxruntimeService/IONNXRuntimeSvc.h" #include "GaudiKernel/ServiceHandle.h" @@ -20,7 +20,7 @@ namespace AthONNX { /************************Flattening of Input Data***************************/ -/***************************************************************************/ +/***************************************************************************/ template<typename T> @@ -28,7 +28,7 @@ namespace AthONNX { // 1. Compute the total size required. int total_size = 0; for (const auto& feature : features) total_size += feature.size(); - + // 2. Create a vector to hold the data. std::vector<T> Flatten1D; Flatten1D.reserve(total_size); @@ -37,7 +37,7 @@ namespace AthONNX { for (const auto& feature : features) for (const auto& elem : feature) Flatten1D.push_back(elem); - + return Flatten1D; } @@ -45,13 +45,13 @@ namespace AthONNX { /****************************************************************************************/ template<typename T> - inline Ort::Value TensorCreator(std::vector<T>& flattenData, std::vector<int64_t>& input_node_dims ){ + inline Ort::Value TensorCreator(std::vector<T>& flattenData, std::vector<int64_t>& input_node_dims ){ /************** Create input tensor object from input data values to feed into your model *********************/ - auto memory_info = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault); - Ort::Value input_tensor = Ort::Value::CreateTensor<T>(memory_info, - flattenData.data(), - flattenData.size(), /*** 1x28x28 = 784 ***/ - input_node_dims.data(), + auto memory_info = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault); + Ort::Value input_tensor = Ort::Value::CreateTensor<T>(memory_info, + flattenData.data(), + flattenData.size(), /*** 1x28x28 = 784 ***/ + input_node_dims.data(), input_node_dims.size()); /*** [1, 28, 28] = 3 ***/ return input_tensor; } @@ -62,7 +62,7 @@ namespace AthONNX { //template<typename T> inline std::unique_ptr< Ort::Session > CreateORTSession(const std::string& modelFile, bool withCUDA=false){ - + // Set up the ONNX Runtime session. Ort::SessionOptions sessionOptions; sessionOptions.SetIntraOpNumThreads( 1 ); @@ -84,7 +84,7 @@ namespace AthONNX { /***********************************************************************************************/ inline std::tuple<std::vector<int64_t>, std::vector<const char*> > GetInputNodeInfo(const std::unique_ptr< Ort::Session >& session){ - + std::vector<int64_t> input_node_dims; size_t num_input_nodes = session->GetInputCount(); std::vector<const char*> input_node_names(num_input_nodes); @@ -94,17 +94,17 @@ namespace AthONNX { input_node_names[i] = input_name; Ort::TypeInfo type_info = session->GetInputTypeInfo(i); auto tensor_info = type_info.GetTensorTypeAndShapeInfo(); - + input_node_dims = tensor_info.GetShape(); } - return std::make_tuple(input_node_dims, input_node_names); + return std::make_tuple(input_node_dims, input_node_names); } /*********************************Output Node Structure of Model*********************************/ /***********************************************************************************************/ inline std::tuple<std::vector<int64_t>, std::vector<const char*> > GetOutputNodeInfo(const std::unique_ptr< Ort::Session >& session){ - + //output nodes std::vector<int64_t> output_node_dims; size_t num_output_nodes = session->GetOutputCount(); @@ -132,20 +132,20 @@ namespace AthONNX { &input_tensor, input_node_names.size(), /** 1, flatten_input:0 **/ output_node_names.data(), - output_node_names.size()); /** 1, dense_1/Softmax:0 **/ - + output_node_names.size()); /** 1, dense_1/Softmax:0 **/ + //assert(output_tensor.size() == output_node_names.size() && output_tensor.front().IsTensor()); // Get pointer to output tensor float values float* floatarr = output_tensor.front().GetTensorMutableData<float>(); return floatarr; } - void InferenceWithIOBinding(const std::unique_ptr<Ort::Session>& session, + void InferenceWithIOBinding(const std::unique_ptr<Ort::Session>& session, const std::vector<const char*>& inputNames, const std::vector<Ort::Value>& inputData, const std::vector<const char*>& outputNames, const std::vector<Ort::Value>& outputData){ - + if (inputNames.empty()) { throw std::runtime_error("Onnxruntime input data maping cannot be empty"); } diff --git a/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModel.h b/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModel.h index d660543e5e584a75c390bc19aa4181cb722daf6f..f5792b7c60e84bad966fb62c409939ece6ad6641 100644 --- a/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModel.h +++ b/Control/AthenaExamples/AthExOnnxRuntime/src/EvaluateModel.h @@ -1,5 +1,5 @@ // Dear emacs, this is -*- c++ -*- -// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration #ifndef ATHEXONNXRUNTIME_EVALUATEMODEL_H #define ATHEXONNXRUNTIME_EVALUATEMODEL_H @@ -11,7 +11,7 @@ #include "GaudiKernel/ServiceHandle.h" // Onnx Runtime include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> // System include(s). #include <memory> @@ -61,7 +61,7 @@ namespace AthOnnx { ToolHandle< IOnnxRuntimeInferenceTool > m_onnxTool{ this, "ORTInferenceTool", "AthOnnx::OnnxRuntimeInferenceTool" }; - + std::vector<std::vector<std::vector<float>>> m_input_tensor_values_notFlat; }; // class EvaluateModel diff --git a/Generators/Rivet_i/CMakeLists.txt b/Generators/Rivet_i/CMakeLists.txt index 2fcd8c0e870a2c5e44634c44424a59b55b807236..74ed66c55057206ad61f633c9d98f54e4138420d 100644 --- a/Generators/Rivet_i/CMakeLists.txt +++ b/Generators/Rivet_i/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( Rivet_i ) @@ -9,6 +9,8 @@ find_package( FastJetContrib ) find_package( ROOT COMPONENTS Core Hist ) find_package( Rivet ) find_package( YODA ) +find_package( HighFive QUIET ) # Public dependency of Rivet 4.0.0 +find_package( HDF5 ) # Private dependency of Rivet 4.0.0 # Remove the --as-needed linker flags: atlas_disable_as_needed() @@ -21,6 +23,9 @@ atlas_add_component( Rivet_i LINK_LIBRARIES ${FASTJET_LIBRARIES} ${ROOT_LIBRARIES} AtlasHepMCLib TruthUtils ${RIVET_LIBRARIES} ${YODA_LIBRARIES} AthenaBaseComps CxxUtils GaudiKernel GenInterfacesLib AthenaKernel GeneratorObjects PathResolver xAODEventInfo ) +if( HIGHFIVE_FOUND ) + target_link_libraries( Rivet_i PRIVATE HighFive ) +endif() # Install file(s) from the package. atlas_install_scripts( share/setup* ) diff --git a/Generators/Rivet_i/src/Rivet_i.cxx b/Generators/Rivet_i/src/Rivet_i.cxx index 3f2288634528a4e06a1d07fdcc35282c2f52b3db..aa11e184fe20c27744aebb6b5f84da39ef5385aa 100644 --- a/Generators/Rivet_i/src/Rivet_i.cxx +++ b/Generators/Rivet_i/src/Rivet_i.cxx @@ -20,6 +20,7 @@ #include "Rivet/Rivet.hh" #include "Rivet/Analysis.hh" +#include "Rivet/Config/RivetConfig.hh" #include "Rivet/Tools/RivetYODA.hh" @@ -43,7 +44,7 @@ Rivet_i::Rivet_i(const std::string& name, ISvcLocator* pSvcLocator) : declareProperty("CrossSectionUncertainty", m_crossSection_uncert=0.0); declareProperty("Stream", m_stream="/Rivet"); declareProperty("RunName", m_runname=""); - declareProperty("HistoFile", m_file="Rivet.yoda"); + declareProperty("HistoFile", m_file="Rivet.yoda.gz"); declareProperty("HistoPreload", m_preload=""); declareProperty("AnalysisPath", m_anapath=""); declareProperty("IgnoreBeamCheck", m_ignorebeams=false); @@ -125,10 +126,17 @@ StatusCode Rivet_i::initialize ATLAS_NOT_THREAD_SAFE () { // Set up analysis handler m_analysisHandler = new Rivet::AnalysisHandler(m_runname); assert(m_analysisHandler); + + #if RIVET_VERSION_CODE >= 40000 + m_analysisHandler->setCheckBeams(!m_ignorebeams); //< Whether to do beam ID/energy consistency checks + m_analysisHandler->matchWeightNames(m_matchWeights); //< Only run on a subset of the multi-weights + m_analysisHandler->unmatchWeightNames(m_unmatchWeights); //< Veto a subset of the multi-weights + #else m_analysisHandler->setIgnoreBeams(m_ignorebeams); //< Whether to do beam ID/energy consistency checks - m_analysisHandler->skipMultiWeights(m_skipweights); //< Only run on the nominal weight m_analysisHandler->selectMultiWeights(m_matchWeights); //< Only run on a subset of the multi-weights m_analysisHandler->deselectMultiWeights(m_unmatchWeights); //< Veto a subset of the multi-weights + #endif + m_analysisHandler->skipMultiWeights(m_skipweights); //< Only run on the nominal weight m_analysisHandler->setNominalWeightName(m_nominalWeightName); if (m_weightcap>0) m_analysisHandler->setWeightCap(m_weightcap); @@ -169,7 +177,7 @@ StatusCode Rivet_i::execute() { m_needsConversion = !evtStore()->contains<McEventCollection>(m_genEventKey); ATH_MSG_DEBUG("Rivet_i needs xAOD::Truth to HepMC::GenEvent conversion? " << m_needsConversion); - const HepMC::GenEvent* checkedEvent; + std::unique_ptr<HepMC::GenEvent> checkedEvent; if (m_needsConversion) { const xAOD::TruthEventContainer* truthCollection; if (evtStore()->retrieve(truthCollection, "TruthEvents").isFailure()) { @@ -226,8 +234,6 @@ StatusCode Rivet_i::execute() { // Analyse the event m_analysisHandler->analyze(*checkedEvent); - delete checkedEvent; - return StatusCode::SUCCESS; } @@ -284,8 +290,8 @@ inline std::vector<std::string> split(const std::string& input, const std::strin return {first, last}; } -const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent& event, const EventContext& ctx) { - HepMC::GenEvent* modEvent = new HepMC::GenEvent(event); +std::unique_ptr<HepMC::GenEvent> Rivet_i::checkEvent(const HepMC::GenEvent& event, const EventContext& ctx) { + auto modEvent = std::make_unique<HepMC::GenEvent>(event); if (!m_needsConversion) { // overwrite the HEPMC dummy event number with the proper ATLAS event number @@ -406,25 +412,25 @@ const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent& event, const E modEvent->set_beam_particles(b1, b2); } if (modEvent->beams().front()->momentum().e() > 50000.0) { - MeV2GeV(modEvent); + MeV2GeV(*modEvent); } #else modEvent->use_units(HepMC::Units::GEV, HepMC::Units::MM); if (modEvent->particles_size() == 1) modEvent->set_beam_particles(*modEvent->particles_begin(), *modEvent->particles_begin()); if (modEvent->beam_particles().first->momentum().e() > 50000.0) { - MeV2GeV(modEvent); + MeV2GeV(*modEvent); } #endif return modEvent; } -void Rivet_i::MeV2GeV(HepMC::GenEvent* evt) { +void Rivet_i::MeV2GeV(HepMC::GenEvent& evt) { #ifdef HEPMC3 - for (auto& p: evt->particles()) { + for (auto& p: evt.particles()) { p->set_momentum(p->momentum()*0.001); #else - for (HepMC::GenParticlePtr p: *evt) { + for (HepMC::GenParticlePtr p: evt) { const HepMC::FourVector& mom = p->momentum(); p->set_momentum(HepMC::FourVector (mom.px()*0.001, mom.py()*0.001, @@ -434,4 +440,3 @@ void Rivet_i::MeV2GeV(HepMC::GenEvent* evt) { p->set_generated_mass(p->generated_mass()*0.001); } } - diff --git a/Generators/Rivet_i/src/Rivet_i.h b/Generators/Rivet_i/src/Rivet_i.h index c30f5097fc03029baff56904682506e3fef54b9f..77cf2b9c4b73e001c34a6c1150e6b9a23bbcb3e8 100644 --- a/Generators/Rivet_i/src/Rivet_i.h +++ b/Generators/Rivet_i/src/Rivet_i.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef RIVET_I_H @@ -17,6 +17,7 @@ #include <vector> #include <string> +#include <memory> class ISvcLocator; class IxAODtoHepMCTool; @@ -56,10 +57,10 @@ private: // StatusCode regGraph(const AIDA::IDataPointSet& dps, const std::string& path); // Check and potentially modify events for correct units, beam particles, ... - const HepMC::GenEvent* checkEvent(const HepMC::GenEvent& event, const EventContext& ctx); + std::unique_ptr<HepMC::GenEvent> checkEvent(const HepMC::GenEvent& event, const EventContext& ctx); // Utility method to convert units of the event - void MeV2GeV(HepMC::GenEvent* event); + void MeV2GeV(HepMC::GenEvent& event); /// A pointer to the THistSvc //ServiceHandle<ITHistSvc> m_histSvc; diff --git a/Generators/TruthRivetTools/CMakeLists.txt b/Generators/TruthRivetTools/CMakeLists.txt index d72cc1c682b2397fef146282f1bb0644b7e96478..9b67c8073e84ca57a6c76308fefe4cb9b4028740 100644 --- a/Generators/TruthRivetTools/CMakeLists.txt +++ b/Generators/TruthRivetTools/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Declare the name of the package: atlas_subdir( TruthRivetTools ) @@ -9,6 +9,8 @@ find_package( YODA ) find_package( FastJet ) find_package( ROOT COMPONENTS Core Physics ) find_package( GSL ) +find_package( HighFive QUIET ) # Public dependency of Rivet 4.0.0 +find_package( HDF5 ) # Private dependency of Rivet 4.0.0 # Remove the --as-needed linker flags: atlas_disable_as_needed() @@ -23,6 +25,9 @@ atlas_add_library( TruthRivetToolsLib LINK_LIBRARIES ${RIVET_LIBRARIES} ${YODA_LIBRARIES} ${FASTJET_LIBRARIES} ${ROOT_LIBRARIES} ${GSL_LIBRARIES} AsgTools AtlasHepMCLib AtlasHepMCsearchLib CxxUtils GenInterfacesLib ) +if( HIGHFIVE_FOUND ) + target_link_libraries( TruthRivetToolsLib PUBLIC HighFive ) +endif() atlas_add_component( TruthRivetTools src/components/*.cxx diff --git a/Generators/TruthRivetTools/Root/HiggsTruthCategoryTool.cxx b/Generators/TruthRivetTools/Root/HiggsTruthCategoryTool.cxx index f7c446c9d80f2e045a05f34c3f0ea523a7313f6c..e4a0de385b27d7174b556aaeea55c631cba77829 100644 --- a/Generators/TruthRivetTools/Root/HiggsTruthCategoryTool.cxx +++ b/Generators/TruthRivetTools/Root/HiggsTruthCategoryTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // TruthRivetTools includes @@ -7,10 +7,9 @@ #include <mutex> -HiggsTruthCategoryTool::HiggsTruthCategoryTool( const std::string& name) +HiggsTruthCategoryTool::HiggsTruthCategoryTool( const std::string& name) : asg::AsgTool( name ), - rivetAnaHandler(nullptr), - higgsTemplateCrossSections(nullptr) + m_higgsTemplateCrossSections( nullptr ) { // cannot be set to true until the issue with the beam protons in the truth event record is fixed.. // see JIRA ticket: https://its.cern.ch/jira/browse/ATLASRECTS-3072?filter=-2 @@ -21,11 +20,11 @@ HiggsTruthCategoryTool::HiggsTruthCategoryTool( const std::string& name) StatusCode HiggsTruthCategoryTool::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); // Rivet analysis :: Higgs truth event classifier class - higgsTemplateCrossSections = new Rivet::HiggsTemplateCrossSections(); + m_higgsTemplateCrossSections = new Rivet::HiggsTemplateCrossSections(); // create an instance of the Rivet analysis handler - rivetAnaHandler = new Rivet::AnalysisHandler(); + m_rivetAnaHandler = std::make_unique<Rivet::AnalysisHandler>(); // Add the Higgs truth classifier class to the handler - rivetAnaHandler->addAnalysis(higgsTemplateCrossSections); + m_rivetAnaHandler->addAnalysis(m_higgsTemplateCrossSections); return StatusCode::SUCCESS; } @@ -39,18 +38,18 @@ StatusCode HiggsTruthCategoryTool :: finalize () { } else{ // TODO:: update the tool properly deal with output files/paths - rivetAnaHandler->finalize(); - rivetAnaHandler->writeData("HiggsTruthCategoryTool.yoda"); + m_rivetAnaHandler->finalize(); + m_rivetAnaHandler->writeData("HiggsTruthCategoryTool.yoda"); } ATH_MSG_INFO (" ====================================================== "); - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } HTXS::HiggsClassification* HiggsTruthCategoryTool :: getHiggsTruthCategoryObject (const HepMC::GenEvent& HepMCEvent, const HTXS::HiggsProdMode prodMode) const { if ( !m_isInitialized.test_and_set() ) { [&]() { - higgsTemplateCrossSections->setHiggsProdMode(prodMode); - rivetAnaHandler->init(HepMCEvent); + m_higgsTemplateCrossSections->setHiggsProdMode(prodMode); + m_rivetAnaHandler->init(HepMCEvent); }(); } // fill histos if flag is specified @@ -58,7 +57,6 @@ HTXS::HiggsClassification* HiggsTruthCategoryTool :: getHiggsTruthCategoryObject // get the category output object containing the template cross section category, // and Higgs, V-boson, jets 4-vectors - const Rivet::HiggsClassification htxs_cat_rivet = higgsTemplateCrossSections->classifyEvent(HepMCEvent,prodMode); + const Rivet::HiggsClassification htxs_cat_rivet = m_higgsTemplateCrossSections->classifyEvent(const_cast<HepMC::GenEvent&>(HepMCEvent),prodMode); return HTXS::Rivet2Root(htxs_cat_rivet); } - diff --git a/Generators/TruthRivetTools/TruthRivetTools/HiggsTemplateCrossSections.h b/Generators/TruthRivetTools/TruthRivetTools/HiggsTemplateCrossSections.h index f94e7521c70cb7046bb3ec2e111bc3764c733620..0e61240fa79a26473e64864ccad8df70557e8885 100644 --- a/Generators/TruthRivetTools/TruthRivetTools/HiggsTemplateCrossSections.h +++ b/Generators/TruthRivetTools/TruthRivetTools/HiggsTemplateCrossSections.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef TRUTHRIVETTOOLS_HIGGSTEMPLATECROSSSECTIONS_H @@ -12,8 +12,8 @@ // Definition of the StatusCode and Category enums // Note: the Template XSec Defs *depends* on having included -// the TLorentzVector header *before* it is included -- it -// uses the include guard from TLorentzVector to decide +// the TLorentzVector header *before* it is included -- it +// uses the include guard from TLorentzVector to decide // what is available #include "TLorentzVector.h" #include "TruthRivetTools/HiggsTemplateCrossSectionsDefs.h" @@ -25,8 +25,8 @@ #include "CxxUtils/checker_macros.h" namespace Rivet { - - /// @class HiggsTemplateCrossSections + + /// @class HiggsTemplateCrossSections /// @brief Rivet routine for classifying MC events according to the Higgs template cross section categories /// @author Jim Lacey (DESY) <james.lacey@cern.ch,jlacey@desy.de> /// @author Dag Gillberg (Carleton University) <dag.gillberg@cern.ch> @@ -52,33 +52,33 @@ namespace Rivet { } return ptcl; } - + /// @brief Whether particle p originate from any of the ptcls bool originateFrom(const Particle& p, const Particles& ptcls ) const { auto prodVtx = p.genParticle()->production_vertex(); if (prodVtx == nullptr) return false; // for each ancestor, check if it matches any of the input particles - for (auto ancestor:Rivet::HepMCUtils::particles(prodVtx,Relatives::ANCESTORS)){ - for ( auto part:ptcls ) + for (auto ancestor:Rivet::HepMCUtils::particles(prodVtx,Relatives::ANCESTORS)){ + for ( auto part:ptcls ) if ( ancestor==part.genParticle() ) return true; } // if we get here, no ancetor matched any input particle - return false; + return false; } - + /// @brief Whether particle p originates from p2 bool originateFrom(const Particle& p, const Particle& p2 ) const { Particles ptcls = {p2}; return originateFrom(p,ptcls); } - - /// @brief Checks whether the input particle has a child with a given PDGID + + /// @brief Checks whether the input particle has a child with a given PDGID bool hasChild(HepMC::ConstGenParticlePtr ptcl, int pdgID) const { for (const Particle& child:Particle(*ptcl).children()) if (child.pid()==pdgID) return true; return false; } - - /// @brief Checks whether the input particle has a parent with a given PDGID + + /// @brief Checks whether the input particle has a parent with a given PDGID bool hasParent(HepMC::ConstGenParticlePtr ptcl, int pdgID) const { for (auto parent:Rivet::HepMCUtils::particles(ptcl->production_vertex(),Relatives::PARENTS)) if (parent->pdg_id()==pdgID) return true; @@ -95,13 +95,19 @@ namespace Rivet { /// @brief Return true if particle decays to charged leptons. bool ChLeptonDecay(const Particle &p) const { for (const Particle& child:p.children()) - if (PID::isChLepton(child.pid())) return true; + if ( +#if RIVET_VERSION_CODE >= 40000 + PID::isChargedLepton(child.pid()) +#else + PID::isChLepton(child.pid()) +#endif // RIVET_VERSION_CODE + ) return true; return false; } - + /// @brief Returns the classification object with the error code set. /// Prints an warning message, and keeps track of number of errors - HiggsClassification error(HiggsClassification &cat, HTXS::ErrorCode err, + HiggsClassification error(HiggsClassification &cat, HTXS::ErrorCode err, std::string msg="", int NmaxWarnings=20) const { // Set the error, and keep statistics cat.errorCode = err; @@ -131,13 +137,13 @@ namespace Rivet { cat.stage1_2_fine_cat_pTjet25GeV = HTXS::Stage1_2_Fine::UNKNOWN; cat.stage1_2_fine_cat_pTjet30GeV = HTXS::Stage1_2_Fine::UNKNOWN; - if (prodMode == HTXS::UNKNOWN) + if (prodMode == HTXS::UNKNOWN) return error(cat,HTXS::PRODMODE_DEFINED, - "Unkown Higgs production mechanism. Cannot classify event." + "Unkown Higgs production mechanism. Cannot classify event." " Classification for all events will most likely fail."); /***** - * Step 1. + * Step 1. * Idenfify the Higgs boson and the hard scatter vertex * There should be only one of each. */ @@ -159,21 +165,21 @@ namespace Rivet { } // Make sure things are in order so far - if (Nhiggs!=1) + if (Nhiggs!=1) return error(cat,HTXS::HIGGS_IDENTIFICATION, "Current event has "+std::to_string(Nhiggs)+" Higgs bosons. There must be only one."); - if (cat.higgs.children().size()<2) + if (cat.higgs.children().size()<2) return error(cat,HTXS::HIGGS_DECAY_IDENTIFICATION, "Could not identify Higgs boson decay products."); - if (HSvtx == nullptr) + if (HSvtx == nullptr) return error(cat,HTXS::HS_VTX_IDENTIFICATION,"Cannot find hard-scatter vertex of current event."); /***** - * Step 2. + * Step 2. * Identify associated vector bosons */ - + // Find associated vector bosons bool is_uncatdV = false; Particles uncatV_decays; @@ -197,7 +203,7 @@ namespace Rivet { is_uncatdV = true; cat.V = Particle(24,uncatV_p4,uncatV_v4); } } - + if ( !is_uncatdV ){ if ( isVH(prodMode) && !cat.V.genParticle()->end_vertex() ) @@ -205,13 +211,13 @@ namespace Rivet { if ( isVH(prodMode) && cat.V.children().size()<2 ) return error(cat,HTXS::VH_DECAY_IDENTIFICATION,"Vector boson does not decay!"); - + if ( ( prodMode==HTXS::WH && (nZs>0||nWs!=1) ) || - ( (prodMode==HTXS::QQ2ZH||prodMode==HTXS::GG2ZH) && (nZs!=1||nWs>0) ) ) + ( (prodMode==HTXS::QQ2ZH||prodMode==HTXS::GG2ZH) && (nZs!=1||nWs>0) ) ) return error(cat,HTXS::VH_IDENTIFICATION,"Found "+std::to_string(nWs)+" W-bosons and "+ std::to_string(nZs)+" Z-bosons. Inconsitent with VH expectation."); } - + // Find and store the W-bosons from ttH->WbWbH Particles Ws; if ( prodMode==HTXS::TTH || prodMode==HTXS::TH ){ @@ -219,7 +225,7 @@ namespace Rivet { for ( auto ptcl : Rivet::HepMCUtils::particles(HSvtx,Relatives::CHILDREN) ) { if ( !PID::isTop(ptcl->pdg_id()) ) continue; Particle top = getLastInstance(Particle(ptcl)); - if ( top.genParticle()->end_vertex() ) + if ( top.genParticle()->end_vertex() ) for (auto child:top.children()) if ( PID::isW(child.pid()) ) Ws += getLastInstance(child); } @@ -260,32 +266,38 @@ namespace Rivet { // All particles reaching here are considered hadrons and will be used to build jets hadrons += p; } - + cat.p4decay_higgs = hSum; cat.p4decay_V = vSum; FinalState fps_temp; - FastJets jets(fps_temp, FastJets::ANTIKT, 0.4 ); + FastJets jets(fps_temp, +#if RIVET_VERSION_CODE >= 40000 + JetAlg::ANTIKT, +#else + FastJets::ANTIKT, +#endif // RIVET_VERSION_CODE + 0.4 ); jets.calc(hadrons); cat.jets25 = jets.jetsByPt( Cuts::pT > 25.0 ); cat.jets30 = jets.jetsByPt( Cuts::pT > 30.0 ); - + // check that four mometum sum of all stable particles satisfies momentum consevation if ( sum.pt()>0.1 ) return error(cat,HTXS::MOMENTUM_CONSERVATION,"Four vector sum does not amount to pT=0, m=E=sqrt(s), but pT="+ std::to_string(sum.pt())+" GeV and m = "+std::to_string(sum.mass())+" GeV"); - + // check if V-boson was not included in the event record but decay particles were // EFT contact interaction: return UNKNOWN for category but set all event/particle kinematics - if(is_uncatdV) + if(is_uncatdV) return error(cat,HTXS::VH_IDENTIFICATION,"Failed to identify associated V-boson!"); - + /***** * Step 4. * Classify and save output */ - + // Apply the categorization categorization cat.isZ2vvDecay = false; if( (prodMode==HTXS::GG2ZH || prodMode==HTXS::QQ2ZH) && !quarkDecay(cat.V) && !ChLeptonDecay(cat.V) ) cat.isZ2vvDecay = true; @@ -299,14 +311,14 @@ namespace Rivet { cat.errorCode = HTXS::SUCCESS; ++m_errorCount[HTXS::SUCCESS]; return cat; - } + } /// @name Categorization methods /// Methods to assign the truth category based - /// on the identified Higgs boson and associated + /// on the identified Higgs boson and associated /// vector bosons and/or reconstructed jets /// @{ - + /// @brief Return bin index of x given the provided bin edges. 0=first bin, -1=underflow bin. int getBin(double x, const std::vector<double>& bins) const { if (bins.size()==0||x<bins[0]) return -1; // should not happen! @@ -314,7 +326,7 @@ namespace Rivet { if (x<bins[i]) return i-1; return bins.size()-1; } - + /// @brief VBF topolog selection /// 0 = fail loose selction: m_jj > 400 GeV and Dy_jj > 2.8 /// 1 pass loose, but fail additional cut pT(Hjj)<25. 2 pass tight selection @@ -355,7 +367,7 @@ namespace Rivet { /// @brief Whether the Higgs is produced in association with a vector boson (VH) bool isVH(HTXS::HiggsProdMode p) const { return p==HTXS::WH || p==HTXS::QQ2ZH || p==HTXS::GG2ZH; } - + /// @brief Stage-0 HTXS categorization HTXS::Stage0::Category getStage0Category(const HTXS::HiggsProdMode prodMode, const Particle &higgs, @@ -640,7 +652,7 @@ namespace Rivet { } // Projections for final state particles - const FinalState FS; + const FinalState FS; declare(FS,"FS"); // initialize the histograms with for each of the stages @@ -651,7 +663,7 @@ namespace Rivet { printf("======== Sucessful Initialization =========\n"); printf("==============================================================\n"); } - + // Perform the per-event analysis void analyze(const Event& event) { @@ -664,7 +676,7 @@ namespace Rivet { int F=cat.stage0_cat%10, P=cat.stage1_cat_pTjet30GeV/100; m_hist_stage0->fill( cat.stage0_cat/10*2+F, weight ); - + // Stage 1 enum offsets for each production mode: GGF=12, VBF=6, WH= 5, QQ2ZH=5, GG2ZH=4, TTH=2, BBH=2, TH=2 static const vector<int> offset({0,1,13,19,24,29,33,35,37,39}); int off = offset[P]; @@ -701,7 +713,7 @@ namespace Rivet { m_hist_pT_Hjj->fill((j1+j2+cat.higgs.momentum()).pt(),weight); } } - + void printClassificationSummary(){ MSG_INFO (" ====================================================== "); MSG_INFO (" Higgs Template X-Sec Categorization Tool "); @@ -731,7 +743,7 @@ namespace Rivet { m_hist_Njets25,m_hist_Njets30,m_hist_pT_Higgs,m_hist_y_Higgs,m_hist_pT_V,m_hist_pT_jet1,m_hist_deltay_jj,m_hist_dijet_mass,m_hist_pT_Hjj,m_hist_isZ2vv}) scale(hist, sf); } - + /* * initialize histograms */ @@ -760,7 +772,7 @@ namespace Rivet { /* * initialize private members used in the classification procedure */ - + private: double m_sumw=0.0; HTXS::HiggsProdMode m_HiggsProdMode; @@ -787,4 +799,3 @@ namespace Rivet { } #endif - diff --git a/Generators/TruthRivetTools/TruthRivetTools/HiggsTruthCategoryTool.h b/Generators/TruthRivetTools/TruthRivetTools/HiggsTruthCategoryTool.h index 705a7aabdc3d2a83b7d3e437fc3d38f6b12cac77..c98ec6920a87eba37c5a81b65c20b0a58bbb1269 100644 --- a/Generators/TruthRivetTools/TruthRivetTools/HiggsTruthCategoryTool.h +++ b/Generators/TruthRivetTools/TruthRivetTools/HiggsTruthCategoryTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /* @@ -27,25 +27,28 @@ // Return type (non-pointer) // Note: the Template XSec Defs *depends* on having included -// the TLorentzVector header *before* it is included -- it -// uses the include guard from TLorentzVector to decide +// the TLorentzVector header *before* it is included -- it +// uses the include guard from TLorentzVector to decide // what is available #include "TLorentzVector.h" #include "TruthRivetTools/HiggsTemplateCrossSectionsDefs.h" #include "AtlasHepMC/GenEvent.h" -class HiggsTruthCategoryTool -: public asg::AsgTool, - public virtual IHiggsTruthCategoryTool -{ - public: +// System include(s). +#include <memory> + +class HiggsTruthCategoryTool +: public asg::AsgTool, + public virtual IHiggsTruthCategoryTool +{ + public: ASG_TOOL_CLASS( HiggsTruthCategoryTool , IHiggsTruthCategoryTool ) HiggsTruthCategoryTool( const std::string& name ); - ~HiggsTruthCategoryTool() { }; + public: - Rivet::AnalysisHandler *rivetAnaHandler; //! - Rivet::HiggsTemplateCrossSections *higgsTemplateCrossSections; //! + std::unique_ptr<Rivet::AnalysisHandler> m_rivetAnaHandler; //! + Rivet::HiggsTemplateCrossSections* m_higgsTemplateCrossSections; //! virtual StatusCode initialize() override; StatusCode finalize () override; HTXS::HiggsClassification* getHiggsTruthCategoryObject(const HepMC::GenEvent& HepMCEvent, const HTXS::HiggsProdMode prodMode) const override; diff --git a/InnerDetector/InDetGNNTracking/src/SiGNNTrackFinderTool.h b/InnerDetector/InDetGNNTracking/src/SiGNNTrackFinderTool.h index 64dbf4af558667151cc5d842612ab43fa77e5aac..6f6a693a6e5585f6756179e07eae53f82651b652 100644 --- a/InnerDetector/InDetGNNTracking/src/SiGNNTrackFinderTool.h +++ b/InnerDetector/InDetGNNTracking/src/SiGNNTrackFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef SiGNNTrackFinder_H @@ -15,7 +15,7 @@ // ONNX Runtime include(s). #include "AthOnnxInterfaces/IOnnxRuntimeInferenceTool.h" -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> class MsgStream; @@ -36,13 +36,13 @@ namespace InDet{ /////////////////////////////////////////////////////////////////// // Main methods for local track finding asked by the ISiMLTrackFinder /////////////////////////////////////////////////////////////////// - + /** * @brief Get track candidates from a list of space points. * @param spacepoints a list of spacepoints as inputs to the GNN-based track finder. * @param tracks a list of track candidates. - * - * @return + * + * @return */ virtual StatusCode getTracks( const std::vector<const Trk::SpacePoint*>& spacepoints, @@ -85,7 +85,7 @@ namespace InDet{ }; MsgStream& operator << (MsgStream& ,const SiGNNTrackFinderTool&); - std::ostream& operator << (std::ostream&,const SiGNNTrackFinderTool&); + std::ostream& operator << (std::ostream&,const SiGNNTrackFinderTool&); } diff --git a/PhysicsAnalysis/AnalysisCommon/ONNXUtils/ONNXUtils/ONNXWrapper.h b/PhysicsAnalysis/AnalysisCommon/ONNXUtils/ONNXUtils/ONNXWrapper.h index 2cb9f453fd1231e2c515948e3c46c3d866f9acd4..eb74e0cf910f3d26618b53f936ea1a05f822ab26 100644 --- a/PhysicsAnalysis/AnalysisCommon/ONNXUtils/ONNXUtils/ONNXWrapper.h +++ b/PhysicsAnalysis/AnalysisCommon/ONNXUtils/ONNXUtils/ONNXWrapper.h @@ -10,7 +10,7 @@ #include "PathResolver/PathResolver.h" // ONNX Library -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> class ONNXWrapper { @@ -24,10 +24,10 @@ class ONNXWrapper { // Features of the network structure // input and output nodes - size_t m_nr_inputs; + size_t m_nr_inputs; size_t m_nr_output; - // dimensions of the input and output + // dimensions of the input and output std::map<std::string, std::vector<int64_t>> m_input_dims; std::map<std::string, std::vector<int64_t>> m_output_dims; @@ -51,7 +51,7 @@ class ONNXWrapper { // Constructor with parameters ONNXWrapper(const std::string model_path); - + std::map<std::string, std::vector<float>> Run( std::map<std::string, std::vector<float>> inputs, @@ -59,7 +59,7 @@ class ONNXWrapper { const std::map<std::string, std::vector<int64_t>> GetModelInputs(); const std::map<std::string, std::vector<int64_t>> GetModelOutputs(); - + const std::map<std::string, std::string> GetMETAData(); std::string GetMETADataByKey(const char * key); const std::vector<int64_t>& getInputShape(int input_nr); diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/OnnxOutput.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/OnnxOutput.h index 07a52a2eda237401def7d1f5be13285e89233186..c78955b5f7de7547cff1be7739a65b1d4153c2ef 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/OnnxOutput.h +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/OnnxOutput.h @@ -7,7 +7,7 @@ This class is used to store the configuration for a ONNX output node. #ifndef OUTPUTNODE_H #define OUTPUTNODE_H -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> #include "nlohmann/json.hpp" #include <string> diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/OnnxUtil.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/OnnxUtil.h index 4bbcb1c1adb64e568dffebcc19e2f82b2358b5cb..383ace1b4c83f5e0cc6eaf7f220d8a0b2c82e932 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/OnnxUtil.h +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/OnnxUtil.h @@ -2,7 +2,7 @@ Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration This class acts as the interface to an ONNX model. It handles loading model - the model, initializing the ORT session, and running inference. It is decoupled + the model, initializing the ORT session, and running inference. It is decoupled from the ATLAS EDM as much as possible. The FlavorTagDiscriminants::GNN class handles the interaction with the ATLAS EDM. */ @@ -10,7 +10,7 @@ #ifndef ONNXUTIL_H #define ONNXUTIL_H -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> #include "nlohmann/json.hpp" #include "lwtnn/parse_json.hh" @@ -64,7 +64,7 @@ namespace FlavorTagDiscriminants { private: const nlohmann::json loadMetadata(const std::string& key) const; const std::string determineModelName() const; - + nlohmann::json m_metadata; std::string m_path_to_onnx; diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/util/get-onnx-metadata.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/util/get-onnx-metadata.cxx index 014f8f167c4ca963e8fa4df490c6c94d27ac52e3..ba26bf550357061ced8d129a310f33dad5ce3833 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/util/get-onnx-metadata.cxx +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/util/get-onnx-metadata.cxx @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> #include <iostream> #include <cstdint> diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/util/get-onnx-model-info.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/util/get-onnx-model-info.cxx index 8f1a3f49bf5c3c7ee312d2af296474b8a60a319a..48ef1f1747ae58175af933d3daa5f17a78dd7fe5 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/util/get-onnx-model-info.cxx +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/util/get-onnx-model-info.cxx @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> #include <iostream> #include <iomanip> #include <unordered_map> @@ -52,7 +52,7 @@ void pretty_print_table( int line_length = max_length_name + 4 + 10 + 3 + max_length_shape; std::string h_line(line_length, '-'); - std::cout << h_line << std::endl; + std::cout << h_line << std::endl; // header std::ios_base::fmtflags f( std::cout.flags() ); //save cout format flags @@ -60,14 +60,14 @@ void pretty_print_table( std::cout << std::setw(10) << "type"; std::cout << "shape" << std::endl; - std::cout << h_line << std::endl; + std::cout << h_line << std::endl; for (size_t i = 0; i < names.size(); i++) { std::cout << std::left << std::setw(max_length_name + 4) << " " + names.at(i); std::cout << std::setw(10) << typeMap.at(types.at(i)); std::cout << shape_strs.at(i) << std::endl; - } - std::cout << h_line << std::endl; + } + std::cout << h_line << std::endl; std::cout.flags( f );//restore format } diff --git a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/xAODBTaggingEfficiency/OnnxUtil.h b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/xAODBTaggingEfficiency/OnnxUtil.h index c6f6b85b294b33ce2663a4d74730eebb48f4f960..9857b1c9a837f06edc3b27b6908a474e6530e203 100644 --- a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/xAODBTaggingEfficiency/OnnxUtil.h +++ b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/xAODBTaggingEfficiency/OnnxUtil.h @@ -1,11 +1,11 @@ /* -Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef ONNXUTIL_H #define ONNXUTIL_H -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> #include <string> #include <vector> #include <memory> @@ -20,7 +20,7 @@ class OnnxUtil final{ ~OnnxUtil() = default; void initialize(); - + // for fixed cut wp void runInference( const std::vector<std::vector<float>> & node_feat, @@ -41,10 +41,10 @@ class OnnxUtil final{ std::unique_ptr< Ort::Env > m_env; std::string m_path_to_onnx; - + // num_wp=1 for fixed cut; int m_num_wp{}; - + }; // Class OnnxUtil diff --git a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/onnx/Model.h b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/onnx/Model.h index da5b21baabea95ba0efe0040e2e3963f19bc534c..996bd0f1c7c7ba12acea6a54b42c418eb9c6c78c 100644 --- a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/onnx/Model.h +++ b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/onnx/Model.h @@ -1,12 +1,12 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#ifndef RingerSelectorTools_tools_onnx_Model_h -#define RingerSelectorTools_tools_onnx_Model_h +#ifndef RingerSelectorTools_tools_onnx_Model_h +#define RingerSelectorTools_tools_onnx_Model_h #include "AsgMessaging/AsgMessaging.h" -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> #include "AthOnnxruntimeService/IONNXRuntimeSvc.h" #include <assert.h> #include <vector> @@ -21,32 +21,32 @@ namespace Ringer{ class Model { public: - - /*! Constructor */ + + /*! Constructor */ Model( const std::string& modelPath, AthONNX::IONNXRuntimeSvc *svc, float etmin, float etmax, float etamin, float etamax, unsigned barcode); - + /*! Destructor */ ~Model()=default; - + void compile(); - /*! Get the Et lower edge */ + /*! Get the Et lower edge */ float etMin() const { return m_etmin; }; - + /*! Get the Et high edge */ float etMax() const { return m_etmax; }; - - /*! Get the Eta lower edge */ + + /*! Get the Eta lower edge */ float etaMin() const { return m_etamin; }; /*! Get the Eta high edge */ float etaMax() const { return m_etamax; }; - + /*! Calculate the disriminant */ float predict ( std::vector< std::vector<float> > & ) const; - + unsigned barcode() const { return m_barcode; }; private: @@ -57,7 +57,7 @@ namespace Ringer{ std::vector<int64_t> m_output_node_dims; std::vector<const char*> m_input_node_names; std::vector<const char*> m_output_node_names; - + float m_etmin, m_etmax; float m_etamin, m_etamax; unsigned m_barcode; diff --git a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/onnx/RingerSelector.h b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/onnx/RingerSelector.h index 68faa97ba571c3ea9103096318f7e4a0aa479c78..96160a788c8019c593ac9958fe6ae7c3c37ce032 100644 --- a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/onnx/RingerSelector.h +++ b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/onnx/RingerSelector.h @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#ifndef RingerSelectorTools_tools_onnx_RingerSelector_h -#define RingerSelectorTools_tools_onnx_RingerSelector_h +#ifndef RingerSelectorTools_tools_onnx_RingerSelector_h +#define RingerSelectorTools_tools_onnx_RingerSelector_h @@ -12,7 +12,7 @@ #include "RingerSelectorTools/tools/onnx/Model.h" #include "RingerSelectorTools/tools/onnx/Threshold.h" #include "AthOnnxruntimeService/IONNXRuntimeSvc.h" -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> #include "xAODTrigRinger/TrigRingerRings.h" #include "xAODTrigCalo/TrigEMCluster.h" #include "xAODTrigEgamma/TrigElectron.h" @@ -28,10 +28,10 @@ namespace Ringer { { public: - + /** Standard constructor */ RingerSelector( const std::string& name ); - + /** Standard destructor */ ~RingerSelector()=default; @@ -49,7 +49,7 @@ namespace Ringer { /** - * @brief Calculation of model output + * @brief Calculation of model output **/ float predict(const xAOD::TrigRingerRings *, const xAOD::TrigElectron * ) const; @@ -58,10 +58,10 @@ namespace Ringer { * @brief Accept method **/ bool accept(const xAOD::TrigRingerRings *, float discr, float mu ) const; - + private: - + /// @brief hold all onnx sessions std::vector< Ringer::onnx::Model > m_models; /// @brief hold all thresholds definitions @@ -72,12 +72,12 @@ namespace Ringer { /// @brief Get the list of values inside of tenv template <typename T> std::vector<T> GetValues (const std::string& input, TEnv& env); /// @brief Get the list of paths inside of tenv - std::vector<std::string> GetPaths(const std::string& input, TEnv& env); + std::vector<std::string> GetPaths(const std::string& input, TEnv& env); /// @brief Get basepath from calib path std::string GetBasePath(const std::string &path) const; }; - + } // namespace onnx } //namespace Ringer diff --git a/Projects/AnalysisBase/externals.txt b/Projects/AnalysisBase/externals.txt index 03cd0618a3c6f104d43baed70e6cdff96d9b7f33..dca07b82c9ba10bbd181ef1b833e48e268f270e3 100644 --- a/Projects/AnalysisBase/externals.txt +++ b/Projects/AnalysisBase/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AnalysisBaseExternalsVersion = 2.1.10 +AnalysisBaseExternalsVersion = 2.1.12 diff --git a/Projects/AthAnalysis/build_externals.sh b/Projects/AthAnalysis/build_externals.sh index 201d36cb7bbba1a319113f5b5dda27890b0023d6..4a557b7d2c49688ed2101fe371e45c9890892294 100755 --- a/Projects/AthAnalysis/build_externals.sh +++ b/Projects/AthAnalysis/build_externals.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # # Script building all the externals necessary for AthAnalysis. # @@ -10,7 +10,7 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthAnalysisExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=104 - -DLCG_VERSION_POSTFIX="d_ATLAS_7" + -DLCG_VERSION_POSTFIX="d_ATLAS_9" -DATLAS_ONNXRUNTIME_USE_CUDA=FALSE -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v38r0.000/Gaudi-v38r0.000.tar.gz;URL_MD5;af374562de2c29151881f49b4d8b49cf") ATLAS_EXTRA_MAKE_ARGS=() diff --git a/Projects/AthAnalysis/externals.txt b/Projects/AthAnalysis/externals.txt index 97410e6fe82e984e1cf8d86318c57aa6ec3595ff..412f3a1bb870cdfd5d2f0018626871b24cf0ee5e 100644 --- a/Projects/AthAnalysis/externals.txt +++ b/Projects/AthAnalysis/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthAnalysisExternalsVersion = 2.1.10 +AthAnalysisExternalsVersion = 2.1.12 diff --git a/Projects/AthGeneration/build_externals.sh b/Projects/AthGeneration/build_externals.sh index d2ce199d4e5fce1e32f5cdf7bff0b620c8f89a29..2923ec97c0dfd1b17d0f2a91275c33aa27953719 100755 --- a/Projects/AthGeneration/build_externals.sh +++ b/Projects/AthGeneration/build_externals.sh @@ -10,7 +10,7 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthGenerationExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=104 - -DLCG_VERSION_POSTFIX="d_ATLAS_7" + -DLCG_VERSION_POSTFIX="d_ATLAS_9" -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v38r0.000/Gaudi-v38r0.000.tar.gz;URL_MD5;af374562de2c29151881f49b4d8b49cf" -DATLAS_GEOMODEL_SOURCE="URL;https://gitlab.cern.ch/GeoModelDev/GeoModel/-/archive/5.3.0/GeoModel-5.3.0.tar.bz2;URL_MD5;69c41f2c12ada4d953b6452454f92a04" -DATLAS_GEOMODEL_PATCH="" diff --git a/Projects/AthGeneration/externals.txt b/Projects/AthGeneration/externals.txt index 8e2797e10e94f50a7147bb25eb9a06d9e2112dd5..e90a98c0a88b04627f0ec3e2c8c259db19c7ce31 100644 --- a/Projects/AthGeneration/externals.txt +++ b/Projects/AthGeneration/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthGenerationExternalsVersion = 2.1.10 +AthGenerationExternalsVersion = 2.1.12 diff --git a/Projects/AthSimulation/build_externals.sh b/Projects/AthSimulation/build_externals.sh index 9ab91d26a2f9546a8582e0ccb7800cb0417212c9..07adc639a0e1c1485037d833fc27079573898acf 100755 --- a/Projects/AthSimulation/build_externals.sh +++ b/Projects/AthSimulation/build_externals.sh @@ -10,7 +10,7 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthSimulationExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=104 - -DLCG_VERSION_POSTFIX="d_ATLAS_7" + -DLCG_VERSION_POSTFIX="d_ATLAS_9" -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v38r0.000/Gaudi-v38r0.000.tar.gz;URL_MD5;af374562de2c29151881f49b4d8b49cf" -DATLAS_GEOMODEL_SOURCE="URL;https://gitlab.cern.ch/GeoModelDev/GeoModel/-/archive/5.3.0/GeoModel-5.3.0.tar.bz2;URL_MD5;69c41f2c12ada4d953b6452454f92a04" -DATLAS_GEOMODEL_PATCH="" diff --git a/Projects/AthSimulation/externals.txt b/Projects/AthSimulation/externals.txt index f4d75095015347f18fd4a9decab067093c8b17e4..dcc382da801b1875f434c316686981fc8cf5953c 100644 --- a/Projects/AthSimulation/externals.txt +++ b/Projects/AthSimulation/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthSimulationExternalsVersion = 2.1.10 +AthSimulationExternalsVersion = 2.1.12 diff --git a/Projects/Athena/build_externals.sh b/Projects/Athena/build_externals.sh index 174be31bda98d3546adf484bd87ed498a54da376..59e9f6e1450ada518bc5dae4d0b99ab78ca8dbb4 100755 --- a/Projects/Athena/build_externals.sh +++ b/Projects/Athena/build_externals.sh @@ -10,7 +10,7 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthenaExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=104 - -DLCG_VERSION_POSTFIX="d_ATLAS_7" + -DLCG_VERSION_POSTFIX="d_ATLAS_9" -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v38r0.000/Gaudi-v38r0.000.tar.gz;URL_MD5;af374562de2c29151881f49b4d8b49cf" -DATLAS_ACTS_SOURCE="URL;https://github.com/acts-project/acts/archive/refs/tags/v32.0.2.tar.gz;URL_HASH;SHA256=a817a9b6434ae206c36b1c25df6139ffcde95234944d09e718125e14da7996b8" -DATLAS_GEOMODEL_SOURCE="URL;https://gitlab.cern.ch/GeoModelDev/GeoModel/-/archive/5.3.0/GeoModel-5.3.0.tar.bz2;URL_MD5;69c41f2c12ada4d953b6452454f92a04" diff --git a/Projects/Athena/externals.txt b/Projects/Athena/externals.txt index b9f46ba2910ceb81228dfd9003d492b282e49108..5398b1f3119077828f52707868712e56395c2a66 100644 --- a/Projects/Athena/externals.txt +++ b/Projects/Athena/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthenaExternalsVersion = 2.1.10 +AthenaExternalsVersion = 2.1.12 diff --git a/Projects/DetCommon/externals.txt b/Projects/DetCommon/externals.txt index 37599d205b5b4874b5a3f84a7075c6e93677002c..4e9521781706dfbdd1e06225ecf35d63247e2d8b 100644 --- a/Projects/DetCommon/externals.txt +++ b/Projects/DetCommon/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AtlasExternalsVersion = 2.1.10 +AtlasExternalsVersion = 2.1.12 diff --git a/Projects/VP1Light/build_externals.sh b/Projects/VP1Light/build_externals.sh index 5d3625644e5b01b71932338d49d67ba59ace5630..655ed86cd313a53cc6861c804db650e63562edf5 100755 --- a/Projects/VP1Light/build_externals.sh +++ b/Projects/VP1Light/build_externals.sh @@ -10,7 +10,7 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="VP1LightExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=104 - -DLCG_VERSION_POSTFIX="d_ATLAS_7" + -DLCG_VERSION_POSTFIX="d_ATLAS_9" -DATLAS_GEOMODEL_SOURCE="URL;https://gitlab.cern.ch/GeoModelDev/GeoModel/-/archive/5.3.0/GeoModel-5.3.0.tar.bz2;URL_MD5;69c41f2c12ada4d953b6452454f92a04" -DATLAS_GEOMODEL_PATCH="" -DATLAS_GEOMODEL_FORCEDOWNLOAD_MESSAGE="Forcing_the_re-download_of_GeoModel_(2024.01.27.)") diff --git a/Projects/VP1Light/externals.txt b/Projects/VP1Light/externals.txt index 9e53959ad6f2a3350e6e035489ac2094c5209907..090b04942f0e1048e628cdd0f842c348c51dcf28 100644 --- a/Projects/VP1Light/externals.txt +++ b/Projects/VP1Light/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -VP1LightExternalsVersion = 2.1.10 +VP1LightExternalsVersion = 2.1.12 diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSONNXHandler.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSONNXHandler.h index e03f096d89e3690a4bc76216f619ee0da19da0c2..d8ba3f20149a8cf275885a089907dd7bbd351147 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSONNXHandler.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSONNXHandler.h @@ -23,7 +23,7 @@ #include <iostream> // ONNX Runtime include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> // For reading and writing to root #include "TFile.h" diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSONNXHandler.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSONNXHandler.cxx index 92b1c513fd0af61dc58cb4dfb9d23b7949d16944..18f0eee944bf85118fd15381f915d40db15de19d 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSONNXHandler.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSONNXHandler.cxx @@ -11,7 +11,7 @@ #include <vector> // ONNX Runtime include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> // For reading and writing to root #include "TBranch.h" diff --git a/Simulation/Overlay/TrackOverlay/TrackOverlayRec/src/TrackOverlayDecisionAlg.cxx b/Simulation/Overlay/TrackOverlay/TrackOverlayRec/src/TrackOverlayDecisionAlg.cxx index 804bdfcb23e14db2e646061b6a5920387266203d..08b36a833b39f0b152fd25c5a9b8683527e4e0f7 100644 --- a/Simulation/Overlay/TrackOverlay/TrackOverlayRec/src/TrackOverlayDecisionAlg.cxx +++ b/Simulation/Overlay/TrackOverlay/TrackOverlayRec/src/TrackOverlayDecisionAlg.cxx @@ -1,5 +1,5 @@ /* - * * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + * * Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration * * */ // #include <fstream> @@ -7,7 +7,7 @@ #include <iostream> #include <vector> #include <sstream> -#include <unistd.h> +#include <unistd.h> #include <Eigen/Core> // #include "GaudiKernel/SystemOfUnits.h" @@ -20,7 +20,7 @@ #include "PathResolver/PathResolver.h" // ONNX Runtime include(s). -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> // #include "TrackOverlayDecisionAlg.h" #include "EventBookkeeperTools/FilterReporter.h" @@ -28,8 +28,8 @@ namespace TrackOverlayDecisionAlg { TrackOverlayDecisionAlg::TrackOverlayDecisionAlg( const std::string& name, ISvcLocator* pSvcLocator ) : ::AthReentrantAlgorithm( name, pSvcLocator ) - { - } + { + } StatusCode TrackOverlayDecisionAlg::initialize() { @@ -43,7 +43,7 @@ StatusCode TrackOverlayDecisionAlg::initialize() std::string this_file = __FILE__; const std::string model_path = PathResolverFindCalibFile("TrackOverlay/TrackOverlay_J7_model.onnx"); Ort::SessionOptions session_options; - + m_session = std::make_unique<Ort::Session>(m_svc->env(), model_path.c_str(), session_options); m_inputInfo = TrackOverlayDecisionAlg::GetInputNodeInfo(m_session); m_outputInfo = TrackOverlayDecisionAlg::GetOutputNodeInfo(m_session); @@ -107,32 +107,32 @@ const std::vector<const xAOD::TruthParticle*> TrackOverlayDecisionAlg::getTruthP for (const auto& link : links) { if (link.isValid()){ tempVec.push_back(*link); - } - } - } + } + } + } } else { ATH_MSG_ERROR("no entries in TruthPileupEvents container!"); - } + } } } else { ATH_MSG_ERROR("bad value for PileUpSwitch"); } - } + } return tempVec; } StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const { ATH_MSG_DEBUG ("Executing ..."); - + std::vector<const xAOD::TruthParticle*> truthParticlesVec = TrackOverlayDecisionAlg::getTruthParticles(); - + //Access truth info for the NN input float eventPxSum = 0.0; float eventPySum = 0.0; float eventPt = 0.0; float puEvents = 0.0; - + std::vector<float> pxValues, pyValues, pzValues, eValues, etaValues, phiValues, ptValues; float truthMultiplicity = 0.0; const int truthParticles = truthParticlesVec.size(); @@ -140,11 +140,11 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const const xAOD::TruthParticle* thisTruth = truthParticlesVec[itruth]; const IAthSelectionTool::CutResult accept = m_truthSelectionTool->accept(thisTruth); if(accept){ - pxValues.push_back((thisTruth->px()*0.001-1.46988000e+03)* px_diff); //as MinMaxScaler: 1.46988000e+03 is the lowest value of px from a J7 sample; *(0.001) is used to convert unit rather than *(1/1000) to speed up. + pxValues.push_back((thisTruth->px()*0.001-1.46988000e+03)* px_diff); //as MinMaxScaler: 1.46988000e+03 is the lowest value of px from a J7 sample; *(0.001) is used to convert unit rather than *(1/1000) to speed up. pyValues.push_back((thisTruth->py()*0.001-1.35142000e+03)* py_diff); //the lowest value of py: 1.35142000e+03 pzValues.push_back((thisTruth->pz()*0.001-1.50464000e+03)* pz_diff); //the lowest value of pz: 1.50464000e+03 ptValues.push_back((thisTruth->pt()*0.001-5.00006000e-01)* pt_diff); //the lowest value of pt: 5.00006000e-01 - + etaValues.push_back(thisTruth->eta()); phiValues.push_back(thisTruth->phi()); eValues.push_back((thisTruth->e()*0.001-5.08307000e-01)*e_diff); //the lowest value of energy: 5.08307000e-01 @@ -161,11 +161,11 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const } puEvents = !m_truthPileUpEventName.key().empty() and truthPileupEventContainer.isValid() ? static_cast<int>( truthPileupEventContainer->size() ) : pie.isValid() ? pie->actualInteractionsPerCrossing() : 0; eventPt = std::sqrt(eventPxSum*eventPxSum + eventPySum*eventPySum)*0.001; - + std::vector<float> puEventsVec(pxValues.size(), (puEvents-1.55000000e+01)*pu_diff); //min of puEvents= 15.5, max of puEvents=84.5 std::vector<float> truthMultiplicityVec(pxValues.size(), (truthMultiplicity-1.80000000e+01)*multi_diff); std::vector<float> eventPtVec(pxValues.size(), (eventPt-3.42359395e-01)*eventPt_diff); - std::vector<float> predictions; + std::vector<float> predictions; //Compute the distances using Eigen for Eigen's optimized operations. Initialize matirces. Observed a significant improvement on computing calculation. Eigen::VectorXf ptEigen = Eigen::VectorXf::Map(ptValues.data(), ptValues.size()); @@ -196,7 +196,7 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const pt_0p2 += ptEigen[j]; } }// for j - + std::vector<float> featData; featData.push_back(pxValues[i]); featData.push_back(pyValues[i]); @@ -209,11 +209,11 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const featData.push_back((sum_0p05 * area0p05) * constant4); featData.push_back(pt_0p2 * constant5); featData.push_back(pt_0p05 * constant6); - + featData.push_back(puEventsVec[i]); featData.push_back(truthMultiplicityVec[i]); featData.push_back(eventPtVec[i]); - + std::vector<int64_t> input_node_dims; std::vector<char*> input_node_names; input_node_dims = std::get<0>(m_inputInfo); @@ -223,7 +223,7 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const std::vector<char*> output_node_names; output_node_dims = std::get<0>(m_outputInfo); output_node_names = std::get<1>(m_outputInfo); - + Ort::MemoryInfo memoryInfo = Ort::MemoryInfo::CreateCpu(OrtArenaAllocator, OrtMemTypeCPU); input_node_dims[0]=1; Ort::Value input_data = Ort::Value::CreateTensor(memoryInfo, featData.data(), featData.size(), input_node_dims.data(), input_node_dims.size()); @@ -233,7 +233,7 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const auto output_values = mysession.Run(run_options, input_node_names.data(), &input_data, input_node_names.size(), output_node_names.data(), output_node_names.size()); float* predictionData = output_values[0].GetTensorMutableData<float>(); float prediction = predictionData[0]; - + predictions.push_back(prediction); }//for i float threshold = m_MLthreshold; @@ -245,7 +245,7 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const } } float rouletteScore = static_cast<float>(badTracks) / static_cast<float>(truthMultiplicity); - + FilterReporter filter(m_filterParams, false, ctx); bool pass = false; int decision = rouletteScore == 0; @@ -255,7 +255,7 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const else{ pass = false; } - + if (m_invertfilter) { pass =! pass; } @@ -266,5 +266,3 @@ StatusCode TrackOverlayDecisionAlg::execute(const EventContext &ctx) const }// end namespace TrackOverlayDecisionAlg - - diff --git a/Simulation/Overlay/TrackOverlay/TrackOverlayRec/src/TrackOverlayDecisionAlg.h b/Simulation/Overlay/TrackOverlay/TrackOverlayRec/src/TrackOverlayDecisionAlg.h index cd3f6086d817ad5c15c08469cfd20cc08ec3234d..d1ee540626e3f88c2a3e1643451b206a9691f383 100644 --- a/Simulation/Overlay/TrackOverlay/TrackOverlayRec/src/TrackOverlayDecisionAlg.h +++ b/Simulation/Overlay/TrackOverlay/TrackOverlayRec/src/TrackOverlayDecisionAlg.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + * Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration * */ #ifndef TRACKOVERLAYREC_TRACKOVERLAYDECISIONALG_H @@ -21,7 +21,7 @@ #include "xAODTruth/TruthEventContainer.h" #include "xAODTruth/TruthPileupEventContainer.h" //ONNX Runtime include(s) -#include <core/session/onnxruntime_cxx_api.h> +#include <onnxruntime_cxx_api.h> #include "AthOnnxruntimeService/IONNXRuntimeSvc.h" namespace TrackOverlayDecisionAlg{ const double M_TWOPI = 2.0 * M_PI; @@ -48,7 +48,7 @@ namespace TrackOverlayDecisionAlg{ /** Constructor with parameters */ TrackOverlayDecisionAlg( const std::string& name, ISvcLocator* pSvcLocator ); /** Destructor */ - virtual ~TrackOverlayDecisionAlg() = default; + virtual ~TrackOverlayDecisionAlg() = default; /** Athena algorithm's interface method initialize() */ virtual StatusCode initialize() override final; /** Athena algorithm's interface method execute() */ virtual StatusCode execute(const EventContext& ctx) const override final; @@ -107,7 +107,7 @@ namespace TrackOverlayDecisionAlg{ output_node_dims = tensor_info.GetShape(); } return std::make_tuple(output_node_dims, output_node_names); - } + } }; }