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
 

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 ( const edm::ParameterSet params)

Definition at line 42 of file GhostTrackComputer.cc.

References reco::TrackKinematics::add(), charmCut, data, reco::IPTagInfo< Container, Base >::impactParameterData(), metsig::jet, MetAnalyzer::pv(), reco::IPTagInfo< Container, Base >::selectedTracks(), reco::IPTagInfo< Container, Base >::sortedIndexes(), threshTrack(), HiIsolationCommonParameters_cff::track, trackNoDeltaRSelector, l1t::tracks, and reco::TrackKinematics::vectorSum().

42  :
43  charmCut(params.getParameter<double>("charmCut")),
45  trackSelector(params.getParameter<edm::ParameterSet>("trackSelection")),
47  minTrackWeight(params.getParameter<double>("minimumTrackWeight")),
48  trackPairV0Filter(params.getParameter<edm::ParameterSet>("trackPairV0Filter"))
49 {
50 }
T getParameter(std::string const &) const
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

Member Function Documentation

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

Definition at line 136 of file GhostTrackComputer.cc.

References reco::TrackKinematics::add(), addMeas(), edm::RefVector< C, T, F >::begin(), data, deltaR(), HiRegitMuonDetachedTripletStep_cff::DeltaR, edm::RefVector< C, T, F >::end(), reco::btau::etaRel(), reco::TaggingVariableList::finalize(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::flightDirection(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::flightDistance(), reco::btau::flightDistance2dSig, reco::btau::flightDistance2dVal, reco::btau::flightDistance3dSig, reco::btau::flightDistance3dVal, reco::Vertex::hasRefittedTracks(), reco::TrackBase::hitPattern(), mps_fire::i, training_settings::idx, reco::IPTagInfo< Container, Base >::impactParameterData(), reco::TaggingVariableList::insert(), reco::btag::IP2DSig, reco::btag::IP3DSig, edm::Ref< C, T, F >::isNonnull(), reco::btau::jetEta, reco::btau::jetNSecondaryVertices, reco::btau::jetNSingleTrackVertices, reco::btau::jetPt, minTrackWeight, reco::TrackBase::momentum(), gen::n, reco::TrackBase::normalizedChi2(), reco::btag::Vertices::NoVertex, nTracks(), reco::TrackKinematics::numberOfTracks(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::nVertices(), TrackValidation_cff::nVertices, convertSQLiteXML::ok, reco::HitPattern::pixelLayersWithMeasurement(), reco::IPTagInfo< Container, Base >::primaryVertex(), reco::btag::Vertices::PseudoVertex, MetAnalyzer::pv(), reco::btag::Vertices::RecoVertex, reco::Vertex::refittedTrack(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::secondaryVertex(), reco::IPTagInfo< Container, Base >::selectedTracks(), Measurement1D::significance(), sortCriterium, reco::IPTagInfo< Container, Base >::sortedIndexes(), mathSSE::sqrt(), threshTrack(), HiIsolationCommonParameters_cff::track, reco::btau::trackChi2, reco::btau::trackDecayLenVal, reco::btau::trackDeltaR, reco::HitPattern::trackerLayersWithMeasurement(), 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, l1t::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(), reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, reco::btau::vertexJetDeltaR, reco::btau::vertexMass, reco::btau::vertexNTracks, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::vertexTracks(), and w.

138 {
139  using namespace ROOT::Math;
140 
141  edm::RefToBase<Jet> jet = ipInfo.jet();
142  math::XYZVector jetDir = jet->momentum().Unit();
143  bool havePv = ipInfo.primaryVertex().isNonnull();
144  GlobalPoint pv;
145  if (havePv)
146  pv = GlobalPoint(ipInfo.primaryVertex()->x(),
147  ipInfo.primaryVertex()->y(),
148  ipInfo.primaryVertex()->z());
149 
151 
152  TaggingVariableList vars;
153 
154  vars.insert(btau::jetPt, jet->pt(), true);
155  vars.insert(btau::jetEta, jet->eta(), true);
156 
157  TrackKinematics allKinematics;
158  TrackKinematics vertexKinematics;
159  TrackKinematics trackKinematics;
160 
161  std::pair<double, double> vertexDist2D, vertexDist3D;
162  std::pair<double, double> tracksDist2D, tracksDist3D;
163 
164  unsigned int nVertices = 0;
165  unsigned int nVertexTracks = 0;
166  unsigned int nTracks = 0;
167  for(unsigned int i = 0; i < svInfo.nVertices(); i++) {
168  const Vertex &vertex = svInfo.secondaryVertex(i);
169  bool hasRefittedTracks = vertex.hasRefittedTracks();
171  unsigned int n = 0;
173  track != tracks.end(); track++)
174  if (svInfo.trackWeight(i, *track) >= minTrackWeight)
175  n++;
176 
177  if (n < 1)
178  continue;
179  bool isTrackVertex = (n == 1);
180  ++*(isTrackVertex ? &nTracks : &nVertices);
181 
182  addMeas(*(isTrackVertex ? &tracksDist2D : &vertexDist2D),
183  svInfo.flightDistance(i, true));
184  addMeas(*(isTrackVertex ? &tracksDist3D : &vertexDist3D),
185  svInfo.flightDistance(i, false));
186 
187  TrackKinematics &kin = isTrackVertex ? trackKinematics
188  : vertexKinematics;
190  track != tracks.end(); track++) {
191  float w = svInfo.trackWeight(i, *track);
192  if (w < minTrackWeight)
193  continue;
194  if (hasRefittedTracks) {
195  Track actualTrack =
196  vertex.refittedTrack(*track);
197  kin.add(actualTrack, w);
199  actualTrack.momentum()), true);
200  } else {
201  kin.add(**track, w);
203  (*track)->momentum()), true);
204  }
205  if (!isTrackVertex)
206  nVertexTracks++;
207  }
208  }
209 
210  Measurement1D dist2D, dist3D;
211  if (nVertices) {
212  vtxType = btag::Vertices::RecoVertex;
213 
214  if (nVertices == 1 && nTracks) {
215  vertexDist2D.first += tracksDist2D.first;
216  vertexDist2D.second += tracksDist2D.second;
217  vertexDist3D.first += tracksDist3D.first;
218  vertexDist3D.second += tracksDist3D.second;
219  vertexKinematics += trackKinematics;
220  }
221 
222  dist2D = Measurement1D(
223  vertexDist2D.first / vertexDist2D.second,
224  std::sqrt(1. / vertexDist2D.second));
225  dist3D = Measurement1D(
226  vertexDist3D.first / vertexDist3D.second,
227  std::sqrt(1. / vertexDist3D.second));
228 
229  vars.insert(btau::jetNSecondaryVertices, nVertices, true);
230  vars.insert(btau::vertexNTracks, nVertexTracks, true);
231  } else if (nTracks) {
233  vertexKinematics = trackKinematics;
234 
235  dist2D = Measurement1D(
236  tracksDist2D.first / tracksDist2D.second,
237  std::sqrt(1. / tracksDist2D.second));
238  dist3D = Measurement1D(
239  tracksDist3D.first / tracksDist3D.second,
240  std::sqrt(1. / tracksDist3D.second));
241  }
242 
243  if (nVertices || nTracks) {
244  vars.insert(btau::flightDistance2dVal, dist2D.value(), true);
245  vars.insert(btau::flightDistance2dSig, dist2D.significance(), true);
246  vars.insert(btau::flightDistance3dVal, dist3D.value(), true);
247  vars.insert(btau::flightDistance3dSig, dist3D.significance(), true);
249  Geom::deltaR(svInfo.flightDirection(0), jetDir),true);
250  vars.insert(btau::jetNSingleTrackVertices, nTracks, true);
251  }
252 
253  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
254  const std::vector<btag::TrackIPData> &ipData =
255  ipInfo.impactParameterData();
256  const edm::RefVector<TrackCollection> &tracks =
257  ipInfo.selectedTracks();
258 
259  TrackRef trackPairV0Test[2];
260  for(unsigned int i = 0; i < indices.size(); i++) {
261  std::size_t idx = indices[i];
262  const btag::TrackIPData &data = ipData[idx];
263  const TrackRef &trackRef = tracks[idx];
264  const Track &track = *trackRef;
265 
266  // filter track
267 
268  if (!trackSelector(track, data, *jet, pv))
269  continue;
270 
271  // add track to kinematics for all tracks in jet
272 
273  allKinematics.add(track);
274 
275  // check against all other tracks for V0 track pairs
276 
277  trackPairV0Test[0] = tracks[idx];
278  bool ok = true;
279  for(unsigned int j = 0; j < indices.size(); j++) {
280  if (i == j)
281  continue;
282 
283  std::size_t pairIdx = indices[j];
284  const btag::TrackIPData &pairTrackData =
285  ipData[pairIdx];
286  const TrackRef &pairTrackRef = tracks[pairIdx];
287  const Track &pairTrack = *pairTrackRef;
288 
289  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
290  continue;
291 
292  trackPairV0Test[1] = pairTrackRef;
293  if (!trackPairV0Filter(trackPairV0Test, 2)) {
294  ok = false;
295  break;
296  }
297  }
298  if (!ok)
299  continue;
300 
301  // add track variables
302 
303  math::XYZVector trackMom = track.momentum();
304  double trackMag = std::sqrt(trackMom.Mag2());
305 
306  vars.insert(btau::trackSip3dVal, data.ip3d.value(), true);
307  vars.insert(btau::trackSip3dSig, data.ip3d.significance(), true);
308  vars.insert(btau::trackSip2dVal, data.ip2d.value(), true);
309  vars.insert(btau::trackSip2dSig, data.ip2d.significance(), true);
310  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
311  vars.insert(btau::trackGhostTrackDistVal, data.distanceToGhostTrack.value(), true);
312  vars.insert(btau::trackGhostTrackDistSig, data.distanceToGhostTrack.significance(), true);
313  vars.insert(btau::trackGhostTrackWeight, data.ghostTrackWeight, true);
314  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToGhostTrack - pv).mag() : -1.0, true);
315 
316  vars.insert(btau::trackMomentum, trackMag, true);
317  vars.insert(btau::trackEta, trackMom.Eta(), true);
318 
319  vars.insert(btau::trackChi2, track.normalizedChi2(), true);
322  vars.insert(btau::trackPtRel, VectorUtil::Perp(trackMom, jetDir), true);
323  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
324  }
325 
326  vars.insert(btau::vertexCategory, vtxType, true);
328  VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
330  allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
332  threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv)
333  .ip3d.significance(),
334  true);
336  threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv)
337  .ip2d.significance(),
338  true);
339 
340  if (vtxType != btag::Vertices::NoVertex) {
341  math::XYZTLorentzVector allSum = allKinematics.vectorSum();
342  math::XYZTLorentzVector vertexSum = vertexKinematics.vectorSum();
343 
344  vars.insert(btau::vertexMass, vertexSum.M(), true);
345  if (allKinematics.numberOfTracks())
347  vertexSum.E() / allSum.E(), true);
348  else
349  vars.insert(btau::vertexEnergyRatio, 1, true);
350  }
351 
352  vars.finalize();
353 
354  return vars;
355 }
const unsigned int nTracks(const reco::Vertex &sv)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
const double w
Definition: UKUtility.cc:23
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:556
void add(const reco::Track &track, double weight=1.0)
const VTX & secondaryVertex(unsigned int index) const
Track refittedTrack(const TrackBaseRef &track) const
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:149
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Container & selectedTracks() const
Definition: IPTagInfo.h:101
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:493
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:670
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:253
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:512
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:248
const edm::Ref< VertexCollection > & primaryVertex() const
Definition: IPTagInfo.h:133
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
static void addMeas(std::pair< double, double > &sum, Measurement1D meas)
float trackWeight(unsigned int svIndex, unsigned int trackindex) const
T sqrt(T t)
Definition: SSEVec.h:18
def pv(vc)
Definition: MetAnalyzer.py:6
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
Definition: IPTagInfo.h:238
reco::V0Filter trackPairV0Filter
const GlobalVector & flightDirection(unsigned int index) const
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:91
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double significance() const
Definition: Measurement1D.h:32
unsigned int numberOfTracks() const
reco::btag::SortCriteria sortCriterium
const reco::btag::TrackIPData & threshTrack(const reco::TrackIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:445
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
double value() const
Definition: Measurement1D.h:28
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const math::XYZTLorentzVector & vectorSum() const
Measurement1D flightDistance(unsigned int index, int dim=0) const
reco::TrackSelector trackSelector
void insert(const TaggingVariable &variable, bool delayed=false)
TaggingVariableList GhostTrackComputer::operator() ( const reco::CandIPTagInfo ipInfo,
const reco::CandSecondaryVertexTagInfo svInfo 
) const
virtual

Definition at line 358 of file GhostTrackComputer.cc.

References reco::TrackKinematics::add(), addMeas(), data, reco::CompositePtrCandidate::daughterPtrVector(), deltaR(), HiRegitMuonDetachedTripletStep_cff::DeltaR, reco::btau::etaRel(), reco::TaggingVariableList::finalize(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::flightDirection(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::flightDistance(), reco::btau::flightDistance2dSig, reco::btau::flightDistance2dVal, reco::btau::flightDistance3dSig, reco::btau::flightDistance3dVal, reco::TrackBase::hitPattern(), mps_fire::i, training_settings::idx, reco::IPTagInfo< Container, Base >::impactParameterData(), reco::TaggingVariableList::insert(), reco::btag::IP2DSig, reco::btag::IP3DSig, edm::Ref< C, T, F >::isNonnull(), reco::btau::jetEta, reco::btau::jetNSecondaryVertices, reco::btau::jetNSingleTrackVertices, reco::btau::jetPt, reco::TrackBase::momentum(), gen::n, reco::TrackBase::normalizedChi2(), reco::btag::Vertices::NoVertex, nTracks(), reco::TrackKinematics::numberOfTracks(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::nVertices(), TrackValidation_cff::nVertices, convertSQLiteXML::ok, reco::HitPattern::pixelLayersWithMeasurement(), 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(), HiIsolationCommonParameters_cff::track, reco::btau::trackChi2, reco::btau::trackDecayLenVal, reco::btau::trackDeltaR, reco::HitPattern::trackerLayersWithMeasurement(), 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, l1t::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(), reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, reco::btau::vertexJetDeltaR, reco::btau::vertexMass, and reco::btau::vertexNTracks.

360 {
361  using namespace ROOT::Math;
362 
363  edm::RefToBase<Jet> jet = ipInfo.jet();
364  math::XYZVector jetDir = jet->momentum().Unit();
365  bool havePv = ipInfo.primaryVertex().isNonnull();
366  GlobalPoint pv;
367  if (havePv)
368  pv = GlobalPoint(ipInfo.primaryVertex()->x(),
369  ipInfo.primaryVertex()->y(),
370  ipInfo.primaryVertex()->z());
371 
373 
374  TaggingVariableList vars;
375 
376  vars.insert(btau::jetPt, jet->pt(), true);
377  vars.insert(btau::jetEta, jet->eta(), true);
378 
379  TrackKinematics allKinematics;
380  TrackKinematics vertexKinematics;
381  TrackKinematics trackKinematics;
382 
383  std::pair<double, double> vertexDist2D, vertexDist3D;
384  std::pair<double, double> tracksDist2D, tracksDist3D;
385 
386  unsigned int nVertices = 0;
387  unsigned int nVertexTracks = 0;
388  unsigned int nTracks = 0;
389  for(unsigned int i = 0; i < svInfo.nVertices(); i++) {
390  const reco::VertexCompositePtrCandidate &vertex = svInfo.secondaryVertex(i);
391  const std::vector<CandidatePtr> & tracks = vertex.daughterPtrVector();
392  unsigned int n = 0;
393  for(std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track)
394  n++;
395 
396  if (n < 1)
397  continue;
398  bool isTrackVertex = (n == 1);
399  ++*(isTrackVertex ? &nTracks : &nVertices);
400 
401  addMeas(*(isTrackVertex ? &tracksDist2D : &vertexDist2D),
402  svInfo.flightDistance(i, true));
403  addMeas(*(isTrackVertex ? &tracksDist3D : &vertexDist3D),
404  svInfo.flightDistance(i, false));
405 
406  TrackKinematics &kin = isTrackVertex ? trackKinematics : vertexKinematics;
407 
408  for(std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
409  kin.add(*track);
410  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*track)->momentum()), true);
411  if (!isTrackVertex)
412  nVertexTracks++;
413  }
414  }
415 
416  Measurement1D dist2D, dist3D;
417  if (nVertices) {
418  vtxType = btag::Vertices::RecoVertex;
419 
420  if (nVertices == 1 && nTracks) {
421  vertexDist2D.first += tracksDist2D.first;
422  vertexDist2D.second += tracksDist2D.second;
423  vertexDist3D.first += tracksDist3D.first;
424  vertexDist3D.second += tracksDist3D.second;
425  vertexKinematics += trackKinematics;
426  }
427 
428  dist2D = Measurement1D(
429  vertexDist2D.first / vertexDist2D.second,
430  std::sqrt(1. / vertexDist2D.second));
431  dist3D = Measurement1D(
432  vertexDist3D.first / vertexDist3D.second,
433  std::sqrt(1. / vertexDist3D.second));
434 
435  vars.insert(btau::jetNSecondaryVertices, nVertices, true);
436  vars.insert(btau::vertexNTracks, nVertexTracks, true);
437  } else if (nTracks) {
439  vertexKinematics = trackKinematics;
440 
441  dist2D = Measurement1D(
442  tracksDist2D.first / tracksDist2D.second,
443  std::sqrt(1. / tracksDist2D.second));
444  dist3D = Measurement1D(
445  tracksDist3D.first / tracksDist3D.second,
446  std::sqrt(1. / tracksDist3D.second));
447  }
448 
449  if (nVertices || nTracks) {
450  vars.insert(btau::flightDistance2dVal, dist2D.value(), true);
451  vars.insert(btau::flightDistance2dSig, dist2D.significance(), true);
452  vars.insert(btau::flightDistance3dVal, dist3D.value(), true);
453  vars.insert(btau::flightDistance3dSig, dist3D.significance(), true);
454  vars.insert(btau::vertexJetDeltaR, Geom::deltaR(svInfo.flightDirection(0), jetDir),true);
455  vars.insert(btau::jetNSingleTrackVertices, nTracks, true);
456  }
457 
458  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
459  const std::vector<btag::TrackIPData> &ipData = ipInfo.impactParameterData();
460  const CandIPTagInfo::input_container &tracks = ipInfo.selectedTracks();
461 
462  const Track * trackPairV0Test[2];
463  for(unsigned int i = 0; i < indices.size(); i++) {
464  std::size_t idx = indices[i];
465  const btag::TrackIPData &data = ipData[idx];
466  const Track * trackPtr = reco::btag::toTrack(tracks[idx]);
467  const Track &track = *trackPtr;
468 
469  // filter track
470 
471  if (!trackSelector(track, data, *jet, pv))
472  continue;
473 
474  // add track to kinematics for all tracks in jet
475 
476  allKinematics.add(track);
477 
478  // check against all other tracks for V0 track pairs
479 
480  trackPairV0Test[0] = reco::btag::toTrack(tracks[idx]);
481  bool ok = true;
482  for(unsigned int j = 0; j < indices.size(); j++) {
483  if (i == j)
484  continue;
485 
486  std::size_t pairIdx = indices[j];
487  const btag::TrackIPData &pairTrackData = ipData[pairIdx];
488  const Track * pairTrackPtr = reco::btag::toTrack(tracks[pairIdx]);
489  const Track &pairTrack = *pairTrackPtr;
490 
491  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
492  continue;
493 
494  trackPairV0Test[1] = pairTrackPtr;
495  if (!trackPairV0Filter(trackPairV0Test, 2)) {
496  ok = false;
497  break;
498  }
499  }
500  if (!ok)
501  continue;
502 
503  // add track variables
504 
505  math::XYZVector trackMom = track.momentum();
506  double trackMag = std::sqrt(trackMom.Mag2());
507 
508  vars.insert(btau::trackSip3dVal, data.ip3d.value(), true);
509  vars.insert(btau::trackSip3dSig, data.ip3d.significance(), true);
510  vars.insert(btau::trackSip2dVal, data.ip2d.value(), true);
511  vars.insert(btau::trackSip2dSig, data.ip2d.significance(), true);
512  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
513  vars.insert(btau::trackGhostTrackDistVal, data.distanceToGhostTrack.value(), true);
514  vars.insert(btau::trackGhostTrackDistSig, data.distanceToGhostTrack.significance(), true);
515  vars.insert(btau::trackGhostTrackWeight, data.ghostTrackWeight, true);
516  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToGhostTrack - pv).mag() : -1.0, true);
517 
518  vars.insert(btau::trackMomentum, trackMag, true);
519  vars.insert(btau::trackEta, trackMom.Eta(), true);
520 
521  vars.insert(btau::trackChi2, track.normalizedChi2(), true);
524  vars.insert(btau::trackPtRel, VectorUtil::Perp(trackMom, jetDir), true);
525  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
526  }
527 
528  vars.insert(btau::vertexCategory, vtxType, true);
529  vars.insert(btau::trackSumJetDeltaR, VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
530  vars.insert(btau::trackSumJetEtRatio, allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
531  vars.insert(btau::trackSip3dSigAboveCharm, threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(), true);
532  vars.insert(btau::trackSip2dSigAboveCharm, threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(), true);
533 
534  if (vtxType != btag::Vertices::NoVertex) {
535  math::XYZTLorentzVector allSum = allKinematics.vectorSum();
536  math::XYZTLorentzVector vertexSum = vertexKinematics.vectorSum();
537 
538  vars.insert(btau::vertexMass, vertexSum.M(), true);
539  if (allKinematics.numberOfTracks())
540  vars.insert(btau::vertexEnergyRatio, vertexSum.E() / allSum.E(), true);
541  else
542  vars.insert(btau::vertexEnergyRatio, 1, true);
543  }
544 
545  vars.finalize();
546 
547  return vars;
548 }
const unsigned int nTracks(const reco::Vertex &sv)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:556
void add(const reco::Track &track, double weight=1.0)
const VTX & secondaryVertex(unsigned int index) const
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Container & selectedTracks() const
Definition: IPTagInfo.h:101
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:493
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:670
const reco::Track * toTrack(const reco::TrackBaseRef &t)
Definition: IPTagInfo.h:24
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:512
const edm::Ref< VertexCollection > & primaryVertex() const
Definition: IPTagInfo.h:133
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
static void addMeas(std::pair< double, double > &sum, Measurement1D meas)
T sqrt(T t)
Definition: SSEVec.h:18
def pv(vc)
Definition: MetAnalyzer.py:6
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
Definition: IPTagInfo.h:238
reco::V0Filter trackPairV0Filter
const GlobalVector & flightDirection(unsigned int index) const
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:91
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double significance() const
Definition: Measurement1D.h:32
unsigned int numberOfTracks() const
reco::btag::SortCriteria sortCriterium
const reco::btag::TrackIPData & threshTrack(const reco::TrackIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:445
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
double value() const
Definition: Measurement1D.h:28
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const math::XYZTLorentzVector & vectorSum() const
Measurement1D flightDistance(unsigned int index, int dim=0) const
const daughters & daughterPtrVector() const
references to daughtes
reco::TrackSelector trackSelector
Container input_container
Definition: IPTagInfo.h:53
void insert(const TaggingVariable &variable, bool delayed=false)
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 GhostTrackComputer(), and operator()().

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

double GhostTrackComputer::charmCut
private

Definition at line 39 of file GhostTrackComputer.h.

Referenced by GhostTrackComputer().

double GhostTrackComputer::minTrackWeight
private

Definition at line 43 of file GhostTrackComputer.h.

Referenced by operator()().

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

Definition at line 40 of file GhostTrackComputer.h.

Referenced by operator()().

reco::TrackSelector GhostTrackComputer::trackNoDeltaRSelector
private

Definition at line 42 of file GhostTrackComputer.h.

Referenced by GhostTrackComputer().

reco::V0Filter GhostTrackComputer::trackPairV0Filter
private

Definition at line 45 of file GhostTrackComputer.h.

Referenced by operator()().

reco::TrackSelector GhostTrackComputer::trackSelector
private

Definition at line 41 of file GhostTrackComputer.h.

Referenced by operator()().

bool GhostTrackComputer::vertexMassCorrection
private

Definition at line 44 of file GhostTrackComputer.h.