#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 TransientTrack & | convert (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 TransientTrackBuilder * | trackBuilder |
TransientTrackMap | trackMap |
Definition at line 16 of file JetSignalVertexCompatibilityAlgo.h.
typedef std::map<reco::TrackBaseRef, reco::TransientTrack, RefToBaseLess<reco::Track> > reco::JetSignalVertexCompatibilityAlgo::TransientTrackMap [private] |
Definition at line 37 of file JetSignalVertexCompatibilityAlgo.h.
JetSignalVertexCompatibilityAlgo::JetSignalVertexCompatibilityAlgo | ( | double | cut, |
double | temperature | ||
) |
Definition at line 30 of file JetSignalVertexCompatibilityAlgo.cc.
: cut(cut), temperature(temperature) {}
JetSignalVertexCompatibilityAlgo::~JetSignalVertexCompatibilityAlgo | ( | ) |
Definition at line 35 of file JetSignalVertexCompatibilityAlgo.cc.
{}
double JetSignalVertexCompatibilityAlgo::activation | ( | double | compat | ) | const [private] |
Definition at line 74 of file JetSignalVertexCompatibilityAlgo.cc.
References cut, funct::exp(), and temperature.
Referenced by compatibility().
{ return 1. / (std::exp((compat - cut) / temperature) + 1.); }
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().
{ std::vector<float> result(vertices.size(), 0.); float sum = 0.; for(TrackRefVector::const_iterator track = tracks.begin(); track != tracks.end(); ++track) { const TransientTrack &transientTrack = convert(TrackBaseRef(*track)); for(unsigned int i = 0; i < vertices.size(); i++) { double compat = trackVertexCompat(vertices[i], transientTrack); double contribution = activation(compat) * (*track)->pt(); result[i] += contribution; sum += contribution; } } if (sum < 1.0e-9) { for(unsigned int i = 0; i < result.size(); i++) result[i] = 1.0 / result.size(); } else { for(unsigned int i = 0; i < result.size(); i++) result[i] /= sum; } return result; }
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(), pos, trackBuilder, and trackMap.
Referenced by compatibility().
{ TransientTrackMap::iterator pos = trackMap.lower_bound(track); if (pos != trackMap.end() && pos->first == track) return pos->second; // the castTo will only work with regular, i.e. no GsfTracks // the interface is not intrinsically polymorph... return trackMap.insert(pos, std::make_pair(track, trackBuilder->build( track.castTo<TrackRef>())))->second; }
void JetSignalVertexCompatibilityAlgo::resetEvent | ( | const TransientTrackBuilder * | trackBuilder | ) |
Definition at line 114 of file JetSignalVertexCompatibilityAlgo.cc.
References trackBuilder, and trackMap.
Referenced by JetSignalVertexCompatibility::produce().
{ trackMap.clear(); trackBuilder = builder; }
double JetSignalVertexCompatibilityAlgo::trackVertexCompat | ( | const reco::Vertex & | vtx, |
const TransientTrack & | track | ||
) | [static, private] |
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().
{ GlobalPoint point1 = RecoVertex::convertPos(vtx.position()); AnalyticalImpactPointExtrapolator extrap(track.field()); TrajectoryStateOnSurface tsos = extrap.extrapolate(track.impactPointState(), point1); if (!tsos.isValid()) return 1.0e6; GlobalPoint point2 = tsos.globalPosition(); ROOT::Math::SVector<double, 3> dir(point1.x() - point2.x(), point1.y() - point2.y(), point1.z() - point2.z()); GlobalError cov = RecoVertex::convertError(vtx.covariance()) + tsos.cartesianError().position(); return ROOT::Math::Mag2(dir) / std::sqrt(ROOT::Math::Similarity(cov.matrix_new(), dir)); }
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().
Definition at line 46 of file JetSignalVertexCompatibilityAlgo.h.
Referenced by convert(), and resetEvent().
TransientTrackMap reco::JetSignalVertexCompatibilityAlgo::trackMap [mutable, private] |
Definition at line 45 of file JetSignalVertexCompatibilityAlgo.h.
Referenced by convert(), and resetEvent().