Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:07

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef EICEVENTHEADERV1_H
0004 #define EICEVENTHEADERV1_H
0005 
0006 #include "EicEventHeader.h"
0007 
0008 #include <cstdint>
0009 #include <iostream>
0010 #include <map>
0011 
0012 class EicEventHeaderv1 : public EicEventHeader
0013 {
0014  public:
0015   EicEventHeaderv1() {}
0016   explicit EicEventHeaderv1(const EicEventHeader *eicevt);
0017   ~EicEventHeaderv1() override {}
0018 
0019   //  void identify(std::ostream& os  = std::cout) const;
0020   void Reset() override;
0021 
0022   // property relates methods
0023   bool has_property(const PROPERTY prop_id) const override;
0024   float get_property_float(const PROPERTY prop_id) const override;
0025   int get_property_int(const PROPERTY prop_id) const override;
0026   unsigned int get_property_uint(const PROPERTY prop_id) const override;
0027   void set_property(const PROPERTY prop_id, const float value) override;
0028   void set_property(const PROPERTY prop_id, const int value) override;
0029   void set_property(const PROPERTY prop_id, const unsigned int value) override;
0030 
0031   // Generator specific values
0032   void set_eventgenerator_type(const int i) override { set_property(prop_eventgen, i); }
0033   int get_eventgenerator_type() const override { return get_property_int(prop_eventgen); }
0034 
0035   // Milou
0036   void set_milou_weight(const float val) override { set_property(prop_milou_weight, val); }
0037   float get_milou_weight() const override { return get_property_float(prop_milou_weight); }
0038   void set_milou_trueX(const float val) override { set_property(prop_milou_truex, val); }
0039   float get_milou_trueX() const override { return get_property_float(prop_milou_truex); }
0040   void set_milou_trueQ2(const float val) override { set_property(prop_milou_trueq2, val); }
0041   float get_milou_trueQ2() const override { return get_property_float(prop_milou_trueq2); }
0042 
0043   // DEMP
0044   void set_demp_weight(const float val) override { set_property(prop_demp_weight, val); }
0045   float get_demp_weight() const override { return get_property_float(prop_demp_weight); }
0046 
0047  protected:
0048   unsigned int get_property_nocheck(const PROPERTY prop_id) const override;
0049   void set_property_nocheck(const PROPERTY prop_id, const unsigned int ui) override { prop_map[prop_id] = ui; }
0050 
0051   //! storage types for properties
0052   typedef uint8_t prop_id_t;
0053   typedef uint32_t prop_storage_t;
0054   typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
0055   //! convert between 32bit inputs and storage type prop_storage_t
0056   union u_property
0057   {
0058     float fdata;
0059     int32_t idata;
0060     uint32_t uidata;
0061 
0062     u_property(int32_t in)
0063       : idata(in)
0064     {
0065     }
0066     u_property(uint32_t in)
0067       : uidata(in)
0068     {
0069     }
0070     u_property(float in)
0071       : fdata(in)
0072     {
0073     }
0074     u_property()
0075       : uidata(0)
0076     {
0077     }
0078 
0079     prop_storage_t get_storage() const { return uidata; }
0080   };
0081 
0082   //! container for  properties
0083   prop_map_t prop_map;
0084 
0085   ClassDefOverride(EicEventHeaderv1, 1)
0086 };
0087 
0088 #endif