7 constexpr
static int qualityMap[8] = {1, 0, 1, 1, 4, 4, 5, 6};
21 const float catch_infs(
const float in,
const float replace_value) {
24 if (in < -1e32 || in > 1e32)
31 const float replace_value,
32 const float lowerbound,
33 const float upperbound,
35 const bool use_offsets) {
37 if (withoutinfs +
offset < lowerbound)
39 if (withoutinfs +
offset > upperbound)
68 return p.Unit().Dot(
d.Unit());
72 float mindrsvpfcand(
const std::vector<reco::VertexCompositePtrCandidate> &svs,
75 for (
unsigned int i0 = 0; i0 < svs.size(); ++i0) {
85 template bool sv_vertex_comparator<reco::VertexCompositePtrCandidate, reco::Vertex>(
90 if (
pfcand.trackRef().isNonnull() &&
pv->trackWeight(
pfcand.trackRef()) > 0.5 && pv_ass_quality == 7) {
101 uint16_t qualityFlags = 0;
117 uint16_t qualityFlags = 0;
123 const auto *patJet =
dynamic_cast<const pat::Jet *
>(&
jet);
127 if (patJet->nSubjetCollections() > 0) {
128 auto subjets = patJet->subjets();
152 std::vector<float> &datavec,
161 assert(min_length <= max_length);
163 unsigned target_length = std::clamp((
unsigned)
input.size(), min_length, max_length);
164 for (
unsigned i = 0;
i < target_length; ++
i) {
168 datavec[
i + startval] = pad_value;
171 return target_length;
177 unsigned target_length,
178 std::vector<float> &datavec,
188 for (
unsigned i = 0; i < std::min(static_cast<unsigned int>(
input.size()), target_length); ++
i) {
191 if (
input.size() < target_length)
192 datavec.insert(datavec.end(), target_length -
input.size(), pad_value);
194 return target_length;
199 std::vector<std::string> &input_names_,
200 std::unordered_map<std::string, PreprocessParams> &prep_info_map_,
202 std::vector<unsigned> &input_sizes_,
206 if (!json_path.empty()) {
210 js.at(
"input_names").get_to(input_names_);
211 for (
const auto &group_name : input_names_) {
212 const auto &group_pset = js.at(group_name);
213 auto &prep_params = prep_info_map_[group_name];
214 group_pset.at(
"var_names").get_to(prep_params.var_names);
215 if (group_pset.contains(
"var_length")) {
216 prep_params.min_length = group_pset.at(
"var_length");
217 prep_params.max_length = prep_params.min_length;
219 prep_params.min_length = group_pset.at(
"min_length");
220 prep_params.max_length = group_pset.at(
"max_length");
221 input_shapes_.push_back({1, (int64_t)prep_params.var_names.size(), -1});
223 const auto &var_info_pset = group_pset.at(
"var_infos");
224 for (
const auto &var_name : prep_params.var_names) {
225 const auto &var_pset = var_info_pset.at(var_name);
226 double median = var_pset.at(
"median");
231 double pad = var_pset.contains(
"pad") ? double(var_pset.at(
"pad")) : 0;
232 prep_params.var_info_map[var_name] =
236 if (
doExtra && data_ !=
nullptr) {
238 const auto &len = input_sizes_.emplace_back(prep_params.max_length * prep_params.var_names.size());
239 data_->emplace_back(len, 0);
245 input_names_ = prep_pset.
getParameter<std::vector<std::string>>(
"input_names");
246 for (
const auto &group_name : input_names_) {
248 auto &prep_params = prep_info_map_[group_name];
249 prep_params.var_names = group_pset.
getParameter<std::vector<std::string>>(
"var_names");
250 prep_params.min_length = group_pset.
getParameter<
unsigned>(
"var_length");
251 prep_params.max_length = prep_params.min_length;
253 for (
const auto &var_name : prep_params.var_names) {
260 prep_params.var_info_map[var_name] =
264 if (
doExtra && data_ !=
nullptr) {
266 const auto &len = input_sizes_.emplace_back(prep_params.max_length * prep_params.var_names.size());
267 data_->emplace_back(len, 0);
int center_norm_pad_halfRagged(const std::vector< float > &input, float center, float scale, unsigned target_length, std::vector< float > &datavec, int startval, float pad_value=0, float replace_inf_value=0, float min=0, float max=-1)
float quality_from_pfcand(const reco::PFCandidate &pfcand)
vector< string > parse(string line, const string &delimiter)
T getParameter(std::string const &) const
float vertexDdotP(const reco::VertexCompositePtrCandidate &sv, const reco::Vertex &pv)
Measurement1D vertexD3d(const reco::VertexCompositePtrCandidate &svcand, const reco::Vertex &pv)
math::XYZVector Vector
point in the space
const float catch_infs(const float in, const float replace_value=0.)
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
constexpr bool isNotFinite(T x)
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
Base class for all types of Jets.
ParameterSet const & getParameterSet(std::string const &) const
const Point & vertex() const override
vertex position (overwritten by PF...)
std::pair< float, float > getDRSubjetFeatures(const reco::Jet &jet, const reco::Candidate *cand)
std::vector< std::vector< float > > FloatArrays
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
static std::string const input
const float catch_infs_and_bound(const float in, const float replace_value, const float lowerbound, const float upperbound, const float offset=0., const bool use_offsets=true)
qualityFlagsShiftsAndMasks
void ParticleNetConstructor(const edm::ParameterSet &Config_, bool doExtra, std::vector< std::string > &input_names_, std::unordered_map< std::string, PreprocessParams > &prep_info_map_, std::vector< std::vector< int64_t >> &input_shapes_, std::vector< unsigned > &input_sizes_, cms::Ort::FloatArrays *data_)
float mindrsvpfcand(const std::vector< reco::VertexCompositePtrCandidate > &svs, const reco::Candidate *cand, float mindr=0.4)
std::vector< float > features(const reco::PreId &ecal, const reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools)
Measurement1D vertexDxy(const reco::VertexCompositePtrCandidate &svcand, const reco::Vertex &pv)
float vtx_ass_from_pfcand(const reco::PFCandidate &pfcand, int pv_ass_quality, const reco::VertexRef &pv)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Analysis-level calorimeter jet class.
int center_norm_pad(const std::vector< float > &input, float center, float scale, unsigned min_length, unsigned max_length, std::vector< float > &datavec, int startval, float pad_value=0, float replace_inf_value=0, float min=0, float max=-1)
float lost_inner_hits_from_pfcand(const reco::PFCandidate &pfcand)
Particle reconstructed by the particle flow algorithm.
static constexpr int qualityMap[8]