Algorithm Development Pt. 2
Analyzing tracks
Let's look at some tracks. In our execute() function, we'll use the selectedTracks() function (a member function belonging to our mother class xTRT::Algorithm). We're using it to retrieve, you guessed it, some selected tracks. What this function does is create a new container of xAOD::TrackParticle objects, where all of the tracks in the container passed the Tracks. selection that you define in your config file. You can go to the Config section for more detailed info, but here I'll just mention some track specific options. The default config we're using have options of the form: (the numbers might not be the same, but you can change them!)
### Cuts for the selectedTracks() container
Tracks.p: 5 ## momentum requirement in GeV
Tracks.pT: 5 ## transverse momentum requirement in GeV
Tracks.eta: 2.0 ## absolute value eta max
Tracks.nSi: 6 ## number of silicon hits required (pixel + SCT)
Tracks.nPix: 1 ## number of pixel hits required
Tracks.nTRT: 12 ## total number of TRT hits required
Tracks.nTRTprec: 1 ## total number of TRT precision hits requiredAlright, so how would we get tracks that pass this selection? In just four lines, here's grabbing the selected tracks, looping over them, and grabbing the track occupancy (don't add this code yet, we'll add it in a sec.):
EL::StatusCode AnaProjectLooperAlg::execute() {
// ...
// ...
auto tracks = selectedTracks();
for ( const xAOD::TrackParticle* track : *tracks ) {
float trkOccupancy = xTRT::trackOccupancy(track);
}
// ...
// ...
}trackOccupancy(...) is a helper function that is part of the TRTFramework library. You can find technical details in the doxygen API documentation here. You can find a list of helper functions that take either xAOD::TrackParticle, xAOD::Electron, or xAOD::Muon objects specifically here.
Let's make a tree that stores a few track properties and fills for every track as well as also some histograms. Go back to the header and define a few new private member variables:
And in our source:
Now go recompile, run the code, and find your new histograms and new tree + branches!
Analyzing hits
To analyze using hits, we need to access them. While looping over a track, we can grab the track measurement container like so:
1. create some pointers for the measurement on surface (msos) and the drift circle (driftCircle)
2. Use a predefined auxiliary accessor (xTRT::Acc::msosLink, which is an SG::AuxElement::ConstAccessor for the link to the measurement on surface) to check if the container of measurements is there, then loop over them. To read more about aux data go to that section.
3. for each track measurement, set the msos and driftCircle variables after making sure that their links are valid (also make sure we only have TRT hits).
The code block below shows the process.
At that point, you have access to the xTRT::MSOS (a typedef to xAOD::MeasurementOnSurface) object (we're calling our variable msos) and the xTRT::DriftCircle (a typedef to xAOD::TrackMeasurementValidation) object (we're calling our variable driftCircle).*
You can use the xTRT::getHitSummary(...) function to fill a struct with hit properties (instead of manually grabbing the aux data). See all the properties in the xTRT::HitSummary struct here. To learn more details about aux data, go to this chapter.
* We define these typedef's because it's more intuitive to use MSOS and DriftCircle. The actual classes are used throughout the inner detector software, that's why they have a generic name.
Last updated