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::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &svInfo) const
 
virtual reco::TaggingVariableList operator() (const reco::CandIPTagInfo &ipInfo, const reco::CandSecondaryVertexTagInfo &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")) {}
reco::TrackSelector trackSelector
reco::btag::SortCriteria getCriterium(const std::string &name)
Definition: TrackSorting.cc:11
unsigned int pseudoMultiplicityMin
reco::TrackSelector trackNoDeltaRSelector
reco::V0Filter pseudoVertexV0Filter
reco::btag::SortCriteria sortCriterium
reco::TrackSelector trackPseudoSelector
edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset) const
reco::V0Filter trackPairV0Filter
unsigned int trackMultiplicityMin

◆ ~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.

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

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

◆ 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.

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, dqmdumpme::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_2022v12_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()().

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 }
reco::TrackSelector trackSelector
const double piPlus
Definition: ParticleMasses.h:9
int neutralHadronMultiplicity() const
neutralHadronMultiplicity
Definition: Jet.h:447
unsigned int pseudoMultiplicityMin
int chargedHadronMultiplicity() const
chargedHadronMultiplicity
Definition: PFJet.h:124
float electronEnergyFraction() const
electronEnergyFraction
Definition: PFJet.h:109
void add(const reco::Track &track, double weight=1.0)
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
reco::V0Filter pseudoVertexV0Filter
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double flipValue(double value, bool vertex) const
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:404
float photonEnergyFraction() const
photonEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:420
unsigned int numberOfTracks() const
int photonMultiplicity() const
photonMultiplicity
Definition: PFJet.h:128
Jets made from PFObjects.
Definition: PFJet.h:20
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
reco::btag::SortCriteria sortCriterium
float photonEnergyFraction() const
photonEnergyFraction
Definition: PFJet.h:105
IterationRange flipIterate(int size, bool vertex) const
reco::TrackSelector trackPseudoSelector
T sqrt(T t)
Definition: SSEVec.h:19
const math::XYZTLorentzVector & vectorSum() const
def pv(vc)
Definition: MetAnalyzer.py:7
int photonMultiplicity() const
photonMultiplicity
Definition: Jet.h:449
int electronMultiplicity() const
electronMultiplicity
Definition: PFJet.h:130
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction
Definition: PFJet.h:97
int neutralHadronMultiplicity() const
neutralHadronMultiplicity
Definition: PFJet.h:126
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:275
int chargedHadronMultiplicity() const
chargedHadronMultiplicity
Definition: Jet.h:445
reco::V0Filter trackPairV0Filter
int muonMultiplicity() const
muonMultiplicity
Definition: PFJet.h:132
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:400
int electronMultiplicity() const
electronMultiplicity
Definition: Jet.h:451
auto const & tracks
cannot be loose
float muonEnergyFraction() const
muonEnergyFraction
Definition: PFJet.h:113
#define range_for(i, x)
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction
Definition: PFJet.h:101
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
int muonMultiplicity() const
muonMultiplicity
Definition: Jet.h:736
Analysis-level calorimeter jet class.
Definition: Jet.h:77
float muonEnergyFraction() const
muonEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:432
fixed size matrix
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const reco::btag::TrackIPData & threshTrack(const reco::CandIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
const math::XYZTLorentzVector & weightedVectorSum() const
vars
Definition: DeepTauId.cc:30
float electronEnergyFraction() const
electronEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:426
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
unsigned int trackMultiplicityMin

◆ flipIterate()

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

Definition at line 31 of file CombinedSVComputer.cc.

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

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

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 }
size
Write out results.

◆ flipValue()

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

◆ operator()() [1/2]

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

Definition at line 133 of file CombinedSVComputer.cc.

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_2022v12_cff::track, reco::btau::trackEtaRel, bphysicsOniaDQM_cfi::vertex, reco::btau::vertexFitProb, reco::btau::vertexNTracks, extraflags_cff::vtx, and w().

Referenced by CombinedSVSoftLeptonComputer::operator()().

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 }
const double piPlus
Definition: ParticleMasses.h:9
void add(const reco::Track &track, double weight=1.0)
T w() const
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
IterationRange flipIterate(int size, bool vertex) const
T sqrt(T t)
Definition: SSEVec.h:19
#define range_for(i, x)
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
vars
Definition: DeepTauId.cc:30
void fillCommonVariables(reco::TaggingVariableList &vars, reco::TrackKinematics &vertexKinematics, const IPTI &ipInfo, const SVTI &svInfo, double &vtx_track_ptSum, double &vtx_track_ESum) const
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38

◆ operator()() [2/2]

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

Definition at line 195 of file CombinedSVComputer.cc.

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_2022v12_cff::track, reco::btau::trackEtaRel, tracks, bphysicsOniaDQM_cfi::vertex, reco::btau::vertexFitProb, reco::btau::vertexNTracks, and extraflags_cff::vtx.

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 }
const double piPlus
Definition: ParticleMasses.h:9
void add(const reco::Track &track, double weight=1.0)
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
IterationRange flipIterate(int size, bool vertex) const
T sqrt(T t)
Definition: SSEVec.h:19
auto const & tracks
cannot be loose
#define range_for(i, x)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const VTX & secondaryVertex(unsigned int index) const
vars
Definition: DeepTauId.cc:30
void fillCommonVariables(reco::TaggingVariableList &vars, reco::TrackKinematics &vertexKinematics, const IPTI &ipInfo, const SVTI &svInfo, double &vtx_track_ptSum, double &vtx_track_ESum) const

◆ 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().