17 conf.getParameter<
edm::FileInPath>(
"onnxPIDModelPath").
fullPath()),
19 conf.getParameter<
edm::FileInPath>(
"onnxEnergyModelPath").
fullPath()),
23 eidMinClusterEnergy_(conf.getParameter<double>(
"eid_min_cluster_energy")),
24 eidNLayers_(conf.getParameter<
int>(
"eid_n_layers")),
25 eidNClusters_(conf.getParameter<
int>(
"eid_n_clusters")),
26 doPID_(conf.getParameter<
int>(
"doPID")),
27 doRegression_(conf.getParameter<
int>(
"doRegression"))
30 static std::unique_ptr<cms::Ort::ONNXRuntime> onnxPIDRuntimeInstance =
31 std::make_unique<cms::Ort::ONNXRuntime>(
id_modelPath_.c_str());
33 static std::unique_ptr<cms::Ort::ONNXRuntime> onnxEnergyRuntimeInstance =
34 std::make_unique<cms::Ort::ONNXRuntime>(
en_modelPath_.c_str());
40 std::vector<Trackster>& tracksters) {
42 for (
int i = 0; i < static_cast<int>(tracksters.size());
i++) {
43 float sumClusterEnergy = 0.;
47 tracksters[
i].setRegressedEnergy(0.
f);
48 tracksters[
i].zeroProbabilities();
70 std::vector<int> clusterIndices(trackster.
vertices().size());
71 for (
int k = 0; k < static_cast<int>(trackster.
vertices().size());
k++) {
72 clusterIndices[
k] =
k;
82 for (
const int&
k : clusterIndices) {
105 auto& energyOutputTensor =
result[0];
107 for (
int i = 0; i < static_cast<int>(
batchSize_);
i++) {
108 const float energy = energyOutputTensor[
i];
117 auto pidOutputTensor = pidOutput[0];
118 float* probs = pidOutputTensor.data();
129 iDesc.
add<
int>(
"algo_verbosity", 0);
132 edm::FileInPath(
"RecoHGCal/TICL/data/ticlv5/onnx_models/patternrecognition/id_v0.onnx"))
133 ->setComment(
"Path to ONNX PID model CLU3D");
136 "onnxEnergyModelPath",
137 edm::FileInPath(
"RecoHGCal/TICL/data/ticlv5/onnx_models/patternrecognition/energy_v0.onnx"))
138 ->setComment(
"Path to ONNX Energy model CLU3D");
139 iDesc.
add<std::vector<std::string>>(
"inputNames", {
"input"});
140 iDesc.
add<std::vector<std::string>>(
"output_en", {
"enreg_output"});
141 iDesc.
add<std::vector<std::string>>(
"output_id", {
"pid_output"});
142 iDesc.
add<
double>(
"eid_min_cluster_energy", 1.0);
143 iDesc.
add<
int>(
"eid_n_layers", 50);
144 iDesc.
add<
int>(
"eid_n_clusters", 10);
145 iDesc.
add<
int>(
"doPID", 1);
146 iDesc.
add<
int>(
"doRegression", 1);
const std::vector< std::string > output_en_
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
hgcal::RecHitTools rhtools_
std::vector< std::vector< int64_t > > input_shapes_
const std::vector< std::string > inputNames_
void inputData(const std::vector< reco::CaloCluster > &layerClusters, std::vector< Trackster > &tracksters) override
TracksterInferenceByDNN(const edm::ParameterSet &conf)
double phi() const
azimuthal angle of cluster centroid
const cms::Ort::ONNXRuntime * onnxEnergySession_
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
const cms::Ort::ONNXRuntime * onnxPIDSession_
const std::string id_modelPath_
Abs< T >::type abs(const T &t)
void runInference(std::vector< Trackster > &tracksters) override
const std::vector< std::string > output_id_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double energy() const
cluster energy
std::vector< unsigned int > & vertices()
std::vector< float > & vertex_multiplicity()
const float eidMinClusterEnergy_
const std::string en_modelPath_
static constexpr int eidNFeatures_
std::vector< int > tracksterIndices_
double eta() const
pseudorapidity of cluster centroid
std::vector< std::vector< float > > input_Data_
FloatArrays run(const std::vector< std::string > &input_names, FloatArrays &input_values, const std::vector< std::vector< int64_t >> &input_shapes={}, const std::vector< std::string > &output_names={}, int64_t batch_size=1) const