CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::TaggingVariableName
taggingVariables
 
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 ( 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")),
16  trackSelector(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
reco::V0Filter trackPairV0Filter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset) const
unsigned int trackMultiplicityMin
virtual CombinedSVComputer::~CombinedSVComputer ( )
virtualdefault

Member Function Documentation

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

Definition at line 5 of file CombinedSVComputer.cc.

References edm::ParameterSet::addParameter().

5  {
6  edm::ParameterSet psetCopy(pset);
7  psetCopy.addParameter<double>("jetDeltaRMax", 99999.0);
8  return psetCopy;
9 }
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::btau::chargedHadronEnergyFraction, reco::btau::chargedHadronMultiplicity, reco::btag::TrackIPData::closestToJetAxis, data, HLT_FULL_cff::DeltaR, HLT_FULL_cff::deltaR, DeadROC_duringRun::dir, reco::btag::TrackIPData::distanceToJetAxis, reco::btau::electronEnergyFraction, reco::btau::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, dqmdumpme::indices, reco::TaggingVariableList::insert(), reco::btag::TrackIPData::ip2d, reco::btag::IP2DSig, reco::btag::TrackIPData::ip3d, reco::btag::IP3DSig, dqmiolumiharvest::j, metsig::jet, reco::btau::jetAbsEta, reco::btau::jetEta, reco::btau::jetNSecondaryVertices, reco::btau::jetNTracks, reco::btau::jetPt, PV3DBase< T, PVType, FrameType >::mag2(), reco::btau::massVertexEnergyFraction, reco::btau::muonEnergyFraction, reco::btau::muonMultiplicity, reco::btau::neutralHadronEnergyFraction, reco::btau::neutralHadronMultiplicity, reco::btag::Vertices::NoVertex, reco::TrackKinematics::numberOfTracks(), convertSQLiteXML::ok, reco::btau::photonEnergyFraction, reco::btau::photonMultiplicity, reco::ParticleMasses::piPlus, pseudoMultiplicityMin, reco::btag::Vertices::PseudoVertex, pseudoVertexV0Filter, MetAnalyzer::pv(), sistrip::SpyUtilities::range(), range_for, dt_dqm_sourceclient_common_cff::reco, reco::btag::Vertices::RecoVertex, Measurement1D::significance(), 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, Measurement1D::value(), reco::TrackKinematics::vectorSum(), reco::btau::vertexBoostOverSqrtJetPt, reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, vertexFlip, reco::btau::vertexJetDeltaR, reco::btau::vertexMass, vertexMassCorrection, reco::btau::vertexNTracks, reco::TrackKinematics::weightedVectorSum(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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);
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) {
296  vars.insert(btau::chargedHadronEnergyFraction, pfJet->chargedHadronEnergyFraction(), true);
297  vars.insert(btau::neutralHadronEnergyFraction, pfJet->neutralHadronEnergyFraction(), true);
298  vars.insert(btau::photonEnergyFraction, pfJet->photonEnergyFraction(), true);
299  vars.insert(btau::electronEnergyFraction, pfJet->electronEnergyFraction(), true);
300  vars.insert(btau::muonEnergyFraction, pfJet->muonEnergyFraction(), true);
301  vars.insert(btau::chargedHadronMultiplicity, pfJet->chargedHadronMultiplicity(), true);
302  vars.insert(btau::neutralHadronMultiplicity, pfJet->neutralHadronMultiplicity(), 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(
307  btau::hadronMultiplicity, pfJet->chargedHadronMultiplicity() + pfJet->neutralHadronMultiplicity(), true);
309  pfJet->chargedHadronMultiplicity() + pfJet->neutralHadronMultiplicity() + pfJet->photonMultiplicity(),
310  true);
312  pfJet->chargedHadronMultiplicity() + pfJet->neutralHadronMultiplicity() + pfJet->photonMultiplicity() +
313  pfJet->electronMultiplicity() + pfJet->muonMultiplicity(),
314  true);
315 
316  } else if (patJet != nullptr && patJet->isPFJet()) {
317  vars.insert(btau::chargedHadronEnergyFraction, patJet->chargedHadronEnergyFraction(), true);
318  vars.insert(btau::neutralHadronEnergyFraction, patJet->neutralHadronEnergyFraction(), true);
319  vars.insert(btau::photonEnergyFraction, patJet->photonEnergyFraction(), true);
320  vars.insert(btau::electronEnergyFraction, patJet->electronEnergyFraction(), true);
321  vars.insert(btau::muonEnergyFraction, patJet->muonEnergyFraction(), true);
322  vars.insert(btau::chargedHadronMultiplicity, patJet->chargedHadronMultiplicity(), true);
323  vars.insert(btau::neutralHadronMultiplicity, patJet->neutralHadronMultiplicity(), 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(
328  btau::hadronMultiplicity, patJet->chargedHadronMultiplicity() + patJet->neutralHadronMultiplicity(), true);
329  vars.insert(
331  patJet->chargedHadronMultiplicity() + patJet->neutralHadronMultiplicity() + patJet->photonMultiplicity(),
332  true);
334  patJet->chargedHadronMultiplicity() + patJet->neutralHadronMultiplicity() +
335  patJet->photonMultiplicity() + patJet->electronMultiplicity() + patJet->muonMultiplicity(),
336  true);
337 
338  } else {
341  vars.insert(btau::photonEnergyFraction, 0., true);
342  vars.insert(btau::electronEnergyFraction, 0., true);
343  vars.insert(btau::muonEnergyFraction, 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
T mag2() const
Definition: PV3DBase.h:63
const math::XYZTLorentzVector & weightedVectorSum() const
unsigned int pseudoMultiplicityMin
void add(const reco::Track &track, double weight=1.0)
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
Measurement1D ip2d
Definition: IPTagInfo.h:31
reco::V0Filter pseudoVertexV0Filter
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
auto const & tracks
cannot be loose
Jets made from PFObjects.
Definition: PFJet.h:20
const uint16_t range(const Frame &aFrame)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
reco::btag::SortCriteria sortCriterium
reco::TrackSelector trackPseudoSelector
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
Measurement1D ip3d
Definition: IPTagInfo.h:32
IterationRange flipIterate(int size, bool vertex) const
reco::V0Filter trackPairV0Filter
double significance() const
Definition: Measurement1D.h:29
unsigned int numberOfTracks() const
#define range_for(i, x)
GlobalPoint closestToJetAxis
Definition: IPTagInfo.h:29
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
double flipValue(double value, bool vertex) const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
Analysis-level calorimeter jet class.
Definition: Jet.h:77
double value() const
Definition: Measurement1D.h:25
const reco::btag::TrackIPData & threshTrack(const reco::CandIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
Measurement1D distanceToJetAxis
Definition: IPTagInfo.h:33
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const math::XYZTLorentzVector & vectorSum() const
list indices
Definition: dqmdumpme.py:50
T x() const
Definition: PV3DBase.h:59
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
void insert(const TaggingVariable &variable, bool delayed=false)
unsigned int trackMultiplicityMin
CombinedSVComputer::IterationRange CombinedSVComputer::flipIterate ( int  size,
bool  vertex 
) const
inline

Definition at line 31 of file CombinedSVComputer.cc.

References CombinedSVComputer::IterationRange::begin, CombinedSVComputer::IterationRange::end, CombinedSVComputer::IterationRange::increment, sistrip::SpyUtilities::range(), findQualityFiles::size, trackFlip, 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 }
const uint16_t range(const Frame &aFrame)
tuple size
Write out results.
double CombinedSVComputer::flipValue ( double  value,
bool  vertex 
) const
inline

Definition at line 27 of file CombinedSVComputer.cc.

References trackFlip, relativeConstraints::value, and vertexFlip.

Referenced by fillCommonVariables().

27  {
28  return (vertex ? vertexFlip : trackFlip) ? -value : value;
29 }
TaggingVariableList CombinedSVComputer::operator() ( const reco::TrackIPTagInfo ipInfo,
const reco::SecondaryVertexTagInfo svInfo 
) const
virtual

Definition at line 133 of file CombinedSVComputer.cc.

References reco::btau::etaRel(), fillCommonVariables(), flipIterate(), reco::Vertex::hasRefittedTracks(), mps_fire::i, minTrackWeight, reco::LeafCandidate::momentum(), reco::TrackBase::momentum(), HLT_FULL_cff::normalizedChi2, BeamSpotPI::nTracks, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::nVertices(), reco::ParticleMasses::piPlus, range_for, reco::Vertex::refittedTrack(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::secondaryVertex(), mathSSE::sqrt(), HGCalGeometryMode::Square, reco::btau::trackEtaRel, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), reco::Vertex::trackWeight(), reco::btau::vertexFitProb, reco::btau::vertexNTracks, 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
const VTX & secondaryVertex(unsigned int index) const
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:181
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
const uint16_t range(const Frame &aFrame)
tuple normalizedChi2
T sqrt(T t)
Definition: SSEVec.h:19
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:96
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
IterationRange flipIterate(int size, bool vertex) const
#define range_for(i, x)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
void fillCommonVariables(reco::TaggingVariableList &vars, reco::TrackKinematics &vertexKinematics, const IPTI &ipInfo, const SVTI &svInfo, double &vtx_track_ptSum, double &vtx_track_ESum) const
Track refittedTrack(const TrackBaseRef &track) const
Definition: Vertex.cc:91
T w() const
vars
Definition: DeepTauId.cc:164
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:38
TaggingVariableList CombinedSVComputer::operator() ( const reco::CandIPTagInfo ipInfo,
const reco::CandSecondaryVertexTagInfo svInfo 
) const
virtual

Definition at line 195 of file CombinedSVComputer.cc.

References reco::CompositePtrCandidate::daughterPtrVector(), reco::btau::etaRel(), fillCommonVariables(), flipIterate(), mps_fire::i, reco::LeafCandidate::momentum(), reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::nVertices(), reco::ParticleMasses::piPlus, range_for, reco::TemplatedSecondaryVertexTagInfo< IPTI, VTX >::secondaryVertex(), mathSSE::sqrt(), HGCalGeometryMode::Square, HLT_FULL_cff::track, reco::btau::trackEtaRel, reco::btau::vertexFitProb, and reco::btau::vertexNTracks.

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 
216  const reco::VertexCompositePtrCandidate &vertex = svInfo.secondaryVertex(i);
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
const VTX & secondaryVertex(unsigned int index) const
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
auto const & tracks
cannot be loose
virtual const daughters & daughterPtrVector() const
references to daughtes
const uint16_t range(const Frame &aFrame)
T sqrt(T t)
Definition: SSEVec.h:19
IterationRange flipIterate(int size, bool vertex) const
#define range_for(i, x)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
void fillCommonVariables(reco::TaggingVariableList &vars, reco::TrackKinematics &vertexKinematics, const IPTI &ipInfo, const SVTI &svInfo, double &vtx_track_ptSum, double &vtx_track_ESum) const
vars
Definition: DeepTauId.cc:164
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().

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

double CombinedSVComputer::charmCut
private

Definition at line 75 of file CombinedSVComputer.h.

double CombinedSVComputer::minTrackWeight
private

Definition at line 82 of file CombinedSVComputer.h.

Referenced by operator()().

unsigned int CombinedSVComputer::pseudoMultiplicityMin
private

Definition at line 80 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

reco::V0Filter CombinedSVComputer::pseudoVertexV0Filter
private

Definition at line 85 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

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

Definition at line 76 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

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

Definition at line 87 of file CombinedSVComputer.h.

bool CombinedSVComputer::trackFlip
private

Definition at line 73 of file CombinedSVComputer.h.

Referenced by flipIterate(), and flipValue().

unsigned int CombinedSVComputer::trackMultiplicityMin
private

Definition at line 81 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

reco::TrackSelector CombinedSVComputer::trackNoDeltaRSelector
private

Definition at line 78 of file CombinedSVComputer.h.

reco::V0Filter CombinedSVComputer::trackPairV0Filter
private

Definition at line 86 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

reco::TrackSelector CombinedSVComputer::trackPseudoSelector
private

Definition at line 79 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

reco::TrackSelector CombinedSVComputer::trackSelector
private

Definition at line 77 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

bool CombinedSVComputer::useTrackWeights
private

Definition at line 83 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().

bool CombinedSVComputer::vertexFlip
private

Definition at line 74 of file CombinedSVComputer.h.

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

bool CombinedSVComputer::vertexMassCorrection
private

Definition at line 84 of file CombinedSVComputer.h.

Referenced by fillCommonVariables().