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 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 16 of file JetSignalVertexCompatibilityAlgo.h.

Member Typedef Documentation

Definition at line 37 of file JetSignalVertexCompatibilityAlgo.h.

Constructor & Destructor Documentation

JetSignalVertexCompatibilityAlgo::JetSignalVertexCompatibilityAlgo ( double  cut,
double  temperature 
)
JetSignalVertexCompatibilityAlgo::~JetSignalVertexCompatibilityAlgo ( )

Definition at line 35 of file JetSignalVertexCompatibilityAlgo.cc.

36 {}

Member Function Documentation

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

Definition at line 80 of file JetSignalVertexCompatibilityAlgo.cc.

References activation(), edm::RefVector< C, T, F >::begin(), convert(), alignCSCRings::e, edm::RefVector< C, T, F >::end(), i, query::result, and trackVertexCompat().

Referenced by JetSignalVertexCompatibility::produce().

83 {
84  std::vector<float> result(vertices.size(), 0.);
85  float sum = 0.;
86 
87  for(TrackRefVector::const_iterator track = tracks.begin();
88  track != tracks.end(); ++track) {
89  const TransientTrack &transientTrack =
90  convert(TrackBaseRef(*track));
91 
92  for(unsigned int i = 0; i < vertices.size(); i++) {
93  double compat =
94  trackVertexCompat(vertices[i], transientTrack);
95  double contribution =
96  activation(compat) * (*track)->pt();
97 
98  result[i] += contribution;
99  sum += contribution;
100  }
101  }
102 
103  if (sum < 1.0e-9) {
104  for(unsigned int i = 0; i < result.size(); i++)
105  result[i] = 1.0 / result.size();
106  } else {
107  for(unsigned int i = 0; i < result.size(); i++)
108  result[i] /= sum;
109  }
110 
111  return result;
112 }
int i
Definition: DBlmapReader.cc:9
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
static double trackVertexCompat(const reco::Vertex &vtx, const TransientTrack &track)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:22
tuple result
Definition: query.py:137
const TransientTrack & convert(const reco::TrackBaseRef &track) const
const TransientTrack & JetSignalVertexCompatibilityAlgo::convert ( const reco::TrackBaseRef track) const
private

Definition at line 61 of file JetSignalVertexCompatibilityAlgo.cc.

References TransientTrackBuilder::build(), edm::RefToBase< T >::castTo(), trackBuilder, and trackMap.

Referenced by compatibility().

62 {
63  TransientTrackMap::iterator pos = trackMap.lower_bound(track);
64  if (pos != trackMap.end() && pos->first == track)
65  return pos->second;
66 
67  // the castTo will only work with regular, i.e. no GsfTracks
68  // the interface is not intrinsically polymorph...
69  return trackMap.insert(pos,
70  std::make_pair(track, trackBuilder->build(
71  track.castTo<TrackRef>())))->second;
72 }
reco::TransientTrack build(const reco::Track *p) const
REF castTo() const
cast to a concrete type
Definition: RefToBase.h:241
void JetSignalVertexCompatibilityAlgo::resetEvent ( const TransientTrackBuilder trackBuilder)

Definition at line 114 of file JetSignalVertexCompatibilityAlgo.cc.

References trackBuilder, and trackMap.

Referenced by JetSignalVertexCompatibility::produce().

116 {
117  trackMap.clear();
118  trackBuilder = builder;
119 }
double JetSignalVertexCompatibilityAlgo::trackVertexCompat ( const reco::Vertex vtx,
const TransientTrack track 
)
staticprivate

Definition at line 38 of file JetSignalVertexCompatibilityAlgo.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), reco::Vertex::covariance(), dir, reco::TransientTrack::field(), TrajectoryStateOnSurface::globalPosition(), reco::TransientTrack::impactPointState(), reco::Vertex::position(), and mathSSE::sqrt().

Referenced by compatibility().

40 {
44  extrap.extrapolate(track.impactPointState(), point1);
45 
46  if (!tsos.isValid())
47  return 1.0e6;
48 
49  GlobalPoint point2 = tsos.globalPosition();
50  ROOT::Math::SVector<double, 3> dir(point1.x() - point2.x(),
51  point1.y() - point2.y(),
52  point1.z() - point2.z());
54  tsos.cartesianError().position();
55 
56  return ROOT::Math::Mag2(dir) /
57  std::sqrt(ROOT::Math::Similarity(cov.matrix_new(), dir));
58 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
T y() const
Definition: PV3DBase.h:63
const MagneticField * field() const
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:109
const Point & position() const
position
Definition: Vertex.h:92
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
TrajectoryStateOnSurface impactPointState() const
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

const double reco::JetSignalVertexCompatibilityAlgo::cut
private

Definition at line 48 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by activation().

const double reco::JetSignalVertexCompatibilityAlgo::temperature
private

Definition at line 49 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by activation().

const TransientTrackBuilder* reco::JetSignalVertexCompatibilityAlgo::trackBuilder
private

Definition at line 46 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by convert(), and resetEvent().

TransientTrackMap reco::JetSignalVertexCompatibilityAlgo::trackMap
mutableprivate

Definition at line 45 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by convert(), and resetEvent().