CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes

reco::JetSignalVertexCompatibilityAlgo Class Reference

#include <JetSignalVertexCompatibilityAlgo.h>

List of all members.

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.

{}

Member Function Documentation

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));
}

Member Data Documentation

Definition at line 48 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by activation().

Definition at line 49 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by activation().

Definition at line 46 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by convert(), and resetEvent().

Definition at line 45 of file JetSignalVertexCompatibilityAlgo.h.

Referenced by convert(), and resetEvent().