30 static std::unique_ptr<ONNXRuntime> initializeGlobalCache(
const edm::ParameterSet&);
49 enum InputIndexes { kGlobal = 0, kSeedingTracks = 1, kNeighbourTracks = 2 };
63 n_seed_* n_features_seed_,
64 n_neighbor_* n_features_neighbor_,
65 n_neighbor_* n_features_neighbor_,
66 n_neighbor_* n_features_neighbor_,
67 n_neighbor_* n_features_neighbor_,
68 n_neighbor_* n_features_neighbor_,
69 n_neighbor_* n_features_neighbor_,
70 n_neighbor_* n_features_neighbor_,
71 n_neighbor_* n_features_neighbor_,
72 n_neighbor_* n_features_neighbor_,
73 n_neighbor_* n_features_neighbor_};
77 flav_names_(iConfig.getParameter<
std::vector<
std::
string>>(
"flav_names")),
78 input_names_(iConfig.getParameter<
std::vector<
std::
string>>(
"input_names")),
79 output_names_(iConfig.getParameter<
std::vector<
std::
string>>(
"output_names")),
80 min_jet_pt_(iConfig.getParameter<double>(
"min_jet_pt")),
81 max_jet_eta_(iConfig.getParameter<double>(
"max_jet_eta")) {
84 produces<JetTagCollection>(flav_name);
96 desc.
add<std::vector<std::string>>(
"input_names",
110 desc.
add<std::vector<std::string>>(
"output_names", {
"dense_6"});
111 desc.
add<std::vector<std::string>>(
"flav_names", std::vector<std::string>{
"probb",
"probc",
"probuds",
"probg"});
112 desc.
add<
double>(
"min_jet_pt", 15.0);
113 desc.
add<
double>(
"max_jet_eta", 2.5);
115 descriptions.
add(
"pfDeepVertexJetTags", desc);
130 std::vector<std::unique_ptr<JetTagCollection>> output_tags;
131 if (!tag_infos->empty()) {
132 unsigned good_taginfo_count = 0;
133 std::vector<bool> good_taginfo_jets(tag_infos->size(),
false);
134 for (
unsigned jet_n = 0; jet_n < tag_infos->size(); ++jet_n) {
135 const auto& jet_ref = (*tag_infos)[jet_n].jet();
137 good_taginfo_count++;
138 good_taginfo_jets[jet_n] =
true;
144 data_.emplace_back(good_taginfo_count * len, 0);
148 auto jet_ref = tag_infos->begin()->jet();
151 output_tags.emplace_back(std::make_unique<JetTagCollection>(ref2prod));
155 unsigned inputs_done_count = 0;
156 for (
unsigned jet_n = 0; jet_n < tag_infos->size(); ++jet_n) {
157 if (good_taginfo_jets[jet_n]) {
158 const auto&
taginfo = (*tag_infos)[jet_n];
165 assert(inputs_done_count == good_taginfo_count);
170 unsigned i_output = 0;
171 for (
unsigned jet_n = 0; jet_n < tag_infos->size(); ++jet_n) {
172 const auto& jet_ref = (*tag_infos)[jet_n].jet();
173 for (std::size_t flav_n = 0; flav_n <
flav_names_.size(); flav_n++) {
174 if (good_taginfo_jets[jet_n]) {
175 (*(output_tags[flav_n]))[jet_ref] =
outputs[i_output];
178 (*(output_tags[flav_n]))[jet_ref] = -2;
185 output_tags.emplace_back(std::make_unique<JetTagCollection>());
190 for (std::size_t flav_n = 0; flav_n <
flav_names_.size(); ++flav_n) {
197 float* ptr =
nullptr;
198 const float*
start =
nullptr;
203 const auto& jet_features =
features.jet_features;
212 for (std::size_t seed_n = 0; seed_n < max_seed_n; seed_n++) {
213 const auto& seed_features =
features.seed_features[seed_n];
222 for (std::size_t seed_n = 0; seed_n < max_seed_n; seed_n++) {
223 const auto& neighbourTracks_features =
features.seed_features[seed_n].nearTracks;
224 auto max_neighbour_n =
std::min(neighbourTracks_features.size(), (std::size_t)
n_neighbor_);
225 for (std::size_t neighbour_n = 0; neighbour_n < max_neighbour_n; neighbour_n++) {
const Features & features() const
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< std::vector< float > > FloatArrays
constexpr unsigned n_neighbor
constexpr unsigned n_features_global
#define DEFINE_FWK_MODULE(type)
void neighbourTrack_tensor_filler(float *&ptr, const btagbtvdeep::TrackPairFeatures &neighbourTrack_features)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr unsigned n_features_neighbor
constexpr unsigned n_features_seed
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
void seedTrack_tensor_filler(float *&ptr, const btagbtvdeep::SeedingTrackFeatures &seed_features)
constexpr unsigned n_seed
void jet4vec_tensor_filler(float *&ptr, const btagbtvdeep::JetFeatures &jet_features)