|
|
|||
File indexing completed on 2025-12-16 09:21:44
0001 #ifndef G4EVAL_FILLTRUTHRECOMATCHTREE_H 0002 #define G4EVAL_FILLTRUTHRECOMATCHTREE_H 0003 0004 /** 0005 * @file trackbase/TrkrMatchDefs.h 0006 * @author D. Stewart 0007 * @date February 2023 0008 * @brief Write a TFile with a TTree with the matched tracks and (optionall) clusters 0009 * This module takes the matching done in TruthRecoTrackMatching in the 0010 * EmbRecoMatchContainer objects, and writes out the tracks kinematics to TTree 0011 * in a TFile. 0012 * The following data is always written out: 0013 * For each track type: 0014 * G4M : PHG4 matched 0015 * G4U : PHG4 unmatched 0016 * SvM : Svtx (reco) matched 0017 * SvU : SVtx (reco) unmatched 0018 * The following is stored: 0019 * trackid, nclus, nclus{mvtx,intt,tpc}, pt, phi, eta 0020 * For matched tracks (G4M and SvM): 0021 * nclus_matchrat, nclus{mvtx,intt,tpc}_matchrat 0022 * For matched tracks, the numbers of matched clusters (these are shared by G4M and SvM): 0023 * nclusM, nclusM_{mvtx,intt,tpc} 0024 * 0025 * If the option is passed to save clusteres (default is on), then the cluster 0026 * locations are saved too, as unmatched clusters (in all types of tracks), 0027 * and the mutually matched clusters (shared by the G4M and SvM tracks): 0028 * {G4U,G4M,SvU,SvM}_clusU_{i0,i1,x,y,z,r} 0029 * For matche clusters, these are simply: 0030 * clusM_{i0,i1,x,y,z,r,layer} 0031 * The vectors of x,y,z,r are stoped in each branch with each tracks' data sequentially 0032 * following the last. The branch i0 and i1 index where the one starts and the other stops. 0033 * for each track. 0034 * 0035 * Data for matched tracks positionally align with each other (i.e. 1st entry in each 0036 * correlate, then the 2nd, etc...) 0037 * 0038 * A track is only an unmatched track is it has no matches (the options in 0039 * TruthRecoTrackMatching can allow multiply matches for the same track...) 0040 * 0041 * options: 0042 * save cluster locations = true 0043 * save un-matched Svtx tracks = false 0044 */ 0045 0046 #include "g4evaltools.h" 0047 0048 #include <fun4all/SubsysReco.h> 0049 0050 #include <string> 0051 #include <vector> 0052 0053 class EmbRecoMatchContainer; 0054 class PHCompositeNode; 0055 class PHG4ParticleSvtxMap; 0056 class SvtxPHG4ParticleMap; 0057 class EmbRecoMatchContainer; 0058 class PHCompositeNode; 0059 class PHG4TpcGeom; 0060 class PHG4TpcGeomContainer; 0061 class PHG4TruthInfoContainer; 0062 class SvtxTrack; 0063 class SvtxTrackMap; 0064 class TrackSeedContainer; 0065 class TrkrCluster; 0066 /* class TrkrClusterContainer; */ 0067 class TrkrTruthTrack; 0068 class TrkrTruthTrackContainer; 0069 class TTree; 0070 class TH2; 0071 0072 class FillTruthRecoMatchTree : public SubsysReco 0073 { 0074 public: 0075 FillTruthRecoMatchTree( 0076 bool _fill_clusters = true, bool _fill_SvUnMatched = false, float _cluster_nzwidths = 0.5, float _cluster_nphiwidths = 0.5, const std::string &tfile_name = "trackclusmatch.root"); 0077 0078 ~FillTruthRecoMatchTree() override = default; 0079 0080 int Init(PHCompositeNode *) override; 0081 int InitRun(PHCompositeNode *topNode) override; 0082 int process_event(PHCompositeNode * /*topNode*/) override; 0083 int End(PHCompositeNode *topNode) override; 0084 0085 void clear_clusvecs(const std::string &tag = ""); 0086 0087 void print_mvtx_diagnostics(); 0088 0089 private: 0090 int createNodes(PHCompositeNode *topNode); 0091 0092 G4Eval::TrkrClusterComparer m_cluster_comp{1., 1.}; 0093 G4Eval::ClusCntr m_cluscntr; 0094 0095 // contianer used to fill the other track matches 0096 EmbRecoMatchContainer *m_EmbRecoMatchContainer{nullptr}; 0097 PHG4TruthInfoContainer *m_PHG4TruthInfoContainer{nullptr}; 0098 SvtxTrackMap *m_SvtxTrackMap{nullptr}; 0099 /* TrkrClusterContainer *m_TruthClusterContainer {nullptr}; */ 0100 /* TrkrClusterContainer *m_RecoClusterContainer {nullptr}; */ 0101 TrkrTruthTrackContainer *m_TrkrTruthTrackContainer{nullptr}; 0102 /* PHG4TpcGeomContainer *m_PHG4TpcGeomContainer {nullptr}; */ 0103 0104 TTree *m_ttree; 0105 bool m_fill_clusters; 0106 bool m_fill_SvU; // unmatched Svtx tracks 0107 std::string m_outfile_name; 0108 0109 // Tree Branch members: 0110 int nevent{-1}; 0111 int nphg4{0}; 0112 int nsvtx{0}; 0113 int ntrackmatches{0}; 0114 int nphg4_part{0}; 0115 float centrality{0.}; 0116 0117 // Tracks and clustes 0118 // 0119 // lables: 0120 // tracks: 0121 // g4 : phg4track matched 0122 // sv : svtx_track matched 0123 // gU : phg4track not-matched 0124 // sU : svtx_track not-matched 0125 // clusters: 0126 // M : matched 0127 // U : unmatched 0128 TH2 *h2_G4_nPixelsPhi; 0129 TH2 *h2_G4_nPixelsZ; 0130 TH2 *h2_Sv_nPixelsPhi; 0131 TH2 *h2_Sv_nPixelsZ; 0132 0133 // Track tree 0134 int b_trackid{}; 0135 bool b_is_g4track{}; 0136 bool b_is_Svtrack{}; 0137 bool b_is_matched{}; 0138 0139 float b_trkpt{}; 0140 float b_trkphi{}; 0141 float b_trketa{}; 0142 0143 int b_nclus{}; 0144 int b_nclustpc{}; 0145 int b_nclusmvtx{}; 0146 int b_nclusintt{}; 0147 0148 float b_matchrat{}; 0149 float b_matchrat_intt{}; 0150 float b_matchrat_mvtx{}; 0151 float b_matchrat_tpc{}; 0152 0153 std::vector<bool> b_clusmatch{}; 0154 std::vector<float> b_clus_x{}; 0155 std::vector<float> b_clus_y{}; 0156 std::vector<float> b_clus_z{}; 0157 std::vector<float> b_clus_r{}; 0158 std::vector<int> b_clus_layer{}; 0159 std::vector<int> b_clus_nphibins{}; 0160 std::vector<int> b_clus_ntbins{}; 0161 0162 /* std::vector<int> b_G4M_trackid {}; // g4-track-matched */ 0163 /* std::vector<int> b_G4M_nclus {}; */ 0164 /* std::vector<int> b_G4M_nclusmvtx {}; */ 0165 /* std::vector<int> b_G4M_nclusintt {}; */ 0166 /* std::vector<int> b_G4M_nclustpc {}; */ 0167 /* std::vector<float> b_G4M_nclus_matchrat {}; */ 0168 /* std::vector<float> b_G4M_nclusmvtx_matchrat {}; */ 0169 /* std::vector<float> b_G4M_nclusintt_matchrat {}; */ 0170 /* std::vector<float> b_G4M_nclustpc_matchrat {}; */ 0171 /* std::vector<float> b_G4M_pt {}; */ 0172 /* std::vector<float> b_G4M_phi {}; */ 0173 /* std::vector<float> b_G4M_eta {}; */ 0174 /* std::vector<int> b_SvM_trackid {}; // Svtx-track-matched */ 0175 /* std::vector<int> b_SvM_nclus {}; */ 0176 /* std::vector<int> b_SvM_nclusmvtx {}; */ 0177 /* std::vector<int> b_SvM_nclusintt {}; */ 0178 /* std::vector<int> b_SvM_nclustpc {}; */ 0179 /* std::vector<float> b_SvM_nclus_matchrat {}; */ 0180 /* std::vector<float> b_SvM_nclusmvtx_matchrat {}; */ 0181 /* std::vector<float> b_SvM_nclusintt_matchrat {}; */ 0182 /* std::vector<float> b_SvM_nclustpc_matchrat {}; */ 0183 /* std::vector<float> b_SvM_pt {}; */ 0184 /* std::vector<float> b_SvM_phi {}; */ 0185 /* std::vector<float> b_SvM_eta {}; */ 0186 /* std::vector<int> b_clusM_i0 {}; // if storing clusters -- matched clusters */ 0187 /* std::vector<int> b_clusM_i1 {}; */ 0188 /* std::vector<float> b_clusM_layer {}; */ 0189 /* std::vector<float> b_clusM_x {}; */ 0190 /* std::vector<float> b_clusM_y {}; */ 0191 /* std::vector<float> b_clusM_z {}; */ 0192 /* std::vector<float> b_clusM_r {}; */ 0193 /* std::vector<int> b_G4M_clusU_i0 {}; // matched phg4 unmatched clusters */ 0194 /* std::vector<int> b_G4M_clusU_i1 {}; */ 0195 /* std::vector<float> b_G4M_clusU_layer {}; */ 0196 /* std::vector<float> b_G4M_clusU_x {}; */ 0197 /* std::vector<float> b_G4M_clusU_y {}; */ 0198 /* std::vector<float> b_G4M_clusU_z {}; */ 0199 /* std::vector<float> b_G4M_clusU_r {}; */ 0200 /* std::vector<int> b_SvM_clusU_i0 {}; // matched phg4 unmatched clusters */ 0201 /* std::vector<int> b_SvM_clusU_i1 {}; */ 0202 /* std::vector<float> b_SvM_clusU_layer {}; */ 0203 /* std::vector<float> b_SvM_clusU_x {}; */ 0204 /* std::vector<float> b_SvM_clusU_y {}; */ 0205 /* std::vector<float> b_SvM_clusU_z {}; */ 0206 /* std::vector<float> b_SvM_clusU_r {}; */ 0207 /* std::vector<int> b_G4U_trackid {}; // unmatched tracks */ 0208 /* std::vector<int> b_G4U_nclus {}; */ 0209 /* std::vector<int> b_G4U_nclusmvtx {}; */ 0210 /* std::vector<int> b_G4U_nclusintt {}; */ 0211 /* std::vector<int> b_G4U_nclustpc {}; */ 0212 /* std::vector<float> b_G4U_pt {}; */ 0213 /* std::vector<float> b_G4U_phi {}; */ 0214 /* std::vector<float> b_G4U_eta {}; */ 0215 /* std::vector<int> b_SvU_trackid {}; // Svtx-track-matched */ 0216 /* std::vector<int> b_SvU_nclus {}; */ 0217 /* std::vector<int> b_SvU_nclusmvtx {}; */ 0218 /* std::vector<int> b_SvU_nclusintt {}; */ 0219 /* std::vector<int> b_SvU_nclustpc {}; */ 0220 /* std::vector<float> b_SvU_pt {}; */ 0221 /* std::vector<float> b_SvU_phi {}; */ 0222 /* std::vector<float> b_SvU_eta {}; */ 0223 /* std::vector<int> b_G4U_clusU_i0 {}; // unmatched phg4 unmatched clusters */ 0224 /* std::vector<int> b_G4U_clusU_i1 {}; */ 0225 /* std::vector<float> b_G4U_clusU_layer {}; */ 0226 /* std::vector<float> b_G4U_clusU_x {}; */ 0227 /* std::vector<float> b_G4U_clusU_y {}; */ 0228 /* std::vector<float> b_G4U_clusU_z {}; */ 0229 /* std::vector<float> b_G4U_clusU_r {}; */ 0230 /* std::vector<int> b_SvU_clusU_i0 {}; // unmatched phg4 unmatched clusters */ 0231 /* std::vector<int> b_SvU_clusU_i1 {}; */ 0232 /* std::vector<float> b_SvU_clusU_layer {}; */ 0233 /* std::vector<float> b_SvU_clusU_x {}; */ 0234 /* std::vector<float> b_SvU_clusU_y {}; */ 0235 /* std::vector<float> b_SvU_clusU_z {}; */ 0236 /* std::vector<float> b_SvU_clusU_r {}; */ 0237 }; 0238 0239 #endif // G4EVAL_FILLTRUTHRECOMATCHTREE_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|