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