24 const std::vector<float> &
masses,
29 std::vector<btagbtvdeep::SeedingTrackFeatures> & seedingT_features_vector
37 std::multimap<double,std::pair<btagbtvdeep::SeedingTrackInfoBuilder,std::vector<btagbtvdeep::TrackPairFeatures>>> sortedSeedsMap;
38 std::multimap<double,btagbtvdeep::TrackPairInfoBuilder> sortedNeighboursMap;
40 std::vector<btagbtvdeep::TrackPairFeatures> tp_features_vector;
42 sortedSeedsMap.clear();
43 seedingT_features_vector.clear();
45 std::vector<std::pair<bool,Measurement1D>> absIP3D(selectedTracks.size());
46 std::vector<std::pair<bool,Measurement1D>> absIP2D(selectedTracks.size());
47 std::vector<bool> absIP3D_filled(selectedTracks.size(),
false);
48 std::vector<bool> absIP2D_filled(selectedTracks.size(),
false);
50 unsigned int selTrackCount=0;
52 for(
auto const& it : selectedTracks){
55 sortedNeighboursMap.clear();
56 tp_features_vector.clear();
62 absIP3D[selTrackCount-1]=ip;
63 absIP3D_filled[selTrackCount-1]=
true;
71 if (!(ip.first && ip.second.value() >= 0.0 &&
72 ip.second.significance() >= 1.0 &&
73 ip.second.value() <= 9999. &&
74 ip.second.significance() <= 9999. &&
75 it.track().normalizedChi2()<5. &&
76 std::fabs(it.track().dxy(pv.
position())) < 2 &&
77 std::fabs(it.track().dz(pv.
position())) < 17 &&
78 jet_dist.second.value()<0.07 &&
84 absIP2D[selTrackCount-1]=ip2d;
85 absIP2D_filled[selTrackCount-1]=
true;
90 unsigned int neighbourTrackCount=0;
92 for(
auto const&
tt : selectedTracks){
94 neighbourTrackCount+=1;
96 if(neighbourTrackCount==selTrackCount)
continue;
97 if(std::fabs(pv.
z()-
tt.track().vz())>0.1)
continue;
100 if(!absIP2D_filled[neighbourTrackCount-1])
103 absIP2D_filled[neighbourTrackCount-1]=
true;
106 if(!absIP3D_filled[neighbourTrackCount-1])
109 absIP3D_filled[neighbourTrackCount-1]=
true;
112 std::pair<bool,Measurement1D> t_ip = absIP3D[neighbourTrackCount-1];
113 std::pair<bool,Measurement1D> t_ip2d = absIP2D[neighbourTrackCount-1];
116 trackPairInfo.
buildTrackPairInfo(&(it),&(
tt),pv,masses[neighbourTrackCount-1],jetdirection, t_ip, t_ip2d);
117 sortedNeighboursMap.insert(std::make_pair(trackPairInfo.
pca_distance(), trackPairInfo));
123 for(
auto const& im: sortedNeighboursMap){
125 if(max_counter>=20)
break;
128 auto const& tp = im.second;
130 tp_features.
pt=(tp.track_pt()==0) ? 0: 1.0/tp.track_pt();
131 tp_features.
eta=tp.track_eta();
132 tp_features.
phi=tp.track_phi();
133 tp_features.
mass=tp.track_candMass();
136 tp_features.
ip3D=
log(tp.track_ip3d());
137 tp_features.
sip3D=
log(tp.track_ip3dSig());
138 tp_features.
ip2D=
log(tp.track_ip2d());
139 tp_features.
sip2D=
log(tp.track_ip2dSig());
141 tp_features.
dsigPCA=
log(tp.pca_significance());
168 max_counter=max_counter+1;
169 tp_features_vector.push_back(tp_features);
174 sortedSeedsMap.insert(std::make_pair(-seedInfo.
sip3d_Signed(), std::make_pair(seedInfo,tp_features_vector)));
179 int max_counter_seed=0;
181 for(
auto const& im: sortedSeedsMap){
183 if(max_counter_seed>=10)
break;
187 auto const&
seed = im.second.first;
190 seed_features.
pt=(
seed.pt()==0) ? 0: 1.0/
seed.pt();
213 max_counter_seed=max_counter_seed+1;
214 seedingT_features_vector.push_back(seed_features);
220 if (sortedSeedsMap.size()<10){
222 for (
unsigned int i=sortedSeedsMap.size();
i<10;
i++){
225 std::vector<btagbtvdeep::TrackPairFeatures> tp_features_zeropad(20);
227 seed_features_zeropad.
nearTracks=tp_features_zeropad;
228 seedingT_features_vector.push_back(seed_features_zeropad);
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
double y() const
y coordinate
Base class for all types of Jets.
double px() const final
x coordinate of momentum vector
GlobalPoint globalPosition() const
float dotprod_PCAjetMomenta
const Point & position() const
position
float dotprodTrackSeedVectors2D
double pz() const final
z coordinate of momentum vector
double z() const
z coordinate
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)
double x() const
x coordinate
double py() const final
y coordinate of momentum vector
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)
const float sip3d_Signed() const
float logWithOffset(float v, float logOffset=0)
const float pca_distance() const