24 const std::vector<float>&
masses,
29 std::vector<btagbtvdeep::SeedingTrackFeatures>& seedingT_features_vector)
35 std::multimap<double, std::pair<btagbtvdeep::SeedingTrackInfoBuilder, std::vector<btagbtvdeep::TrackPairFeatures>>>
37 std::multimap<double, btagbtvdeep::TrackPairInfoBuilder> sortedNeighboursMap;
39 std::vector<btagbtvdeep::TrackPairFeatures> tp_features_vector;
41 sortedSeedsMap.clear();
42 seedingT_features_vector.clear();
44 std::vector<std::pair<bool, Measurement1D>> absIP3D(
selectedTracks.size());
45 std::vector<std::pair<bool, Measurement1D>> absIP2D(
selectedTracks.size());
49 unsigned int selTrackCount = 0;
53 sortedNeighboursMap.clear();
54 tp_features_vector.clear();
61 absIP3D[selTrackCount - 1] = ip;
62 absIP3D_filled[selTrackCount - 1] =
true;
71 if (!(ip.first && ip.second.value() >= 0.0 && ip.second.significance() >= 1.0 && ip.second.value() <= 9999. &&
72 ip.second.significance() <= 9999. && it.track().normalizedChi2() < 5. &&
73 std::fabs(it.track().dxy(
pv.position())) < 2 && std::fabs(it.track().dz(
pv.position())) < 17 &&
74 jet_dist.second.value() < 0.07 && length < 5.))
79 absIP2D[selTrackCount - 1] = ip2d;
80 absIP2D_filled[selTrackCount - 1] =
true;
89 jet_dist.second.value(),
94 unsigned int neighbourTrackCount = 0;
97 neighbourTrackCount += 1;
99 if (neighbourTrackCount == selTrackCount)
101 if (std::fabs(
pv.z() -
tt.track().vz()) > 0.1)
105 if (!absIP2D_filled[neighbourTrackCount - 1]) {
107 absIP2D_filled[neighbourTrackCount - 1] =
true;
110 if (!absIP3D_filled[neighbourTrackCount - 1]) {
112 absIP3D_filled[neighbourTrackCount - 1] =
true;
115 std::pair<bool, Measurement1D> t_ip = absIP3D[neighbourTrackCount - 1];
116 std::pair<bool, Measurement1D> t_ip2d = absIP2D[neighbourTrackCount - 1];
120 sortedNeighboursMap.insert(std::make_pair(trackPairInfo.
pca_distance(), trackPairInfo));
125 for (
auto const& im : sortedNeighboursMap) {
126 if (max_counter >= 20)
130 auto const&
tp = im.second;
132 tp_features.
pt = (
tp.track_pt() == 0) ? 0 : 1.0 /
tp.track_pt();
133 tp_features.
eta =
tp.track_eta();
134 tp_features.
phi =
tp.track_phi();
135 tp_features.
mass =
tp.track_candMass();
169 max_counter = max_counter + 1;
170 tp_features_vector.push_back(tp_features);
173 sortedSeedsMap.insert(std::make_pair(-seedInfo.
sip3d_Signed(), std::make_pair(seedInfo, tp_features_vector)));
176 int max_counter_seed = 0;
178 for (
auto const& im : sortedSeedsMap) {
179 if (max_counter_seed >= 10)
184 auto const&
seed = im.second.first;
187 seed_features.
pt = (
seed.pt() == 0) ? 0 : 1.0 /
seed.pt();
188 seed_features.
eta =
seed.eta();
189 seed_features.
phi =
seed.phi();
209 max_counter_seed = max_counter_seed + 1;
210 seedingT_features_vector.push_back(seed_features);
213 if (sortedSeedsMap.size() < 10) {
214 for (
unsigned int i = sortedSeedsMap.size();
i < 10;
i++) {
215 std::vector<btagbtvdeep::TrackPairFeatures> tp_features_zeropad(20);
217 seed_features_zeropad.
nearTracks = tp_features_zeropad;
218 seedingT_features_vector.push_back(seed_features_zeropad);
Base class for all types of Jets.
const float pca_distance() const
float dotprod_PCAjetMomenta
const float sip3d_Signed() const
GlobalPoint globalPosition() const
float dotprodTrackSeedVectors2D
float dotprodTrackSeedVectors3D
std::vector< btagbtvdeep::TrackPairFeatures > nearTracks
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void buildTrackPairInfo(const reco::TransientTrack *it, const reco::TransientTrack *tt, const reco::Vertex &pv, float mass, GlobalVector jetdirection, const std::pair< bool, Measurement1D > &t_ip, const std::pair< bool, Measurement1D > &t_ip2d)
void buildSeedingTrackInfo(const reco::TransientTrack *it, const reco::Vertex &pv, const reco::Jet &jet, float mass, const std::pair< bool, Measurement1D > &ip, const std::pair< bool, Measurement1D > &ip2d, float jet_distance, float jaxis_dlength, HistogramProbabilityEstimator *m_probabilityEstimator, bool m_computeProbabilities)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void seedingTracksToFeatures(const std::vector< reco::TransientTrack > &selectedTracks, const std::vector< float > &masses, const reco::Jet &jet, const reco::Vertex &pv, HistogramProbabilityEstimator *probabilityEstimator, bool computeProbabilities, std::vector< btagbtvdeep::SeedingTrackFeatures > &seedingT_features_vector)
float logWithOffset(float v, float logOffset=0)