diff --git a/Detector/DetDriftChamber/compact/det.xml b/Detector/DetDriftChamber/compact/det.xml index b62dd532daa4c15c48ae37228faeffe3fe32692f..fb4bffdeee7cb3cb61a4eafd8de6123629da6bbe 100644 --- a/Detector/DetDriftChamber/compact/det.xml +++ b/Detector/DetDriftChamber/compact/det.xml @@ -19,6 +19,8 @@ <define> + <constant name="tracker_region_rmax" value="1723*mm" /> + <constant name="tracker_region_zmax" value="3050*mm" /> <constant name="world_size" value="2226*mm"/> <constant name="world_x" value="world_size"/> <constant name="world_y" value="world_size"/> diff --git a/Simulation/DetSimDedx/CMakeLists.txt b/Simulation/DetSimDedx/CMakeLists.txt index 03bf40d9d9fcd35f039bceef58d450e07c23483a..867ff20cd4b6ed8f04919b89340901dccbb12272 100644 --- a/Simulation/DetSimDedx/CMakeLists.txt +++ b/Simulation/DetSimDedx/CMakeLists.txt @@ -2,7 +2,9 @@ find_package(Geant4 REQUIRED ui_all vis_all) include(${Geant4_USE_FILE}) find_package(Garfield REQUIRED) +message(Garfield::Garfield) message("libonnxruntime ${OnnxRuntime_LIBRARY}") +message("libonnxruntime include ${OnnxRuntime_INCLUDE_DIR}") find_package(OnnxRuntime REQUIRED) message("libonnxruntime ${OnnxRuntime_LIBRARY}") @@ -20,7 +22,8 @@ gaudi_add_module(DetSimDedx EDM4HEP::edm4hep EDM4HEP::edm4hepDict k4FWCore::k4FWCore Garfield::Garfield - ${OnnxRuntime_LIBRARY} + OnnxRuntime + #${OnnxRuntime_LIBRARY} #/cvmfs/sft.cern.ch/lcg/views/LCG_103/x86_64-centos7-gcc11-opt/lib/libonnxruntime.so ${CLHEP_LIBRARIES} diff --git a/Simulation/DetSimDedx/src/TrackHeedSimTool.cpp b/Simulation/DetSimDedx/src/TrackHeedSimTool.cpp index fb03cefec2c426a5e98f713944d9ccf44c76b02b..3bafda261a99e92b6a84182be886a87b55243ac2 100644 --- a/Simulation/DetSimDedx/src/TrackHeedSimTool.cpp +++ b/Simulation/DetSimDedx/src/TrackHeedSimTool.cpp @@ -428,9 +428,15 @@ StatusCode TrackHeedSimTool::initialize() auto num_input_nodes = m_session->GetInputCount(); if(m_debug) std::cout << "num_input_nodes: " << num_input_nodes << std::endl; for (size_t i = 0; i < num_input_nodes; ++i) { + #if (ORT_API_VERSION >=13) auto name = m_session->GetInputNameAllocated(i, m_allocator); m_inputNodeNameAllocatedStrings.push_back(std::move(name)); m_input_node_names.push_back(m_inputNodeNameAllocatedStrings.back().get()); + #else + auto name = m_session->GetInputName(i, m_allocator); + m_inputNodeNameAllocatedStrings.push_back(name); + m_input_node_names.push_back(m_inputNodeNameAllocatedStrings.back()); + #endif Ort::TypeInfo type_info = m_session->GetInputTypeInfo(i); auto tensor_info = type_info.GetTensorTypeAndShapeInfo(); @@ -441,7 +447,11 @@ StatusCode TrackHeedSimTool::initialize() if(m_debug) std::cout<< "[" << i << "]" + #if (ORT_API_VERSION >=13) << " input_name: " << m_inputNodeNameAllocatedStrings.back().get() + #else + << " input_name: " << m_inputNodeNameAllocatedStrings.back() + #endif << " ndims: " << dims.size() << " dims: " << dims_str(dims) << std::endl; @@ -449,15 +459,25 @@ StatusCode TrackHeedSimTool::initialize() // prepare the output size_t num_output_nodes = m_session->GetOutputCount(); for(std::size_t i = 0; i < num_output_nodes; i++) { + #if (ORT_API_VERSION >=13) auto output_name = m_session->GetOutputNameAllocated(i, m_allocator); m_outputNodeNameAllocatedStrings.push_back(std::move(output_name)); m_output_node_names.push_back(m_outputNodeNameAllocatedStrings.back().get()); + #else + auto output_name = m_session->GetOutputName(i, m_allocator); + m_outputNodeNameAllocatedStrings.push_back(output_name); + m_output_node_names.push_back(m_outputNodeNameAllocatedStrings.back()); + #endif Ort::TypeInfo type_info = m_session->GetOutputTypeInfo(i); auto tensor_info = type_info.GetTensorTypeAndShapeInfo(); ONNXTensorElementDataType type = tensor_info.GetElementType(); m_output_node_dims = tensor_info.GetShape(); if(m_debug) std::cout << "[" << i << "]" + #if (ORT_API_VERSION >=13) << " output_name: " << m_outputNodeNameAllocatedStrings.back().get() + #else + << " output_name: " << m_outputNodeNameAllocatedStrings.back() + #endif << " ndims: " << m_output_node_dims.size() << " dims: " << dims_str(m_output_node_dims) << std::endl; diff --git a/Simulation/DetSimDedx/src/TrackHeedSimTool.h b/Simulation/DetSimDedx/src/TrackHeedSimTool.h index d152fb9725f4124ad286f758e7643e16b7fa6b7e..46a9bd89b9447fcea2cc84c7d2987e4b3732190b 100644 --- a/Simulation/DetSimDedx/src/TrackHeedSimTool.h +++ b/Simulation/DetSimDedx/src/TrackHeedSimTool.h @@ -39,6 +39,7 @@ #include <string> #include "core/session/onnxruntime_cxx_api.h" +#include "core/session/onnxruntime_c_api.h" using namespace Garfield; class TrackHeedSimTool: public extends<AlgTool, IDedxSimTool> { @@ -135,9 +136,13 @@ class TrackHeedSimTool: public extends<AlgTool, IDedxSimTool> { std::vector<std::vector<int64_t>> m_input_node_dims; std::vector<const char*> m_output_node_names; std::vector<int64_t> m_output_node_dims; + #if (ORT_API_VERSION >=13) std::vector<Ort::AllocatedStringPtr> m_inputNodeNameAllocatedStrings; std::vector<Ort::AllocatedStringPtr> m_outputNodeNameAllocatedStrings; - + #else + std::vector<const char*> m_inputNodeNameAllocatedStrings; + std::vector<const char*> m_outputNodeNameAllocatedStrings; + #endif Gaudi::Property<bool> m_sim_pulse { this, "sim_pulse" , true }; Gaudi::Property<std::string> m_model_file{ this, "model", "model_test.onnx"};