File indexing completed on 2025-08-06 08:19:06
0001 #ifndef G4EVAL_CALOTRUTHEVAL_H
0002 #define G4EVAL_CALOTRUTHEVAL_H
0003
0004 #include "BaseTruthEval.h"
0005
0006 #include <map>
0007 #include <set>
0008 #include <string>
0009
0010 class PHCompositeNode;
0011
0012 class PHG4Hit;
0013 class PHG4HitContainer;
0014 class PHG4Particle;
0015 class PHG4TruthInfoContainer;
0016 class PHG4Shower;
0017 class PHG4VtxPoint;
0018
0019 class CaloTruthEval
0020 {
0021 public:
0022
0023 CaloTruthEval(PHCompositeNode* topNode, const std::string& caloname);
0024 virtual ~CaloTruthEval();
0025
0026
0027 int get_caloid() { return _caloid; }
0028
0029
0030 void next_event(PHCompositeNode* topNode);
0031
0032
0033 void do_caching(bool do_cache) { _do_cache = do_cache; }
0034
0035
0036
0037 void set_strict(bool strict)
0038 {
0039 _strict = strict;
0040 _basetrutheval.set_strict(strict);
0041 }
0042
0043
0044 unsigned int get_errors() { return _errors; }
0045
0046
0047 void set_verbosity(int verbosity)
0048 {
0049 _verbosity = verbosity;
0050 _basetrutheval.set_verbosity(verbosity);
0051 }
0052
0053
0054
0055
0056 bool has_reduced_node_pointers();
0057
0058
0059 PHG4Shower* get_primary_shower(PHG4Shower* shower);
0060
0061
0062 PHG4Shower* get_primary_shower(PHG4Particle* particle);
0063
0064
0065 PHG4Particle* get_primary_particle(PHG4Shower* shower);
0066
0067
0068 PHG4Particle* get_primary_particle(PHG4Particle* particle);
0069
0070
0071 int get_embed(PHG4Particle* particle);
0072
0073
0074 PHG4VtxPoint* get_vertex(PHG4Particle* particle);
0075
0076
0077 bool are_same_shower(PHG4Shower* s1, PHG4Shower* s2);
0078
0079
0080 bool are_same_particle(PHG4Particle* p1, PHG4Particle* p2);
0081
0082
0083 bool are_same_vertex(PHG4VtxPoint* vtx1, PHG4VtxPoint* vtx2);
0084
0085
0086 bool is_primary(PHG4Shower* shower);
0087
0088
0089 bool is_primary(PHG4Particle* particle);
0090
0091
0092 float get_shower_energy_deposit(PHG4Particle* primary);
0093
0094
0095 float get_shower_eh_ratio(PHG4Particle* primary);
0096
0097
0098
0099
0100 bool has_full_node_pointers();
0101
0102
0103 std::set<PHG4Hit*> all_truth_hits(PHG4Shower* shower);
0104
0105
0106 std::set<PHG4Hit*> all_truth_hits(PHG4Particle* particle);
0107
0108
0109 PHG4Particle* get_parent_particle(PHG4Hit* g4hit);
0110
0111
0112 PHG4Particle* get_primary_particle(PHG4Hit* g4hit);
0113
0114
0115 bool is_g4hit_from_particle(PHG4Hit* g4hit, PHG4Particle* particle);
0116
0117
0118 std::set<PHG4Hit*> get_shower_hits_from_primary(PHG4Particle* primary);
0119
0120 private:
0121 void get_node_pointers(PHCompositeNode* topNode);
0122
0123 BaseTruthEval _basetrutheval;
0124
0125 std::string _caloname;
0126 int _caloid;
0127 PHG4TruthInfoContainer* _truthinfo{nullptr};
0128 PHG4HitContainer* _g4hits{nullptr};
0129 int _g4hit_container_id{-1};
0130
0131 bool _strict{false};
0132 int _verbosity{1};
0133 unsigned int _errors{0};
0134
0135 bool _do_cache{true};
0136 std::map<PHG4Particle*, float> _cache_get_shower_energy_deposit;
0137 std::map<PHG4Shower*, std::set<PHG4Hit*> > _cache_all_truth_hits_g4shower;
0138 std::map<PHG4Particle*, std::set<PHG4Hit*> > _cache_all_truth_hits_g4particle;
0139 std::map<PHG4Hit*, PHG4Particle*> _cache_get_primary_particle_g4hit;
0140 std::map<PHG4Particle*, std::set<PHG4Hit*> > _cache_get_shower_hits_from_primary;
0141 };
0142
0143 #endif