CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
GhostTrackComputer Class Reference

#include <GhostTrackComputer.h>

Public Member Functions

 GhostTrackComputer (const edm::ParameterSet &params)
 
virtual reco::TaggingVariableList operator() (const reco::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &svInfo) const
 
virtual reco::TaggingVariableList operator() (const reco::CandIPTagInfo &ipInfo, const reco::CandSecondaryVertexTagInfo &svInfo) const
 
virtual ~GhostTrackComputer ()=default
 

Private Member Functions

const reco::btag::TrackIPDatathreshTrack (const reco::TrackIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
 
const reco::btag::TrackIPDatathreshTrack (const reco::CandIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
 

Private Attributes

double charmCut
 
double minTrackWeight
 
reco::btag::SortCriteria sortCriterium
 
reco::TrackSelector trackNoDeltaRSelector
 
reco::V0Filter trackPairV0Filter
 
reco::TrackSelector trackSelector
 
bool vertexMassCorrection
 

Detailed Description

Definition at line 16 of file GhostTrackComputer.h.

Constructor & Destructor Documentation

◆ GhostTrackComputer()

GhostTrackComputer::GhostTrackComputer ( const edm::ParameterSet params)

Definition at line 41 of file GhostTrackComputer.cc.

42  : charmCut(params.getParameter<double>("charmCut")),
43  sortCriterium(TrackSorting::getCriterium(params.getParameter<std::string>("trackSort"))),
44  trackSelector(params.getParameter<edm::ParameterSet>("trackSelection")),
45  trackNoDeltaRSelector(dropDeltaR(params.getParameter<edm::ParameterSet>("trackSelection"))),
46  minTrackWeight(params.getParameter<double>("minimumTrackWeight")),
47  trackPairV0Filter(params.getParameter<edm::ParameterSet>("trackPairV0Filter")) {}
reco::btag::SortCriteria getCriterium(const std::string &name)
Definition: TrackSorting.cc:11
static edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset)
reco::V0Filter trackPairV0Filter
reco::btag::SortCriteria sortCriterium
reco::TrackSelector trackNoDeltaRSelector
reco::TrackSelector trackSelector

◆ ~GhostTrackComputer()

virtual GhostTrackComputer::~GhostTrackComputer ( )
virtualdefault

Member Function Documentation

◆ operator()() [1/2]

TaggingVariableList GhostTrackComputer::operator() ( const reco::TrackIPTagInfo ipInfo,
const reco::SecondaryVertexTagInfo svInfo 
) const
virtual

Definition at line 118 of file GhostTrackComputer.cc.

References reco::TrackKinematics::add(), addMeas(), data, electronAnalyzer_cfi::DeltaR, PbPb_ZMuSkimMuonDPG_cff::deltaR, reco::btau::etaRel(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::flightDirection(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::flightDistance(), reco::btau::flightDistance2dSig, reco::btau::flightDistance2dVal, reco::btau::flightDistance3dSig, reco::btau::flightDistance3dVal, mps_fire::i, heavyIonCSV_trainingSettings::idx, reco::IPTagInfo< Container, Base >::impactParameterData(), dqmdumpme::indices, reco::btag::IP2DSig, electrons_cff::ip3d, reco::btag::IP3DSig, edm::Ref< C, T, F >::isNonnull(), dqmiolumiharvest::j, metsig::jet, reco::btau::jetEta, reco::btau::jetNSecondaryVertices, reco::btau::jetNSingleTrackVertices, reco::btau::jetPt, minTrackWeight, reco::TrackBase::momentum(), dqmiodumpmetadata::n, reco::btag::Vertices::NoVertex, BeamSpotPI::nTracks, reco::TrackKinematics::numberOfTracks(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::nVertices(), TrackCollections2monitor_cff::nVertices, convertSQLiteXML::ok, reco::IPTagInfo< Container, Base >::primaryVertex(), reco::btag::Vertices::PseudoVertex, MetAnalyzer::pv(), reco::btag::Vertices::RecoVertex, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::secondaryVertex(), reco::IPTagInfo< Container, Base >::selectedTracks(), Measurement1D::significance(), sortCriterium, reco::IPTagInfo< Container, Base >::sortedIndexes(), mathSSE::sqrt(), threshTrack(), HLT_2022v12_cff::track, reco::btau::trackChi2, reco::btau::trackDecayLenVal, reco::btau::trackDeltaR, reco::btau::trackEta, reco::btau::trackEtaRel, reco::btau::trackGhostTrackDistSig, reco::btau::trackGhostTrackDistVal, reco::btau::trackGhostTrackWeight, reco::btau::trackJetDistVal, reco::btau::trackMomentum, reco::btau::trackNPixelHits, reco::btau::trackNTotalHits, trackPairV0Filter, reco::btau::trackPtRel, tracks, trackSelector, reco::btau::trackSip2dSig, reco::btau::trackSip2dSigAboveCharm, reco::btau::trackSip2dVal, reco::btau::trackSip3dSig, reco::btau::trackSip3dSigAboveCharm, reco::btau::trackSip3dVal, reco::btau::trackSumJetDeltaR, reco::btau::trackSumJetEtRatio, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::trackWeight(), Measurement1D::value(), reco::TrackKinematics::vectorSum(), bphysicsOniaDQM_cfi::vertex, reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, reco::btau::vertexJetDeltaR, reco::btau::vertexMass, reco::btau::vertexNTracks, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::vertexTracks(), and w().

119  {
120  using namespace ROOT::Math;
121 
122  edm::RefToBase<Jet> jet = ipInfo.jet();
123  math::XYZVector jetDir = jet->momentum().Unit();
124  bool havePv = ipInfo.primaryVertex().isNonnull();
125  GlobalPoint pv;
126  if (havePv)
127  pv = GlobalPoint(ipInfo.primaryVertex()->x(), ipInfo.primaryVertex()->y(), ipInfo.primaryVertex()->z());
128 
130 
132 
133  vars.insert(btau::jetPt, jet->pt(), true);
134  vars.insert(btau::jetEta, jet->eta(), true);
135 
136  TrackKinematics allKinematics;
137  TrackKinematics vertexKinematics;
138  TrackKinematics trackKinematics;
139 
140  std::pair<double, double> vertexDist2D, vertexDist3D;
141  std::pair<double, double> tracksDist2D, tracksDist3D;
142 
143  unsigned int nVertices = 0;
144  unsigned int nVertexTracks = 0;
145  unsigned int nTracks = 0;
146  for (unsigned int i = 0; i < svInfo.nVertices(); i++) {
147  const Vertex &vertex = svInfo.secondaryVertex(i);
148  bool hasRefittedTracks = vertex.hasRefittedTracks();
150  unsigned int n = 0;
151  for (TrackRefVector::const_iterator track = tracks.begin(); track != tracks.end(); track++)
152  if (svInfo.trackWeight(i, *track) >= minTrackWeight)
153  n++;
154 
155  if (n < 1)
156  continue;
157  bool isTrackVertex = (n == 1);
158  ++*(isTrackVertex ? &nTracks : &nVertices);
159 
160  addMeas(*(isTrackVertex ? &tracksDist2D : &vertexDist2D), svInfo.flightDistance(i, true));
161  addMeas(*(isTrackVertex ? &tracksDist3D : &vertexDist3D), svInfo.flightDistance(i, false));
162 
163  TrackKinematics &kin = isTrackVertex ? trackKinematics : vertexKinematics;
164  for (TrackRefVector::const_iterator track = tracks.begin(); track != tracks.end(); track++) {
165  float w = svInfo.trackWeight(i, *track);
166  if (w < minTrackWeight)
167  continue;
168  if (hasRefittedTracks) {
169  Track actualTrack = vertex.refittedTrack(*track);
170  kin.add(actualTrack, w);
171  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, actualTrack.momentum()), true);
172  } else {
173  kin.add(**track, w);
174  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*track)->momentum()), true);
175  }
176  if (!isTrackVertex)
177  nVertexTracks++;
178  }
179  }
180 
181  Measurement1D dist2D, dist3D;
182  if (nVertices) {
183  vtxType = btag::Vertices::RecoVertex;
184 
185  if (nVertices == 1 && nTracks) {
186  vertexDist2D.first += tracksDist2D.first;
187  vertexDist2D.second += tracksDist2D.second;
188  vertexDist3D.first += tracksDist3D.first;
189  vertexDist3D.second += tracksDist3D.second;
190  vertexKinematics += trackKinematics;
191  }
192 
193  dist2D = Measurement1D(vertexDist2D.first / vertexDist2D.second, std::sqrt(1. / vertexDist2D.second));
194  dist3D = Measurement1D(vertexDist3D.first / vertexDist3D.second, std::sqrt(1. / vertexDist3D.second));
195 
197  vars.insert(btau::vertexNTracks, nVertexTracks, true);
198  } else if (nTracks) {
200  vertexKinematics = trackKinematics;
201 
202  dist2D = Measurement1D(tracksDist2D.first / tracksDist2D.second, std::sqrt(1. / tracksDist2D.second));
203  dist3D = Measurement1D(tracksDist3D.first / tracksDist3D.second, std::sqrt(1. / tracksDist3D.second));
204  }
205 
206  if (nVertices || nTracks) {
207  vars.insert(btau::flightDistance2dVal, dist2D.value(), true);
208  vars.insert(btau::flightDistance2dSig, dist2D.significance(), true);
209  vars.insert(btau::flightDistance3dVal, dist3D.value(), true);
210  vars.insert(btau::flightDistance3dSig, dist3D.significance(), true);
211  vars.insert(btau::vertexJetDeltaR, Geom::deltaR(svInfo.flightDirection(0), jetDir), true);
213  }
214 
215  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
216  const std::vector<btag::TrackIPData> &ipData = ipInfo.impactParameterData();
218 
219  TrackRef trackPairV0Test[2];
220  for (unsigned int i = 0; i < indices.size(); i++) {
221  std::size_t idx = indices[i];
222  const btag::TrackIPData &data = ipData[idx];
223  const TrackRef &trackRef = tracks[idx];
224  const Track &track = *trackRef;
225 
226  // filter track
227 
228  if (!trackSelector(track, data, *jet, pv))
229  continue;
230 
231  // add track to kinematics for all tracks in jet
232 
233  allKinematics.add(track);
234 
235  // check against all other tracks for V0 track pairs
236 
237  trackPairV0Test[0] = tracks[idx];
238  bool ok = true;
239  for (unsigned int j = 0; j < indices.size(); j++) {
240  if (i == j)
241  continue;
242 
243  std::size_t pairIdx = indices[j];
244  const btag::TrackIPData &pairTrackData = ipData[pairIdx];
245  const TrackRef &pairTrackRef = tracks[pairIdx];
246  const Track &pairTrack = *pairTrackRef;
247 
248  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
249  continue;
250 
251  trackPairV0Test[1] = pairTrackRef;
252  if (!trackPairV0Filter(trackPairV0Test, 2)) {
253  ok = false;
254  break;
255  }
256  }
257  if (!ok)
258  continue;
259 
260  // add track variables
261 
262  const math::XYZVector &trackMom = track.momentum();
263  double trackMag = std::sqrt(trackMom.Mag2());
264 
265  vars.insert(btau::trackSip3dVal, data.ip3d.value(), true);
266  vars.insert(btau::trackSip3dSig, data.ip3d.significance(), true);
267  vars.insert(btau::trackSip2dVal, data.ip2d.value(), true);
268  vars.insert(btau::trackSip2dSig, data.ip2d.significance(), true);
269  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
270  vars.insert(btau::trackGhostTrackDistVal, data.distanceToGhostTrack.value(), true);
271  vars.insert(btau::trackGhostTrackDistSig, data.distanceToGhostTrack.significance(), true);
272  vars.insert(btau::trackGhostTrackWeight, data.ghostTrackWeight, true);
273  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToGhostTrack - pv).mag() : -1.0, true);
274 
275  vars.insert(btau::trackMomentum, trackMag, true);
276  vars.insert(btau::trackEta, trackMom.Eta(), true);
277 
278  vars.insert(btau::trackChi2, track.normalizedChi2(), true);
279  vars.insert(btau::trackNPixelHits, track.hitPattern().pixelLayersWithMeasurement(), true);
280  vars.insert(btau::trackNTotalHits, track.hitPattern().trackerLayersWithMeasurement(), true);
281  vars.insert(btau::trackPtRel, VectorUtil::Perp(trackMom, jetDir), true);
282  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
283  }
284 
285  vars.insert(btau::vertexCategory, vtxType, true);
286  vars.insert(btau::trackSumJetDeltaR, VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
287  vars.insert(btau::trackSumJetEtRatio, allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
288  vars.insert(
289  btau::trackSip3dSigAboveCharm, threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(), true);
290  vars.insert(
291  btau::trackSip2dSigAboveCharm, threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(), true);
292 
293  if (vtxType != btag::Vertices::NoVertex) {
294  const math::XYZTLorentzVector &allSum = allKinematics.vectorSum();
295  const math::XYZTLorentzVector &vertexSum = vertexKinematics.vectorSum();
296 
297  vars.insert(btau::vertexMass, vertexSum.M(), true);
298  if (allKinematics.numberOfTracks())
299  vars.insert(btau::vertexEnergyRatio, vertexSum.E() / allSum.E(), true);
300  else
301  vars.insert(btau::vertexEnergyRatio, 1, true);
302  }
303 
304  vars.finalize();
305 
306  return vars;
307 }
void add(const reco::Track &track, double weight=1.0)
T w() const
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Container & selectedTracks() const
Definition: IPTagInfo.h:99
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
float trackWeight(unsigned int svIndex, unsigned int trackindex) const
unsigned int numberOfTracks() const
const reco::btag::TrackIPData & threshTrack(const reco::TrackIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
Definition: IPTagInfo.h:231
static void addMeas(std::pair< double, double > &sum, Measurement1D meas)
T sqrt(T t)
Definition: SSEVec.h:19
const math::XYZTLorentzVector & vectorSum() const
def pv(vc)
Definition: MetAnalyzer.py:7
const GlobalVector & flightDirection(unsigned int index) const
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:90
reco::V0Filter trackPairV0Filter
Measurement1D flightDistance(unsigned int index, int dim=0) const
auto const & tracks
cannot be loose
reco::btag::SortCriteria sortCriterium
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const VTX & secondaryVertex(unsigned int index) const
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
double value() const
Definition: Measurement1D.h:25
double significance() const
Definition: Measurement1D.h:29
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
reco::TrackSelector trackSelector
const edm::Ref< VertexCollection > & primaryVertex() const
Definition: IPTagInfo.h:133
vars
Definition: DeepTauId.cc:30

◆ operator()() [2/2]

TaggingVariableList GhostTrackComputer::operator() ( const reco::CandIPTagInfo ipInfo,
const reco::CandSecondaryVertexTagInfo svInfo 
) const
virtual

Definition at line 309 of file GhostTrackComputer.cc.

References reco::TrackKinematics::add(), addMeas(), data, electronAnalyzer_cfi::DeltaR, PbPb_ZMuSkimMuonDPG_cff::deltaR, reco::btau::etaRel(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::flightDirection(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::flightDistance(), reco::btau::flightDistance2dSig, reco::btau::flightDistance2dVal, reco::btau::flightDistance3dSig, reco::btau::flightDistance3dVal, mps_fire::i, heavyIonCSV_trainingSettings::idx, reco::IPTagInfo< Container, Base >::impactParameterData(), dqmdumpme::indices, reco::btag::IP2DSig, electrons_cff::ip3d, reco::btag::IP3DSig, edm::Ref< C, T, F >::isNonnull(), dqmiolumiharvest::j, metsig::jet, reco::btau::jetEta, reco::btau::jetNSecondaryVertices, reco::btau::jetNSingleTrackVertices, reco::btau::jetPt, dqmiodumpmetadata::n, reco::btag::Vertices::NoVertex, BeamSpotPI::nTracks, reco::TrackKinematics::numberOfTracks(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::nVertices(), TrackCollections2monitor_cff::nVertices, convertSQLiteXML::ok, reco::IPTagInfo< Container, Base >::primaryVertex(), reco::btag::Vertices::PseudoVertex, MetAnalyzer::pv(), reco::btag::Vertices::RecoVertex, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::secondaryVertex(), reco::IPTagInfo< Container, Base >::selectedTracks(), Measurement1D::significance(), sortCriterium, reco::IPTagInfo< Container, Base >::sortedIndexes(), mathSSE::sqrt(), threshTrack(), reco::btag::toTrack(), HLT_2022v12_cff::track, reco::btau::trackChi2, reco::btau::trackDecayLenVal, reco::btau::trackDeltaR, reco::btau::trackEta, reco::btau::trackEtaRel, reco::btau::trackGhostTrackDistSig, reco::btau::trackGhostTrackDistVal, reco::btau::trackGhostTrackWeight, reco::btau::trackJetDistVal, reco::btau::trackMomentum, reco::btau::trackNPixelHits, reco::btau::trackNTotalHits, trackPairV0Filter, reco::btau::trackPtRel, tracks, trackSelector, reco::btau::trackSip2dSig, reco::btau::trackSip2dSigAboveCharm, reco::btau::trackSip2dVal, reco::btau::trackSip3dSig, reco::btau::trackSip3dSigAboveCharm, reco::btau::trackSip3dVal, reco::btau::trackSumJetDeltaR, reco::btau::trackSumJetEtRatio, Measurement1D::value(), reco::TrackKinematics::vectorSum(), bphysicsOniaDQM_cfi::vertex, reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, reco::btau::vertexJetDeltaR, reco::btau::vertexMass, and reco::btau::vertexNTracks.

310  {
311  using namespace ROOT::Math;
312 
313  edm::RefToBase<Jet> jet = ipInfo.jet();
314  math::XYZVector jetDir = jet->momentum().Unit();
315  bool havePv = ipInfo.primaryVertex().isNonnull();
316  GlobalPoint pv;
317  if (havePv)
318  pv = GlobalPoint(ipInfo.primaryVertex()->x(), ipInfo.primaryVertex()->y(), ipInfo.primaryVertex()->z());
319 
321 
323 
324  vars.insert(btau::jetPt, jet->pt(), true);
325  vars.insert(btau::jetEta, jet->eta(), true);
326 
327  TrackKinematics allKinematics;
328  TrackKinematics vertexKinematics;
329  TrackKinematics trackKinematics;
330 
331  std::pair<double, double> vertexDist2D, vertexDist3D;
332  std::pair<double, double> tracksDist2D, tracksDist3D;
333 
334  unsigned int nVertices = 0;
335  unsigned int nVertexTracks = 0;
336  unsigned int nTracks = 0;
337  for (unsigned int i = 0; i < svInfo.nVertices(); i++) {
339  const std::vector<CandidatePtr> &tracks = vertex.daughterPtrVector();
340  unsigned int n = 0;
341  for (std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track)
342  n++;
343 
344  if (n < 1)
345  continue;
346  bool isTrackVertex = (n == 1);
347  ++*(isTrackVertex ? &nTracks : &nVertices);
348 
349  addMeas(*(isTrackVertex ? &tracksDist2D : &vertexDist2D), svInfo.flightDistance(i, true));
350  addMeas(*(isTrackVertex ? &tracksDist3D : &vertexDist3D), svInfo.flightDistance(i, false));
351 
352  TrackKinematics &kin = isTrackVertex ? trackKinematics : vertexKinematics;
353 
354  for (std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
355  kin.add(*track);
356  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*track)->momentum()), true);
357  if (!isTrackVertex)
358  nVertexTracks++;
359  }
360  }
361 
362  Measurement1D dist2D, dist3D;
363  if (nVertices) {
364  vtxType = btag::Vertices::RecoVertex;
365 
366  if (nVertices == 1 && nTracks) {
367  vertexDist2D.first += tracksDist2D.first;
368  vertexDist2D.second += tracksDist2D.second;
369  vertexDist3D.first += tracksDist3D.first;
370  vertexDist3D.second += tracksDist3D.second;
371  vertexKinematics += trackKinematics;
372  }
373 
374  dist2D = Measurement1D(vertexDist2D.first / vertexDist2D.second, std::sqrt(1. / vertexDist2D.second));
375  dist3D = Measurement1D(vertexDist3D.first / vertexDist3D.second, std::sqrt(1. / vertexDist3D.second));
376 
378  vars.insert(btau::vertexNTracks, nVertexTracks, true);
379  } else if (nTracks) {
381  vertexKinematics = trackKinematics;
382 
383  dist2D = Measurement1D(tracksDist2D.first / tracksDist2D.second, std::sqrt(1. / tracksDist2D.second));
384  dist3D = Measurement1D(tracksDist3D.first / tracksDist3D.second, std::sqrt(1. / tracksDist3D.second));
385  }
386 
387  if (nVertices || nTracks) {
388  vars.insert(btau::flightDistance2dVal, dist2D.value(), true);
389  vars.insert(btau::flightDistance2dSig, dist2D.significance(), true);
390  vars.insert(btau::flightDistance3dVal, dist3D.value(), true);
391  vars.insert(btau::flightDistance3dSig, dist3D.significance(), true);
392  vars.insert(btau::vertexJetDeltaR, Geom::deltaR(svInfo.flightDirection(0), jetDir), true);
394  }
395 
396  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
397  const std::vector<btag::TrackIPData> &ipData = ipInfo.impactParameterData();
399 
400  const Track *trackPairV0Test[2];
401  for (unsigned int i = 0; i < indices.size(); i++) {
402  std::size_t idx = indices[i];
403  const btag::TrackIPData &data = ipData[idx];
404  const Track *trackPtr = reco::btag::toTrack(tracks[idx]);
405  const Track &track = *trackPtr;
406 
407  // filter track
408 
409  if (!trackSelector(track, data, *jet, pv))
410  continue;
411 
412  // add track to kinematics for all tracks in jet
413 
414  allKinematics.add(track);
415 
416  // check against all other tracks for V0 track pairs
417 
418  trackPairV0Test[0] = reco::btag::toTrack(tracks[idx]);
419  bool ok = true;
420  for (unsigned int j = 0; j < indices.size(); j++) {
421  if (i == j)
422  continue;
423 
424  std::size_t pairIdx = indices[j];
425  const btag::TrackIPData &pairTrackData = ipData[pairIdx];
426  const Track *pairTrackPtr = reco::btag::toTrack(tracks[pairIdx]);
427  const Track &pairTrack = *pairTrackPtr;
428 
429  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
430  continue;
431 
432  trackPairV0Test[1] = pairTrackPtr;
433  if (!trackPairV0Filter(trackPairV0Test, 2)) {
434  ok = false;
435  break;
436  }
437  }
438  if (!ok)
439  continue;
440 
441  // add track variables
442 
443  const math::XYZVector &trackMom = track.momentum();
444  double trackMag = std::sqrt(trackMom.Mag2());
445 
446  vars.insert(btau::trackSip3dVal, data.ip3d.value(), true);
447  vars.insert(btau::trackSip3dSig, data.ip3d.significance(), true);
448  vars.insert(btau::trackSip2dVal, data.ip2d.value(), true);
449  vars.insert(btau::trackSip2dSig, data.ip2d.significance(), true);
450  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
451  vars.insert(btau::trackGhostTrackDistVal, data.distanceToGhostTrack.value(), true);
452  vars.insert(btau::trackGhostTrackDistSig, data.distanceToGhostTrack.significance(), true);
453  vars.insert(btau::trackGhostTrackWeight, data.ghostTrackWeight, true);
454  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToGhostTrack - pv).mag() : -1.0, true);
455 
456  vars.insert(btau::trackMomentum, trackMag, true);
457  vars.insert(btau::trackEta, trackMom.Eta(), true);
458 
459  vars.insert(btau::trackChi2, track.normalizedChi2(), true);
460  vars.insert(btau::trackNPixelHits, track.hitPattern().pixelLayersWithMeasurement(), true);
461  vars.insert(btau::trackNTotalHits, track.hitPattern().trackerLayersWithMeasurement(), true);
462  vars.insert(btau::trackPtRel, VectorUtil::Perp(trackMom, jetDir), true);
463  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
464  }
465 
466  vars.insert(btau::vertexCategory, vtxType, true);
467  vars.insert(btau::trackSumJetDeltaR, VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
468  vars.insert(btau::trackSumJetEtRatio, allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
469  vars.insert(
470  btau::trackSip3dSigAboveCharm, threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(), true);
471  vars.insert(
472  btau::trackSip2dSigAboveCharm, threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(), true);
473 
474  if (vtxType != btag::Vertices::NoVertex) {
475  const math::XYZTLorentzVector &allSum = allKinematics.vectorSum();
476  const math::XYZTLorentzVector &vertexSum = vertexKinematics.vectorSum();
477 
478  vars.insert(btau::vertexMass, vertexSum.M(), true);
479  if (allKinematics.numberOfTracks())
480  vars.insert(btau::vertexEnergyRatio, vertexSum.E() / allSum.E(), true);
481  else
482  vars.insert(btau::vertexEnergyRatio, 1, true);
483  }
484 
485  vars.finalize();
486 
487  return vars;
488 }
void add(const reco::Track &track, double weight=1.0)
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Container & selectedTracks() const
Definition: IPTagInfo.h:99
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
const reco::Track * toTrack(const reco::TrackBaseRef &t)
Definition: IPTagInfo.h:24
unsigned int numberOfTracks() const
const reco::btag::TrackIPData & threshTrack(const reco::TrackIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
Definition: IPTagInfo.h:231
static void addMeas(std::pair< double, double > &sum, Measurement1D meas)
T sqrt(T t)
Definition: SSEVec.h:19
const math::XYZTLorentzVector & vectorSum() const
def pv(vc)
Definition: MetAnalyzer.py:7
const GlobalVector & flightDirection(unsigned int index) const
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:90
reco::V0Filter trackPairV0Filter
Measurement1D flightDistance(unsigned int index, int dim=0) const
auto const & tracks
cannot be loose
reco::btag::SortCriteria sortCriterium
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const VTX & secondaryVertex(unsigned int index) const
double value() const
Definition: Measurement1D.h:25
double significance() const
Definition: Measurement1D.h:29
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
reco::TrackSelector trackSelector
Container input_container
Definition: IPTagInfo.h:50
const edm::Ref< VertexCollection > & primaryVertex() const
Definition: IPTagInfo.h:133
vars
Definition: DeepTauId.cc:30

◆ threshTrack() [1/2]

const reco::btag::TrackIPData& GhostTrackComputer::threshTrack ( const reco::TrackIPTagInfo trackIPTagInfo,
const reco::btag::SortCriteria  sort,
const reco::Jet jet,
const GlobalPoint pv 
) const
private

Referenced by operator()().

◆ threshTrack() [2/2]

const reco::btag::TrackIPData& GhostTrackComputer::threshTrack ( const reco::CandIPTagInfo trackIPTagInfo,
const reco::btag::SortCriteria  sort,
const reco::Jet jet,
const GlobalPoint pv 
) const
private

Member Data Documentation

◆ charmCut

double GhostTrackComputer::charmCut
private

Definition at line 35 of file GhostTrackComputer.h.

◆ minTrackWeight

double GhostTrackComputer::minTrackWeight
private

Definition at line 39 of file GhostTrackComputer.h.

Referenced by operator()().

◆ sortCriterium

reco::btag::SortCriteria GhostTrackComputer::sortCriterium
private

Definition at line 36 of file GhostTrackComputer.h.

Referenced by operator()().

◆ trackNoDeltaRSelector

reco::TrackSelector GhostTrackComputer::trackNoDeltaRSelector
private

Definition at line 38 of file GhostTrackComputer.h.

◆ trackPairV0Filter

reco::V0Filter GhostTrackComputer::trackPairV0Filter
private

Definition at line 41 of file GhostTrackComputer.h.

Referenced by operator()().

◆ trackSelector

reco::TrackSelector GhostTrackComputer::trackSelector
private

Definition at line 37 of file GhostTrackComputer.h.

Referenced by operator()().

◆ vertexMassCorrection

bool GhostTrackComputer::vertexMassCorrection
private

Definition at line 40 of file GhostTrackComputer.h.