CMS 3D CMS Logo

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

#include <CombinedSVComputer.h>

Inheritance diagram for CombinedSVComputer:
CombinedSVSoftLeptonComputer

Classes

struct  IterationRange
 

Public Member Functions

 CombinedSVComputer (const edm::ParameterSet &params)
 
edm::ParameterSet dropDeltaR (const edm::ParameterSet &pset) const
 
template<class SVTI , class IPTI >
void fillCommonVariables (reco::TaggingVariableList &vars, reco::TrackKinematics &vertexKinematics, const IPTI &ipInfo, const SVTI &svInfo, double &vtx_track_ptSum, double &vtx_track_ESum) const
 
IterationRange flipIterate (int size, bool vertex) const
 
double flipValue (double value, bool vertex) const
 
virtual reco::TaggingVariableList operator() (const reco::CandIPTagInfo &ipInfo, const reco::CandSecondaryVertexTagInfo &svInfo) const
 
virtual reco::TaggingVariableList operator() (const reco::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &svInfo) const
 
const reco::btag::TrackIPDatathreshTrack (const reco::CandIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
 
const reco::btag::TrackIPDatathreshTrack (const reco::TrackIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
 
virtual ~CombinedSVComputer ()=default
 

Private Attributes

double charmCut
 
double minTrackWeight
 
unsigned int pseudoMultiplicityMin
 
reco::V0Filter pseudoVertexV0Filter
 
reco::btag::SortCriteria sortCriterium
 
std::vector< reco::btau::TaggingVariableNametaggingVariables
 
bool trackFlip
 
unsigned int trackMultiplicityMin
 
reco::TrackSelector trackNoDeltaRSelector
 
reco::V0Filter trackPairV0Filter
 
reco::TrackSelector trackPseudoSelector
 
reco::TrackSelector trackSelector
 
bool useTrackWeights
 
bool vertexFlip
 
bool vertexMassCorrection
 

Detailed Description

Definition at line 39 of file CombinedSVComputer.h.

Constructor & Destructor Documentation

◆ CombinedSVComputer()

CombinedSVComputer::CombinedSVComputer ( const edm::ParameterSet params)
explicit

Definition at line 11 of file CombinedSVComputer.cc.

12  : trackFlip(params.getParameter<bool>("trackFlip")),
13  vertexFlip(params.getParameter<bool>("vertexFlip")),
14  charmCut(params.getParameter<double>("charmCut")),
15  sortCriterium(TrackSorting::getCriterium(params.getParameter<std::string>("trackSort"))),
16  trackSelector(params.getParameter<edm::ParameterSet>("trackSelection")),
17  trackNoDeltaRSelector(dropDeltaR(params.getParameter<edm::ParameterSet>("trackSelection"))),
18  trackPseudoSelector(params.getParameter<edm::ParameterSet>("trackPseudoSelection")),
19  pseudoMultiplicityMin(params.getParameter<unsigned int>("pseudoMultiplicityMin")),
20  trackMultiplicityMin(params.getParameter<unsigned int>("trackMultiplicityMin")),
21  minTrackWeight(params.getParameter<double>("minimumTrackWeight")),
22  useTrackWeights(params.getParameter<bool>("useTrackWeights")),
23  vertexMassCorrection(params.getParameter<bool>("correctVertexMass")),
24  pseudoVertexV0Filter(params.getParameter<edm::ParameterSet>("pseudoVertexV0Filter")),
25  trackPairV0Filter(params.getParameter<edm::ParameterSet>("trackPairV0Filter")) {}

◆ ~CombinedSVComputer()

virtual CombinedSVComputer::~CombinedSVComputer ( )
virtualdefault

Member Function Documentation

◆ dropDeltaR()

edm::ParameterSet CombinedSVComputer::dropDeltaR ( const edm::ParameterSet pset) const
inline

Definition at line 5 of file CombinedSVComputer.cc.

5  {
6  edm::ParameterSet psetCopy(pset);
7  psetCopy.addParameter<double>("jetDeltaRMax", 99999.0);
8  return psetCopy;
9 }

References edm::ParameterSet::addParameter(), and muonDTDigis_cfi::pset.

◆ fillCommonVariables()

template<class SVTI , class IPTI >
void CombinedSVComputer::fillCommonVariables ( reco::TaggingVariableList vars,
reco::TrackKinematics vertexKinematics,
const IPTI &  ipInfo,
const SVTI &  svInfo,
double &  vtx_track_ptSum,
double &  vtx_track_ESum 
) const

Definition at line 91 of file CombinedSVComputer.h.

96  {
97  using namespace ROOT::Math;
98  using namespace reco;
99 
100  typedef typename IPTI::input_container Container;
101  typedef typename Container::value_type TrackRef;
102 
103  edm::RefToBase<Jet> jet = ipInfo.jet();
104  math::XYZVector jetDir = jet->momentum().Unit();
105  bool havePv = ipInfo.primaryVertex().isNonnull();
106  GlobalPoint pv;
107  if (havePv)
108  pv = GlobalPoint(ipInfo.primaryVertex()->x(), ipInfo.primaryVertex()->y(), ipInfo.primaryVertex()->z());
109 
111 
112  vars.insert(btau::jetPt, jet->pt(), true);
113  vars.insert(btau::jetEta, jet->eta(), true);
114  vars.insert(btau::jetAbsEta, fabs(jet->eta()), true);
115 
116  if (ipInfo.selectedTracks().size() < trackMultiplicityMin)
117  return;
118 
119  vars.insert(btau::jetNTracks, ipInfo.selectedTracks().size(), true);
120 
121  TrackKinematics allKinematics;
122  TrackKinematics trackJetKinematics;
123 
124  double jet_track_ESum = 0.;
125 
126  int vtx = -1;
127 
128  IterationRange range = flipIterate(svInfo.nVertices(), true);
129  range_for(i, range) {
130  if (vtx < 0)
131  vtx = i;
132  }
133 
134  if (vtx >= 0) {
135  vtxType = btag::Vertices::RecoVertex;
136  vars.insert(btau::flightDistance1dVal, flipValue(svInfo.flightDistance(vtx, 1).value(), true), true);
137  vars.insert(btau::flightDistance1dSig, flipValue(svInfo.flightDistance(vtx, 1).significance(), true), true);
138  vars.insert(btau::flightDistance2dVal, flipValue(svInfo.flightDistance(vtx, 2).value(), true), true);
139  vars.insert(btau::flightDistance2dSig, flipValue(svInfo.flightDistance(vtx, 2).significance(), true), true);
140  vars.insert(btau::flightDistance3dVal, flipValue(svInfo.flightDistance(vtx, 3).value(), true), true);
141  vars.insert(btau::flightDistance3dSig, flipValue(svInfo.flightDistance(vtx, 3).significance(), true), true);
142  vars.insert(btau::vertexJetDeltaR, Geom::deltaR(svInfo.flightDirection(vtx), vertexFlip ? -jetDir : jetDir), true);
143  vars.insert(btau::jetNSecondaryVertices, svInfo.nVertices(), true);
144  }
145 
146  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
147  const std::vector<reco::btag::TrackIPData> &ipData = ipInfo.impactParameterData();
148 
149  const Container &tracks = ipInfo.selectedTracks();
150  std::vector<TrackRef> pseudoVertexTracks;
151 
152  std::vector<TrackRef> trackPairV0Test(2);
153  range = flipIterate(indices.size(), false);
154  range_for(i, range) {
155  std::size_t idx = indices[i];
156  const reco::btag::TrackIPData &data = ipData[idx];
157  const TrackRef &track = tracks[idx];
158 
159  jet_track_ESum += std::sqrt(track->momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
160 
161  // add track to kinematics for all tracks in jet
162  //allKinematics.add(track); // would make more sense for some variables, e.g. vertexEnergyRatio nicely between 0 and 1, but not necessarily the best option for the discriminating power...
163 
164  // filter track -> this track selection can be tighter than the vertex track selection (used to fill the track related variables...)
165  if (!trackSelector(track, data, *jet, pv))
166  continue;
167 
168  // add track to kinematics for all tracks in jet
169  allKinematics.add(track);
170 
171  // if no vertex was reconstructed, attempt pseudo vertex
172  if (vtxType == btag::Vertices::NoVertex && trackPseudoSelector(track, data, *jet, pv)) {
173  pseudoVertexTracks.push_back(track);
174  vertexKinematics.add(track);
175  }
176 
177  // check against all other tracks for V0 track pairs
178  trackPairV0Test[0] = track;
179  bool ok = true;
180  range_for(j, range) {
181  if (i == j)
182  continue;
183 
184  std::size_t pairIdx = indices[j];
185  const reco::btag::TrackIPData &pairTrackData = ipData[pairIdx];
186  const TrackRef &pairTrack = tracks[pairIdx];
187 
188  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
189  continue;
190 
191  trackPairV0Test[1] = pairTrack;
192  if (!trackPairV0Filter(trackPairV0Test)) {
193  ok = false;
194  break;
195  }
196  }
197  if (!ok)
198  continue;
199 
200  trackJetKinematics.add(track);
201 
202  // add track variables
203  math::XYZVector trackMom = track->momentum();
204  double trackMag = std::sqrt(trackMom.Mag2());
205 
206  vars.insert(btau::trackSip3dVal, flipValue(data.ip3d.value(), false), true);
207  vars.insert(btau::trackSip3dSig, flipValue(data.ip3d.significance(), false), true);
208  vars.insert(btau::trackSip2dVal, flipValue(data.ip2d.value(), false), true);
209  vars.insert(btau::trackSip2dSig, flipValue(data.ip2d.significance(), false), true);
210  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
211  // vars.insert(btau::trackJetDistSig, data.distanceToJetAxis.significance(), true);
212  // vars.insert(btau::trackFirstTrackDist, data.distanceToFirstTrack, true);
213  // vars.insert(btau::trackGhostTrackVal, data.distanceToGhostTrack.value(), true);
214  // vars.insert(btau::trackGhostTrackSig, data.distanceToGhostTrack.significance(), true);
215  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToJetAxis - pv).mag() : -1.0, true);
216 
217  vars.insert(btau::trackMomentum, trackMag, true);
218  vars.insert(btau::trackEta, trackMom.Eta(), true);
219 
220  // check for erroneous Perp^2 values before evaluating Perp (fix for DeepCSV NaN outputs)
221  double perp_trackMom_jetDir = VectorUtil::Perp2(trackMom, jetDir);
222  perp_trackMom_jetDir = (perp_trackMom_jetDir > 0. ? std::sqrt(perp_trackMom_jetDir) : 0.);
223 
224  vars.insert(btau::trackPtRel, perp_trackMom_jetDir, true);
225  vars.insert(btau::trackPPar, jetDir.Dot(trackMom), true);
226  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
227  vars.insert(btau::trackPtRatio, perp_trackMom_jetDir / trackMag, true);
228  vars.insert(btau::trackPParRatio, jetDir.Dot(trackMom) / trackMag, true);
229  }
230 
231  if (vtxType == btag::Vertices::NoVertex && vertexKinematics.numberOfTracks() >= pseudoMultiplicityMin &&
232  pseudoVertexV0Filter(pseudoVertexTracks)) {
234  for (typename std::vector<TrackRef>::const_iterator trkIt = pseudoVertexTracks.begin();
235  trkIt != pseudoVertexTracks.end();
236  ++trkIt) {
237  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*trkIt)->momentum()), true);
238  vtx_track_ptSum += std::sqrt((*trkIt)->momentum().Perp2());
239  vtx_track_ESum += std::sqrt((*trkIt)->momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
240  }
241  }
242 
243  vars.insert(btau::vertexCategory, vtxType, true);
244 
245  vars.insert(btau::trackJetPt, trackJetKinematics.vectorSum().Pt(), true);
246  vars.insert(btau::trackSumJetDeltaR, VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
247  vars.insert(btau::trackSumJetEtRatio, allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
248 
250  flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.significance(), false),
251  true);
253  flipValue(threshTrack(ipInfo, reco::btag::IP3DSig, *jet, pv).ip3d.value(), false),
254  true);
256  flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.significance(), false),
257  true);
259  flipValue(threshTrack(ipInfo, reco::btag::IP2DSig, *jet, pv).ip2d.value(), false),
260  true);
261 
262  if (vtxType != btag::Vertices::NoVertex) {
263  math::XYZTLorentzVector allSum = useTrackWeights ? allKinematics.weightedVectorSum() : allKinematics.vectorSum();
264  math::XYZTLorentzVector vertexSum =
265  useTrackWeights ? vertexKinematics.weightedVectorSum() : vertexKinematics.vectorSum();
266 
267  if (vtxType != btag::Vertices::RecoVertex) {
268  vars.insert(btau::vertexNTracks, vertexKinematics.numberOfTracks(), true);
269  vars.insert(btau::vertexJetDeltaR, VectorUtil::DeltaR(vertexSum, jetDir), true);
270  }
271 
272  double vertexMass = vertexSum.M();
274  const GlobalVector &dir = svInfo.flightDirection(vtx);
275  double vertexPt2 = math::XYZVector(dir.x(), dir.y(), dir.z()).Cross(vertexSum).Mag2() / dir.mag2();
276  vertexMass = std::sqrt(vertexMass * vertexMass + vertexPt2) + std::sqrt(vertexPt2);
277  }
278  vars.insert(btau::vertexMass, vertexMass, true);
279 
280  double varPi = (vertexMass / 5.2794) *
281  (vtx_track_ESum / jet_track_ESum); // 5.2794 should be the average B meson mass of PDG! CHECK!!!
282  vars.insert(btau::massVertexEnergyFraction, varPi / (varPi + 0.04), true);
283  double varB = (std::sqrt(5.2794) * vtx_track_ptSum) / (vertexMass * std::sqrt(jet->pt()));
284  vars.insert(btau::vertexBoostOverSqrtJetPt, varB * varB / (varB * varB + 10.), true);
285 
286  if (allKinematics.numberOfTracks()) {
287  vars.insert(btau::vertexEnergyRatio, vertexSum.E() / allSum.E(), true);
288  } else {
289  vars.insert(btau::vertexEnergyRatio, 1, true);
290  }
291  }
292 
293  reco::PFJet const *pfJet = dynamic_cast<reco::PFJet const *>(&*jet);
294  pat::Jet const *patJet = dynamic_cast<pat::Jet const *>(&*jet);
295  if (pfJet != nullptr) {
298  vars.insert(btau::photonEnergyFraction, pfJet->photonEnergyFraction(), true);
300  vars.insert(btau::muonEnergyFraction, pfJet->muonEnergyFraction(), true);
303  vars.insert(btau::photonMultiplicity, pfJet->photonMultiplicity(), true);
304  vars.insert(btau::electronMultiplicity, pfJet->electronMultiplicity(), true);
305  vars.insert(btau::muonMultiplicity, pfJet->muonMultiplicity(), true);
306  vars.insert(
310  true);
313  pfJet->electronMultiplicity() + pfJet->muonMultiplicity(),
314  true);
315 
316  } else if (patJet != nullptr && patJet->isPFJet()) {
319  vars.insert(btau::photonEnergyFraction, patJet->photonEnergyFraction(), true);
321  vars.insert(btau::muonEnergyFraction, patJet->muonEnergyFraction(), true);
324  vars.insert(btau::photonMultiplicity, patJet->photonMultiplicity(), true);
325  vars.insert(btau::electronMultiplicity, patJet->electronMultiplicity(), true);
326  vars.insert(btau::muonMultiplicity, patJet->muonMultiplicity(), true);
327  vars.insert(
329  vars.insert(
332  true);
335  patJet->photonMultiplicity() + patJet->electronMultiplicity() + patJet->muonMultiplicity(),
336  true);
337 
338  } else {
339  vars.insert(btau::chargedHadronEnergyFraction, 0., true);
340  vars.insert(btau::neutralHadronEnergyFraction, 0., true);
341  vars.insert(btau::photonEnergyFraction, 0., true);
342  vars.insert(btau::electronEnergyFraction, 0., true);
343  vars.insert(btau::muonEnergyFraction, 0., true);
344  vars.insert(btau::chargedHadronMultiplicity, 0, true);
345  vars.insert(btau::neutralHadronMultiplicity, 0, true);
346  vars.insert(btau::photonMultiplicity, 0, true);
347  vars.insert(btau::electronMultiplicity, 0, true);
348  vars.insert(btau::muonMultiplicity, 0, true);
349  vars.insert(btau::hadronMultiplicity, 0, true);
350  vars.insert(btau::hadronPhotonMultiplicity, 0, true);
351  vars.insert(btau::totalMultiplicity, 0, true);
352  }
353 }

References reco::TrackKinematics::add(), reco::PFJet::chargedHadronEnergyFraction(), reco::btau::chargedHadronEnergyFraction, pat::Jet::chargedHadronEnergyFraction(), reco::btau::chargedHadronMultiplicity, reco::PFJet::chargedHadronMultiplicity(), pat::Jet::chargedHadronMultiplicity(), data, electronAnalyzer_cfi::DeltaR, PbPb_ZMuSkimMuonDPG_cff::deltaR, DeadROC_duringRun::dir, reco::btau::electronEnergyFraction, reco::PFJet::electronEnergyFraction(), pat::Jet::electronEnergyFraction(), reco::btau::electronMultiplicity, reco::PFJet::electronMultiplicity(), pat::Jet::electronMultiplicity(), reco::btau::etaRel(), reco::btau::flightDistance1dSig, reco::btau::flightDistance1dVal, reco::btau::flightDistance2dSig, reco::btau::flightDistance2dVal, reco::btau::flightDistance3dSig, reco::btau::flightDistance3dVal, flipIterate(), flipValue(), reco::btau::hadronMultiplicity, reco::btau::hadronPhotonMultiplicity, mps_fire::i, heavyIonCSV_trainingSettings::idx, bTagCombinedSVVariables_cff::indices, reco::btag::IP2DSig, electrons_cff::ip3d, reco::btag::IP3DSig, pat::Jet::isPFJet(), dqmiolumiharvest::j, metsig::jet, reco::btau::jetAbsEta, reco::btau::jetEta, reco::btau::jetNSecondaryVertices, reco::btau::jetNTracks, reco::btau::jetPt, reco::btau::massVertexEnergyFraction, reco::btau::muonEnergyFraction, reco::PFJet::muonEnergyFraction(), pat::Jet::muonEnergyFraction(), reco::btau::muonMultiplicity, reco::PFJet::muonMultiplicity(), pat::Jet::muonMultiplicity(), reco::PFJet::neutralHadronEnergyFraction(), reco::btau::neutralHadronEnergyFraction, pat::Jet::neutralHadronEnergyFraction(), reco::btau::neutralHadronMultiplicity, reco::PFJet::neutralHadronMultiplicity(), pat::Jet::neutralHadronMultiplicity(), reco::btag::Vertices::NoVertex, reco::TrackKinematics::numberOfTracks(), convertSQLiteXML::ok, reco::btau::photonEnergyFraction, reco::PFJet::photonEnergyFraction(), pat::Jet::photonEnergyFraction(), reco::btau::photonMultiplicity, reco::PFJet::photonMultiplicity(), pat::Jet::photonMultiplicity(), reco::ParticleMasses::piPlus, pseudoMultiplicityMin, reco::btag::Vertices::PseudoVertex, pseudoVertexV0Filter, MetAnalyzer::pv(), FastTimerService_cff::range, range_for, reco::btag::Vertices::RecoVertex, sortCriterium, mathSSE::sqrt(), HGCalGeometryMode::Square, threshTrack(), reco::btau::totalMultiplicity, HLT_FULL_cff::track, reco::btau::trackDecayLenVal, reco::btau::trackDeltaR, reco::btau::trackEta, reco::btau::trackEtaRel, reco::btau::trackJetDistVal, reco::btau::trackJetPt, reco::btau::trackMomentum, trackMultiplicityMin, trackPairV0Filter, reco::btau::trackPPar, reco::btau::trackPParRatio, trackPseudoSelector, reco::btau::trackPtRatio, reco::btau::trackPtRel, tracks, trackSelector, reco::btau::trackSip2dSig, reco::btau::trackSip2dSigAboveCharm, reco::btau::trackSip2dVal, reco::btau::trackSip2dValAboveCharm, reco::btau::trackSip3dSig, reco::btau::trackSip3dSigAboveCharm, reco::btau::trackSip3dVal, reco::btau::trackSip3dValAboveCharm, reco::btau::trackSumJetDeltaR, reco::btau::trackSumJetEtRatio, useTrackWeights, reco::TrackKinematics::vectorSum(), reco::btau::vertexBoostOverSqrtJetPt, reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, vertexFlip, reco::btau::vertexJetDeltaR, reco::btau::vertexMass, vertexMassCorrection, reco::btau::vertexNTracks, extraflags_cff::vtx, and reco::TrackKinematics::weightedVectorSum().

Referenced by operator()().

◆ flipIterate()

CombinedSVComputer::IterationRange CombinedSVComputer::flipIterate ( int  size,
bool  vertex 
) const
inline

Definition at line 31 of file CombinedSVComputer.cc.

31  {
32  IterationRange range;
33  if (vertex ? vertexFlip : trackFlip) {
34  range.begin = size - 1;
35  range.end = -1;
36  range.increment = -1;
37  } else {
38  range.begin = 0;
39  range.end = size;
40  range.increment = +1;
41  }
42 
43  return range;
44 }

References FastTimerService_cff::range, findQualityFiles::size, trackFlip, bphysicsOniaDQM_cfi::vertex, and vertexFlip.

Referenced by fillCommonVariables(), and operator()().

◆ flipValue()

double CombinedSVComputer::flipValue ( double  value,
bool  vertex 
) const
inline

Definition at line 27 of file CombinedSVComputer.cc.

27  {
28  return (vertex ? vertexFlip : trackFlip) ? -value : value;
29 }

References trackFlip, relativeConstraints::value, bphysicsOniaDQM_cfi::vertex, and vertexFlip.

Referenced by fillCommonVariables().

◆ operator()() [1/2]

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

Definition at line 195 of file CombinedSVComputer.cc.

196  {
197  using namespace ROOT::Math;
198 
199  edm::RefToBase<Jet> jet = ipInfo.jet();
200  math::XYZVector jetDir = jet->momentum().Unit();
202 
203  TrackKinematics vertexKinematics;
204 
205  double vtx_track_ptSum = 0.;
206  double vtx_track_ESum = 0.;
207 
208  // the following is specific depending on the type of vertex
209  int vtx = -1;
210  unsigned int numberofvertextracks = 0;
211 
212  IterationRange range = flipIterate(svInfo.nVertices(), true);
213  range_for(i, range) {
214  numberofvertextracks = numberofvertextracks + (svInfo.secondaryVertex(i)).numberOfSourceCandidatePtrs();
215 
217  const std::vector<CandidatePtr> &tracks = vertex.daughterPtrVector();
218  for (std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
219  vertexKinematics.add(*track);
220  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*track)->momentum()), true);
221  if (vtx < 0) // calculate this only for the first vertex
222  {
223  vtx_track_ptSum += std::sqrt((*track)->momentum().Perp2());
224  vtx_track_ESum += std::sqrt((*track)->momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
225  }
226  }
227 
228  if (vtx < 0)
229  vtx = i;
230  }
231  if (vtx >= 0) {
232  vars.insert(btau::vertexNTracks, numberofvertextracks, true);
233  vars.insert(btau::vertexFitProb, (svInfo.secondaryVertex(vtx)).vertexNormalizedChi2(), true);
234  }
235 
236  // after we collected vertex information we let the common code complete the job
237  fillCommonVariables(vars, vertexKinematics, ipInfo, svInfo, vtx_track_ptSum, vtx_track_ESum);
238 
239  vars.finalize();
240  return vars;
241 }

References reco::TrackKinematics::add(), reco::btau::etaRel(), fillCommonVariables(), flipIterate(), mps_fire::i, metsig::jet, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::nVertices(), reco::ParticleMasses::piPlus, FastTimerService_cff::range, range_for, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::secondaryVertex(), mathSSE::sqrt(), HGCalGeometryMode::Square, HLT_FULL_cff::track, reco::btau::trackEtaRel, tracks, bphysicsOniaDQM_cfi::vertex, reco::btau::vertexFitProb, reco::btau::vertexNTracks, and extraflags_cff::vtx.

◆ operator()() [2/2]

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

Definition at line 133 of file CombinedSVComputer.cc.

134  {
135  using namespace ROOT::Math;
136 
137  edm::RefToBase<Jet> jet = ipInfo.jet();
138  math::XYZVector jetDir = jet->momentum().Unit();
140 
141  TrackKinematics vertexKinematics;
142 
143  double vtx_track_ptSum = 0.;
144  double vtx_track_ESum = 0.;
145 
146  // the following is specific depending on the type of vertex
147  int vtx = -1;
148  unsigned int numberofvertextracks = 0;
149 
150  IterationRange range = flipIterate(svInfo.nVertices(), true);
151  range_for(i, range) {
152  numberofvertextracks = numberofvertextracks + (svInfo.secondaryVertex(i)).nTracks();
153 
154  const Vertex &vertex = svInfo.secondaryVertex(i);
155  bool hasRefittedTracks = vertex.hasRefittedTracks();
156  for (reco::Vertex::trackRef_iterator track = vertex.tracks_begin(); track != vertex.tracks_end(); track++) {
157  double w = vertex.trackWeight(*track);
158  if (w < minTrackWeight)
159  continue;
160  if (hasRefittedTracks) {
161  const Track actualTrack = vertex.refittedTrack(*track);
162  vertexKinematics.add(actualTrack, w);
163  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, actualTrack.momentum()), true);
164  if (vtx < 0) // calculate this only for the first vertex
165  {
166  vtx_track_ptSum += std::sqrt(actualTrack.momentum().Perp2());
167  vtx_track_ESum += std::sqrt(actualTrack.momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
168  }
169  } else {
170  vertexKinematics.add(**track, w);
171  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*track)->momentum()), true);
172  if (vtx < 0) // calculate this only for the first vertex
173  {
174  vtx_track_ptSum += std::sqrt((*track)->momentum().Perp2());
175  vtx_track_ESum += std::sqrt((*track)->momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
176  }
177  }
178  }
179 
180  if (vtx < 0)
181  vtx = i;
182  }
183  if (vtx >= 0) {
184  vars.insert(btau::vertexNTracks, numberofvertextracks, true);
185  vars.insert(btau::vertexFitProb, (svInfo.secondaryVertex(vtx)).normalizedChi2(), true);
186  }
187 
188  // after we collected vertex information we let the common code complete the job
189  fillCommonVariables(vars, vertexKinematics, ipInfo, svInfo, vtx_track_ptSum, vtx_track_ESum);
190 
191  vars.finalize();
192  return vars;
193 }

References reco::TrackKinematics::add(), reco::btau::etaRel(), fillCommonVariables(), flipIterate(), mps_fire::i, metsig::jet, minTrackWeight, reco::TrackBase::momentum(), TrackCollections2monitor_cff::normalizedChi2, BeamSpotPI::nTracks, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::nVertices(), reco::ParticleMasses::piPlus, FastTimerService_cff::range, range_for, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::secondaryVertex(), mathSSE::sqrt(), HGCalGeometryMode::Square, HLT_FULL_cff::track, reco::btau::trackEtaRel, bphysicsOniaDQM_cfi::vertex, reco::btau::vertexFitProb, reco::btau::vertexNTracks, extraflags_cff::vtx, and w.

Referenced by CombinedSVSoftLeptonComputer::operator()().

◆ threshTrack() [1/2]

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

Referenced by fillCommonVariables().

◆ threshTrack() [2/2]

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

Member Data Documentation

◆ charmCut

double CombinedSVComputer::charmCut
private

Definition at line 75 of file CombinedSVComputer.h.

◆ minTrackWeight

double CombinedSVComputer::minTrackWeight
private

Definition at line 82 of file CombinedSVComputer.h.

Referenced by operator()().

◆ pseudoMultiplicityMin

unsigned int CombinedSVComputer::pseudoMultiplicityMin
private

Definition at line 80 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

◆ pseudoVertexV0Filter

reco::V0Filter CombinedSVComputer::pseudoVertexV0Filter
private

Definition at line 85 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

◆ sortCriterium

reco::btag::SortCriteria CombinedSVComputer::sortCriterium
private

Definition at line 76 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

◆ taggingVariables

std::vector<reco::btau::TaggingVariableName> CombinedSVComputer::taggingVariables
private

Definition at line 87 of file CombinedSVComputer.h.

◆ trackFlip

bool CombinedSVComputer::trackFlip
private

Definition at line 73 of file CombinedSVComputer.h.

Referenced by flipIterate(), and flipValue().

◆ trackMultiplicityMin

unsigned int CombinedSVComputer::trackMultiplicityMin
private

Definition at line 81 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

◆ trackNoDeltaRSelector

reco::TrackSelector CombinedSVComputer::trackNoDeltaRSelector
private

Definition at line 78 of file CombinedSVComputer.h.

◆ trackPairV0Filter

reco::V0Filter CombinedSVComputer::trackPairV0Filter
private

Definition at line 86 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

◆ trackPseudoSelector

reco::TrackSelector CombinedSVComputer::trackPseudoSelector
private

Definition at line 79 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

◆ trackSelector

reco::TrackSelector CombinedSVComputer::trackSelector
private

Definition at line 77 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

◆ useTrackWeights

bool CombinedSVComputer::useTrackWeights
private

Definition at line 83 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

◆ vertexFlip

bool CombinedSVComputer::vertexFlip
private

Definition at line 74 of file CombinedSVComputer.h.

Referenced by fillCommonVariables(), flipIterate(), and flipValue().

◆ vertexMassCorrection

bool CombinedSVComputer::vertexMassCorrection
private

Definition at line 84 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

Vector3DBase
Definition: Vector3DBase.h:8
pat::Jet::electronMultiplicity
int electronMultiplicity() const
electronMultiplicity
Definition: Jet.h:451
reco::btau::jetPt
Definition: TaggingVariable.h:32
reco::btau::vertexBoostOverSqrtJetPt
Definition: TaggingVariable.h:118
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
reco::btau::trackPtRatio
Definition: TaggingVariable.h:51
reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
reco::btau::chargedHadronEnergyFraction
Definition: TaggingVariable.h:103
reco::TrackKinematics
Definition: TrackKinematics.h:16
CombinedSVComputer::charmCut
double charmCut
Definition: CombinedSVComputer.h:75
reco::ParticleMasses::piPlus
const double piPlus
Definition: ParticleMasses.h:9
mps_fire.i
i
Definition: mps_fire.py:428
reco::btau::neutralHadronEnergyFraction
Definition: TaggingVariable.h:104
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
reco::PFJet::neutralHadronMultiplicity
int neutralHadronMultiplicity() const
neutralHadronMultiplicity
Definition: PFJet.h:126
CombinedSVComputer::useTrackWeights
bool useTrackWeights
Definition: CombinedSVComputer.h:83
reco::btau::trackSumJetEtRatio
Definition: TaggingVariable.h:66
reco::btau::flightDistance1dSig
Definition: TaggingVariable.h:83
reco::btau::neutralHadronMultiplicity
Definition: TaggingVariable.h:109
CombinedSVComputer::trackNoDeltaRSelector
reco::TrackSelector trackNoDeltaRSelector
Definition: CombinedSVComputer.h:78
reco::btau::vertexCategory
Definition: TaggingVariable.h:69
reco::PFJet::photonEnergyFraction
float photonEnergyFraction() const
photonEnergyFraction
Definition: PFJet.h:105
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
reco::btau::totalMultiplicity
Definition: TaggingVariable.h:115
reco::btau::muonEnergyFraction
Definition: TaggingVariable.h:107
reco::btau::trackSip2dSigAboveCharm
Definition: TaggingVariable.h:90
reco::btau::photonEnergyFraction
Definition: TaggingVariable.h:105
reco::TemplatedSecondaryVertexTagInfo::nVertices
unsigned int nVertices() const
Definition: TemplatedSecondaryVertexTagInfo.h:112
reco::TaggingVariableList
Definition: TaggingVariable.h:194
pat::Jet::photonEnergyFraction
float photonEnergyFraction() const
photonEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:420
pat::Jet::neutralHadronEnergyFraction
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:404
reco::PFJet::muonEnergyFraction
float muonEnergyFraction() const
muonEnergyFraction
Definition: PFJet.h:113
reco::btag::Vertices::PseudoVertex
Definition: VertexTypes.h:18
reco::btau::trackJetPt
Definition: TaggingVariable.h:33
reco::btau::trackSip2dValAboveCharm
Definition: TaggingVariable.h:89
reco::btau::flightDistance3dVal
Definition: TaggingVariable.h:86
reco::btau::trackEta
Definition: TaggingVariable.h:42
reco::btau::trackSip3dValAboveCharm
Definition: TaggingVariable.h:91
reco::TrackKinematics::numberOfTracks
unsigned int numberOfTracks() const
Definition: TrackKinematics.h:44
reco::PFJet::chargedHadronEnergyFraction
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction
Definition: PFJet.h:97
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::btau::trackEtaRel
Definition: TaggingVariable.h:49
reco::PFJet::electronEnergyFraction
float electronEnergyFraction() const
electronEnergyFraction
Definition: PFJet.h:109
BeamSpotPI::nTracks
Definition: BeamSpotPayloadInspectorHelper.h:42
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
reco::btau::massVertexEnergyFraction
Definition: TaggingVariable.h:117
CombinedSVComputer::vertexMassCorrection
bool vertexMassCorrection
Definition: CombinedSVComputer.h:84
reco::btau::trackSip2dVal
Definition: TaggingVariable.h:54
reco::VertexCompositePtrCandidate
Definition: VertexCompositePtrCandidate.h:16
reco::JetExtendedAssociation::Container
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
Definition: JetExtendedAssociation.h:29
edm::Ref< TrackCollection >
CombinedSVComputer::flipValue
double flipValue(double value, bool vertex) const
Definition: CombinedSVComputer.cc:27
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
pat::Jet::neutralHadronMultiplicity
int neutralHadronMultiplicity() const
neutralHadronMultiplicity
Definition: Jet.h:447
reco::btau::vertexFitProb
Definition: TaggingVariable.h:77
reco::btag::Vertices::NoVertex
Definition: VertexTypes.h:18
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
range_for
#define range_for(i, x)
Definition: CombinedSVComputer.h:37
CombinedSVComputer::minTrackWeight
double minTrackWeight
Definition: CombinedSVComputer.h:82
reco::btau::flightDistance1dVal
Definition: TaggingVariable.h:82
vars
vars
Definition: DeepTauId.cc:164
reco::btag::Vertices::RecoVertex
Definition: VertexTypes.h:18
w
const double w
Definition: UKUtility.cc:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CombinedSVComputer::trackMultiplicityMin
unsigned int trackMultiplicityMin
Definition: CombinedSVComputer.h:81
reco::btau::trackDeltaR
Definition: TaggingVariable.h:50
reco::Track
Definition: Track.h:27
reco::btau::trackPtRel
Definition: TaggingVariable.h:47
reco::btau::trackMomentum
Definition: TaggingVariable.h:41
reco::btau::trackSumJetDeltaR
Definition: TaggingVariable.h:67
reco::PFJet::chargedHadronMultiplicity
int chargedHadronMultiplicity() const
chargedHadronMultiplicity
Definition: PFJet.h:124
HGCalGeometryMode::Square
Definition: HGCalGeometryMode.h:26
reco::btau::muonMultiplicity
Definition: TaggingVariable.h:112
CombinedSVComputer::trackSelector
reco::TrackSelector trackSelector
Definition: CombinedSVComputer.h:77
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
reco::TrackKinematics::vectorSum
const math::XYZTLorentzVector & vectorSum() const
Definition: TrackKinematics.h:47
Point3DBase< float, GlobalTag >
CombinedSVComputer::fillCommonVariables
void fillCommonVariables(reco::TaggingVariableList &vars, reco::TrackKinematics &vertexKinematics, const IPTI &ipInfo, const SVTI &svInfo, double &vtx_track_ptSum, double &vtx_track_ESum) const
Definition: CombinedSVComputer.h:91
ROOT::Math
Definition: Transform3DPJ.h:41
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::btau::hadronPhotonMultiplicity
Definition: TaggingVariable.h:114
CombinedSVComputer::flipIterate
IterationRange flipIterate(int size, bool vertex) const
Definition: CombinedSVComputer.cc:31
reco::btau::trackJetDistVal
Definition: TaggingVariable.h:60
reco::btau::jetEta
Definition: TaggingVariable.h:34
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
edm::ParameterSet
Definition: ParameterSet.h:47
reco::btag::Vertices::VertexType
VertexType
Definition: VertexTypes.h:18
reco::PFJet::neutralHadronEnergyFraction
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction
Definition: PFJet.h:101
reco::btau::jetAbsEta
Definition: TaggingVariable.h:35
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
reco::btau::trackSip2dSig
Definition: TaggingVariable.h:55
reco::btau::trackSip3dSig
Definition: TaggingVariable.h:57
pat::Jet::electronEnergyFraction
float electronEnergyFraction() const
electronEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:426
reco::btau::trackPParRatio
Definition: TaggingVariable.h:52
reco::btau::jetNSecondaryVertices
Definition: TaggingVariable.h:72
reco::PFJet::electronMultiplicity
int electronMultiplicity() const
electronMultiplicity
Definition: PFJet.h:130
reco::TemplatedSecondaryVertexTagInfo::secondaryVertex
const VTX & secondaryVertex(unsigned int index) const
Definition: TemplatedSecondaryVertexTagInfo.h:107
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
electrons_cff.ip3d
ip3d
Definition: electrons_cff.py:357
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
reco::PFJet::photonMultiplicity
int photonMultiplicity() const
photonMultiplicity
Definition: PFJet.h:128
reco::btau::etaRel
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
Definition: TaggingVariable.h:22
reco::btau::electronEnergyFraction
Definition: TaggingVariable.h:106
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
reco::btau::vertexJetDeltaR
Definition: TaggingVariable.h:80
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
reco::btau::trackPPar
Definition: TaggingVariable.h:48
reco::btau::chargedHadronMultiplicity
Definition: TaggingVariable.h:108
TrackCollections2monitor_cff.normalizedChi2
normalizedChi2
Definition: TrackCollections2monitor_cff.py:247
CombinedSVComputer::pseudoMultiplicityMin
unsigned int pseudoMultiplicityMin
Definition: CombinedSVComputer.h:80
reco::btau::trackSip3dVal
Definition: TaggingVariable.h:56
pat::Jet::isPFJet
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:275
pat::Jet::chargedHadronMultiplicity
int chargedHadronMultiplicity() const
chargedHadronMultiplicity
Definition: Jet.h:445
CombinedSVComputer::trackPairV0Filter
reco::V0Filter trackPairV0Filter
Definition: CombinedSVComputer.h:86
reco::PFJet::muonMultiplicity
int muonMultiplicity() const
muonMultiplicity
Definition: PFJet.h:132
pat::Jet::muonMultiplicity
int muonMultiplicity() const
muonMultiplicity
Definition: Jet.h:736
reco::TrackKinematics::weightedVectorSum
const math::XYZTLorentzVector & weightedVectorSum() const
Definition: TrackKinematics.h:48
pat::Jet::chargedHadronEnergyFraction
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:400
CombinedSVComputer::vertexFlip
bool vertexFlip
Definition: CombinedSVComputer.h:74
CombinedSVComputer::pseudoVertexV0Filter
reco::V0Filter pseudoVertexV0Filter
Definition: CombinedSVComputer.h:85
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
metsig::jet
Definition: SignAlgoResolutions.h:47
pat::Jet::photonMultiplicity
int photonMultiplicity() const
photonMultiplicity
Definition: Jet.h:449
reco::btau::hadronMultiplicity
Definition: TaggingVariable.h:113
pat::Jet::muonEnergyFraction
float muonEnergyFraction() const
muonEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:432
relativeConstraints.value
value
Definition: relativeConstraints.py:53
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
reco::btau::jetNTracks
Definition: TaggingVariable.h:37
CombinedSVComputer::sortCriterium
reco::btag::SortCriteria sortCriterium
Definition: CombinedSVComputer.h:76
edm::RefToBase< Jet >
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
reco::btau::trackDecayLenVal
Definition: TaggingVariable.h:58
reco::btau::flightDistance3dSig
Definition: TaggingVariable.h:87
reco::btau::flightDistance2dVal
Definition: TaggingVariable.h:84
reco::btau::electronMultiplicity
Definition: TaggingVariable.h:111
reco::btag::IP3DSig
Definition: IPTagInfo.h:43
reco::btau::photonMultiplicity
Definition: TaggingVariable.h:110
CombinedSVComputer::trackPseudoSelector
reco::TrackSelector trackPseudoSelector
Definition: CombinedSVComputer.h:79
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
reco::TrackBase::momentum
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
CombinedSVComputer::threshTrack
const reco::btag::TrackIPData & threshTrack(const reco::CandIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
TrackSorting::getCriterium
reco::btag::SortCriteria getCriterium(const std::string &name)
Definition: TrackSorting.cc:11
reco::btau::flightDistance2dSig
Definition: TaggingVariable.h:85
reco::btau::vertexMass
Definition: TaggingVariable.h:75
reco::btau::vertexNTracks
Definition: TaggingVariable.h:76
reco::btau::vertexEnergyRatio
Definition: TaggingVariable.h:79
reco::Vertex
Definition: Vertex.h:35
reco::btau::trackSip3dSigAboveCharm
Definition: TaggingVariable.h:92
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
reco::btag::IP2DSig
Definition: IPTagInfo.h:43
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
reco::btag::TrackIPData
Definition: IPTagInfo.h:28
CombinedSVComputer::trackFlip
bool trackFlip
Definition: CombinedSVComputer.h:73
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
CombinedSVComputer::dropDeltaR
edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset) const
Definition: CombinedSVComputer.cc:5
reco::TrackKinematics::add
void add(const reco::Track &track, double weight=1.0)
Definition: TrackKinematics.cc:57