Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:12:31

0001 #ifndef PIDCANDIDATEv1_H__
0002 #define PIDCANDIDATEv1_H__
0003 
0004 #include "PidCandidate.h"
0005 
0006 #ifdef __CINT__
0007 #include <stdint.h>
0008 #else
0009 #include <cstdint>
0010 #endif
0011 #include <iostream>
0012 #include <map>
0013 
0014 class PidCandidatev1 : public PidCandidate
0015 {
0016 public:
0017   PidCandidatev1();
0018   explicit PidCandidatev1(const PidCandidate &tc);
0019   virtual ~PidCandidatev1() {}
0020 
0021   void identify(std::ostream& os  = std::cout) const;
0022 
0023   void Reset();
0024 
0025   void set_candidate_id(const int i) { _candidateid = i; }
0026   int get_candidate_id() const { return _candidateid; }
0027 
0028   virtual void print() const;
0029 
0030   bool  has_property(const PROPERTY prop_id) const;
0031   float get_property_float(const PROPERTY prop_id) const;
0032   int   get_property_int(const PROPERTY prop_id) const;
0033   unsigned int   get_property_uint(const PROPERTY prop_id) const;
0034   void  set_property(const PROPERTY prop_id, const float value);
0035   void  set_property(const PROPERTY prop_id, const int value);
0036   void  set_property(const PROPERTY prop_id, const unsigned int value);
0037 
0038 protected:
0039   unsigned int get_property_nocheck(const PROPERTY prop_id) const;
0040   void set_property_nocheck(const PROPERTY prop_id,const unsigned int ui) {prop_map[prop_id]=ui;}
0041   int _candidateid;
0042 
0043   //! storage types for additional property
0044   typedef uint8_t prop_id_t;
0045   typedef uint32_t prop_storage_t;
0046   typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
0047 
0048   //! convert between 32bit inputs and storage type prop_storage_t
0049   union u_property{
0050     float fdata;
0051     int32_t idata;
0052     uint32_t uidata;
0053 
0054     u_property(int32_t in): idata(in) {}
0055     u_property(uint32_t in): uidata(in) {}
0056     u_property(float in): fdata(in) {}
0057     u_property(): uidata(0) {}
0058 
0059     prop_storage_t get_storage() const {return uidata;}
0060   };
0061 
0062   //! container for additional property
0063   prop_map_t prop_map;
0064 
0065   ClassDef(PidCandidatev1,2)
0066 };
0067 
0068 #endif