CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
CombinedSVSoftLeptonComputer Class Reference

#include <CombinedSVSoftLeptonComputer.h>

Classes

struct  IterationRange
 

Public Member Functions

 CombinedSVSoftLeptonComputer (const edm::ParameterSet &params)
 
reco::TaggingVariableList operator() (const reco::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &svInfo, const reco::SoftLeptonTagInfo &muonInfo, const reco::SoftLeptonTagInfo &elecInfo) const
 

Private Member Functions

IterationRange flipIterate (int size, bool vertex) const
 
double flipValue (double value, bool vertex) const
 
const
reco::TrackIPTagInfo::TrackIPData
threshTrack (const reco::TrackIPTagInfo &trackIPTagInfo, const reco::TrackIPTagInfo::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
 

Private Attributes

double charmCut
 
double minTrackWeight
 
unsigned int pseudoMultiplicityMin
 
reco::V0Filter pseudoVertexV0Filter
 
reco::TrackIPTagInfo::SortCriteria sortCriterium
 
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 15 of file CombinedSVSoftLeptonComputer.h.

Constructor & Destructor Documentation

CombinedSVSoftLeptonComputer::CombinedSVSoftLeptonComputer ( const edm::ParameterSet params)

Definition at line 56 of file CombinedSVSoftLeptonComputer.cc.

56  :
57  trackFlip(params.getParameter<bool>("trackFlip")),
58  vertexFlip(params.getParameter<bool>("vertexFlip")),
59  charmCut(params.getParameter<double>("charmCut")),
61  trackSelector(params.getParameter<edm::ParameterSet>("trackSelection")),
63  trackPseudoSelector(params.getParameter<edm::ParameterSet>("trackPseudoSelection")),
64  pseudoMultiplicityMin(params.getParameter<unsigned int>("pseudoMultiplicityMin")),
65  trackMultiplicityMin(params.getParameter<unsigned int>("trackMultiplicityMin")),
66  minTrackWeight(params.getParameter<double>("minimumTrackWeight")),
67  useTrackWeights(params.getParameter<bool>("useTrackWeights")),
68  vertexMassCorrection(params.getParameter<bool>("correctVertexMass")),
69  pseudoVertexV0Filter(params.getParameter<edm::ParameterSet>("pseudoVertexV0Filter")),
70  trackPairV0Filter(params.getParameter<edm::ParameterSet>("trackPairV0Filter"))
71 {
72 
73 }
T getParameter(std::string const &) const
reco::TrackIPTagInfo::SortCriteria getCriterium(const std::string &name)
Definition: TrackSorting.cc:11
reco::TrackIPTagInfo::SortCriteria sortCriterium
static edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset)

Member Function Documentation

CombinedSVSoftLeptonComputer::IterationRange CombinedSVSoftLeptonComputer::flipIterate ( int  size,
bool  vertex 
) const
inlineprivate

Definition at line 80 of file CombinedSVSoftLeptonComputer.cc.

References CombinedSVSoftLeptonComputer::IterationRange::begin, CombinedSVSoftLeptonComputer::IterationRange::end, CombinedSVSoftLeptonComputer::IterationRange::increment, findQualityFiles::size, trackFlip, and vertexFlip.

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

82 {
83  IterationRange range;
84  if (vertex ? vertexFlip : trackFlip) {
85  range.begin = size - 1;
86  range.end = -1;
87  range.increment = -1;
88  } else {
89  range.begin = 0;
90  range.end = size;
91  range.increment = +1;
92  }
93 
94  return range;
95 }
tuple size
Write out results.
double CombinedSVSoftLeptonComputer::flipValue ( double  value,
bool  vertex 
) const
inlineprivate
TaggingVariableList CombinedSVSoftLeptonComputer::operator() ( const reco::TrackIPTagInfo ipInfo,
const reco::SecondaryVertexTagInfo svInfo,
const reco::SoftLeptonTagInfo muonInfo,
const reco::SoftLeptonTagInfo elecInfo 
) const

Definition at line 145 of file CombinedSVSoftLeptonComputer.cc.

References edm::RefVector< C, T, F >::begin(), reco::btau::chargedHadronEnergyFraction, reco::btau::chargedHadronMultiplicity, reco::TrackIPTagInfo::TrackIPData::closestToJetAxis, data, reco::SoftLeptonProperties::deltaR, Geom::deltaR(), dir, reco::TrackIPTagInfo::TrackIPData::distanceToJetAxis, reco::btau::electronEnergyFraction, reco::btau::electronMultiplicity, edm::RefVector< C, T, F >::end(), reco::LeafCandidate::et(), reco::SoftLeptonProperties::etaRel, etaRel(), edm::hlt::Exception, reco::SecondaryVertexTagInfo::flightDirection(), reco::SecondaryVertexTagInfo::flightDistance(), reco::btau::flightDistance2dSig, reco::btau::flightDistance2dVal, reco::btau::flightDistance3dSig, reco::btau::flightDistance3dVal, flipIterate(), flipValue(), reco::btau::hadronMultiplicity, reco::btau::hadronPhotonMultiplicity, reco::Vertex::hasRefittedTracks(), i, customizeTrackingMonitorSeedNumber::idx, reco::TrackIPTagInfo::impactParameterData(), reco::TaggingVariableList::insert(), reco::TrackIPTagInfo::TrackIPData::ip2d, reco::TrackIPTagInfo::TrackIPData::ip3d, edm::Ref< C, T, F >::isNonnull(), j, reco::JTATagInfo::jet(), metsig::jet, reco::btau::jetEta, reco::btau::jetNSecondaryVertices, reco::btau::jetNTracks, reco::btau::jetPt, reco::btau::leptonDeltaR, reco::btau::leptonEtaRel, reco::btau::leptonPtRel, reco::btau::leptonRatio, reco::btau::leptonRatioRel, reco::SoftLeptonTagInfo::leptons(), reco::btau::leptonSip3d, PV3DBase< T, PVType, FrameType >::mag2(), reco::btau::massVertexEnergyFraction, minTrackWeight, reco::TrackBase::momentum(), reco::btau::muonEnergyFraction, reco::btau::muonMultiplicity, reco::btau::neutralHadronEnergyFraction, reco::btau::neutralHadronMultiplicity, reco::btag::Vertices::NoVertex, reco::SecondaryVertexTagInfo::nVertices(), convertSQLiteXML::ok, reco::btau::photonEnergyFraction, reco::btau::photonMultiplicity, reco::ParticleMasses::piPlus, funct::pow(), reco::TrackIPTagInfo::primaryVertex(), reco::SoftLeptonTagInfo::properties(), pseudoMultiplicityMin, reco::btag::Vertices::PseudoVertex, pseudoVertexV0Filter, reco::SoftLeptonProperties::ptRel, range_for, reco::SoftLeptonProperties::ratio, reco::SoftLeptonProperties::ratioRel, reco::btag::Vertices::RecoVertex, reco::Vertex::refittedTrack(), reco::SecondaryVertexTagInfo::secondaryVertex(), reco::TrackIPTagInfo::selectedTracks(), Measurement1D::significance(), reco::SoftLeptonProperties::sip3d, edm::RefVector< C, T, F >::size(), sortCriterium, reco::TrackIPTagInfo::sortedIndexes(), mathSSE::sqrt(), threshTrack(), reco::btau::totalMultiplicity, reco::btau::trackDecayLenVal, reco::btau::trackDeltaR, reco::btau::trackEtaRel, reco::btau::trackJetDistVal, reco::btau::trackJetPt, trackMultiplicityMin, trackPairV0Filter, reco::btau::trackPPar, reco::btau::trackPParRatio, trackPseudoSelector, reco::btau::trackPtRatio, reco::btau::trackPtRel, testEve_cfg::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, reco::SecondaryVertexTagInfo::trackWeight(), useTrackWeights, Measurement1D::value(), reco::btau::vertexBoostOverSqrtJetPt, reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, reco::btau::vertexFitProb, reco::btau::vertexJetDeltaR, reco::btau::vertexLeptonCategory, reco::btau::vertexMass, vertexMassCorrection, reco::btau::vertexNTracks, reco::SecondaryVertexTagInfo::vertexTracks(), w(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

150 {
151  using namespace ROOT::Math;
152 
153  edm::RefToBase<Jet> jet = ipInfo.jet();
154 
155  math::XYZVector jetDir = jet->momentum().Unit();
156  bool havePv = ipInfo.primaryVertex().isNonnull();
157  GlobalPoint pv;
158  if (havePv)
159  pv = GlobalPoint(ipInfo.primaryVertex()->x(), ipInfo.primaryVertex()->y(), ipInfo.primaryVertex()->z());
160 
162 
163  TaggingVariableList vars;
164 
165  vars.insert(btau::jetPt, jet->pt(), true);
166  vars.insert(btau::jetEta, jet->eta(), true);
167 
168  if (ipInfo.selectedTracks().size() < trackMultiplicityMin)
169  return vars;
170 
171  vars.insert(btau::jetNTracks, ipInfo.selectedTracks().size(), true);
172 
173  TrackKinematics allKinematics;
174  TrackKinematics vertexKinematics;
175  TrackKinematics trackJetKinematics;
176 
177  double vtx_track_ptSum= 0.;
178  double vtx_track_ESum= 0.;
179  double jet_track_ESum= 0.;
180 
181  int vtx = -1;
182  unsigned int numberofvertextracks = 0;
183 
184  //IF THERE ARE SECONDARY VERTICES THE JET FALLS IN THE RECOVERTEX CATEGORY
185  IterationRange range = flipIterate(svInfo.nVertices(), true);
186  range_for(i, range) {
187  if (vtx < 0) vtx = i; //RecoVertex category (vtx=0) if we enter at least one time in this loop!
188 
189  numberofvertextracks = numberofvertextracks + (svInfo.secondaryVertex(i)).nTracks();
190 
191  const Vertex &vertex = svInfo.secondaryVertex(i);
192  bool hasRefittedTracks = vertex.hasRefittedTracks();
194  for(TrackRefVector::const_iterator track = tracks.begin(); track != tracks.end(); track++) {
195  double w = svInfo.trackWeight(i, *track);
196  if (w < minTrackWeight)
197  continue;
198  if (hasRefittedTracks) {
199  Track actualTrack = vertex.refittedTrack(*track);
200  vars.insert(btau::trackEtaRel, etaRel(jetDir,actualTrack.momentum()), true);
201  vertexKinematics.add(actualTrack, w);
202  if(i==0)
203  {
204  math::XYZVector vtx_trackMom = actualTrack.momentum();
205  vtx_track_ptSum += std::sqrt(std::pow(vtx_trackMom.X(),2) + std::pow(vtx_trackMom.Y(),2));
206  vtx_track_ESum += std::sqrt(vtx_trackMom.Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
207  }
208  } else { //THIS ONE IS TAKEN...
209  vars.insert(btau::trackEtaRel, etaRel(jetDir,(*track)->momentum()), true);
210  vertexKinematics.add(**track, w);
211  if(i==0) // calculate this only for the first vertex
212  {
213  math::XYZVector vtx_trackMom = (*track)->momentum();
214  vtx_track_ptSum += std::sqrt(std::pow(vtx_trackMom.X(),2) + std::pow(vtx_trackMom.Y(),2));
215  vtx_track_ESum += std::sqrt(vtx_trackMom.Mag2() + std::pow(ParticleMasses::piPlus,2));
216  }
217  }
218  }
219  }
220 
221  if (vtx >= 0) {
222  vtxType = btag::Vertices::RecoVertex;
223  vars.insert(btau::flightDistance2dVal,flipValue(svInfo.flightDistance(vtx, true).value(),true),true);
224  vars.insert(btau::flightDistance2dSig,flipValue(svInfo.flightDistance(vtx, true).significance(),true),true);
225  vars.insert(btau::flightDistance3dVal,flipValue(svInfo.flightDistance(vtx, false).value(),true),true);
226  vars.insert(btau::flightDistance3dSig,flipValue(svInfo.flightDistance(vtx, false).significance(),true),true);
227  vars.insert(btau::vertexJetDeltaR,Geom::deltaR(svInfo.flightDirection(vtx), jetDir),true);
228  vars.insert(btau::jetNSecondaryVertices, svInfo.nVertices(), true);
229  vars.insert(btau::vertexNTracks, numberofvertextracks, true);
230  vars.insert(btau::vertexFitProb,(svInfo.secondaryVertex(vtx)).normalizedChi2(), true);
231  }
232 
233 
234  //NOW ATTEMPT TO RECONSTRUCT PSEUDOVERTEX!!!
235  std::vector<std::size_t> indices = ipInfo.sortedIndexes(sortCriterium);
236  const std::vector<TrackIPTagInfo::TrackIPData> &ipData = ipInfo.impactParameterData();
237  const edm::RefVector<TrackCollection> &tracks = ipInfo.selectedTracks();
238 
239  std::vector<TrackRef> pseudoVertexTracks;
240 
241  range = flipIterate(indices.size(), false);
242  range_for(i, range) {
243  std::size_t idx = indices[i];
244  const TrackIPTagInfo::TrackIPData &data = ipData[idx];
245  const TrackRef &trackRef = tracks[idx];
246  const Track &track = *trackRef;
247 
248  // if no vertex was reconstructed, attempt pseudo vertex
249  if (vtxType == btag::Vertices::NoVertex && trackPseudoSelector(track, data, *jet, pv)) {
250  pseudoVertexTracks.push_back(trackRef);
251  vertexKinematics.add(track);
252  }
253  }
254 
255  if (vtxType == btag::Vertices::NoVertex && vertexKinematics.numberOfTracks() >= pseudoMultiplicityMin && pseudoVertexV0Filter(pseudoVertexTracks))
256  {
258  for(std::vector<TrackRef>::const_iterator track = pseudoVertexTracks.begin(); track != pseudoVertexTracks.end(); ++track)
259  {
260  vars.insert(btau::trackEtaRel, etaRel(jetDir, (*track)->momentum()), true);
261  math::XYZVector vtx_trackMom = (*track)->momentum();
262  vtx_track_ptSum += std::sqrt(std::pow(vtx_trackMom.X(),2) + std::pow(vtx_trackMom.Y(),2));
263  vtx_track_ESum += std::sqrt(vtx_trackMom.Mag2() + std::pow(ParticleMasses::piPlus,2));
264  }
265  }
266 
267  vars.insert(btau::vertexCategory, vtxType, true);
268 
269 
270 
271  // do a tighter track selection to fill the variable plots...
272  TrackRef trackPairV0Test[2];
273  range = flipIterate(indices.size(), false);
274  range_for(i, range) {
275 
276  std::size_t idx = indices[i];
277  const TrackIPTagInfo::TrackIPData &data = ipData[idx];
278  const TrackRef &trackRef = tracks[idx];
279  const Track &track = *trackRef;
280 
281  jet_track_ESum += std::sqrt((track.momentum()).Mag2() + std::pow(ParticleMasses::piPlus,2));
282  // add track to kinematics for all tracks in jet
283  //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...
284 
285  // filter tracks -> this track selection can be more tight (used to fill the track related variables...)
286  if (!trackSelector(track, data, *jet, pv))
287  continue;
288 
289  // add track to kinematics for all tracks in jet
290  allKinematics.add(track);
291 
292  // check against all other tracks for K0 track pairs setting the track mass to pi+
293  trackPairV0Test[0] = tracks[idx];
294  bool ok = true;
295  range_for(j, range) {
296  if (i == j)
297  continue;
298 
299  std::size_t pairIdx = indices[j];
300  const TrackIPTagInfo::TrackIPData &pairTrackData = ipData[pairIdx];
301  const TrackRef &pairTrackRef = tracks[pairIdx];
302  const Track &pairTrack = *pairTrackRef;
303 
304  if (!trackSelector(pairTrack, pairTrackData, *jet, pv))
305  continue;
306 
307  trackPairV0Test[1] = pairTrackRef;
308  if (!trackPairV0Filter(trackPairV0Test, 2)) { //V0 filter is more tight (0.03) than the one used for the RecoVertex and PseudoVertex tracks (0.05)
309  ok = false;
310  break;
311  }
312  }
313 
314  if (!ok)
315  continue;
316 
317  trackJetKinematics.add(track);
318 
319  // add track variables
320  math::XYZVector trackMom = track.momentum();
321  double trackMag = std::sqrt(trackMom.Mag2());
322 
323  vars.insert(btau::trackSip3dVal, flipValue(data.ip3d.value(), false), true);
324  vars.insert(btau::trackSip3dSig, flipValue(data.ip3d.significance(), false), true);
325  vars.insert(btau::trackSip2dVal, flipValue(data.ip2d.value(), false), true);
326  vars.insert(btau::trackSip2dSig, flipValue(data.ip2d.significance(), false), true);
327  vars.insert(btau::trackJetDistVal, data.distanceToJetAxis.value(), true);
328  vars.insert(btau::trackDecayLenVal, havePv ? (data.closestToJetAxis - pv).mag() : -1.0, true);
329 
330  vars.insert(btau::trackPtRel, VectorUtil::Perp(trackMom, jetDir), true);
331  vars.insert(btau::trackPPar, jetDir.Dot(trackMom), true);
332  vars.insert(btau::trackDeltaR, VectorUtil::DeltaR(trackMom, jetDir), true);
333  vars.insert(btau::trackPtRatio, VectorUtil::Perp(trackMom, jetDir) / trackMag, true);
334  vars.insert(btau::trackPParRatio, jetDir.Dot(trackMom) / trackMag, true);
335  }
336 
337  vars.insert(btau::trackJetPt, trackJetKinematics.vectorSum().Pt(), true);
338 
339  vars.insert(btau::trackSumJetDeltaR,VectorUtil::DeltaR(allKinematics.vectorSum(), jetDir), true);
340  vars.insert(btau::trackSumJetEtRatio,allKinematics.vectorSum().Et() / ipInfo.jet()->et(), true);
341  vars.insert(btau::trackSip3dSigAboveCharm, flipValue(threshTrack(ipInfo, TrackIPTagInfo::IP3DSig, *jet, pv).ip3d.significance(),false),true);
342  vars.insert(btau::trackSip3dValAboveCharm, flipValue(threshTrack(ipInfo, TrackIPTagInfo::IP3DSig, *jet, pv).ip3d.value(),false),true);
343  vars.insert(btau::trackSip2dSigAboveCharm, flipValue(threshTrack(ipInfo, TrackIPTagInfo::IP2DSig, *jet, pv).ip2d.significance(),false),true);
344  vars.insert(btau::trackSip2dValAboveCharm, flipValue(threshTrack(ipInfo, TrackIPTagInfo::IP2DSig, *jet, pv).ip2d.value(),false),true);
345 
346  if (vtxType != btag::Vertices::NoVertex) {
347  math::XYZTLorentzVector allSum = useTrackWeights ? allKinematics.weightedVectorSum() : allKinematics.vectorSum();
348  math::XYZTLorentzVector vertexSum = useTrackWeights ? vertexKinematics.weightedVectorSum() : vertexKinematics.vectorSum();
349 
350  if (vtxType != btag::Vertices::RecoVertex) {
351  vars.insert(btau::vertexNTracks,vertexKinematics.numberOfTracks(), true);
352  vars.insert(btau::vertexJetDeltaR,VectorUtil::DeltaR(vertexSum, jetDir), true);
353  }
354 
355  double vertexMass = vertexSum.M();
356  double varPi = 0;
357  double varB = 0;
358  if (vtxType == btag::Vertices::RecoVertex) {
360  {
361  GlobalVector dir = svInfo.flightDirection(vtx);
362  double vertexPt2 = math::XYZVector(dir.x(), dir.y(), dir.z()).Cross(vertexSum).Mag2() / dir.mag2();
363  vertexMass = std::sqrt(vertexMass * vertexMass + vertexPt2) + std::sqrt(vertexPt2);
364  }
365  }
366  vars.insert(btau::vertexMass, vertexMass, true);
367  varPi = (vertexMass/5.2794) * (vtx_track_ESum /jet_track_ESum); //5.2794 should be average B meson mass of PDG! CHECK!!!
368  vars.insert(btau::massVertexEnergyFraction, varPi, true);
369  varB = (std::sqrt(5.2794) * vtx_track_ptSum) / ( vertexMass * std::sqrt(jet->pt()));
370  vars.insert(btau::vertexBoostOverSqrtJetPt,varB*varB/(varB*varB + 10.), true);
371 
372  if (allKinematics.numberOfTracks())
373  vars.insert(btau::vertexEnergyRatio, vertexSum.E() / allSum.E(), true);
374  else
375  vars.insert(btau::vertexEnergyRatio, 1, true);
376  }
377 
378  reco::PFJet const * pfJet = dynamic_cast<reco::PFJet const *>( &* jet ) ;
379  pat::Jet const * patJet = dynamic_cast<pat::Jet const *>( &* jet ) ;
380  if ( pfJet != 0 ) {
381  vars.insert(btau::chargedHadronEnergyFraction,pfJet->chargedHadronEnergyFraction(), true);
382  vars.insert(btau::neutralHadronEnergyFraction,pfJet->neutralHadronEnergyFraction(), true);
383  vars.insert(btau::photonEnergyFraction,pfJet->photonEnergyFraction(), true);
384  vars.insert(btau::electronEnergyFraction,pfJet->electronEnergyFraction(), true);
385  vars.insert(btau::muonEnergyFraction,pfJet->muonEnergyFraction(), true);
386  vars.insert(btau::chargedHadronMultiplicity,pfJet->chargedHadronMultiplicity(), true);
387  vars.insert(btau::neutralHadronMultiplicity,pfJet->neutralHadronMultiplicity(), true);
388  vars.insert(btau::photonMultiplicity,pfJet->photonMultiplicity(), true);
389  vars.insert(btau::electronMultiplicity,pfJet->electronMultiplicity(), true);
390  vars.insert(btau::muonMultiplicity,pfJet->muonMultiplicity(), true);
391  vars.insert(btau::hadronMultiplicity,pfJet->chargedHadronMultiplicity()+pfJet->neutralHadronMultiplicity(), true);
392  vars.insert(btau::hadronPhotonMultiplicity,pfJet->chargedHadronMultiplicity()+pfJet->neutralHadronMultiplicity()+pfJet->photonMultiplicity(), true);
393  vars.insert(btau::totalMultiplicity,pfJet->chargedHadronMultiplicity()+pfJet->neutralHadronMultiplicity()+pfJet->photonMultiplicity()+pfJet->electronMultiplicity()+pfJet->muonMultiplicity(), true);
394 
395  }
396  else if( patJet != 0)
397  {
398  vars.insert(btau::chargedHadronEnergyFraction,patJet->chargedHadronEnergyFraction(), true);
399  vars.insert(btau::neutralHadronEnergyFraction,patJet->neutralHadronEnergyFraction(), true);
400  vars.insert(btau::photonEnergyFraction,patJet->photonEnergyFraction(), true);
401  vars.insert(btau::electronEnergyFraction,patJet->electronEnergyFraction(), true);
402  vars.insert(btau::muonEnergyFraction,patJet->muonEnergyFraction(), true);
403  vars.insert(btau::chargedHadronMultiplicity,patJet->chargedHadronMultiplicity(), true);
404  vars.insert(btau::neutralHadronMultiplicity,patJet->neutralHadronMultiplicity(), true);
405  vars.insert(btau::photonMultiplicity,patJet->photonMultiplicity(), true);
406  vars.insert(btau::electronMultiplicity,patJet->electronMultiplicity(), true);
407  vars.insert(btau::muonMultiplicity,patJet->muonMultiplicity(), true);
408  vars.insert(btau::hadronMultiplicity,patJet->chargedHadronMultiplicity()+patJet->neutralHadronMultiplicity(), true);
409  vars.insert(btau::hadronPhotonMultiplicity,patJet->chargedHadronMultiplicity()+patJet->neutralHadronMultiplicity()+patJet->photonMultiplicity(), true);
410  vars.insert(btau::totalMultiplicity,patJet->chargedHadronMultiplicity()+patJet->neutralHadronMultiplicity()+patJet->photonMultiplicity()+patJet->electronMultiplicity()+patJet->muonMultiplicity(), true);
411 
412  }
413  else
414  {
415  throw cms::Exception("InvalidConfiguration") << "From CombinedSVSoftLeptonComputer::operator: reco::PFJet OR pat::Jet are required by this module" << std::endl;
416  }
417 
418  int leptonCategory = 0; //0 = no lepton, 1 = muon, 2 = electron
419 
420  for (unsigned int i = 0; i < muonInfo.leptons(); i++) {// loop over all muons, not optimal -> find the best or use ranking from best to worst
421  leptonCategory = 1; // muon category
422  const SoftLeptonProperties & propertiesMuon = muonInfo.properties(i);
423  vars.insert(btau::leptonPtRel,propertiesMuon.ptRel , true);
424  vars.insert(btau::leptonSip3d,propertiesMuon.sip3d , true);
425  vars.insert(btau::leptonDeltaR,propertiesMuon.deltaR , true);
426  vars.insert(btau::leptonRatioRel,propertiesMuon.ratioRel , true);
427  vars.insert(btau::leptonEtaRel,propertiesMuon.etaRel , true);
428  vars.insert(btau::leptonRatio,propertiesMuon.ratio , true);
429  }
430 
431  if(leptonCategory != 1){ //no soft muon found, try soft electron
432  for (unsigned int i = 0; i < elecInfo.leptons(); i++) { // loop over all electrons, not optimal -> find the best or use ranking from best to worst
433  leptonCategory = 2; // electron category
434  const SoftLeptonProperties & propertiesElec = elecInfo.properties(i);
435  vars.insert(btau::leptonPtRel,propertiesElec.ptRel , true);
436  vars.insert(btau::leptonSip3d,propertiesElec.sip3d , true);
437  vars.insert(btau::leptonDeltaR,propertiesElec.deltaR , true);
438  vars.insert(btau::leptonRatioRel,propertiesElec.ratioRel , true);
439  vars.insert(btau::leptonEtaRel,propertiesElec.etaRel , true);
440  vars.insert(btau::leptonRatio,propertiesElec.ratio , true);
441  }
442  }
443 
444 
445  //put default value for vertexLeptonCategory on 2 = NoVertexNoSoftLepton
446  int vertexLepCat = 2;
447 
448  if(leptonCategory == 0){ // no soft lepton
449  if (vtxType == btag::Vertices::RecoVertex)
450  vertexLepCat = 0;
451  else if (vtxType == btag::Vertices::PseudoVertex)
452  vertexLepCat = 1;
453  else
454  vertexLepCat = 2;
455  } else if(leptonCategory == 1){ // soft muon
456  if (vtxType == btag::Vertices::RecoVertex)
457  vertexLepCat = 3;
458  else if(vtxType == btag::Vertices::PseudoVertex)
459  vertexLepCat = 4;
460  else vertexLepCat = 5;
461  } else if(leptonCategory == 2){ // soft electron
462  if (vtxType == btag::Vertices::RecoVertex)
463  vertexLepCat = 6;
464  else if (vtxType == btag::Vertices::PseudoVertex)
465  vertexLepCat = 7;
466  else
467  vertexLepCat = 8;
468  }
469 
470  vars.insert(btau::vertexLeptonCategory, vertexLepCat , true);
471 
472  vars.finalize();
473 
474  return vars;
475 }
virtual double et() const GCC11_FINAL
transverse energy
int i
Definition: DBlmapReader.cc:9
T mag2() const
Definition: PV3DBase.h:66
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:148
Measurement1D flightDistance(unsigned int index, bool in2d=false) const
const edm::Ref< VertexCollection > & primaryVertex() const
Track refittedTrack(const TrackBaseRef &track) const
#define range_for(i, x)
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:120
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
reco::TrackIPTagInfo::SortCriteria sortCriterium
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
Jets made from PFObjects.
Definition: PFJet.h:21
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
const GlobalVector & flightDirection(unsigned int index) const
const Vertex & secondaryVertex(unsigned int index) const
T sqrt(T t)
Definition: SSEVec.h:48
unsigned int leptons(void) const
T z() const
Definition: PV3DBase.h:64
int j
Definition: DBlmapReader.cc:9
static double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
double flipValue(double value, bool vertex) const
float trackWeight(unsigned int svIndex, unsigned int trackindex) const
virtual edm::RefToBase< Jet > jet(void) const
returns a polymorphic reference to the tagged jet
Definition: JTATagInfo.h:20
TrackRefVector vertexTracks() const
std::vector< size_t > sortedIndexes(SortCriteria mode=IP3DSig) const
const SoftLeptonProperties & properties(size_t i) const
double significance() const
Definition: Measurement1D.h:32
tuple tracks
Definition: testEve_cfg.py:39
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
Analysis-level calorimeter jet class.
Definition: Jet.h:73
double value() const
Definition: Measurement1D.h:28
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
double deltaR(const Vector1 &v1, const Vector2 &v2)
Definition: VectorUtil.h:84
const std::vector< TrackIPData > & impactParameterData() const
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
T w() const
dbl *** dir
Definition: mlp_gen.cc:35
const reco::TrackIPTagInfo::TrackIPData & threshTrack(const reco::TrackIPTagInfo &trackIPTagInfo, const reco::TrackIPTagInfo::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
const edm::RefVector< TrackCollection > & selectedTracks() const
T x() const
Definition: PV3DBase.h:62
IterationRange flipIterate(int size, bool vertex) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void insert(const TaggingVariable &variable, bool delayed=false)
const TrackIPTagInfo::TrackIPData & CombinedSVSoftLeptonComputer::threshTrack ( const reco::TrackIPTagInfo trackIPTagInfo,
const reco::TrackIPTagInfo::SortCriteria  sort,
const reco::Jet jet,
const GlobalPoint pv 
) const
private

Definition at line 98 of file CombinedSVSoftLeptonComputer.cc.

References charmCut, data, flipIterate(), i, customizeTrackingMonitorSeedNumber::idx, reco::TrackIPTagInfo::impactParameterData(), range_for, reco::TrackIPTagInfo::selectedTracks(), reco::TrackIPTagInfo::sortedIndexes(), trackNoDeltaRSelector, and testEve_cfg::tracks.

Referenced by operator()().

102 {
104  trackIPTagInfo.selectedTracks();
105  const std::vector<TrackIPTagInfo::TrackIPData> &ipData =
106  trackIPTagInfo.impactParameterData();
107  std::vector<std::size_t> indices = trackIPTagInfo.sortedIndexes(sort);
108 
109  IterationRange range = flipIterate(indices.size(), false);
110  TrackKinematics kin;
111  range_for(i, range) {
112  std::size_t idx = indices[i];
113  const TrackIPTagInfo::TrackIPData &data = ipData[idx];
114  const Track &track = *tracks[idx];
115 
116  if (!trackNoDeltaRSelector(track, data, jet, pv))
117  continue;
118 
119  kin.add(track);
120  if (kin.vectorSum().M() > charmCut)
121  return data;
122  }
123 
124  static const TrackIPTagInfo::TrackIPData dummy = {
125  GlobalPoint(),
126  GlobalPoint(),
127  Measurement1D(-1.0, 1.0),
128  Measurement1D(-1.0, 1.0),
129  Measurement1D(-1.0, 1.0),
130  Measurement1D(-1.0, 1.0),
131  0.
132  };
133  return dummy;
134 }
int i
Definition: DBlmapReader.cc:9
#define range_for(i, x)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< size_t > sortedIndexes(SortCriteria mode=IP3DSig) const
tuple tracks
Definition: testEve_cfg.py:39
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const std::vector< TrackIPData > & impactParameterData() const
const edm::RefVector< TrackCollection > & selectedTracks() const
IterationRange flipIterate(int size, bool vertex) const

Member Data Documentation

double CombinedSVSoftLeptonComputer::charmCut
private

Definition at line 39 of file CombinedSVSoftLeptonComputer.h.

Referenced by threshTrack().

double CombinedSVSoftLeptonComputer::minTrackWeight
private

Definition at line 46 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

unsigned int CombinedSVSoftLeptonComputer::pseudoMultiplicityMin
private

Definition at line 44 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

reco::V0Filter CombinedSVSoftLeptonComputer::pseudoVertexV0Filter
private

Definition at line 49 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

reco::TrackIPTagInfo::SortCriteria CombinedSVSoftLeptonComputer::sortCriterium
private

Definition at line 40 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

bool CombinedSVSoftLeptonComputer::trackFlip
private

Definition at line 37 of file CombinedSVSoftLeptonComputer.h.

Referenced by flipIterate(), and flipValue().

unsigned int CombinedSVSoftLeptonComputer::trackMultiplicityMin
private

Definition at line 45 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

reco::TrackSelector CombinedSVSoftLeptonComputer::trackNoDeltaRSelector
private

Definition at line 42 of file CombinedSVSoftLeptonComputer.h.

Referenced by threshTrack().

reco::V0Filter CombinedSVSoftLeptonComputer::trackPairV0Filter
private

Definition at line 50 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

reco::TrackSelector CombinedSVSoftLeptonComputer::trackPseudoSelector
private

Definition at line 43 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

reco::TrackSelector CombinedSVSoftLeptonComputer::trackSelector
private

Definition at line 41 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

bool CombinedSVSoftLeptonComputer::useTrackWeights
private

Definition at line 47 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().

bool CombinedSVSoftLeptonComputer::vertexFlip
private

Definition at line 38 of file CombinedSVSoftLeptonComputer.h.

Referenced by flipIterate(), and flipValue().

bool CombinedSVSoftLeptonComputer::vertexMassCorrection
private

Definition at line 48 of file CombinedSVSoftLeptonComputer.h.

Referenced by operator()().