File indexing completed on 2025-12-17 09:21:45
0001 #ifndef G4EVAL_CALORAWCLUSTEREVAL_H
0002 #define G4EVAL_CALORAWCLUSTEREVAL_H
0003
0004 #include "CaloRawTowerEval.h"
0005 #include "CaloTruthEval.h"
0006
0007 #include <map>
0008 #include <set>
0009 #include <string>
0010 #include <utility>
0011
0012 #include <calobase/RawTowerDefs.h>
0013
0014 class PHCompositeNode;
0015 class PHG4Hit;
0016 class PHG4Particle;
0017 class PHG4Shower;
0018 class RawClusterContainer;
0019 class RawCluster;
0020 class RawTowerContainer;
0021 class TowerInfoContainer;
0022
0023 class CaloRawClusterEval
0024 {
0025 public:
0026
0027 CaloRawClusterEval(PHCompositeNode* topNode, const std::string& caloname);
0028 virtual ~CaloRawClusterEval();
0029
0030
0031 int get_caloid() { return get_truth_eval()->get_caloid(); }
0032
0033
0034 void next_event(PHCompositeNode* topNode);
0035
0036
0037 void do_caching(bool do_cache)
0038 {
0039 _do_cache = do_cache;
0040 _towereval.do_caching(do_cache);
0041 }
0042
0043
0044
0045 void set_strict(bool strict)
0046 {
0047 _strict = strict;
0048 _towereval.set_strict(strict);
0049 }
0050
0051 void set_usetowerinfo(bool use) { _usetowerinfo = use; }
0052
0053
0054 unsigned int get_errors() { return _errors + _towereval.get_errors(); }
0055
0056
0057 void set_verbosity(int verbosity)
0058 {
0059 _verbosity = verbosity;
0060 _towereval.set_verbosity(verbosity);
0061 }
0062
0063
0064 CaloTruthEval* get_truth_eval() { return _towereval.get_truth_eval(); }
0065
0066
0067 CaloRawTowerEval* get_rawtower_eval() { return &_towereval; }
0068
0069
0070
0071
0072 bool has_reduced_node_pointers();
0073
0074
0075
0076
0077 std::set<PHG4Shower*> all_truth_primary_showers(RawCluster* cluster);
0078
0079
0080 PHG4Shower* max_truth_primary_shower_by_energy(RawCluster* cluster);
0081
0082
0083 std::set<RawCluster*> all_clusters_from(PHG4Shower* primary);
0084
0085
0086 RawCluster* best_cluster_from(PHG4Shower* primary);
0087
0088
0089 float get_energy_contribution(RawCluster* cluster, PHG4Shower* primary);
0090
0091
0092
0093
0094 std::set<PHG4Particle*> all_truth_primary_particles(RawCluster* cluster);
0095
0096
0097 PHG4Particle* max_truth_primary_particle_by_energy(RawCluster* cluster);
0098
0099
0100 std::set<RawCluster*> all_clusters_from(PHG4Particle* primary);
0101
0102
0103 RawCluster* best_cluster_from(PHG4Particle* primary);
0104
0105
0106 float get_energy_contribution(RawCluster* cluster, PHG4Particle* primary);
0107
0108
0109
0110
0111 bool has_full_node_pointers();
0112
0113
0114 std::set<PHG4Hit*> all_truth_hits(RawCluster* cluster);
0115
0116 private:
0117 void get_node_pointers(PHCompositeNode* topNode);
0118 unsigned int get_towerinfo_key(RawTowerDefs::keytype tower_key);
0119
0120 std::string _caloname;
0121 CaloRawTowerEval _towereval;
0122 RawClusterContainer* _clusters = nullptr;
0123 RawTowerContainer* _towers = nullptr;
0124 TowerInfoContainer* _towerinfos = nullptr;
0125
0126 bool _strict = false;
0127 bool _usetowerinfo = false;
0128 int _verbosity = 1;
0129 unsigned int _errors = 0;
0130
0131 bool _do_cache = true;
0132 std::map<RawCluster*, std::set<PHG4Shower*> > _cache_all_truth_primary_showers;
0133 std::map<RawCluster*, PHG4Shower*> _cache_max_truth_primary_shower_by_energy;
0134 std::map<PHG4Shower*, std::set<RawCluster*> > _cache_all_clusters_from_primary_shower;
0135 std::map<PHG4Shower*, RawCluster*> _cache_best_cluster_from_primary_shower;
0136 std::map<std::pair<RawCluster*, PHG4Shower*>, float> _cache_get_energy_contribution_primary_shower;
0137
0138 std::map<RawCluster*, std::set<PHG4Particle*> > _cache_all_truth_primary_particles;
0139 std::map<RawCluster*, PHG4Particle*> _cache_max_truth_primary_particle_by_energy;
0140 std::map<PHG4Particle*, std::set<RawCluster*> > _cache_all_clusters_from_primary_particle;
0141 std::map<PHG4Particle*, RawCluster*> _cache_best_cluster_from_primary_particle;
0142 std::map<std::pair<RawCluster*, PHG4Particle*>, float> _cache_get_energy_contribution_primary_particle;
0143
0144 std::map<RawCluster*, std::set<PHG4Hit*> > _cache_all_truth_hits;
0145 };
0146
0147 #endif