-
Notifications
You must be signed in to change notification settings - Fork 184
/
RawCluster.h
296 lines (274 loc) · 9.21 KB
/
RawCluster.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#ifndef CALOBASE_RAWCLUSTER_H
#define CALOBASE_RAWCLUSTER_H
#include "RawClusterDefs.h"
#include "RawTowerDefs.h"
#include <phool/PHObject.h>
#include <phool/phool.h>
#include <CLHEP/Vector/ThreeVector.h>
#include <climits>
#include <cmath> // def of NAN
#include <cstddef>
#include <iostream>
#include <map>
#include <string> // for string
#include <type_traits>
#include <utility>
class RawCluster : public PHObject
{
public:
typedef std::map<RawTowerDefs::keytype, float> TowerMap;
typedef TowerMap::iterator TowerIterator;
typedef TowerMap::const_iterator TowerConstIterator;
typedef std::pair<TowerIterator, TowerIterator> TowerRange;
typedef std::pair<TowerConstIterator, TowerConstIterator> TowerConstRange;
~RawCluster() override {}
void Reset() override { PHOOL_VIRTUAL_WARNING; }
PHObject* CloneMe() const override { return nullptr; }
int isValid() const override
{
PHOOL_VIRTUAL_WARNING;
return 0;
}
void identify(std::ostream& /*os*/ = std::cout) const override { PHOOL_VIRTUAL_WARNING; }
/** @defgroup getters
* @{
*/
//! cluster ID
virtual RawClusterDefs::keytype get_id() const
{
PHOOL_VIRTUAL_WARN("get_id()");
return 0;
}
//! total energy
virtual float get_energy() const
{
PHOOL_VIRTUAL_WARN("get_energy()");
return NAN;
}
//! Tower operations
virtual size_t getNTowers() const
{
PHOOL_VIRTUAL_WARNING;
return 0;
}
virtual TowerConstRange get_towers() const
{
PHOOL_VIRTUAL_WARN("get_towers()");
static TowerMap dummy;
return make_pair(dummy.begin(), dummy.end());
}
//! return tower map for c++11 range-based for-loop
virtual const TowerMap& get_towermap() const
{
PHOOL_VIRTUAL_WARN("get_towers()");
static TowerMap dummy;
return dummy;
}
virtual CLHEP::Hep3Vector get_position() const
{
PHOOL_VIRTUAL_WARN("get_position()");
return CLHEP::Hep3Vector(NAN, NAN, NAN);
}
//
//! access to intrinsic cylindrical coordinate system
virtual float get_phi() const
{
PHOOL_VIRTUAL_WARN("get_phi()");
return NAN;
}
virtual float get_r() const
{
PHOOL_VIRTUAL_WARN("get_r()");
return NAN;
}
virtual float get_z() const
{
PHOOL_VIRTUAL_WARN("get_z()");
return NAN;
}
//
/*! \page where is RawCluster::get_eta() ?
*
* get_eta() is retired!
* eta does not have meaning for cluster unless user choose a vertex, which is totally up to user in case of multiple collision,
* and therefore not an intrinsic property of clusterizer.
* The goal is to force people to calculate it based on r/z and the vertex of choice.
*
* There is a utility to help you calculate, a concise example is here to get energy 3-vector:
* https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/dc/d23/ClusterJetInput_8C_source.html#l00045
* Or this one if you only interest in eta:
* https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d7/daf/CaloEvaluator_8C_source.html#l00487
*
* Older code is commented out here:
*
* //! convert cluster location to psuedo-rapidity given a user chosen z-location
* virtual float get_eta() const
* {
* PHOOL_VIRTUAL_WARN("get_eta()");
* return NAN;
* }
* //! convert cluster E_T given a user chosen z-location
* virtual float get_et() const
* {
* PHOOL_VIRTUAL_WARN("get_et()");
* return NAN;
* }
*/
//! access Cartesian coordinate system
virtual float get_x() const
{
PHOOL_VIRTUAL_WARN("get_x()");
return NAN;
}
virtual float get_y() const
{
PHOOL_VIRTUAL_WARN("get_y()");
return NAN;
}
//
//! access additional optional properties
//! cluster core energy for EM shower
virtual float get_ecore() const
{
PHOOL_VIRTUAL_WARN("get_ecore()");
return NAN;
}
//! reduced chi2 for EM shower
virtual float get_chi2() const
{
PHOOL_VIRTUAL_WARN("get_chi2()");
return NAN;
}
//! cluster template probability for EM shower
virtual float get_prob() const
{
PHOOL_VIRTUAL_WARN("get_prob()");
return NAN;
}
//! isolation ET default
virtual float get_et_iso() const
{
PHOOL_VIRTUAL_WARN("get_et_iso()");
return NAN;
}
//! isolation ET the radius and hueristic can be specified
virtual float get_et_iso(const int /*radiusx10*/, bool /*subtracted*/, bool /*clusterTower*/) const
{
PHOOL_VIRTUAL_WARN("get_et_iso(const int radiusx10, bool subtracted, bool clusterTower)");
return NAN;
}
// //! truth cluster's PHG4Particle ID
// virtual int get_truth_track_ID() const
// {
// PHOOL_VIRTUAL_WARN("get_truth_track_ID()");
// return 0;
// }
// //! truth cluster's PHG4Particle flavor
// virtual int get_truth_flavor() const
// {
// PHOOL_VIRTUAL_WARN("get_truth_flavor()");
// return 0;
// }
//
/** @} */ // end of getters
/** @defgroup setters
* @{
*/
//! cluster ID
virtual void set_id(const RawClusterDefs::keytype) { PHOOL_VIRTUAL_WARNING; }
//! Tower operations
virtual void addTower(const RawClusterDefs::keytype /*twrid*/, const float /*etower*/) { PHOOL_VIRTUAL_WARNING; }
//! total energy
virtual void set_energy(const float) { PHOOL_VIRTUAL_WARNING; }
//
//! access to intrinsic cylindrical coordinate system
virtual void set_phi(const float) { PHOOL_VIRTUAL_WARNING; }
virtual void set_z(const float) { PHOOL_VIRTUAL_WARNING; }
virtual void set_r(const float) { PHOOL_VIRTUAL_WARNING; }
//
//! access additional optional properties
//! cluster core energy for EM shower
virtual void set_ecore(const float) { PHOOL_VIRTUAL_WARNING; }
//! reduced chi2 for EM shower
virtual void set_chi2(const float) { PHOOL_VIRTUAL_WARNING; }
//! cluster template probability for EM shower
virtual void set_prob(const float) { PHOOL_VIRTUAL_WARNING; }
//! isolation ET
virtual void set_et_iso(const float) { PHOOL_VIRTUAL_WARNING; }
virtual void set_et_iso(const float /*e*/, const int /*radiusx10*/, bool /*subtracted*/, bool /*clusterTower*/) { PHOOL_VIRTUAL_WARNING; }
// //! truth cluster's PHG4Particle ID
// virtual void set_truth_track_ID(const int) { PHOOL_VIRTUAL_WARNING; }
// //! truth cluster's PHG4Particle flavor
// virtual void set_truth_flavor(const int) { PHOOL_VIRTUAL_WARNING; }
//
/*
*
* @} */
// end of setters
/** @defgroup property_map property map definitions
* @{
*/
public:
//! Procedure to add a new PROPERTY tag:
//! 1.add new tag below with unique value,
//! 2.add a short name to RawCluster::get_property_info()
enum PROPERTY
{ //
// ----- additional cluster properties -----
//! cluster core energy for EM shower
prop_ecore = 0,
//! cluster template probability for EM shower
prop_prob = 1,
//! reduced chi2 for EM shower
prop_chi2 = 2,
// ----- analysis specific quantities -----
//! isolation ET by the calorimeter tower heuristic with subtracted background R=.1
prop_et_iso_calotower_sub_R01 = 20,
//! isolation ET by the calorimeter tower heuristic no subtracted background R=.1
prop_et_iso_calotower_R01 = 21,
//! isolation ET by the calorimeter tower heuristic with subtracted background R=.2
prop_et_iso_calotower_sub_R02 = 22,
//! isolation ET by the calorimeter tower heuristic with subtracted background R=.2
prop_et_iso_calotower_R02 = 23,
//! isolation ET by the calorimeter tower heuristic with subtracted background R=.2
prop_et_iso_calotower_sub_R03 = 24,
//! isolation ET by the calorimeter tower heuristic with subtracted background R=.2
prop_et_iso_calotower_R03 = 25,
//! isolation ET by the calorimeter tower heuristic with subtracted background R=.2
prop_et_iso_calotower_sub_R04 = 26,
//! isolation ET by the calorimeter tower heuristic with subtracted background R=.2
prop_et_iso_calotower_R04 = 27,
// // ----- truth cluster quantities -----
// //! truth cluster's PHG4Particle ID
// prop_truth_track_ID = 100,
// //! truth cluster's PHG4Particle flavor
// prop_truth_flavor = 101,
//! max limit in order to fit into 8 bit unsigned number
prop_MAX_NUMBER = UCHAR_MAX
};
enum PROPERTY_TYPE
{ //
type_int = 1,
type_uint = 2,
type_float = 3,
type_unknown = -1
};
//! getters
virtual bool has_property(const PROPERTY /*prop_id*/) const { return false; }
virtual float get_property_float(const PROPERTY /*prop_id*/) const { return NAN; }
virtual int get_property_int(const PROPERTY /*prop_id*/) const { return INT_MIN; }
virtual unsigned int get_property_uint(const PROPERTY /*prop_id*/) const { return UINT_MAX; }
//! setters
virtual void set_property(const PROPERTY /*prop_id*/, const float /*value*/) { return; }
virtual void set_property(const PROPERTY /*prop_id*/, const int /*value*/) { return; }
virtual void set_property(const PROPERTY /*prop_id*/, const unsigned int /*value*/) { return; }
//! type management
static std::pair<const std::string, PROPERTY_TYPE> get_property_info(PROPERTY prop_id);
static bool check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type);
static std::string get_property_type(const PROPERTY_TYPE prop_type);
/** @} */ // end of property map definitions
protected:
RawCluster() {} // make sure nobody calls ctor of base class
ClassDefOverride(RawCluster, 1)
};
#endif