ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicEventHeaderv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicEventHeaderv1.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef EICEVENTHEADERV1_H
4 #define EICEVENTHEADERV1_H
5 
6 #include "EicEventHeader.h"
7 
8 #include <cstdint>
9 #include <iostream>
10 #include <map>
11 
13 {
14  public:
16  explicit EicEventHeaderv1(const EicEventHeader *eicevt);
17  ~EicEventHeaderv1() override {}
18 
19  // void identify(std::ostream& os = std::cout) const;
20  void Reset() override;
21 
22  // property relates methods
23  bool has_property(const PROPERTY prop_id) const override;
24  float get_property_float(const PROPERTY prop_id) const override;
25  int get_property_int(const PROPERTY prop_id) const override;
26  unsigned int get_property_uint(const PROPERTY prop_id) const override;
27  void set_property(const PROPERTY prop_id, const float value) override;
28  void set_property(const PROPERTY prop_id, const int value) override;
29  void set_property(const PROPERTY prop_id, const unsigned int value) override;
30 
31  // Generator specific values
32  void set_eventgenerator_type(const int i) override { set_property(prop_eventgen, i); }
33  int get_eventgenerator_type() const override { return get_property_int(prop_eventgen); }
34 
35  // Milou
36  void set_milou_weight(const float val) override { set_property(prop_milou_weight, val); }
37  float get_milou_weight() const override { return get_property_float(prop_milou_weight); }
38  void set_milou_trueX(const float val) override { set_property(prop_milou_truex, val); }
39  float get_milou_trueX() const override { return get_property_float(prop_milou_truex); }
40  void set_milou_trueQ2(const float val) override { set_property(prop_milou_trueq2, val); }
41  float get_milou_trueQ2() const override { return get_property_float(prop_milou_trueq2); }
42 
43  // DEMP
44  void set_demp_weight(const float val) override { set_property(prop_demp_weight, val); }
45  float get_demp_weight() const override { return get_property_float(prop_demp_weight); }
46 
47  protected:
48  unsigned int get_property_nocheck(const PROPERTY prop_id) const override;
49  void set_property_nocheck(const PROPERTY prop_id, const unsigned int ui) override { prop_map[prop_id] = ui; }
50 
52  typedef uint8_t prop_id_t;
53  typedef uint32_t prop_storage_t;
54  typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
56  union u_property {
57  float fdata;
58  int32_t idata;
59  uint32_t uidata;
60 
61  u_property(int32_t in)
62  : idata(in)
63  {
64  }
65  u_property(uint32_t in)
66  : uidata(in)
67  {
68  }
69  u_property(float in)
70  : fdata(in)
71  {
72  }
74  : uidata(0)
75  {
76  }
77 
78  prop_storage_t get_storage() const { return uidata; }
79  };
80 
83 
84  ClassDefOverride(EicEventHeaderv1, 1)
85 };
86 
87 #endif