#include <OnlineDQMDigiAD_cmssw.h>
Public Member Functions | |
std::vector< std::vector< float > > | Inference (std::vector< float > &digiHcalMapTW, std::vector< float > &numEvents, std::vector< float > &adThr, std::vector< float > &input_model_state_memory_e_0_0, std::vector< float > &input_model_state_memory_e_0_1, std::vector< float > &input_model_state_memory_e_1_0, std::vector< float > &input_model_state_memory_e_1_1, std::vector< float > &input_model_state_memory_d_0_0, std::vector< float > &input_model_state_memory_d_0_1, std::vector< float > &input_model_state_memory_d_1_0, std::vector< float > &input_model_state_memory_d_1_1) |
Perform inference on a single image. More... | |
std::vector< std::vector< float > > | Inference_CMSSW (const std::vector< std::vector< float >> &digiHcal2DHist_depth_1, const std::vector< std::vector< float >> &digiHcal2DHist_depth_2, const std::vector< std::vector< float >> &digiHcal2DHist_depth_3, const std::vector< std::vector< float >> &digiHcal2DHist_depth_4, const std::vector< std::vector< float >> &digiHcal2DHist_depth_5, const std::vector< std::vector< float >> &digiHcal2DHist_depth_6, const std::vector< std::vector< float >> &digiHcal2DHist_depth_7, const float LS_numEvents, const float flagDecisionThr=20) |
Perform inference on a single image. More... | |
void | InitializeState () |
Resets ml model memory states to default and function needs to be called when new collision run starts. More... | |
void | IsModelExist (std::string hcal_subsystem_name) |
check whether onnx model integration is added for the selected hcal system More... | |
OnlineDQMDigiAD (const std::string model_system_name, const std::string &modelFilepath, cms::Ort::Backend backend=cms::Ort::Backend::cpu) | |
Constructor. More... | |
std::vector< std::vector< std::vector< float > > > | ONNXOutputToDQMHistMap (const std::vector< std::vector< float >> &ad_model_output_vectors, const int numDepth, const int numDIeta=64, const int selOutputIdx=7) |
Converts 1D serialized vector output of the onnx into 3d hcal-hehp vector. More... | |
Private Member Functions | |
std::vector< std::vector< float > > | Map1DTo2DVector (const std::vector< float > &input_1d_vec, const int numSplits) |
Converts serialized 1d vectors into 2d. More... | |
std::vector< float > | PrepareONNXDQMMapVectors (std::vector< std::vector< std::vector< float >>> &digiHcal2DHist_depth_all) |
Prepares model input serialized dqm histogram from 2D histogram inputs from the cmssw. More... | |
std::vector< float > | Serialize2DVector (const std::vector< std::vector< float >> &input_2d_vec) |
Serializes 2d vectors into 1d. More... | |
Private Attributes | |
int64_t | batch_size = 1 |
const std::vector< std::string > | hcal_modeled_systems = {"he", "hb"} |
std::string | hcal_subsystem_name |
std::vector< float > | input_model_state_memory_d_0_0 {std::vector<float>(model_state_layer_serialized_dims[1][0])} |
std::vector< float > | input_model_state_memory_d_0_1 {std::vector<float>(model_state_layer_serialized_dims[1][0])} |
std::vector< float > | input_model_state_memory_d_1_0 {std::vector<float>(model_state_layer_serialized_dims[1][1])} |
std::vector< float > | input_model_state_memory_d_1_1 {std::vector<float>(model_state_layer_serialized_dims[1][1])} |
std::vector< float > | input_model_state_memory_e_0_0 {std::vector<float>(model_state_layer_serialized_dims[0][0])} |
std::vector< float > | input_model_state_memory_e_0_1 {std::vector<float>(model_state_layer_serialized_dims[0][0])} |
std::vector< float > | input_model_state_memory_e_1_0 {std::vector<float>(model_state_layer_serialized_dims[0][1])} |
std::vector< float > | input_model_state_memory_e_1_1 {std::vector<float>(model_state_layer_serialized_dims[0][1])} |
const std::vector< std::string > | input_names |
std::vector< std::vector< int64_t > > | input_shapes |
std::vector< std::vector< float > > | input_values |
std::string | model_path |
const unsigned int | model_state_inner_dim = 2 |
const std::vector< std::vector< unsigned int > > | model_state_layer_dims |
const std::vector< std::vector< unsigned int > > | model_state_layer_serialized_dims |
unsigned | model_state_refresh_counter |
const size_t | num_state_vectors = 8 |
std::unique_ptr< cms::Ort::ONNXRuntime > | ort_mSession = nullptr |
const std::vector< std::string > | output_names |
std::vector< std::vector< float > > | output_values |
Definition at line 24 of file OnlineDQMDigiAD_cmssw.h.
OnlineDQMDigiAD::OnlineDQMDigiAD | ( | const std::string | model_system_name, |
const std::string & | modelFilepath, | ||
cms::Ort::Backend | backend = cms::Ort::Backend::cpu |
||
) |
Constructor.
modelFilepath | path to the .onnx file |
Backend | backend selection cpu or gpu |
Definition at line 31 of file OnlineDQMDigiAD_cmssw.cc.
References HLT_2024v11_cff::backend, cms::Ort::ONNXRuntime::defaultSessionOptions(), edm::FileInPath::fullPath(), HLT_2024v11_cff::model_path, eostools::move(), and AlCaHLTBitMon_QueryRunRegistry::string.
std::vector< std::vector< float > > OnlineDQMDigiAD::Inference | ( | std::vector< float > & | digiHcalMapTW, |
std::vector< float > & | numEvents, | ||
std::vector< float > & | adThr, | ||
std::vector< float > & | input_model_state_memory_e_0_0, | ||
std::vector< float > & | input_model_state_memory_e_0_1, | ||
std::vector< float > & | input_model_state_memory_e_1_0, | ||
std::vector< float > & | input_model_state_memory_e_1_1, | ||
std::vector< float > & | input_model_state_memory_d_0_0, | ||
std::vector< float > & | input_model_state_memory_d_0_1, | ||
std::vector< float > & | input_model_state_memory_d_1_0, | ||
std::vector< float > & | input_model_state_memory_d_1_1 | ||
) |
Perform inference on a single image.
digiHcalMapTW | The input digipccupany maps in time window |
numEvents | The input number of events for map renormalization in time window |
adThr | The anomaly detection decision threshold |
input_model_state_memory_ | The model memory states |
output_tensors | output arrays |
Definition at line 192 of file OnlineDQMDigiAD_cmssw.cc.
References HLT_2024v11_cff::input_names, simpleEdmComparison::numEvents, and HLT_2024v11_cff::output_names.
std::vector< std::vector< float > > OnlineDQMDigiAD::Inference_CMSSW | ( | const std::vector< std::vector< float >> & | digiHcal2DHist_depth_1, |
const std::vector< std::vector< float >> & | digiHcal2DHist_depth_2, | ||
const std::vector< std::vector< float >> & | digiHcal2DHist_depth_3, | ||
const std::vector< std::vector< float >> & | digiHcal2DHist_depth_4, | ||
const std::vector< std::vector< float >> & | digiHcal2DHist_depth_5, | ||
const std::vector< std::vector< float >> & | digiHcal2DHist_depth_6, | ||
const std::vector< std::vector< float >> & | digiHcal2DHist_depth_7, | ||
const float | LS_numEvents, | ||
const float | flagDecisionThr = 20 |
||
) |
Perform inference on a single image.
digiHcal2DHist_depth_1 | 2D histogram digioccupancy of the 1st depth of the hcal-hehb |
digiHcal2DHist_depth_2 | 2D histogram digioccupancy of the 2nd depth of the hcal-hehb |
digiHcal2DHist_depth_3 | 2D histogram digioccupancy of the 3rd depth of the hcal-hehb |
digiHcal2DHist_depth_4 | 2D histogram digioccupancy of the 4th depth of the hcal-hehb |
digiHcal2DHist_depth_5 | 2D histogram digioccupancy of the 5th depth of the hcal-hehb |
digiHcal2DHist_depth_5 | 2D histogram digioccupancy of the 6th depth of the hcal-hehb |
digiHcal2DHist_depth_7 | 2D histogram digioccupancy of the 7th depth of the hcal-hehb |
LS_numEvents | The input number of events for digioccupancy map renormalization |
flagDecisionThr | The anomaly detection decision threshold, decrease to increase sensitivity |
Definition at line 230 of file OnlineDQMDigiAD_cmssw.cc.
References gather_cfg::cout, mps_fire::i, simpleEdmComparison::numEvents, HLT_2024v11_cff::output_names, and AlCaHLTBitMon_QueryRunRegistry::string.
void OnlineDQMDigiAD::InitializeState | ( | ) |
Resets ml model memory states to default and function needs to be called when new collision run starts.
Definition at line 94 of file OnlineDQMDigiAD_cmssw.cc.
References ntuplemaker::fill, and nano_mu_digi_cff::float.
void OnlineDQMDigiAD::IsModelExist | ( | std::string | hcal_subsystem_name | ) |
check whether onnx model integration is added for the selected hcal system
Definition at line 85 of file OnlineDQMDigiAD_cmssw.cc.
References submitPVResolutionJobs::err, spr::find(), and AlCaHLTBitMon_QueryRunRegistry::string.
|
private |
Converts serialized 1d vectors into 2d.
Definition at line 136 of file OnlineDQMDigiAD_cmssw.cc.
References mps_fire::i, and to_string().
std::vector< std::vector< std::vector< float > > > OnlineDQMDigiAD::ONNXOutputToDQMHistMap | ( | const std::vector< std::vector< float >> & | ad_model_output_vectors, |
const int | numDepth, | ||
const int | numDIeta = 64 , |
||
const int | selOutputIdx = 7 |
||
) |
Converts 1D serialized vector output of the onnx into 3d hcal-hehp vector.
ad_model_output_vectors | vector of 3D histogram maps the hcal-hehb, each vector output from the onnx. e.g 3d map of anomaly score and 3d map of anomaly flag or label |
selOutputIdx | index to select of the onnx output. e.g. 5 is the anomaly score and 7 is the anomaly flag (1 is with anomaly, 0 is healthy) |
Definition at line 172 of file OnlineDQMDigiAD_cmssw.cc.
|
private |
Prepares model input serialized dqm histogram from 2D histogram inputs from the cmssw.
digiHcal2DHist_depth_all | 3D vector (depth[ieta[iphi]]) of combined 2D histogram digioccupancy of the any depth of the hcal |
Definition at line 158 of file OnlineDQMDigiAD_cmssw.cc.
References trackerHitRTTI::vector.
|
private |
Serializes 2d vectors into 1d.
Definition at line 126 of file OnlineDQMDigiAD_cmssw.cc.
References convertSQLitetoXML_cfg::output.
|
private |
Definition at line 165 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 102 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 103 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 159 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 160 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 161 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 162 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 155 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 156 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 157 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 158 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 108 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 167 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 166 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 105 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 144 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 145 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 147 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 152 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 143 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 104 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 123 of file OnlineDQMDigiAD_cmssw.h.
|
private |
Definition at line 166 of file OnlineDQMDigiAD_cmssw.h.