16 modelPath_(conf.getParameter<
edm::FileInPath>(
"onnxModelPath").
fullPath()),
19 eidMinClusterEnergy_(conf.getParameter<double>(
"eid_min_cluster_energy")),
20 eidNLayers_(conf.getParameter<
int>(
"eid_n_layers")),
21 eidNClusters_(conf.getParameter<
int>(
"eid_n_clusters")),
22 doPID_(conf.getParameter<
int>(
"doPID")),
23 doRegression_(conf.getParameter<
int>(
"doRegression"))
26 static std::unique_ptr<cms::Ort::ONNXRuntime> onnxRuntimeInstance =
27 std::make_unique<cms::Ort::ONNXRuntime>(
modelPath_.c_str());
33 std::vector<Trackster>& tracksters) {
35 for (
int i = 0; i < static_cast<int>(tracksters.size());
i++) {
36 float sumClusterEnergy = 0.;
40 tracksters[
i].setRegressedEnergy(0.
f);
41 tracksters[
i].zeroProbabilities();
63 std::vector<int> clusterIndices(trackster.
vertices().size());
64 for (
int k = 0; k < static_cast<int>(trackster.
vertices().size());
k++) {
65 clusterIndices[
k] =
k;
75 for (
const int&
k : clusterIndices) {
95 std::vector<std::vector<float>> outputTensors;
100 for (
int i = 0; i < static_cast<int>(
batchSize_);
i++) {
101 const float energy = outputTensors[0][
i];
111 std::vector<float> vec = outputTensors[probsIdx];
112 float* probs = vec.data();
123 iDesc.
add<
int>(
"algo_verbosity", 0);
126 edm::FileInPath(
"RecoHGCal/TICL/data/ticlv4/onnx_models/energy_id_v0.onnx"))
127 ->setComment(
"Path to ONNX PID model CLU3D");
128 iDesc.
add<std::vector<std::string>>(
"inputNames", {
"input:0"});
129 iDesc.
add<std::vector<std::string>>(
"outputNames", {
"output/regressed_energy:0",
"output/id_probabilities:0"});
130 iDesc.
add<
double>(
"eid_min_cluster_energy", 1.0);
131 iDesc.
add<
int>(
"eid_n_layers", 50);
132 iDesc.
add<
int>(
"eid_n_clusters", 10);
133 iDesc.
add<
int>(
"doPID", 1);
134 iDesc.
add<
int>(
"doRegression", 0);
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
double phi() const
azimuthal angle of cluster centroid
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
const std::vector< std::string > outputNames_
Abs< T >::type abs(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const cms::Ort::ONNXRuntime * onnxSession_
void inputData(const std::vector< reco::CaloCluster > &layerClusters, std::vector< Trackster > &tracksters) override
std::vector< std::vector< int64_t > > input_shapes_
double energy() const
cluster energy
std::vector< unsigned int > & vertices()
std::vector< float > & vertex_multiplicity()
std::vector< std::vector< float > > input_Data_
TracksterInferenceByCNNv4(const edm::ParameterSet &conf)
void runInference(std::vector< Trackster > &tracksters) override
double eta() const
pseudorapidity of cluster centroid
static constexpr int eidNFeatures_
const std::string modelPath_
const float eidMinClusterEnergy_
hgcal::RecHitTools rhtools_
const std::vector< std::string > inputNames_
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
std::vector< int > tracksterIndices_