This page contains some brief documentation for the level 2 inner detector tracking truth association classes and algorithms. Please see a presentation attached to this page for a description of the code and relevant classes.

TrigInDetTrackTruth and TrigInDetTrackTruthMap are the classes which store the association between level 2 tracks (TrigInDetTrack) and generated particles (HepMC::GenParticle).

The TrigInDetTrackTruth and TrigInDetTrackTruthMap objects are created by the TrigInDetTrackTruthMaker.

History, bugs, notes:

These packages evolved from code written by John Baines to fill the combined ntuple (CBNT) with level 2 tracking truth information.

The current implementation was available for release 12.0.1, although without the mother-daughter chains (see below). In release 12.0.3 the mother-daughter relations are found and stored.

A different solution is currently (October 2006) being sought so that the same interfaces and classes can be used for level 2, event filter and offline. This is expected for release 13.

No known bugs at present. If you find some, please let me know by sending an email to: (remember to remove the letters NOSPAMAN).

What these classes do:

TrigInDetTrackTruth (one per track with truth association): stores list of all particles which may have created the track, and the number of common hits between each particle and the track.

TrigInDetTrackTruthMap (one per event): works as a “map” to retrieve the TrigInDetTrackTruth objects which correspond to a given track.

TrigInDetTrackTruthMaker finds which truth particles may have contributed to a level 2 track. To do this it:

  • Starts from the ID TrigSpacePoint and InDet::TRT_DriftCircle stored with each TrigInDetTrack;
  • For silicon detectors, navigates to each InDet::SiCluster forming a TrigSiSpacePoint;
  • Gets vector of RDO Identifier for each space point and drift circle. Uses map between Identifier and InDetSimData to find all Deposits left by generated particles (GenParticle);
  • Retrieve list of generated particles (actually HepMcParticleLink, which points to GenParticle) which ontributed to clusters and drift circles. A truth particle is considered a match if at least one of its deposits contributed to a cluster. Should be made configurable in the future (match if >= N hits in common with track…)
  • Does one last step to try to find each particle’s mother.

The gory details:

What is stored in TrigInDetTrackTruth are actually persistent pointers to TrigInDetTrack and HepMC::GenParticle. Hence a TrigInDetTrackTruth contains a vector of HepMcParticleLink, which are persistifiable links to all the HepMC::GenParticles associated to one TrigInDetTrack. A TrigInDetTrackTruthMap acts as a map<TrigInDetTrack, TrigInDetTrackTruth>, except that it stores ElementLinks to TrigInDetTracks instead of simple pointers.

In addition to a vector of HepMcParticleLinks, the TrigInDetTrack stores a vector of TrigIDHitStats. This is a small class designed to store the number of hits in each sub-detector which are common between the TrigInDetTrack and each HepMC::GenParticle

TrigInDetTrackTruth: one per track with truth association

  • Has vector of HepMcParticleLink to point to matching GenParticles
  • Has a vector< pair > to code up any mother-daughter relationships
  • Started with a map<> but this was producing persistency problems
  • Has vector of TrigIDHitStats: to store number of common hits between a track and a GenParticle for each detector

TrigInDetTrackTruthMap: a “map” between each TrigInDetTrack and a TrigInDetTrackTruth object

  • Currently implemented as 2 std::vectors to avoid persistency problems
  • Should be turned into a GaudiUtils::VectorMap for I/O efficiency: O(log N) instead of current O(N)

The TrigInDetTrackTruth/Map code may be browsed in CVSview.

Tre TrigInDetTrackTruth and TrigInDetTrackTruthMap objects are created by the TrigInDetTrackTruthMaker. This Algorithm can be browsed in: CVSview


Example code:

Attached to this page you can find a class (TrigInDetTrackTruthChecker) which was used in the development of TrigInDetTrackTruthMaker. This can be useful as an example code of how the truth association classes may be used. Here are also code snippets with some comments:

The following code retrieves the TrigInDetTrackTruthMap for each event:

 const TrigInDetTrackTruthMap* trk_truth_map;

  log << MSG::INFO << "Retrieving truth map to StoreGate with key " 
      << m_trackTruthMapKey << endreq;

  if (m_storeGate->contains<TrigInDetTrackTruthMap>( "TrigInDetTruthMap" )) {
    log << MSG::INFO << "That TrigInDetTrackTruthMap exists" << endreq;

    sc = m_storeGate->retrieve(trk_truth_map, "TrigInDetTruthMap");
    if (sc.isFailure()) {
      log << MSG::ERROR << "Failed retrieving truth map from StoreGate!" << endreq;
      return StatusCode::FAILURE;

The TrigInDetTrackTruthMap can be simply printed, for debugging, using the print() method. This is of course not thread-safe, etc. But it doesn't really need to be. Use:

    // print truth association map

...and this is what you get:

TrigInDetTruthMap: 2 track-truth associations
#track|algo|       pT     |    eta   |    phi   |#match|mother|Sihits|TRThits|ev.index| barcode |  pdg id  |      pT      | eta    |    phi   |
     0|   2|45542.79022777|1.97542104|2.17365918|     0|  --  |     7|      9|       0|      130|       -11|110119.04147843|1.97555929|2.17321036|
      |    |              |          |          |     1|  --  |     0|      2|       0|   201970|       -11|  19.987994372|1.989150909|2.163899144|
      |    |              |          |          |     2|  --  |     0|      3|       0|   201971|        11| 610.500705090|1.975086846|2.169815590|
     1|   1|46536.08762352|1.97540410|2.17356864|     0|  --  |     7|      9|       0|      130|       -11|110119.04147843|1.97555929|2.17321036|
      |    |              |          |          |     1|  --  |     0|      2|       0|   201970|       -11|  19.987994372|1.989150909|2.163899144|
      |    |              |          |          |     2|  --  |     0|      3|       0|   201971|        11| 610.500705090|1.975086846|2.169815590|

The following code searches for the truth association object corresponding to a given track (trkIter is a TrigInDetTrack iterator). If it finds an association object, it prints out the number of truth particles that may correspond to the track and, for each one of them, prints out the number of hits in common between the track and the truth particle, and the particle barcode.

   // check track has truth association
   if ( trk_truth_map->hasTruth(*trkIter) ) {
     const TrigInDetTrackTruth* p_truth = trk_truth_map->truth(*trkIter);

     log << MSG::DEBUG << "TrigInDetTrack " << iTrk << " has " 
         << p_truth->nrMatches() << " matching true particles" << endreq;

     for (unsigned int iMatch = 0;  iMatch<p_truth->nrMatches(); ++iMatch) {

       log << MSG::DEBUG << "Truth match " << iMatch << " has " 
      << p_truth->nrCommonHits(iMatch) << " common hits" <<  endreq;

       const HepMcParticleLink* p_match = p_truth->truthMatch(iMatch);

       log << MSG::DEBUG << "* barcode=" << p_match << endreq;
   } else {
     log << MSG::DEBUG << "TrigInDetTrack " << iTrk << " doesn't have truth association" << endreq;

Please let me know if some of this code gives problems or doesn't work. Feel free to ask me more (so that I'm forced to write it down!) smile

-- RicardoGoncalo - 28 Sep 2006 -- RicardoGoncalo - 11 Oct 2006 -- RicardoGoncalo - 13 Oct 2006

Topic attachments
I Attachment History Action Size Date Who Comment
PDFpdf L2IDtruth.pdf r1 manage 37.8 K 2006-10-11 - 15:45 RicardoGoncalo Presentation: PESA Algorithms @ SW Week, 12 Sep.06
Unknown file formatcxx TrigInDetTrackTruthChecker.cxx r1 manage 4.6 K 2006-10-11 - 17:39 RicardoGoncalo Implementation file for TrigInDetTrackTruthChecker
Header fileh TrigInDetTrackTruthChecker.h r1 manage 1.6 K 2006-10-11 - 17:39 RicardoGoncalo Header file for TrigInDetTrackTruthChecker
Texttxt r1 manage 0.4 K 2006-10-11 - 17:41 RicardoGoncalo Job options for TrigInetTrackTruthChecker (note Wiki adds ".txt" to end of .py files)
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2006-10-13 - RicardoGoncalo
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback