File indexing completed on 2026-10-15 08:21:04
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 void set_is_topocluster(bool b)
0054 {
0055 _is_topocluster = b;
0056 do_caching(false);
0057 }
0058
0059 void set_topocluster_type(const std::string &s) { _topocluster_type = s; }
0060
0061
0062 unsigned int get_errors() { return _errors + _towereval.get_errors(); }
0063
0064
0065 void set_verbosity(int verbosity)
0066 {
0067 _verbosity = verbosity;
0068 _towereval.set_verbosity(verbosity);
0069 }
0070
0071
0072 CaloTruthEval* get_truth_eval() { return _towereval.get_truth_eval(); }
0073
0074
0075 CaloRawTowerEval* get_rawtower_eval() { return &_towereval; }
0076
0077
0078
0079
0080 bool has_reduced_node_pointers();
0081
0082
0083
0084
0085 std::set<PHG4Shower*> all_truth_primary_showers(RawCluster* cluster);
0086
0087
0088 PHG4Shower* max_truth_primary_shower_by_energy(RawCluster* cluster);
0089
0090
0091 std::set<RawCluster*> all_clusters_from(PHG4Shower* primary);
0092
0093
0094 RawCluster* best_cluster_from(PHG4Shower* primary);
0095
0096
0097 float get_energy_contribution(RawCluster* cluster, PHG4Shower* primary);
0098
0099
0100
0101
0102 std::set<PHG4Particle*> all_truth_primary_particles(RawCluster* cluster);
0103
0104
0105 PHG4Particle* max_truth_primary_particle_by_energy(RawCluster* cluster);
0106
0107
0108 std::set<RawCluster*> all_clusters_from(PHG4Particle* primary);
0109
0110
0111 RawCluster* best_cluster_from(PHG4Particle* primary);
0112
0113
0114 float get_energy_contribution(RawCluster* cluster, PHG4Particle* primary);
0115
0116
0117
0118
0119 bool has_full_node_pointers();
0120
0121
0122 std::set<PHG4Hit*> all_truth_hits(RawCluster* cluster);
0123
0124 private:
0125 void get_node_pointers(PHCompositeNode* topNode);
0126 unsigned int get_towerinfo_key(RawTowerDefs::keytype tower_key);
0127
0128 std::string _caloname;
0129 CaloRawTowerEval _towereval;
0130 RawClusterContainer* _clusters = nullptr;
0131 RawTowerContainer* _towers = nullptr;
0132 TowerInfoContainer* _towerinfos = nullptr;
0133
0134 bool _strict = false;
0135 bool _usetowerinfo = false;
0136 bool _is_topocluster = false;
0137 std::string _topocluster_type = "EMCAL_HCAL";
0138 int _verbosity = 1;
0139 unsigned int _errors = 0;
0140
0141 bool _do_cache = true;
0142 std::map<RawCluster*, std::set<PHG4Shower*> > _cache_all_truth_primary_showers;
0143 std::map<RawCluster*, PHG4Shower*> _cache_max_truth_primary_shower_by_energy;
0144 std::map<PHG4Shower*, std::set<RawCluster*> > _cache_all_clusters_from_primary_shower;
0145 std::map<PHG4Shower*, RawCluster*> _cache_best_cluster_from_primary_shower;
0146 std::map<std::pair<RawCluster*, PHG4Shower*>, float> _cache_get_energy_contribution_primary_shower;
0147
0148 std::map<RawCluster*, std::set<PHG4Particle*> > _cache_all_truth_primary_particles;
0149 std::map<RawCluster*, PHG4Particle*> _cache_max_truth_primary_particle_by_energy;
0150 std::map<PHG4Particle*, std::set<RawCluster*> > _cache_all_clusters_from_primary_particle;
0151 std::map<PHG4Particle*, RawCluster*> _cache_best_cluster_from_primary_particle;
0152 std::map<std::pair<RawCluster*, PHG4Particle*>, float> _cache_get_energy_contribution_primary_particle;
0153
0154 std::map<RawCluster*, std::set<PHG4Hit*> > _cache_all_truth_hits;
0155 };
0156
0157 #endif