-
Notifications
You must be signed in to change notification settings - Fork 184
/
CaloTruthEval.h
143 lines (103 loc) · 4.57 KB
/
CaloTruthEval.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef G4EVAL_CALOTRUTHEVAL_H
#define G4EVAL_CALOTRUTHEVAL_H
#include "BaseTruthEval.h"
#include <map>
#include <set>
#include <string>
class PHCompositeNode;
class PHG4Hit;
class PHG4HitContainer;
class PHG4Particle;
class PHG4TruthInfoContainer;
class PHG4Shower;
class PHG4VtxPoint;
class CaloTruthEval
{
public:
/// example caloname: CEMC, HCALIN, HCALOUT
CaloTruthEval(PHCompositeNode* topNode, const std::string& caloname);
virtual ~CaloTruthEval();
/// get the hash id for this calorimeter volume
int get_caloid() { return _caloid; }
/// reinitialize the eval for a new event
void next_event(PHCompositeNode* topNode);
/// activate or deactivate the memory caching inside the evaluation module
void do_caching(bool do_cache) { _do_cache = do_cache; }
/// strict mode will assert when an error is detected
/// non-strict mode will notice and report at the End()
void set_strict(bool strict)
{
_strict = strict;
_basetrutheval.set_strict(strict);
}
/// get a count of the errors discovered thus far
unsigned int get_errors() { return _errors; }
/// adjust the messaging from the evalutaion module
void set_verbosity(int verbosity)
{
_verbosity = verbosity;
_basetrutheval.set_verbosity(verbosity);
}
// ---reduced sim node or better----------------------------------------------
/// has the eval initialized correctly for reduced sim DST nodes?
bool has_reduced_node_pointers();
/// what was the primary shower associated with the shower object?
PHG4Shower* get_primary_shower(PHG4Shower* shower);
/// what was the primary shower associated with the shower object?
PHG4Shower* get_primary_shower(PHG4Particle* particle);
/// what was the primary particle associated with the shower object?
PHG4Particle* get_primary_particle(PHG4Shower* shower);
/// what was the primary particle associated with another or same particle?
PHG4Particle* get_primary_particle(PHG4Particle* particle);
/// what was the embed flag passed with this particle?
int get_embed(PHG4Particle* particle);
/// what was particle's creation point?
PHG4VtxPoint* get_vertex(PHG4Particle* particle);
/// are these two pointers in fact the same shower?
bool are_same_shower(PHG4Shower* s1, PHG4Shower* s2);
/// are these two pointers in fact the same particle?
bool are_same_particle(PHG4Particle* p1, PHG4Particle* p2);
/// are these two pointers in fact the same vertex?
bool are_same_vertex(PHG4VtxPoint* vtx1, PHG4VtxPoint* vtx2);
/// is this a primary shower?
bool is_primary(PHG4Shower* shower);
/// is this a primary particle?
bool is_primary(PHG4Particle* particle);
/// how much energy did this primary and its shower deposit in the calo volume?
float get_shower_energy_deposit(PHG4Particle* primary);
/// what was the electron/hadron radio of energy deposits inside the calo colume?
float get_shower_eh_ratio(PHG4Particle* primary);
// ---full sim node required--------------------------------------------------
/// has the eval initialized correctly for full sim DST nodes?
bool has_full_node_pointers();
/// what truth hits are contained within this shower entry in this calo volume?
std::set<PHG4Hit*> all_truth_hits(PHG4Shower* shower);
/// what truth hits were left behind by this particle in this calo volume?
std::set<PHG4Hit*> all_truth_hits(PHG4Particle* particle);
/// what particle created this truth hit?
PHG4Particle* get_parent_particle(PHG4Hit* g4hit);
/// what primary particle was responsible for this truth hit?
PHG4Particle* get_primary_particle(PHG4Hit* g4hit);
/// did this particle create this truth hit?
bool is_g4hit_from_particle(PHG4Hit* g4hit, PHG4Particle* particle);
/// what truth hits are the result of this primary particle and its shower
std::set<PHG4Hit*> get_shower_hits_from_primary(PHG4Particle* primary);
private:
void get_node_pointers(PHCompositeNode* topNode);
BaseTruthEval _basetrutheval;
std::string _caloname;
int _caloid;
PHG4TruthInfoContainer* _truthinfo = nullptr;
PHG4HitContainer* _g4hits = nullptr;
int _g4hit_container_id = -1;
bool _strict = false;
int _verbosity = 1;
unsigned int _errors = 0;
bool _do_cache = true;
std::map<PHG4Particle*, float> _cache_get_shower_energy_deposit;
std::map<PHG4Shower*, std::set<PHG4Hit*> > _cache_all_truth_hits_g4shower;
std::map<PHG4Particle*, std::set<PHG4Hit*> > _cache_all_truth_hits_g4particle;
std::map<PHG4Hit*, PHG4Particle*> _cache_get_primary_particle_g4hit;
std::map<PHG4Particle*, std::set<PHG4Hit*> > _cache_get_shower_hits_from_primary;
};
#endif // G4EVAL_CALOTRUTHEVAL_H