Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:19:08

0001 #ifndef FILLTRUTHRECOMATCHMAP_H
0002 #define FILLTRUTHRECOMATCHMAP_H
0003 
0004 /**
0005  * @file trackbase/TrkrMatchDefs.h
0006  * @author D. Stewart
0007  * @date February 2023
0008  * @brief A couple of functions to interpret keys in PHG4ParticleSvtxMap and SvtxPHG4ParticleMap maps keys
0009  *
0010  * More detail:
0011  *  The track matching is filled in EmbRecoMatchContainer objects. For sake of current code practice, these
0012  *  are interpreted into SvtxPHG4ParticleMap and PHG4ParticleSvtxMap objects. Both those objects are filled with maps
0013  *  like:
0014  *    map <track_id{reco,truth}::unsigned int, map< weight::float, track_id{truth,reco}::set<int>>
0015  *    i.e.   track id of reco or truth, mapped to a second map, which maps weighs to sets of integers on the reco
0016  *
0017  *    The weights for a match are given as follows:
0018  *    Before the decimal, the number of matched clusters;
0019  *    After the decimal, the number of possible clusters
0020  *
0021  *    -------------
0022  *    Start Example
0023  *    -------------
0024  *
0025  *    An entry in SvtxPHG4ParticleMap could be:
0026  *      12 -> 41.46 -> { 2, 4 }
0027  *         -> 18.46 -> { 7 }
0028  *    which is to say, reco track id 12 has matches to truth tracks 2, 4, and
0029  *    7. Matches 12->2 and 12->4 weighting key (41.46) indicate that there were
0030  *    41 matched clusters, that the reco track had 46 clusters. Match 12->7 key
0031  *    (18.46) indicates that there were 18 matched clusters (and, again, the reco track had 46 clusters)
0032  *
0033  *    Assuming that truth tracks 2, 4, and 7, were matched only to reco track 12, and
0034  *    each had 45, 44, and 47 clusters, respectively, then the corresponding entries
0035  *    in PHG4ParticleSvtxMap would be:
0036  *      2 -> 41.45 { 12 }
0037  *      4 -> 41.44 { 12 }
0038  *      7 -> 18.47 { 12 }
0039  *
0040  */
0041 
0042 #include <fun4all/SubsysReco.h>
0043 
0044 class EmbRecoMatchContainer;
0045 class PHCompositeNode;
0046 class PHG4ParticleSvtxMap;
0047 class SvtxPHG4ParticleMap;
0048 
0049 class FillTruthRecoMatchMap : public SubsysReco
0050 {
0051  public:
0052   FillTruthRecoMatchMap(const std::string &name = "FillTruthRecoMatchMap");
0053 
0054   virtual ~FillTruthRecoMatchMap() = default;
0055 
0056   int Init(PHCompositeNode *) override;
0057   int InitRun(PHCompositeNode *topNode) override;
0058   int process_event(PHCompositeNode * /*topNode*/) override;
0059   int End(PHCompositeNode *topNode) override;
0060 
0061  private:
0062   int createNodes(PHCompositeNode *topNode);
0063 
0064   EmbRecoMatchContainer *m_EmbRecoMatchContainer{nullptr};  // contianer used to fill the other track matches
0065   SvtxPHG4ParticleMap *m_SvtxPHG4ParticleMap{nullptr};      // reco to truth map, filled for output
0066   PHG4ParticleSvtxMap *m_PHG4ParticleSvtxMap{nullptr};      // truth to reco map, filled for output
0067 };
0068 
0069 #endif  // FILLTRUTHRECOMATCHMAP_H