EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EICPIDParticlev1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EICPIDParticlev1.h
1 // TeLogLikelyhood emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef EICPID_EICPIDParticleV1_H
4 #define EICPID_EICPIDParticleV1_H
5 
6 #include <climits> // for INT_MIN, ULONG_LONG_MAX
7 #include <cmath>
8 #include <cstdint>
9 #include <iostream>
10 #include <map>
11 
12 #include "EICPIDDefs.h"
13 #include "EICPIDParticle.h"
14 
16 {
17  public:
18  EICPIDParticlev1() = default;
19  explicit EICPIDParticlev1(const EICPIDParticle* g4hit);
20  ~EICPIDParticlev1() override = default;
21  void identify(std::ostream& os = std::cout) const override;
22  void Reset() override;
23 
24  EICPIDDefs::keytype get_id() const override { return m_id; }
25  void set_id(const EICPIDDefs::keytype i) override { m_id = i; }
26 
29  void set_LogLikelyhood(EICPIDDefs::PIDCandidate pid, EICPIDDefs::PIDDetector det, float LogLikelyhood) override;
30 
31  bool has_property(const PROPERTY prop_id) const override;
32  float get_property_float(const PROPERTY prop_id) const override;
33  int get_property_int(const PROPERTY prop_id) const override;
34  unsigned int get_property_uint(const PROPERTY prop_id) const override;
35  void set_property(const PROPERTY prop_id, const float value) override;
36  void set_property(const PROPERTY prop_id, const int value) override;
37  void set_property(const PROPERTY prop_id, const unsigned int value) override;
38 
39  protected:
40  unsigned int get_property_nocheck(const PROPERTY prop_id) const override;
41  void set_property_nocheck(const PROPERTY prop_id, const unsigned int ui) override { prop_map[prop_id] = ui; }
42 
44 
46  typedef uint8_t prop_id_t;
48  typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
49 
51  union u_property
52  {
53  float fdata;
54  int32_t idata;
56 
57  u_property(int32_t in)
58  : idata(in)
59  {
60  }
62  : uidata(in)
63  {
64  }
65  u_property(float in)
66  : fdata(in)
67  {
68  }
70  : uidata(0)
71  {
72  }
73 
74  prop_storage_t get_storage() const { return uidata; }
75  };
76 
79 
80  typedef std::pair<EICPIDDefs::PIDCandidate, EICPIDDefs::PIDDetector> LogLikelyhoodMapKey_t;
81  std::map<LogLikelyhoodMapKey_t, float> m_LogLikelyhoodMap;
82 
83  ClassDefOverride(EICPIDParticlev1, 1)
84 };
85 
86 #endif