Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PidCandidate.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PidCandidate.C
1 #include "PidCandidate.h"
2 
3 #include <cstdlib>
4 
5 using namespace std;
6 
8 
9 void
10 PidCandidate::Copy(PidCandidate const &tc)
11 {
12  for (unsigned char ic = 0; ic < UCHAR_MAX; ic++)
13  {
14  PROPERTY prop_id = static_cast<PidCandidate::PROPERTY> (ic);
15  if (tc.has_property(prop_id))
16  {
17  set_property_nocheck(prop_id,tc.get_property_nocheck(prop_id));
18  }
19  }
20 }
21 
22 
23 void
24 PidCandidate::identify(ostream& os) const
25 {
26  cout << "Class " << this->ClassName() << endl;
27  return;
28 }
29 
30 ostream& operator<<(ostream& stream, const PidCandidate * hit){
31  stream <<endl<< "streaming information" <<endl;
32  return stream;
33 }
34 
35 void
37 {
38  cout << "Reset not implemented by daughter class" << endl;
39  return;
40 }
41 
42 
43 std::pair<const std::string,PidCandidate::PROPERTY_TYPE>
45 {
46  switch (prop_id)
47  {
48  case evtgen_pid:
49  return make_pair("evtgen_pid",PidCandidate::type_int);
50 
51  case evtgen_ptotal:
52  return make_pair("evtgen_ptotal",PidCandidate::type_float);
53 
54  case evtgen_etotal:
55  return make_pair("evtgen_etotal",PidCandidate::type_float);
56 
57  case evtgen_theta:
58  return make_pair("evtgen_theta",PidCandidate::type_float);
59 
60  case evtgen_phi:
61  return make_pair("evtgen_phi",PidCandidate::type_float);
62 
63  case evtgen_eta:
64  return make_pair("evtgen_eta",PidCandidate::type_float);
65 
66  case evtgen_charge:
67  return make_pair("evtgen_charge",PidCandidate::type_int);
68 
69  case evtgen_decay_prong:
70  return make_pair("evtgen_decay_prong",PidCandidate::type_uint);
71 
72  case evtgen_decay_hcharged:
73  return make_pair("evtgen_decay_hcharged",PidCandidate::type_uint);
74 
75  case evtgen_decay_lcharged:
76  return make_pair("evtgen_decay_lcharged",PidCandidate::type_uint);
77 
78  // ------
79 
80  case jet_id:
81  return make_pair("jet_id",PidCandidate::type_uint);
82 
83  case jet_eta:
84  return make_pair("jet_eta",PidCandidate::type_float);
85 
86  case jet_phi:
87  return make_pair("jet_phi",PidCandidate::type_float);
88 
89  case jet_etotal:
90  return make_pair("jet_etotal",PidCandidate::type_float);
91 
92  case jet_etrans:
93  return make_pair("jet_etrans",PidCandidate::type_float);
94 
95  case jet_ptotal:
96  return make_pair("jet_ptotal",PidCandidate::type_float);
97 
98  case jet_ptrans:
99  return make_pair("jet_ptrans",PidCandidate::type_float);
100 
101  case jet_minv:
102  return make_pair("jet_minv",PidCandidate::type_float);
103 
104  case jet_mtrans:
105  return make_pair("jet_mtrans",PidCandidate::type_float);
106 
107  case jet_ncomp:
108  return make_pair("jet_ncomp",PidCandidate::type_uint);
109 
110  case jet_ncomp_above_0p1:
111  return make_pair("jet_ncomp_above_0p1",PidCandidate::type_uint);
112 
113  case jet_ncomp_above_1:
114  return make_pair("jet_ncomp_above_1",PidCandidate::type_uint);
115 
116  case jet_ncomp_above_10:
117  return make_pair("jet_ncomp_above_10",PidCandidate::type_uint);
118 
119  case jet_ncomp_emcal:
120  return make_pair("jet_ncomp_emcal",PidCandidate::type_uint);
121 
122  // ------
123 
124  case jetshape_radius:
125  return make_pair("jetshape_radius",PidCandidate::type_float);
126 
127  case jetshape_rms:
128  return make_pair("jetshape_rms",PidCandidate::type_float);
129 
130  case jetshape_r90:
131  return make_pair("jetshape_r90",PidCandidate::type_float);
132 
133  case jetshape_econe_r01:
134  return make_pair("jetshape_econe_r01",PidCandidate::type_float);
135 
136  case jetshape_econe_r02:
137  return make_pair("jetshape_econe_r02",PidCandidate::type_float);
138 
139  case jetshape_econe_r03:
140  return make_pair("jetshape_econe_r03",PidCandidate::type_float);
141 
142  case jetshape_econe_r04:
143  return make_pair("jetshape_econe_r04",PidCandidate::type_float);
144 
145  case jetshape_econe_r05:
146  return make_pair("jetshape_econe_r05",PidCandidate::type_float);
147 
148  // ------
149 
150  case jetshape_emcal_radius:
151  return make_pair("jetshape_emcal_radius",PidCandidate::type_float);
152 
153  case jetshape_emcal_rms:
154  return make_pair("jetshape_emcal_rms",PidCandidate::type_float);
155 
156  case jetshape_emcal_r90:
157  return make_pair("jetshape_emcal_r90",PidCandidate::type_float);
158 
159  case jetshape_emcal_econe_r01:
160  return make_pair("jetshape_emcal_econe_r01",PidCandidate::type_float);
161 
162  case jetshape_emcal_econe_r02:
163  return make_pair("jetshape_emcal_econe_r02",PidCandidate::type_float);
164 
165  case jetshape_emcal_econe_r03:
166  return make_pair("jetshape_emcal_econe_r03",PidCandidate::type_float);
167 
168  case jetshape_emcal_econe_r04:
169  return make_pair("jetshape_emcal_econe_r04",PidCandidate::type_float);
170 
171  case jetshape_emcal_econe_r05:
172  return make_pair("jetshape_emcal_econe_r05",PidCandidate::type_float);
173 
174  // ------
175 
176  case tracks_count_r02:
177  return make_pair("tracks_count_r02",PidCandidate::type_uint);
178 
179  case tracks_count_r04:
180  return make_pair("tracks_count_r04",PidCandidate::type_uint);
181 
182  case tracks_count_R:
183  return make_pair("tracks_count_R",PidCandidate::type_uint);
184 
185  case tracks_rmax_r02:
186  return make_pair("tracks_rmax_r02",PidCandidate::type_float);
187 
188  case tracks_rmax_r04:
189  return make_pair("tracks_rmax_r04",PidCandidate::type_float);
190 
191  case tracks_rmax_R:
192  return make_pair("tracks_rmax_R",PidCandidate::type_float);
193 
194  case tracks_chargesum_r02:
195  return make_pair("tracks_chargesum_r02",PidCandidate::type_int);
196 
197  case tracks_chargesum_r04:
198  return make_pair("tracks_chargesum_r04",PidCandidate::type_int);
199 
200  case tracks_chargesum_R:
201  return make_pair("tracks_chargesum_R",PidCandidate::type_int);
202 
203  // ------
204 
205  // EM Candidates:
206 
207  case em_cluster_id:
208  return make_pair("em_cluster_id",PidCandidate::type_uint);
209 
210  case em_cluster_prob:
211  return make_pair("em_cluster_prob",PidCandidate::type_float);
212 
213  case em_cluster_posx:
214  return make_pair("em_cluster_posx",PidCandidate::type_float);
215 
216  case em_cluster_posy:
217  return make_pair("em_cluster_posy",PidCandidate::type_float);
218 
219  case em_cluster_posz:
220  return make_pair("em_cluster_posz",PidCandidate::type_float);
221 
222  case em_cluster_e:
223  return make_pair("em_cluster_e",PidCandidate::type_float);
224 
225  case em_cluster_ecore:
226  return make_pair("em_cluster_ecore",PidCandidate::type_float);
227 
228  case em_cluster_et_iso:
229  return make_pair("em_cluster_et_iso",PidCandidate::type_float);
230 
231  case em_cluster_theta:
232  return make_pair("em_cluster_theta",PidCandidate::type_float);
233 
234  case em_cluster_phi:
235  return make_pair("em_cluster_phi",PidCandidate::type_float);
236 
237  case em_cluster_eta:
238  return make_pair("em_cluster_eta",PidCandidate::type_float);
239 
240  case em_cluster_pt:
241  return make_pair("em_cluster_pt",PidCandidate::type_float);
242 
243  case em_cluster_ntower:
244  return make_pair("em_cluster_ntower",PidCandidate::type_uint);
245 
246  case em_cluster_caloid:
247  return make_pair("em_cluster_caloid",PidCandidate::type_uint);
248 
249  // ------
250 
251  case em_track_id:
252  return make_pair("em_track_id",PidCandidate::type_uint);
253 
254  case em_track_quality:
255  return make_pair("em_track_quality",PidCandidate::type_float);
256 
257  case em_track_theta:
258  return make_pair("em_track_theta",PidCandidate::type_float);
259 
260  case em_track_phi:
261  return make_pair("em_track_phi",PidCandidate::type_float);
262 
263  case em_track_eta:
264  return make_pair("em_track_eta",PidCandidate::type_float);
265 
266  case em_track_ptotal:
267  return make_pair("em_track_ptotal",PidCandidate::type_float);
268 
269  case em_track_ptrans:
270  return make_pair("em_track_ptrans",PidCandidate::type_float);
271 
272  case em_track_charge:
273  return make_pair("em_track_charge",PidCandidate::type_int);
274 
275  case em_track_dca:
276  return make_pair("em_track_dca",PidCandidate::type_float);
277 
278  case em_track_section:
279  return make_pair("em_track_section",PidCandidate::type_uint);
280 
281  case em_track_e3x3_cemc:
282  return make_pair("em_track_e3x3_cemc",PidCandidate::type_float);
283 
284  case em_track_e3x3_femc:
285  return make_pair("em_track_e3x3_femc",PidCandidate::type_float);
286 
287  case em_track_e3x3_eemc:
288  return make_pair("em_track_e3x3_eemc",PidCandidate::type_float);
289 
290  case em_track_e3x3_ihcal:
291  return make_pair("em_track_e3x3_ihcal",PidCandidate::type_float);
292 
293  case em_track_e3x3_ohcal:
294  return make_pair("em_track_e3x3_ohcal",PidCandidate::type_float);
295 
296  case em_track_e3x3_fhcal:
297  return make_pair("em_track_e3x3_fhcal",PidCandidate::type_float);
298 
299  case em_track_e3x3_ehcal:
300  return make_pair("em_track_e3x3_ehcal",PidCandidate::type_float);
301 
302  case em_track_cluster_dr:
303  return make_pair("em_track_cluster_dr",PidCandidate::type_float);
304 
305  case em_track_theta2cluster:
306  return make_pair("em_track_theta2cluster",PidCandidate::type_float);
307 
308  case em_track_eta2cluster:
309  return make_pair("em_track_eta2cluster",PidCandidate::type_float);
310 
311  case em_track_phi2cluster:
312  return make_pair("em_track_phi2cluster",PidCandidate::type_float);
313 
314  case em_track_p2cluster:
315  return make_pair("em_track_p2cluster",PidCandidate::type_float);
316 
317  case em_track_x2cluster:
318  return make_pair("em_track_x2cluster",PidCandidate::type_float);
319 
320  case em_track_y2cluster:
321  return make_pair("em_track_y2cluster",PidCandidate::type_float);
322 
323  case em_track_z2cluster:
324  return make_pair("em_track_z2cluster",PidCandidate::type_float);
325 
326  // ------
327 
328  case em_pid_prob_electron:
329  return make_pair("em_pid_prob_electron",PidCandidate::type_float);
330 
331  case em_pid_prob_pion:
332  return make_pair("em_pid_prob_pion",PidCandidate::type_float);
333 
334  case em_pid_prob_kaon:
335  return make_pair("em_pid_prob_kaon",PidCandidate::type_float);
336 
337  case em_pid_prob_proton:
338  return make_pair("em_pid_prob_proton",PidCandidate::type_float);
339 
340  // ------
341 
342  case em_evtgen_pid:
343  return make_pair("em_evtgen_pid",PidCandidate::type_int);
344 
345  case em_evtgen_ptotal:
346  return make_pair("em_evtgen_ptotal",PidCandidate::type_float);
347 
348  case em_evtgen_etotal:
349  return make_pair("em_evtgen_etotal",PidCandidate::type_float);
350 
351  case em_evtgen_theta:
352  return make_pair("em_evtgen_theta",PidCandidate::type_float);
353 
354  case em_evtgen_phi:
355  return make_pair("em_evtgen_phi",PidCandidate::type_float);
356 
357  case em_evtgen_eta:
358  return make_pair("em_evtgen_eta",PidCandidate::type_float);
359 
360  case em_evtgen_charge:
361  return make_pair("em_evtgen_charge",PidCandidate::type_int);
362 
363  case em_evtgen_is_scattered_lepton:
364  return make_pair("em_evtgen_is_scattered_lepton",PidCandidate::type_uint);
365 
366  // ------
367 
368  case em_reco_x_e:
369  return make_pair("em_reco_x_e",PidCandidate::type_float);
370 
371  case em_reco_y_e:
372  return make_pair("em_reco_y_e",PidCandidate::type_float);
373 
374  case em_reco_q2_e:
375  return make_pair("em_reco_q2_e",PidCandidate::type_float);
376 
377  case em_reco_w_e:
378  return make_pair("em_reco_w_e",PidCandidate::type_float);
379 
380  // ------
381 
382  default:
383  cout << "PidCandidate::get_property_info - Fatal Error - unknown index " << prop_id << endl;
384  exit(1);
385  }
386 }
387 
388 
389 bool
390 PidCandidate::check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type)
391 {
392  pair<const string,PROPERTY_TYPE> property_info = get_property_info(prop_id);
393  if (property_info.second != prop_type)
394  {
395  return false;
396  }
397  return true;
398 }
399 
400 
401 string
403 {
404  switch(prop_type)
405  {
406  case type_int:
407  return "int";
408  case type_uint:
409  return "unsigned int";
410  case type_float:
411  return "float";
412  default:
413  return "unkown";
414  }
415 }