ATLAS Offline Software
Loading...
Searching...
No Matches
The TrkValTools package

General validation tools for common tracking.

Author
Andreas.Salzburger -at- cern.ch, Sebastian.Fleischmann -at- cern.ch, Wolfgang.Liebig -at- cern.ch

Introduction

This package contains tools to validate track reconstruction on a common Inner Detector - Muons code basis. It includes tools to fill validation ntuples e.g. with track data. The scheme for filling the ntuple is based on track-wise entries. Every instance of the steering tool (Trk::BasicValidationNtupleTool) can fill an ntuple tree of its own (also in the same ntuple file). This allows to produce one tree e.g. with track data from pattern recognition or simplified simulation and one tree with refitted tracks to compare them with ROOT afterwards.

The ntuples created with the tools of this package can also be used by the stand-alone ROOT applications distributed with this package, namely the <nop>TrackPlotter and <nop>ResidualPulls. The <nop>TrackPlotter allows to plot the track and measurement positions in the InnerDetector to check the performance of track fitters "by hand". <nop>ResidualPulls analyses local position residuals and pulls at each measurement surface, providing a general tool to validate the measurement error calibration and material effect corrections.

Validation ntuple scheme

The main steering of the ntuple entries is performed by the Trk::BasicValidationNtupleTool, which can book the ntuple, create the tree directory and add basic entries. This tool is also able to write the current record to the ntuple file and start a new entry. One can also use an existing ntuple tree (which has to have the same track-wise structure) and just use the Trk::BasicValidationNtupleTool to add some ntuple variables.

Every entry (track) contains the event number, a track id (numbering the tracks within one event) and an optional iteration index, which can be used if different intermediate results of a track are produced in the refit procedure (see Trk::DeterministicAnnealingFilter for an example). The track id is the same for all tracks generated within one iteration process and reset to 0 every time a new event is started. Perigee parameters and \( \chi^2 \) are filled for every track if available.

For fitter validation especially information about the measurements on the track and the related track states are needed. Therefore the total number of measurements on the track and the number of measurements within a certain sub-detector type are stored. The tool writes array variables with columns for every measurement into the ntuple.

One can give a list of Trk::IValidationNtupleHelperTool for each detector type by joboptions which are called by the Trk::BasicValidationNtupleTool if a measurement of the related detector is found on the track. Those Trk::IValidationNtupleHelperTool can add items to the ntuple and fill special data needed for validation. The Trk::IValidationNtupleHelperTool may also reside in a detector-specific namespace (e.g. InDetFitterValidation) to be able to add information which need a dynamic cast of the Trk::MeasurementBase to the implementations.

Each detector-specific helper tool list may contain several tools and some tools may even be contained in more than one list, if they fill data for different detector types. There exists also a general list, which tools are called for every type of measurement.

Class Overview

The TrkValTools package contains the following classes:

How to use the tools

The most convenient way to use the validation ntuple tools is to run the Trk::TrackValidationNtupleWriter algorithm from the TrkValAlgs package, which retrieves a track collection from StoreGate and loops over all contained tracks. It needs a configured instance of the Trk::BasicValidationNtupleTool.

You can also run the Trk::BasicValidationNtupleTool directly by calling it from your own algorithm or tool to write data of complete tracks or add data of measurements successively. An example for this use case is the Trk::DeterministicAnnealingFilter.

For all purposes the python Configurables should be used, since the validation ntuple is aimed at a broad variety of applications and would easily not allow meaningful default configuration.

jobOptions of the Trk::BasicValidationNtupleTool

BookNewNtuple

shall a new ntuple directory be created? If set to False no event data (event no. etc.) will be written and the calling Alg takes care of the Tree. Default: False

NtupleFileName

filename handler of the ntuple, only applicable if BookNewNtupl is True. Default: /NTUPLES/FILE1

NtupleDirectoryName

directory to be created or used in the ntuple file, only applicable if BookNewNtupl is Tru\ e. Default: FitterValidation

NtupleTreeName

ntuple tree, only applicable if BookNewNtupl is Tru\ e. Default: Validation

UseROTwithMaxAssgnProb

in the case of Trk::CompetingRIOsOnTrack: shall the included RIO_OnTrack with the maximum assignment probability be used for calculations? Default: True

IgnoreMissingTrackCovarianceForPulls

shall the pull be calculated when no covariance matrix for the track state is available? Default: False

UpdatorTool

tool and instance name of the IUpdator tool to be used to get unbiased track states. If no tool is given (none) the normal track states will be used (and residuals and pulls might be too small). Default: Trk::KalmanUpdator/TrkKalmanUpdator

ExtrapolatorTool

tool and instance name of the IExtrapolator, aimed at getting Perigee parameters for tracks which do not have it. Default: Trk::Extrapolator/InDetExtrapolator

HoleSearchTool

tool and instance name of the ITrackHoleSearchTool for analysis of track holes and assignment efficiencies. Default: InDet::InDetTrackHoleSearchTool/InDetHoleSearchTool

DoHoleSearch

flag toggling the search for holes and filling of associated variables. Default: true

PixelNtupleHelperTools

list of Trk::IValidationNtupleHelperTool to be called if measurement is identified to be in the Pixels. Default: empty

SCTNtupleHelperTools

list of Trk::IValidationNtupleHelperTool to be called if measurement is identified to be in the SCT. Default: empty

TRTNtupleHelperTools

list of Trk::IValidationNtupleHelperTool to be called if measurement is identified to be in the TRT. Default: empty

MDTNtupleHelperTools

list of Trk::IValidationNtupleHelperTool to be called if measurement is identified to be in the MDT. Default: empty

CSCNtupleHelperTools

list of Trk::IValidationNtupleHelperTool to be called if measurement is identified to be in the CSC. Default: empty

RPCNtupleHelperTools

list of Trk::IValidationNtupleHelperTool to be called if measurement is identified to be in the RPC. Default: empty

TGCNtupleHelperTools

list of Trk::IValidationNtupleHelperTool to be called if measurement is identified to be in the TGC. Default: empty

GeneralNtupleHelperTools

list of Trk::IValidationNtupleHelperTool to be called for every measurement independent from detector technology. Default: empty

DoTruth
flag to toggle truth access, allowing validation of tracks on real data with the same ntuple framework. Default: true

jobOptions of the Trk::ResidualValidationNtupleHelper


IgnoreMissingTrackCovariance shall the pull be calculated when no covariance matrix for the track state is available? Default: False

jobOptions of the Trk::DAF_ValidationNtupleHelper


IgnoreMissingTrackCovarianceForPulls shall the pull be calculated when no covariance matrix for the track state is available? Default: False

jobOptions of Trk::TrackDiff

NtupleFileName

filename handler of the ntuple. Default: /NTUPLES

NtupleDirectoryName

directory to be created or used in the ntuple file. Default: TrackValidation

NtupleTreeName

ntuple tree. Default: TrackDiff

CompareOutliers

Shall Trk::TrackStateOnSurface of type Outlier be used in the comparison? Default: True

CompareAllTSoS

Shall Trk::TrackStateOnSurface of all types be used in the comparison? Default: False
If CompareOutliers and CompareAllTSoS are both set to False only Trk::TrackStateOnSurface which are marked as Measurement are used.

WriteNtuple

Shall data be written into a ntuple? Default: True

WriteCompetingROTdata
Shall data about Trk::TrkCompetingRIOsOnTrack be written? Default: False

List of the Ntuple variables

This paragraph gives a short overview of the ntuple variables provided by the different tools

Ntuple variables of the Trk::BasicValidationNtupleTool

RunNumberrun number the track belongs tolong
EventNumberevent number the track belongs tolong
TrackIDnumber of the track within the current eventlong
IterationIndexiteration index of the tracklong
nHitsnumber of measurements on the track (including outliers)long
RecD0\( d_0 \) of the Perigeefloat
RecZ0\( z_0 \) of the Perigeefloat
RecPhi0\( \varphi_0 \) of the Perigeefloat
RecTheta\( \theta_0 \) of the Perigeefloat
RecEta\( \eta \) of the Perigeefloat
RecQoverP\( \frac{q}{p} \) of the Perigeefloat
RecErrD0\( \sigma_{d_0} \) of the Perigeefloat
RecErrZ0\( \sigma_{z_0} \) of the Perigeefloat
RecErrPhi0\( \sigma_{\varphi_0} \) of the Perigeefloat
RecErrTheta\( \sigma_{\theta_0} \) of the Perigeefloat
RecErrQoverP\( \sigma_{\frac{q}{p}} \) of the Perigeefloat
Chi2overNdof\( \frac{chi^2}{n_{DoF}} \)float
Ndof\( n_{DoF} \)float
pullLocX[nHits]pull in Trk::locX (pay attention: this might be wrong for some detector types),
value is set to -1000. for outliers as they usually contain no track parameters
Array<float>
pullLocY[nHits]pull in Trk::locY (pay attention: this might be wrong for some detector types),
value is set to -1000. if no second local coordinate exists for the measurement
Array<float>
residualLocX[nHits]residual in Trk::locX (pay attention: this might be wrong for some detector types),
value is set to -1000. for outliers
Array<float>
residualLocY[nHits]residual in Trk::locX (pay attention: this might be wrong for some detector types),
value is set to -1000. if no second local coordinate exists for the measurement and for outliers
Array<float>
DetectorType[nHits]enum of the detector typeArray<long>
outlierFlag[nHits]flag is set to 1, if the measurement was marked as an outlierArray<long>
nPixelHitsnumber of measurements in the Pixelslong
nSCTHitsnumber of measurements in the SCT (without outliers)long
nTRTHitsnumber of measurements in the TRT (without outliers)long
nMDTHitsnumber of measurements in the MDT (without outliers)long
nCSCHitsnumber of measurements in the SCS (without outliers)long
nRPCHitsnumber of measurements in the RPC (without outliers)long
nTGCHitsnumber of measurements in the TGC (without outliers)long

Ntuple variables of the Trk::ResidualValidationNtupleHelper

PixPullPhi[nPixelHits]pull in \( \varphi \) for Pixel measurementsArray<float>
PixPullEta[nPixelHits]pull in \( \eta \) for Pixel measurementsArray<float>
PixResPhi[nPixelHits]residual in \( \varphi \) for Pixel measurementsArray<float>
PixResEta[nPixelHits]residual in \( \eta \) for Pixel measurementsArray<float>
SCTPull[nSCTHits]pull for SCT measurements (perpendicular to strip direction, therefore just one-dimensional)Array<float>
SCTRes[nSCTHits]residual for SCT measurements (perpendicular to strip direction)Array<float>
TRTPull[nTRTHits]pull for TRT measurementsArray<float>
TRTRes[nTRTHits]residual for TRT measurementsArray<float>

These variables contain only measurements which are not marked as outliers.

Ntuple variables of the Trk::HitPositionNtupleHelper

HitX[nHits]x coordinate of GlobalPosition of the measurementArray<float>
HitY[nHits]y coordinate of GlobalPosition of the measurementArray<float>
HitZ[nHits]z coordinate of GlobalPosition of the measurementArray<float>
HitRadius[nHits]perp() of GlobalPosition of the measurementArray<float>
HitPhi[nHits]phi() of GlobalPosition of the measurementArray<float>
HitLocal1[nHits]Trk::locX of the local position of the measurementArray<float>
HitLocal2[nHits]Trk::locY of the local position of the measurement,
value is set to -1000. if no second local coordinate exists for the measurement
Array<float>
HitSurfaceX[nHits]x coordinate (GlobalPosition) of the center of the measurement surfaceArray<float>
HitSurfaceY[nHits]y coordinate (GlobalPosition) of the center of the measurement surfaceArray<float>
HitSurfaceZ[nHits]z coordinate (GlobalPosition) of the center of the measurement surfaceArray<float>
HitSurfaceRadius[nHits]perp() of the center of the measurement surfaceArray<float>
HitSurfacePhi[nHits]phi() of the center of the measurement surfaceArray<float>
HitSurfaceTheta[nHits]theta() of the center of the measurement surfaceArray<float>

Ntuple variables of the Trk::DAF_ValidationNtupleHelper

CompROTnContainedROTs[nHits]number of contained ROTs in the Trk::CompetingRIOsOnTrackArray<long>
CompROTindexOfMaxAssgnProb[nHits]index of the ROT with maximum assignment probability in the Trk::CompetingRIOsOnTrackArray<long>
CompROTmaxAssgnProb[nHits]maximum assignment probability in the Trk::CompetingRIOsOnTrackArray<float>
CompROTcontainedROTsAssgnProbs[nHits][maxContainedROTs]assignment probabilities of the contained ROTs in the Trk::CompetingRIOsOnTrackMatrix<long>
CompROTcontainedROTsResLocX[nHits][maxContainedROTs]residuals in Trk::locX of the contained ROTs in the Trk::CompetingRIOsOnTrackMatrix<long>
CompROTcontainedROTsResLocY[nHits][maxContainedROTs]residuals in Trk::locY of the contained ROTs in the Trk::CompetingRIOsOnTrack,
value is set to -1000. if no second local coordinate exists for the measurement
Matrix<long>
CompROTcontainedROTsPullLocX[nHits][maxContainedROTs]pulls in Trk::locX of the contained ROTs in the Trk::CompetingRIOsOnTrackMatrix<long>
CompROTcontainedROTsPullLocY[nHits][maxContainedROTs]pulls in Trk::locY of the contained ROTs in the Trk::CompetingRIOsOnTrack,
value is set to -1000. if no second local coordinate exists for the measurement
Matrix<long>

All entries are zero for an index, if the measurement was not a Trk::CompetingRIOsOnTrack.

Ntuple variables of Trk::TrackDiff

EventNumberNumber of the event the tracks belong toint
RefTrackPhi0Phi0 of the reference trackfloat
RefTrackEta0Eta0 of the reference trackfloat
nRefStatesnumber of reference TSoS for each detector typeint[detTypes]
nCompareStatesnumber of TSoS of the compared track (for each detector type)int[detTypes]
nFakeStatesnumber of TSoS of the compared track which are not included in the reference track (does not include wrong types), (for each detector type)int[detTypes]
nMissedStatesnumber of TSoS of the reference track which are not included in the compared track (does not include wrong types, (for each detector type))int[detTypes]
nWrongTypenumber of TSoS which have different types in the reference and the compared track (for each detector type)int[detTypes]
nPRD_Mismatchesnumber of TSoS on the same detector surface which have different Trk::PrepRawData pointers (for each detector type)int[detTypes]
nDriftCircleSignFlipsnumber of Trk::RIO_OnTrack in the TRT which have flipped drift radii signsint
nRefTypesnumber of reference TSoS for each TSoS typeint[tsosTypes]
nCompareTypesnumber of compared TSoS for each TSoS typeint[tsosTypes]
nMissedTypesnumber of TSoS which are not on the compared track (for each TSoS type)int[tsosTypes]
nFakeTypesnumber of TSoS which are not on the reference track (for each TSoS type)int[tsosTypes]
nDiffsnumber of differences foundint
DetectorTypedetector type in which the difference was foundvector <int>[nDiffs]
IsFakeis the difference a fake state?vector<int> [nDiffs]
IsMissingis the difference a missing state?vector<int> [nDiffs]
IsPRD_Mismatchis the diff as PRD mismatch?vector<int> [nDiffs]
IsFlippedSignhas the diff flipped sign?vector<int> [nDiffs]
IsNoDriftTimehas the diff !NoDriftTime?vector<int> [nDiffs]
RefIsMeasurementis reference state a measurement?vector<int> [nDiffs]
RefIsOutlieris reference state an outlier?vector<int> [nDiffs]
ComparedIsMeasurementis compared state a measurement?vector<int> [nDiffs]
ComparedIsOutlieris compared state an outlier?vector<int> [nDiffs]
MaxAssgnProbjust if WriteCompetingROTdata=True: maximum assignment probability of the compared statevector<float> [nDiffs]
SumAssgnProbjust if WriteCompetingROTdata=True: sum of assignment probabilities of the compared statevector<float> [nDiffs]

All numbers contain just the Trk::TrackStateOnSurface which have the types selected in the jobOptions, i.e. in the standard configuration only Measurements and Outliers.

TrackPlotter

Stand-alone ROOT application to plot tracks. The code can be found in the subdirectory root/TrackPlotter of this package; it has to be compiled separately (see below). This application runs on the ValidationNtuple written by the Trk::BasicValidationNtupleTool (from Tracking/TrkValidation/TrkValTools) resp. Trk::TrackValidationNtupleWriter (from Tracking/TrkValidation/TrkValAlgs).

compile this tool by: cd root/TrackPlotter
make trackplotter

to run: ./trackplotter or ./trackplotter TrkValidation.root

This tool needs a correctly set up ROOT installation. If you get the message "cannot run in batch mode", please make sure you have a valid X11 connection.

As ROOT versions and installations may differ on some machines, you may need to recompile the TrackPlotter application, when getting segfaults on a certain machine. You should delete the files trackplotterDict.* (which are recreated by the compiler) and call make clean first.

The TrackPlotter has a config file (trackplotter.conf) which allows to set the ntuple directories and trees. Depending on your runtime setup you may have to change the config file. In the config file you can also activate the plotting of PrepRawData, but in this case you also have to run the related algorithms from the package InDetTrackValidation to fill the RIO data into the ntuple.

Extra Pages