File indexing completed on 2025-08-03 08:18:26
0001 #ifndef G4EVAL_CALORAWTOWEREVAL_H
0002 #define G4EVAL_CALORAWTOWEREVAL_H
0003
0004 #include "CaloTruthEval.h"
0005
0006 #include <map>
0007 #include <set>
0008 #include <string>
0009 #include <utility>
0010
0011 class PHCompositeNode;
0012
0013 class PHG4CellContainer;
0014 class PHG4Hit;
0015 class PHG4HitContainer;
0016 class PHG4Particle;
0017 class PHG4Shower;
0018 class PHG4TruthInfoContainer;
0019
0020 class RawTower;
0021 class RawTowerContainer;
0022
0023 class TowerInfo;
0024 class TowerInfoContainer;
0025
0026 class CaloRawTowerEval
0027 {
0028 public:
0029
0030 CaloRawTowerEval(PHCompositeNode* topNode, const std::string& caloname);
0031 virtual ~CaloRawTowerEval();
0032
0033
0034 int get_caloid() { return get_truth_eval()->get_caloid(); }
0035
0036
0037 void next_event(PHCompositeNode* topNode);
0038
0039
0040 void do_caching(bool do_cache)
0041 {
0042 _do_cache = do_cache;
0043 _trutheval.do_caching(do_cache);
0044 }
0045
0046
0047
0048 void set_strict(bool strict)
0049 {
0050 _strict = strict;
0051 _trutheval.set_strict(strict);
0052 }
0053
0054
0055 unsigned int get_errors() { return _errors + _trutheval.get_errors(); }
0056
0057
0058 void set_verbosity(int verbosity)
0059 {
0060 _verbosity = verbosity;
0061 _trutheval.set_verbosity(verbosity);
0062 }
0063
0064
0065 CaloTruthEval* get_truth_eval() { return &_trutheval; }
0066
0067
0068
0069
0070 bool has_reduced_node_pointers();
0071
0072
0073
0074
0075 std::set<PHG4Shower*> all_truth_primary_showers(RawTower* tower);
0076 std::set<PHG4Shower*> all_truth_primary_showers(TowerInfo* tower);
0077
0078
0079
0080 PHG4Shower* max_truth_primary_shower_by_energy(RawTower* tower);
0081 PHG4Shower* max_truth_primary_shower_by_energy(TowerInfo* tower);
0082
0083
0084 std::set<RawTower*> all_towers_from(PHG4Shower* primary);
0085 std::set<TowerInfo*> all_towerinfos_from(PHG4Shower* primary);
0086
0087
0088 RawTower* best_tower_from(PHG4Shower* primary);
0089 TowerInfo* best_towerinfo_from(PHG4Shower* primary);
0090
0091
0092 float get_energy_contribution(RawTower* tower, PHG4Shower* primary);
0093 float get_energy_contribution(TowerInfo* tower, PHG4Shower* primary);
0094
0095
0096
0097
0098 std::set<PHG4Particle*> all_truth_primary_particles(RawTower* tower);
0099 std::set<PHG4Particle*> all_truth_primary_particles(TowerInfo* tower);
0100
0101
0102 PHG4Particle* max_truth_primary_particle_by_energy(RawTower* tower);
0103 PHG4Particle* max_truth_primary_particle_by_energy(TowerInfo* tower);
0104
0105
0106 std::set<RawTower*> all_towers_from(PHG4Particle* primary);
0107 std::set<TowerInfo*> all_towerinfos_from(PHG4Particle* primary);
0108
0109
0110 RawTower* best_tower_from(PHG4Particle* primary);
0111 TowerInfo* best_towerinfo_from(PHG4Particle* primary);
0112
0113
0114 float get_energy_contribution(RawTower* tower, PHG4Particle* primary);
0115 float get_energy_contribution(TowerInfo* tower, PHG4Particle* primary);
0116
0117
0118
0119
0120 bool has_full_node_pointers();
0121
0122
0123 std::set<PHG4Hit*> all_truth_hits(RawTower* tower);
0124 std::set<PHG4Hit*> all_truth_hits(TowerInfo* tower);
0125
0126 private:
0127 void get_node_pointers(PHCompositeNode* topNode);
0128
0129 std::string _caloname;
0130 CaloTruthEval _trutheval;
0131 RawTowerContainer* _towers = nullptr;
0132 TowerInfoContainer* _towerinfos = nullptr;
0133 PHG4CellContainer* _g4cells = nullptr;
0134 PHG4HitContainer* _g4hits = nullptr;
0135 PHG4TruthInfoContainer* _truthinfo = nullptr;
0136
0137 bool _strict = false;
0138 int _verbosity = 1;
0139 unsigned int _errors = 0;
0140
0141 bool _do_cache = true;
0142
0143 std::map<RawTower*, std::set<PHG4Shower*> > _cache_all_truth_primary_showers;
0144 std::map<RawTower*, PHG4Shower*> _cache_max_truth_primary_shower_by_energy;
0145 std::map<PHG4Shower*, std::set<RawTower*> > _cache_all_towers_from_primary_shower;
0146 std::map<PHG4Shower*, RawTower*> _cache_best_tower_from_primary_shower;
0147 std::map<std::pair<RawTower*, PHG4Shower*>, float> _cache_get_energy_contribution_primary_shower;
0148
0149 std::map<RawTower*, std::set<PHG4Particle*> > _cache_all_truth_primary_particles;
0150 std::map<RawTower*, PHG4Particle*> _cache_max_truth_primary_particle_by_energy;
0151 std::map<PHG4Particle*, std::set<RawTower*> > _cache_all_towers_from_primary_particle;
0152 std::map<PHG4Particle*, RawTower*> _cache_best_tower_from_primary_particle;
0153 std::map<std::pair<RawTower*, PHG4Particle*>, float> _cache_get_energy_contribution_primary_particle;
0154
0155 std::map<RawTower*, std::set<PHG4Hit*> > _cache_all_truth_hits;
0156
0157
0158
0159 std::map<TowerInfo*, std::set<PHG4Shower*> > _cache_towerinfo_all_truth_primary_showers;
0160 std::map<TowerInfo*, PHG4Shower*> _cache_towerinfo_max_truth_primary_shower_by_energy;
0161 std::map<PHG4Shower*, std::set<TowerInfo*> > _cache_towerinfo_all_towers_from_primary_shower;
0162 std::map<PHG4Shower*, TowerInfo*> _cache_towerinfo_best_tower_from_primary_shower;
0163 std::map<std::pair<TowerInfo*, PHG4Shower*>, float> _cache_towerinfo_get_energy_contribution_primary_shower;
0164
0165 std::map<TowerInfo*, std::set<PHG4Particle*> > _cache_towerinfo_all_truth_primary_particles;
0166 std::map<TowerInfo*, PHG4Particle*> _cache_towerinfo_max_truth_primary_particle_by_energy;
0167 std::map<PHG4Particle*, std::set<TowerInfo*> > _cache_towerinfo_all_towers_from_primary_particle;
0168 std::map<PHG4Particle*, TowerInfo*> _cache_towerinfo_best_tower_from_primary_particle;
0169 std::map<std::pair<TowerInfo*, PHG4Particle*>, float> _cache_towerinfo_get_energy_contribution_primary_particle;
0170
0171 std::map<TowerInfo*, std::set<PHG4Hit*> > _cache_towerinfo_all_truth_hits;
0172 };
0173
0174 #endif