#include <MapsTrack.hh>
Jamie Ballin, Imperial College London February 2008
A track is defined by at least 3 hits in 3 sensors. Only one hit per sensor is allowed. At most it is defined by 4 hits in 4 sensors (though only slight revisions would be required to change this).
Note that MapsTracks are lazy: they do not tell each of the assosicated MapsSensors of their residuals unless you explicitly tell them to do so. Telling sensors whether they have been efficient or not is entirely up to the user; see examples in tests/, especially ExtractEfficiencies.cpp code.
Definition at line 27 of file MapsTrack.hh.
Public Types | |
typedef std::pair< int, int > | coord |
typedef std::pair< double, double > | physXY |
Public Member Functions | |
MapsTrack () | |
MapsTrack (unsigned bx, std::map< MapsSensor *, MapsTrack::coord > hits, MapsSensor *fourthSensor=0, unsigned fourthThreshold=0) | |
virtual | ~MapsTrack () |
unsigned | timeStamp () const |
const std::map< MapsSensor *, coord > & | getHits () |
double | sigmaX () const |
double | sigmaY () const |
double | meanX () const |
double | meanY () const |
double | pixelPitch () const |
std::pair< double, double > | trackError () const |
void | setPixelPitch (const double &pitch) |
void | setTrackError (const std::pair< double, double > &error) |
MapsSensor * | fourthSensor () const |
unsigned | fourthSensorThresh () const |
void | setFourthSensorThresh (const unsigned &threshold) |
MapsSensor * | missingSensor (std::vector< MapsSensor * > sensors) const |
std::pair< double, double > | simpleResidual (MapsSensor *s) const throw (MapsException) |
std::map< MapsSensor *, std::pair< double, double > > | allResiduals () |
void | tellSensorsOfResiduals () |
void | tellSensorsOfResiduals (const MapsSensor *const requiredLeft, const MapsSensor *const requiredRight) |
void | tellSensorsOfHits () |
double | theta () const |
double | chiSqProb (const unsigned &dimension) const |
void | setHits (std::map< MapsSensor *, coord > hits) |
std::ostream & | printCoords (std::ostream &s) const |
MapsSensor * | leftExtrapPoint (MapsSensor *) const |
MapsSensor * | rightExtrapPoint (MapsSensor *) const |
std::pair< double, double > | fitParameters (const unsigned &dimension) const |
double | chiSq (const unsigned &dimension) const |
void | make3HitTrack (MapsTrack &mt) |
unsigned | getFourthHitResidual (const MapsTrack &threeHitTrack, std::pair< double, double > &answer) |
std::pair< double, double > | findXYPrediction (const double &zpos) const |
const std::map< MapsSensor *, physXY > & | getGlobalHits () const |
void | eraseGlobalHits () |
Protected Member Functions | |
MapsTrack & | operator= (MapsTrack &mt) |
Friends | |
std::ostream & | operator<< (std::ostream &s, const MapsTrack &mt) |
std::ostream & | diagnose (std::ostream &s, const MapsTrack &mt) |
typedef std::pair<int, int> MapsTrack::coord |
Definition at line 29 of file MapsTrack.hh.
typedef std::pair<double, double> MapsTrack::physXY |
Definition at line 30 of file MapsTrack.hh.
MapsTrack::MapsTrack | ( | ) | [inline] |
Definition at line 32 of file MapsTrack.hh.
MapsTrack::MapsTrack | ( | unsigned | bx, | |
std::map< MapsSensor *, MapsTrack::coord > | hits, | |||
MapsSensor * | fourthSensor = 0 , |
|||
unsigned | fourthThreshold = 0 | |||
) | [inline] |
Constructor
Definition at line 38 of file MapsTrack.hh.
MapsTrack::~MapsTrack | ( | ) | [virtual] |
Definition at line 8 of file MapsTrack.cc.
unsigned MapsTrack::timeStamp | ( | ) | const [inline] |
the timestamp of this track
Definition at line 48 of file MapsTrack.hh.
Referenced by diagnose(), and operator<<().
const std::map< MapsSensor *, MapsTrack::coord > & MapsTrack::getHits | ( | ) |
returns a map of hits making the track
Definition at line 23 of file MapsTrack.cc.
double MapsTrack::sigmaX | ( | ) | const |
The standard deviation of the hits in x
Definition at line 39 of file MapsTrack.cc.
References c, and getGlobalHits().
double MapsTrack::sigmaY | ( | ) | const |
The standard deviation of the hits in y
Definition at line 54 of file MapsTrack.cc.
References c, and getGlobalHits().
double MapsTrack::meanX | ( | ) | const |
Returns the arithmetic mean of the x hits
Definition at line 68 of file MapsTrack.cc.
References c, and getGlobalHits().
Referenced by diagnose(), and operator<<().
double MapsTrack::meanY | ( | ) | const |
Returns the arithmetic mean of the y hits
Definition at line 78 of file MapsTrack.cc.
References c, and getGlobalHits().
Referenced by diagnose(), and operator<<().
double MapsTrack::pixelPitch | ( | ) | const [inline] |
Definition at line 67 of file MapsTrack.hh.
std::pair<double, double> MapsTrack::trackError | ( | ) | const [inline] |
Definition at line 72 of file MapsTrack.hh.
void MapsTrack::setPixelPitch | ( | const double & | pitch | ) |
Use this to set the size of the pixel to anything other than 0.05 mm.
Definition at line 27 of file MapsTrack.cc.
Referenced by make3HitTrack().
void MapsTrack::setTrackError | ( | const std::pair< double, double > & | error | ) |
Use this to set the sigma parameter used in the chi squared computations.
Definition at line 31 of file MapsTrack.cc.
Referenced by main(), and make3HitTrack().
MapsSensor * MapsTrack::fourthSensor | ( | ) | const |
Getter to tell you the fourth sensor for this track
Definition at line 89 of file MapsTrack.cc.
Referenced by operator<<().
unsigned MapsTrack::fourthSensorThresh | ( | ) | const [inline] |
Getter for the fourth sensor threshold.
Definition at line 95 of file MapsTrack.hh.
void MapsTrack::setFourthSensorThresh | ( | const unsigned & | threshold | ) |
Sets/overwrites the fourth sensor's threshold.
Definition at line 92 of file MapsTrack.cc.
Referenced by make3HitTrack().
MapsSensor * MapsTrack::missingSensor | ( | std::vector< MapsSensor * > | sensors | ) | const |
A track is defined by at least 3 hits; this returns the first sensor not found in the supplied list, and zero if all were found.
Definition at line 115 of file MapsTrack.cc.
std::pair< double, double > MapsTrack::simpleResidual | ( | MapsSensor * | s | ) | const throw (MapsException) |
Determines the residual i.t.o. the difference between the real hit in sensor s and the track defined by its left and right extrapolation points
Throws an exception if the track doesn't have a hit for the supplied sensor.
Definition at line 276 of file MapsTrack.cc.
References getGlobalHits(), leftExtrapPoint(), rightExtrapPoint(), and MapsSensor::zPosition().
Referenced by allResiduals(), and tellSensorsOfResiduals().
std::map< MapsSensor *, std::pair< double, double > > MapsTrack::allResiduals | ( | ) |
Convenience method for calling simpleResidual() for all sensors :-|
Definition at line 267 of file MapsTrack.cc.
References getGlobalHits(), and simpleResidual().
void MapsTrack::tellSensorsOfResiduals | ( | ) |
Sets each sensor's residuals based on this track.
Definition at line 96 of file MapsTrack.cc.
References getGlobalHits(), and simpleResidual().
Referenced by tellSensorsOfResiduals().
void MapsTrack::tellSensorsOfResiduals | ( | const MapsSensor *const | requiredLeft, | |
const MapsSensor *const | requiredRight | |||
) |
Sets sensor residuals conditionally: this allows you to define a fixed coordinate system. Usually the left most and right most sensors are set as the fixed references.
Definition at line 106 of file MapsTrack.cc.
References tellSensorsOfResiduals().
void MapsTrack::tellSensorsOfHits | ( | ) |
Sets each sensor's efficiency hits etc. based on this track.
Definition at line 112 of file MapsTrack.cc.
double MapsTrack::theta | ( | ) | const |
Define the theta to be the angle in radians relative to a straight (non-skew) line through the sensors. This uses the complete track fit.
Definition at line 129 of file MapsTrack.cc.
References fitParameters().
Referenced by diagnose().
double MapsTrack::chiSqProb | ( | const unsigned & | dimension | ) | const |
Uses the Root API to evaluate whether the observed chi2 for a "correct model" is more than the chi2 of the track
Definition at line 247 of file MapsTrack.cc.
References chiSq(), and getGlobalHits().
Referenced by diagnose(), MapsTrackManager::exportToRootFile(), and main().
void MapsTrack::setHits | ( | std::map< MapsSensor *, coord > | hits | ) |
Overwrites/sets this track's hits with those supplied.
Referenced by make3HitTrack().
std::ostream & MapsTrack::printCoords | ( | std::ostream & | s | ) | const |
Prints the hits sensor by sensor.
Definition at line 253 of file MapsTrack.cc.
References getGlobalHits().
Referenced by diagnose().
MapsSensor * MapsTrack::leftExtrapPoint | ( | MapsSensor * | ) | const |
Returns the sensor that should be used as the left sensor in a track extrapolation to the supplied sensor
Definition at line 309 of file MapsTrack.cc.
References MapsSensor::zPosition().
Referenced by simpleResidual().
MapsSensor * MapsTrack::rightExtrapPoint | ( | MapsSensor * | ) | const |
Returns the sensor that should be used as the right sensor in a track extrapolation to the supplied sensor
Definition at line 331 of file MapsTrack.cc.
References MapsSensor::zPosition().
Referenced by simpleResidual().
std::pair< double, double > MapsTrack::fitParameters | ( | const unsigned & | dimension | ) | const |
Determines the 'p' coefficients for this track, as defined by chi^2 = sum_i [x_i - (p_0 +z_i*p_1)]^2/sigma_i^2 where i is the layer index and the assumption sigma_i -> sigma is applied.
Dimension: = 0 for x = 1 for y
Definition at line 171 of file MapsTrack.cc.
References c, and getGlobalHits().
Referenced by chiSq(), diagnose(), findXYPrediction(), and theta().
double MapsTrack::chiSq | ( | const unsigned & | dimension | ) | const |
Evaluates the chi squared based on the full track fit.
Dimension: = 0 for x = 1 for y
Definition at line 222 of file MapsTrack.cc.
References c, fitParameters(), and getGlobalHits().
Referenced by chiSqProb(), diagnose(), and MapsTrackManager::recreateFromRootFile().
void MapsTrack::make3HitTrack | ( | MapsTrack & | mt | ) |
Makes a three hit track from tracks with four hits, ignoring the ''fourth sensor''. Makes a copy of this track if we only have 3 hits anyway.
Definition at line 353 of file MapsTrack.cc.
References myFourthSensor, myT, myToldSensorsHits, myToldSensorsResids, setFourthSensorThresh(), setHits(), setPixelPitch(), and setTrackError().
unsigned MapsTrack::getFourthHitResidual | ( | const MapsTrack & | threeHitTrack, | |
std::pair< double, double > & | answer | |||
) |
Evaluates the difference in pixel coordinates between the extrapolated three hit track and the fourth sensor's hit. You supply the answer :-) Returns something other than zero if there was no fourth hit for comparison.
Definition at line 371 of file MapsTrack.cc.
References findXYPrediction(), getGlobalHits(), and MapsSensor::zPosition().
std::pair< double, double > MapsTrack::findXYPrediction | ( | const double & | zpos | ) | const |
Uses the supplied track's fit to extrapolate to the supplied z position.
Definition at line 405 of file MapsTrack.cc.
References fitParameters().
Referenced by getFourthHitResidual().
const std::map< MapsSensor *, MapsTrack::physXY > & MapsTrack::getGlobalHits | ( | ) | const |
Definition at line 387 of file MapsTrack.cc.
Referenced by allResiduals(), chiSq(), chiSqProb(), fitParameters(), getFourthHitResidual(), meanX(), meanY(), printCoords(), sigmaX(), sigmaY(), simpleResidual(), and tellSensorsOfResiduals().
void MapsTrack::eraseGlobalHits | ( | ) |
Definition at line 400 of file MapsTrack.cc.
Definition at line 231 of file MapsTrack.hh.
std::ostream& operator<< | ( | std::ostream & | s, | |
const MapsTrack & | mt | |||
) | [friend] |
One line description of the track.
Definition at line 435 of file MapsTrack.cc.
std::ostream& diagnose | ( | std::ostream & | s, | |
const MapsTrack & | mt | |||
) | [friend] |
Prints a complete description of this track to the specfified output stream
Definition at line 415 of file MapsTrack.cc.