CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
reco::JetSignalVertexCompatibilityAlgo Class Reference

#include <JetSignalVertexCompatibilityAlgo.h>

Classes

struct  RefToBaseLess
 

Public Member Functions

std::vector< float > compatibility (const reco::VertexCollection &vertices, const reco::TrackRefVector &tracks) const
 
 JetSignalVertexCompatibilityAlgo (double cut, double temperature)
 
void resetEvent (const TransientTrackBuilder *trackBuilder)
 
 ~JetSignalVertexCompatibilityAlgo ()
 

Private Types

typedef std::map< reco::TrackBaseRef, reco::TransientTrack, RefToBaseLess< reco::Track > > TransientTrackMap
 

Private Member Functions

double activation (double compat) const
 
const TransientTrackconvert (const reco::TrackBaseRef &track) const
 

Static Private Member Functions

static double trackVertexCompat (const reco::Vertex &vtx, const TransientTrack &track)
 

Private Attributes

const double cut
 
const double temperature
 
const TransientTrackBuildertrackBuilder
 
TransientTrackMap trackMap
 

Detailed Description

Definition at line 15 of file JetSignalVertexCompatibilityAlgo.h.

Member Typedef Documentation

◆ TransientTrackMap

Definition at line 30 of file JetSignalVertexCompatibilityAlgo.h.

Constructor & Destructor Documentation

◆ JetSignalVertexCompatibilityAlgo()

JetSignalVertexCompatibilityAlgo::JetSignalVertexCompatibilityAlgo ( double  cut,
double  temperature 
)

Definition at line 29 of file JetSignalVertexCompatibilityAlgo.cc.

◆ ~JetSignalVertexCompatibilityAlgo()

JetSignalVertexCompatibilityAlgo::~JetSignalVertexCompatibilityAlgo ( )

Definition at line 32 of file JetSignalVertexCompatibilityAlgo.cc.

32 {}

Member Function Documentation

◆ activation()

double JetSignalVertexCompatibilityAlgo::activation ( double  compat) const
private

Definition at line 59 of file JetSignalVertexCompatibilityAlgo.cc.

59  {
60  return 1. / (std::exp((compat - cut) / temperature) + 1.);
61 }

References cut, JetChargeProducer_cfi::exp, and temperature.

Referenced by compatibility().

◆ compatibility()

std::vector< float > JetSignalVertexCompatibilityAlgo::compatibility ( const reco::VertexCollection vertices,
const reco::TrackRefVector tracks 
) const

Definition at line 63 of file JetSignalVertexCompatibilityAlgo.cc.

64  {
65  std::vector<float> result(vertices.size(), 0.);
66  float sum = 0.;
67 
68  for (TrackRefVector::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
69  const TransientTrack &transientTrack = convert(TrackBaseRef(*track));
70 
71  for (unsigned int i = 0; i < vertices.size(); i++) {
72  double compat = trackVertexCompat(vertices[i], transientTrack);
73  double contribution = activation(compat) * (*track)->pt();
74 
75  result[i] += contribution;
76  sum += contribution;
77  }
78  }
79 
80  if (sum < 1.0e-9) {
81  for (unsigned int i = 0; i < result.size(); i++)
82  result[i] = 1.0 / result.size();
83  } else {
84  for (unsigned int i = 0; i < result.size(); i++)
85  result[i] /= sum;
86  }
87 
88  return result;
89 }

References activation(), convert(), MillePedeFileConverter_cfg::e, mps_fire::i, mps_fire::result, HLT_FULL_cff::track, tracks, trackVertexCompat(), and pwdgSkimBPark_cfi::vertices.

Referenced by JetSignalVertexCompatibility::produce().

◆ convert()

const TransientTrack & JetSignalVertexCompatibilityAlgo::convert ( const reco::TrackBaseRef track) const
private

Definition at line 49 of file JetSignalVertexCompatibilityAlgo.cc.

49  {
50  TransientTrackMap::iterator pos = trackMap.lower_bound(track);
51  if (pos != trackMap.end() && pos->first == track)
52  return pos->second;
53 
54  // the castTo will only work with regular, i.e. no GsfTracks
55  // the interface is not intrinsically polymorph...
56  return trackMap.insert(pos, std::make_pair(track, trackBuilder->build(track.castTo<TrackRef>())))->second;
57 }

References TransientTrackBuilder::build(), HLT_FULL_cff::track, trackBuilder, and trackMap.

Referenced by compatibility().

◆ resetEvent()

void JetSignalVertexCompatibilityAlgo::resetEvent ( const TransientTrackBuilder trackBuilder)

Definition at line 91 of file JetSignalVertexCompatibilityAlgo.cc.

91  {
92  trackMap.clear();
93  trackBuilder = builder;
94 }

References trackBuilder, and trackMap.

Referenced by JetSignalVertexCompatibility::produce().

◆ trackVertexCompat()

double JetSignalVertexCompatibilityAlgo::trackVertexCompat ( const reco::Vertex vtx,
const TransientTrack track 
)
staticprivate

Definition at line 34 of file JetSignalVertexCompatibilityAlgo.cc.

34  {
35  GlobalPoint point1 = RecoVertex::convertPos(vtx.position());
37  TrajectoryStateOnSurface tsos = extrap.extrapolate(track.impactPointState(), point1);
38 
39  if (!tsos.isValid())
40  return 1.0e6;
41 
42  GlobalPoint point2 = tsos.globalPosition();
43  ROOT::Math::SVector<double, 3> dir(point1.x() - point2.x(), point1.y() - point2.y(), point1.z() - point2.z());
44  GlobalError cov = RecoVertex::convertError(vtx.covariance()) + tsos.cartesianError().position();
45 
46  return ROOT::Math::Mag2(dir) / std::sqrt(ROOT::Math::Similarity(cov.matrix(), dir));
47 }

References RecoVertex::convertError(), RecoVertex::convertPos(), DeadROC_duringRun::dir, TrajectoryStateOnSurface::globalPosition(), mathSSE::sqrt(), HLT_FULL_cff::track, and extraflags_cff::vtx.

Referenced by compatibility().

Member Data Documentation

◆ cut

const double reco::JetSignalVertexCompatibilityAlgo::cut
private

Definition at line 40 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by activation().

◆ temperature

const double reco::JetSignalVertexCompatibilityAlgo::temperature
private

Definition at line 41 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by activation().

◆ trackBuilder

const TransientTrackBuilder* reco::JetSignalVertexCompatibilityAlgo::trackBuilder
private

Definition at line 38 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by convert(), and resetEvent().

◆ trackMap

TransientTrackMap reco::JetSignalVertexCompatibilityAlgo::trackMap
mutableprivate

Definition at line 37 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by convert(), and resetEvent().

mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
reco::JetSignalVertexCompatibilityAlgo::temperature
const double temperature
Definition: JetSignalVertexCompatibilityAlgo.h:41
pos
Definition: PixelAliasList.h:18
reco::JetSignalVertexCompatibilityAlgo::activation
double activation(double compat) const
Definition: JetSignalVertexCompatibilityAlgo.cc:59
reco::TrackBaseRef
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:35
edm::Ref< TrackCollection >
reco::JetSignalVertexCompatibilityAlgo::trackBuilder
const TransientTrackBuilder * trackBuilder
Definition: JetSignalVertexCompatibilityAlgo.h:38
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::JetSignalVertexCompatibilityAlgo::trackVertexCompat
static double trackVertexCompat(const reco::Vertex &vtx, const TransientTrack &track)
Definition: JetSignalVertexCompatibilityAlgo.cc:34
Point3DBase< float, GlobalTag >
AnalyticalImpactPointExtrapolator
Definition: AnalyticalImpactPointExtrapolator.h:26
RecoVertex::convertError
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GlobalErrorBase< double, ErrorMatrixTag >
reco::JetSignalVertexCompatibilityAlgo::convert
const TransientTrack & convert(const reco::TrackBaseRef &track) const
Definition: JetSignalVertexCompatibilityAlgo.cc:49
reco::JetSignalVertexCompatibilityAlgo::cut
const double cut
Definition: JetSignalVertexCompatibilityAlgo.h:40
reco::TransientTrack
Definition: TransientTrack.h:19
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
edm::RefVectorIterator
Definition: EDProductfwd.h:33
RecoVertex::convertPos
reco::Vertex::Point convertPos(const GlobalPoint &p)
Definition: ConvertToFromReco.h:7
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
mps_fire.result
result
Definition: mps_fire.py:311
reco::JetSignalVertexCompatibilityAlgo::trackMap
TransientTrackMap trackMap
Definition: JetSignalVertexCompatibilityAlgo.h:37
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37