CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
reco::TaggingVariableList operator() (const reco::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &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
 

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 14 of file GhostTrackComputer.h.

Constructor & Destructor Documentation

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

Definition at line 42 of file GhostTrackComputer.cc.

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

Definition at line 99 of file GhostTrackComputer.cc.

References addMeas(), edm::RefVector< C, T, F >::begin(), data, deltaR(), HLT_25ns14e33_v1_cff::DeltaR, edm::RefVector< C, T, F >::end(), 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, reco::Vertex::hasRefittedTracks(), reco::TrackBase::hitPattern(), i, customizeTrackingMonitorSeedNumber::idx, reco::IPTagInfo< Container, Base >::impactParameterData(), reco::TaggingVariableList::insert(), reco::btag::IP2DSig, reco::btag::IP3DSig, edm::Ref< C, T, F >::isNonnull(), j, metsig::jet, 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, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::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(), sortCriterium, reco::IPTagInfo< Container, Base >::sortedIndexes(), mathSSE::sqrt(), threshTrack(), 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, testEve_cfg::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(), reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, reco::btau::vertexJetDeltaR, reco::btau::vertexMass, reco::btau::vertexNTracks, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::vertexTracks(), and w.

101 {
102  using namespace ROOT::Math;
103 
104  edm::RefToBase<Jet> jet = ipInfo.jet();
105  math::XYZVector jetDir = jet->momentum().Unit();
106  bool havePv = ipInfo.primaryVertex().isNonnull();
107  GlobalPoint pv;
108  if (havePv)
109  pv = GlobalPoint(ipInfo.primaryVertex()->x(),
110  ipInfo.primaryVertex()->y(),
111  ipInfo.primaryVertex()->z());
112 
114 
115  TaggingVariableList vars;
116 
117  vars.insert(btau::jetPt, jet->pt(), true);
118  vars.insert(btau::jetEta, jet->eta(), true);
119 
120  TrackKinematics allKinematics;
121  TrackKinematics vertexKinematics;
122  TrackKinematics trackKinematics;
123 
124  std::pair<double, double> vertexDist2D, vertexDist3D;
125  std::pair<double, double> tracksDist2D, tracksDist3D;
126 
127  unsigned int nVertices = 0;
128  unsigned int nVertexTracks = 0;
129  unsigned int nTracks = 0;
130  for(unsigned int i = 0; i < svInfo.nVertices(); i++) {
131  const Vertex &vertex = svInfo.secondaryVertex(i);
132  bool hasRefittedTracks = vertex.hasRefittedTracks();
134  unsigned int n = 0;
135  for(TrackRefVector::const_iterator track = tracks.begin();
136  track != tracks.end(); track++)
137  if (svInfo.trackWeight(i, *track) >= minTrackWeight)
138  n++;
139 
140  if (n < 1)
141  continue;
142  bool isTrackVertex = (n == 1);
143  ++*(isTrackVertex ? &nTracks : &nVertices);
144 
145  addMeas(*(isTrackVertex ? &tracksDist2D : &vertexDist2D),
146  svInfo.flightDistance(i, true));
147  addMeas(*(isTrackVertex ? &tracksDist3D : &vertexDist3D),
148  svInfo.flightDistance(i, false));
149 
150  TrackKinematics &kin = isTrackVertex ? trackKinematics
151  : vertexKinematics;
152  for(TrackRefVector::const_iterator track = tracks.begin();
153  track != tracks.end(); track++) {
154  float w = svInfo.trackWeight(i, *track);
155  if (w < minTrackWeight)
156  continue;
157  if (hasRefittedTracks) {
158  Track actualTrack =
159  vertex.refittedTrack(*track);
160  kin.add(actualTrack, w);
161  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir,
162  actualTrack.momentum()), true);
163  } else {
164  kin.add(**track, w);
165  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir,
166  (*track)->momentum()), true);
167  }
168  if (!isTrackVertex)
169  nVertexTracks++;
170  }
171  }
172 
173  Measurement1D dist2D, dist3D;
174  if (nVertices) {
175  vtxType = btag::Vertices::RecoVertex;
176 
177  if (nVertices == 1 && nTracks) {
178  vertexDist2D.first += tracksDist2D.first;
179  vertexDist2D.second += tracksDist2D.second;
180  vertexDist3D.first += tracksDist3D.first;
181  vertexDist3D.second += tracksDist3D.second;
182  vertexKinematics += trackKinematics;
183  }
184 
185  dist2D = Measurement1D(
186  vertexDist2D.first / vertexDist2D.second,
187  std::sqrt(1. / vertexDist2D.second));
188  dist3D = Measurement1D(
189  vertexDist3D.first / vertexDist3D.second,
190  std::sqrt(1. / vertexDist3D.second));
191 
192  vars.insert(btau::jetNSecondaryVertices, nVertices, true);
193  vars.insert(btau::vertexNTracks, nVertexTracks, true);
194  } else if (nTracks) {
196  vertexKinematics = trackKinematics;
197 
198  dist2D = Measurement1D(
199  tracksDist2D.first / tracksDist2D.second,
200  std::sqrt(1. / tracksDist2D.second));
201  dist3D = Measurement1D(
202  tracksDist3D.first / tracksDist3D.second,
203  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,
212  Geom::deltaR(svInfo.flightDirection(0), jetDir),true);
213  vars.insert(btau::jetNSingleTrackVertices, nTracks, true);
214  }
215 
216  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
217  const std::vector<btag::TrackIPData> &ipData =
218  ipInfo.impactParameterData();
219  const edm::RefVector<TrackCollection> &tracks =
220  ipInfo.selectedTracks();
221 
222  TrackRef trackPairV0Test[2];
223  for(unsigned int i = 0; i < indices.size(); i++) {
224  std::size_t idx = indices[i];
225  const btag::TrackIPData &data = ipData[idx];
226  const TrackRef &trackRef = tracks[idx];
227  const Track &track = *trackRef;
228 
229  // filter track
230 
231  if (!trackSelector(track, data, *jet, pv))
232  continue;
233 
234  // add track to kinematics for all tracks in jet
235 
236  allKinematics.add(track);
237 
238  // check against all other tracks for V0 track pairs
239 
240  trackPairV0Test[0] = tracks[idx];
241  bool ok = true;
242  for(unsigned int j = 0; j < indices.size(); j++) {
243  if (i == j)
244  continue;
245 
246  std::size_t pairIdx = indices[j];
247  const btag::TrackIPData &pairTrackData =
248  ipData[pairIdx];
249  const TrackRef &pairTrackRef = tracks[pairIdx];
250  const Track &pairTrack = *pairTrackRef;
251 
252  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
253  continue;
254 
255  trackPairV0Test[1] = pairTrackRef;
256  if (!trackPairV0Filter(trackPairV0Test, 2)) {
257  ok = false;
258  break;
259  }
260  }
261  if (!ok)
262  continue;
263 
264  // add track variables
265 
266  math::XYZVector trackMom = track.momentum();
267  double trackMag = std::sqrt(trackMom.Mag2());
268 
269  vars.insert(btau::trackSip3dVal, data.ip3d.value(), true);
270  vars.insert(btau::trackSip3dSig, data.ip3d.significance(), true);
271  vars.insert(btau::trackSip2dVal, data.ip2d.value(), true);
272  vars.insert(btau::trackSip2dSig, data.ip2d.significance(), true);
273  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
274  vars.insert(btau::trackGhostTrackDistVal, data.distanceToGhostTrack.value(), true);
275  vars.insert(btau::trackGhostTrackDistSig, data.distanceToGhostTrack.significance(), true);
276  vars.insert(btau::trackGhostTrackWeight, data.ghostTrackWeight, true);
277  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToGhostTrack - pv).mag() : -1.0, true);
278 
279  vars.insert(btau::trackMomentum, trackMag, true);
280  vars.insert(btau::trackEta, trackMom.Eta(), true);
281 
282  vars.insert(btau::trackChi2, track.normalizedChi2(), true);
283  vars.insert(btau::trackNPixelHits, track.hitPattern().pixelLayersWithMeasurement(), true);
284  vars.insert(btau::trackNTotalHits, track.hitPattern().trackerLayersWithMeasurement(), true);
285  vars.insert(btau::trackPtRel, VectorUtil::Perp(trackMom, jetDir), true);
286  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
287  }
288 
289  vars.insert(btau::vertexCategory, vtxType, true);
290  vars.insert(btau::trackSumJetDeltaR,
291  VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
292  vars.insert(btau::trackSumJetEtRatio,
293  allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
294  vars.insert(btau::trackSip3dSigAboveCharm,
296  .ip3d.significance(),
297  true);
298  vars.insert(btau::trackSip2dSigAboveCharm,
300  .ip2d.significance(),
301  true);
302 
303  if (vtxType != btag::Vertices::NoVertex) {
304  math::XYZTLorentzVector allSum = allKinematics.vectorSum();
305  math::XYZTLorentzVector vertexSum = vertexKinematics.vectorSum();
306 
307  vars.insert(btau::vertexMass, vertexSum.M(), true);
308  if (allKinematics.numberOfTracks())
309  vars.insert(btau::vertexEnergyRatio,
310  vertexSum.E() / allSum.E(), true);
311  else
312  vars.insert(btau::vertexEnergyRatio, 1, true);
313  }
314 
315  vars.finalize();
316 
317  return vars;
318 }
Measurement1D flightDistance(unsigned int index, bool in2d=false) const
int i
Definition: DBlmapReader.cc:9
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
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:514
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:134
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Container & selectedTracks() const
Definition: IPTagInfo.h:101
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:458
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:628
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:477
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
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:48
int j
Definition: DBlmapReader.cc:9
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
reco::btag::SortCriteria sortCriterium
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:411
tuple tracks
Definition: testEve_cfg.py:39
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
reco::TrackSelector trackSelector
const reco::btag::TrackIPData & threshTrack(const reco::TrackIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
void insert(const TaggingVariable &variable, bool delayed=false)
const btag::TrackIPData & GhostTrackComputer::threshTrack ( const reco::TrackIPTagInfo trackIPTagInfo,
const reco::btag::SortCriteria  sort,
const reco::Jet jet,
const GlobalPoint pv 
) const
private

Definition at line 53 of file GhostTrackComputer.cc.

References reco::TrackKinematics::add(), charmCut, data, reco::IPTagInfo< Container, Base >::impactParameterData(), getDQMSummary::iter, reco::IPTagInfo< Container, Base >::selectedTracks(), reco::IPTagInfo< Container, Base >::sortedIndexes(), trackNoDeltaRSelector, testEve_cfg::tracks, and reco::TrackKinematics::vectorSum().

Referenced by operator()().

57 {
59  trackIPTagInfo.selectedTracks();
60  const std::vector<btag::TrackIPData> &ipData =
61  trackIPTagInfo.impactParameterData();
62  std::vector<std::size_t> indices = trackIPTagInfo.sortedIndexes(sort);
63 
64  TrackKinematics kin;
65  for(std::vector<std::size_t>::const_iterator iter = indices.begin();
66  iter != indices.end(); ++iter) {
67  const btag::TrackIPData &data = ipData[*iter];
68  const Track &track = *tracks[*iter];
69 
70  if (!trackNoDeltaRSelector(track, data, jet, pv))
71  continue;
72 
73  kin.add(track);
74  if (kin.vectorSum().M() > charmCut)
75  return data;
76  }
77 
78  static const btag::TrackIPData dummy = {
79  GlobalPoint(),
80  GlobalPoint(),
81  Measurement1D(-1.0, 1.0),
82  Measurement1D(-1.0, 1.0),
83  Measurement1D(-1.0, 1.0),
84  Measurement1D(-1.0, 1.0),
85  0.
86  };
87  return dummy;
88 }
void add(const reco::Track &track, double weight=1.0)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Container & selectedTracks() const
Definition: IPTagInfo.h:101
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
Definition: IPTagInfo.h:238
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:91
tuple tracks
Definition: testEve_cfg.py:39
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const math::XYZTLorentzVector & vectorSum() const
reco::TrackSelector trackNoDeltaRSelector

Member Data Documentation

double GhostTrackComputer::charmCut
private

Definition at line 29 of file GhostTrackComputer.h.

Referenced by threshTrack().

double GhostTrackComputer::minTrackWeight
private

Definition at line 33 of file GhostTrackComputer.h.

Referenced by operator()().

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

Definition at line 30 of file GhostTrackComputer.h.

Referenced by operator()().

reco::TrackSelector GhostTrackComputer::trackNoDeltaRSelector
private

Definition at line 32 of file GhostTrackComputer.h.

Referenced by threshTrack().

reco::V0Filter GhostTrackComputer::trackPairV0Filter
private

Definition at line 35 of file GhostTrackComputer.h.

Referenced by operator()().

reco::TrackSelector GhostTrackComputer::trackSelector
private

Definition at line 31 of file GhostTrackComputer.h.

Referenced by operator()().

bool GhostTrackComputer::vertexMassCorrection
private

Definition at line 34 of file GhostTrackComputer.h.