CMS 3D CMS Logo

reco::PFTrack Class Reference

Base class for particle flow input reconstructed tracks and simulated particles. More...

#include <DataFormats/ParticleFlowReco/interface/PFTrack.h>

Inheritance diagram for reco::PFTrack:

reco::PFRecTrack reco::PFSimParticle reco::GsfPFRecTrack reco::PFBrem

List of all members.

Public Member Functions

void addPoint (const reco::PFTrajectoryPoint &trajPt)
 add a trajectory measurement
void calculatePositionREP ()
 calculate posrep_ once and for all for each point
double charge () const
 
Returns:
electric charge

int color () const
const reco::PFTrajectoryPointextrapolatedPoint (unsigned layerid) const
 
Returns:
an extrapolated point

std::vector
< reco::PFTrajectoryPoint >
::const_iterator 
innermostMeasurement () const
 iterator on innermost tracker measurement
unsigned int nTrajectoryMeasurements () const
 
Returns:
number of trajectory measurements in tracker

unsigned int nTrajectoryPoints () const
 
Returns:
number of trajectory points

std::vector
< reco::PFTrajectoryPoint >
::const_iterator 
outermostMeasurement () const
 iterator on outermost tracker measurement
 PFTrack (const PFTrack &other)
 PFTrack (double charge)
 PFTrack ()
void setColor (int color)
void setPoint (unsigned int index, const reco::PFTrajectoryPoint &measurement)
 set a trajectory point
const reco::PFTrajectoryPointtrajectoryPoint (unsigned index) const
 
Returns:
a trajectory point

const std::vector
< reco::PFTrajectoryPoint > & 
trajectoryPoints () const
 
Returns:
vector of trajectory points


Protected Attributes

double charge_
 charge
int color_
 color (transient)
unsigned int indexInnermost_
 index innermost tracker measurement
unsigned int indexOutermost_
 index outermost tracker measurement
std::vector
< reco::PFTrajectoryPoint
trajectoryPoints_
 vector of trajectory points

Static Protected Attributes

static const unsigned int nMaxTrackingLayers_ = 17
 maximal number of tracking layers

Friends

std::ostream & operator<< (std::ostream &out, const PFTrack &track)


Detailed Description

Base class for particle flow input reconstructed tracks and simulated particles.

A PFTrack contains a vector of PFTrajectoryPoint objects. These points are stored in a vector to benefit from the random access. One must take care of storing the points in the right order, and it might even be necessary to insert dummy points.

For a PFRecTrack, the ordering of the points is the following:

For a PFSimParticle, the ordering of the points is the following.

Todo:
Note that some points are missing, and should be added: shower max, intersection with the tracker layers maybe.
PFRecTracks and PFSimParticles are created in the PFTrackProducer module.
Todo:
Make this class abstract ?
Author:
Renaud Bruneliere
Date:
July 2006

Definition at line 63 of file PFTrack.h.


Constructor & Destructor Documentation

PFTrack::PFTrack (  ) 

Definition at line 11 of file PFTrack.cc.

References reco::PFTrajectoryPoint::NLayers, nMaxTrackingLayers_, and trajectoryPoints_.

00011                  :
00012   charge_(0.),
00013   indexInnermost_(0),
00014   indexOutermost_(0),
00015   color_(1) {
00016 
00017   // prepare vector of trajectory points for propagated positions
00018   trajectoryPoints_.reserve(PFTrajectoryPoint::NLayers + nMaxTrackingLayers_);
00019 }

PFTrack::PFTrack ( double  charge  ) 

Definition at line 22 of file PFTrack.cc.

References reco::PFTrajectoryPoint::NLayers, nMaxTrackingLayers_, and trajectoryPoints_.

00022                               : 
00023   charge_(charge), 
00024   indexInnermost_(0),
00025   indexOutermost_(0),
00026   color_(1) {
00027 
00028   // prepare vector of trajectory points for propagated positions
00029   trajectoryPoints_.reserve(PFTrajectoryPoint::NLayers + nMaxTrackingLayers_);
00030 }

PFTrack::PFTrack ( const PFTrack other  ) 

Definition at line 33 of file PFTrack.cc.

00033                                      :
00034   charge_(other.charge_), 
00035   trajectoryPoints_(other.trajectoryPoints_),
00036   indexInnermost_(other.indexInnermost_),
00037   indexOutermost_(other.indexOutermost_),
00038   color_(other.color_)
00039 {}


Member Function Documentation

void PFTrack::addPoint ( const reco::PFTrajectoryPoint trajPt  ) 

add a trajectory measurement

Todo:
throw an exception if the number of points is too large

Definition at line 42 of file PFTrack.cc.

References reco::PFTrajectoryPoint::BeamPipeOrEndVertex, indexInnermost_, indexOutermost_, reco::PFTrajectoryPoint::isTrackerLayer(), and trajectoryPoints_.

Referenced by PFTrackTransformer::addPoints(), and PFTrackTransformer::addPointsAndBrems().

00042                                                       {
00043   
00044   //   cout<<"adding "<<trajPt<<endl;
00045 
00046   if (trajPt.isTrackerLayer()) {
00047     if (!indexOutermost_) { // first time a measurement is added
00048       if (trajectoryPoints_.size() < PFTrajectoryPoint::BeamPipeOrEndVertex + 1) {
00049         PFTrajectoryPoint dummyPt;
00050         for (unsigned iPt = trajectoryPoints_.size(); iPt < PFTrajectoryPoint::BeamPipeOrEndVertex + 1; iPt++)
00051           trajectoryPoints_.push_back(dummyPt);
00052       } else if (trajectoryPoints_.size() > PFTrajectoryPoint::BeamPipeOrEndVertex + 1) {
00053         // throw an exception here
00054         //      edm::LogError("PFTrack")<<"trajectoryPoints_.size() is too large = " 
00055         //                              <<trajectoryPoints_.size()<<"\n";
00056       }
00057       indexOutermost_ = indexInnermost_ = PFTrajectoryPoint::BeamPipeOrEndVertex + 1;
00058     } else 
00059       indexOutermost_++;
00060   }
00061   // Use push_back instead of insert in order to gain time
00062   trajectoryPoints_.push_back(trajPt);
00063 
00064   //   cout<<"adding point "<<*this<<endl;
00065 }

void PFTrack::calculatePositionREP (  ) 

calculate posrep_ once and for all for each point

Todo:
where is posrep? profile and see if it's necessary.

Definition at line 68 of file PFTrack.cc.

References i, and trajectoryPoints_.

00068                                    {
00069   
00070   for(unsigned i=0; i<trajectoryPoints_.size(); i++) {
00071     trajectoryPoints_[i].calculatePositionREP();
00072   }
00073 }

double reco::PFTrack::charge (  )  const [inline]

Returns:
electric charge

Definition at line 87 of file PFTrack.h.

References charge_.

Referenced by PFRootEventManager::countChargedAndPhotons(), reco::operator<<(), and PFRootEventManagerColin::processHIGH_E_TAUS().

00087 { return charge_; }

int reco::PFTrack::color (  )  const [inline]

Definition at line 122 of file PFTrack.h.

References color_.

00122 { return color_; }    

const reco::PFTrajectoryPoint & PFTrack::extrapolatedPoint ( unsigned  layerid  )  const

Returns:
an extrapolated point

Todo:
throw an exception in case of invalid point.

Definition at line 76 of file PFTrack.cc.

References lat::endl(), Exception, indexInnermost_, reco::PFTrajectoryPoint::NLayers, nTrajectoryMeasurements(), and trajectoryPoints_.

Referenced by PFRootEventManager::closestParticle(), PFRootEventManager::fillOutEventWithSimParticles(), PFAlgo::isSatelliteCluster(), DisplayManager::loadGSimParticles(), PFBlockAlgo::testLinkByRecHit(), PFBlockAlgo::testTrackAndECAL(), PFBlockAlgo::testTrackAndHCAL(), and PFBlockAlgo::testTrackAndPS().

00076                                                                               {
00077   
00078   if( layerid >= reco::PFTrajectoryPoint::NLayers ||
00079       nTrajectoryMeasurements() + layerid >= trajectoryPoints_.size() ) {
00080 
00081     // cout<<(*this)<<endl;
00082     // cout<<"lid "<<layerid<<" "<<nTrajectoryMeasurements()<<" "<<trajectoryPoints_.size()<<endl;
00083     
00084     throw cms::Exception("SizeError")<<"PFRecTrack::extrapolatedPoint: cannot access "
00085                                      <<layerid
00086                                      <<" #traj meas = "<<nTrajectoryMeasurements()
00087                                      <<" #traj points = "<<trajectoryPoints_.size()
00088                                      <<endl
00089                                      <<(*this);
00090     // assert(0);
00091   }
00092   if (layerid < indexInnermost_)
00093     return trajectoryPoints_[ layerid ];
00094   else
00095     return trajectoryPoints_[ nTrajectoryMeasurements() + layerid ];  
00096 }

std::vector< reco::PFTrajectoryPoint >::const_iterator reco::PFTrack::innermostMeasurement (  )  const [inline]

iterator on innermost tracker measurement

Definition at line 111 of file PFTrack.h.

References indexInnermost_, and trajectoryPoints_.

00112         { return trajectoryPoints_.begin() + indexInnermost_; }

unsigned int reco::PFTrack::nTrajectoryMeasurements (  )  const [inline]

Returns:
number of trajectory measurements in tracker

Definition at line 94 of file PFTrack.h.

References indexInnermost_, and indexOutermost_.

Referenced by PFRootEventManager::closestParticle(), extrapolatedPoint(), and reco::operator<<().

00095         { return (indexOutermost_ ? indexOutermost_ - indexInnermost_ + 1 : 0); }

unsigned int reco::PFTrack::nTrajectoryPoints (  )  const [inline]

Returns:
number of trajectory points

Definition at line 90 of file PFTrack.h.

References trajectoryPoints_.

Referenced by PFRootEventManager::closestParticle(), and PFRootEventManager::fillOutEventWithSimParticles().

00091         { return trajectoryPoints_.size(); }

std::vector< reco::PFTrajectoryPoint >::const_iterator reco::PFTrack::outermostMeasurement (  )  const [inline]

iterator on outermost tracker measurement

Definition at line 116 of file PFTrack.h.

References indexOutermost_, and trajectoryPoints_.

00117         { return trajectoryPoints_.begin() + indexOutermost_; }

void reco::PFTrack::setColor ( int  color  )  [inline]

Definition at line 120 of file PFTrack.h.

References color_.

00120 {color_ = color;}

void reco::PFTrack::setPoint ( unsigned int  index,
const reco::PFTrajectoryPoint measurement 
) [inline]

set a trajectory point

Definition at line 78 of file PFTrack.h.

References trajectoryPoints_.

00080         { trajectoryPoints_[index] = measurement; }

const reco::PFTrajectoryPoint& reco::PFTrack::trajectoryPoint ( unsigned  index  )  const [inline]

Returns:
a trajectory point

Definition at line 102 of file PFTrack.h.

References trajectoryPoints_.

Referenced by DisplayManager::loadGSimParticles(), and reco::operator<<().

00103         { return trajectoryPoints_[index]; }

const std::vector< reco::PFTrajectoryPoint >& reco::PFTrack::trajectoryPoints (  )  const [inline]

Returns:
vector of trajectory points

Definition at line 98 of file PFTrack.h.

References trajectoryPoints_.

Referenced by DisplayManager::loadGSimParticles(), and PFRootEventManager::trackInsideGCut().

00099         { return trajectoryPoints_; }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const PFTrack track 
) [friend]


Member Data Documentation

double reco::PFTrack::charge_ [protected]

charge

Definition at line 133 of file PFTrack.h.

Referenced by charge().

int reco::PFTrack::color_ [protected]

color (transient)

Definition at line 145 of file PFTrack.h.

Referenced by color(), and setColor().

unsigned int reco::PFTrack::indexInnermost_ [protected]

index innermost tracker measurement

Definition at line 139 of file PFTrack.h.

Referenced by addPoint(), extrapolatedPoint(), innermostMeasurement(), and nTrajectoryMeasurements().

unsigned int reco::PFTrack::indexOutermost_ [protected]

index outermost tracker measurement

Definition at line 142 of file PFTrack.h.

Referenced by addPoint(), nTrajectoryMeasurements(), and outermostMeasurement().

const unsigned PFTrack::nMaxTrackingLayers_ = 17 [static, protected]

maximal number of tracking layers

Definition at line 130 of file PFTrack.h.

Referenced by PFTrack().

std::vector< reco::PFTrajectoryPoint > reco::PFTrack::trajectoryPoints_ [protected]

vector of trajectory points

Definition at line 136 of file PFTrack.h.

Referenced by addPoint(), calculatePositionREP(), extrapolatedPoint(), innermostMeasurement(), nTrajectoryPoints(), reco::operator<<(), outermostMeasurement(), PFTrack(), setPoint(), trajectoryPoint(), and trajectoryPoints().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:51:22 2009 for CMSSW by  doxygen 1.5.4