Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:22:00

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