CMS 3D CMS Logo

Public Member Functions | Private Attributes

reco::TrackKinematics Class Reference

#include <TrackKinematics.h>

List of all members.

Public Member Functions

void add (const reco::Track &track, double weight=1.0)
unsigned int numberOfTracks () const
TrackKinematics operator+ (const TrackKinematics &other)
TrackKinematicsoperator+= (const TrackKinematics &other)
double sumOfWeights () const
 TrackKinematics (const std::vector< reco::Track > &tracks)
 TrackKinematics ()
 TrackKinematics (const reco::Vertex &vertex)
 TrackKinematics (const reco::TrackRefVector &tracks)
const math::XYZTLorentzVectorvectorSum () const
const math::XYZTLorentzVectorweightedVectorSum () const
 ~TrackKinematics ()

Private Attributes

unsigned int n
math::XYZTLorentzVector sum
double sumWeights
math::XYZTLorentzVector weightedSum

Detailed Description

Definition at line 13 of file TrackKinematics.h.


Constructor & Destructor Documentation

TrackKinematics::TrackKinematics ( )

Definition at line 16 of file TrackKinematics.cc.

                                 :
        n(0), sumWeights(0)
{
}
TrackKinematics::TrackKinematics ( const std::vector< reco::Track > &  tracks)

Definition at line 21 of file TrackKinematics.cc.

References add().

                                                               :
        n(0), sumWeights(0)
{
        for(std::vector<Track>::const_iterator iter = tracks.begin();
            iter != tracks.end(); iter++)
                add(*iter);
}
TrackKinematics::TrackKinematics ( const reco::TrackRefVector tracks)

Definition at line 29 of file TrackKinematics.cc.

References add(), edm::RefVector< C, T, F >::begin(), and edm::RefVector< C, T, F >::end().

                                                             :
        n(0), sumWeights(0)
{
        for(TrackRefVector::const_iterator iter = tracks.begin();
            iter != tracks.end(); iter++)
                add(**iter);
}
TrackKinematics::TrackKinematics ( const reco::Vertex vertex)

Definition at line 37 of file TrackKinematics.cc.

References add(), reco::Vertex::hasRefittedTracks(), reco::Vertex::refittedTrack(), reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and reco::Vertex::trackWeight().

                                                     :
        n(0), sumWeights(0)
{
        bool hasRefittedTracks = vertex.hasRefittedTracks();
        for(Vertex::trackRef_iterator iter = vertex.tracks_begin();
            iter != vertex.tracks_end(); ++iter) {
                if (hasRefittedTracks)
                        add(vertex.refittedTrack(*iter),
                            vertex.trackWeight(*iter));
                else
                        add(**iter, vertex.trackWeight(*iter));
        }
}
reco::TrackKinematics::~TrackKinematics ( ) [inline]

Definition at line 19 of file TrackKinematics.h.

{}

Member Function Documentation

void TrackKinematics::add ( const reco::Track track,
double  weight = 1.0 
)

Definition at line 61 of file TrackKinematics.cc.

References n, reco::ParticleMasses::piPlus, reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), sum, sumWeights, CommonMethods::weight(), and weightedSum.

Referenced by GhostTrackComputer::threshTrack(), and TrackKinematics().

{
        ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;

        vec.SetPx(track.px());
        vec.SetPy(track.py());
        vec.SetPz(track.pz());
        vec.SetM(ParticleMasses::piPlus);

        n++;
        sumWeights += weight;
        sum += vec;
        weightedSum += weight * vec;
}
unsigned int reco::TrackKinematics::numberOfTracks ( ) const [inline]

Definition at line 27 of file TrackKinematics.h.

References n.

{ return n; }
TrackKinematics reco::TrackKinematics::operator+ ( const TrackKinematics other) [inline]

Definition at line 24 of file TrackKinematics.h.

References filterCSVwithJSON::copy.

        { TrackKinematics copy = *this; copy += other; return copy; }
TrackKinematics & TrackKinematics::operator+= ( const TrackKinematics other)

Definition at line 51 of file TrackKinematics.cc.

References n, sum, sumWeights, and weightedSum.

{
        n += other.n;
        sumWeights += other.sumWeights;
        sum += other.sum;
        weightedSum += other.weightedSum;

        return *this;
}
double reco::TrackKinematics::sumOfWeights ( ) const [inline]

Definition at line 28 of file TrackKinematics.h.

References sumWeights.

{ return sumWeights; }
const math::XYZTLorentzVector& reco::TrackKinematics::vectorSum ( ) const [inline]
const math::XYZTLorentzVector& reco::TrackKinematics::weightedVectorSum ( ) const [inline]

Definition at line 32 of file TrackKinematics.h.

References weightedSum.

Referenced by reco::VertexFilter::operator()().

        { return weightedSum; }

Member Data Documentation

unsigned int reco::TrackKinematics::n [private]

Definition at line 36 of file TrackKinematics.h.

Referenced by add(), numberOfTracks(), and operator+=().

Definition at line 38 of file TrackKinematics.h.

Referenced by add(), operator+=(), and vectorSum().

Definition at line 37 of file TrackKinematics.h.

Referenced by add(), operator+=(), and sumOfWeights().

Definition at line 39 of file TrackKinematics.h.

Referenced by add(), operator+=(), and weightedVectorSum().