Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:21

0001 #ifndef CALOBASE_RAWTOWER_H
0002 #define CALOBASE_RAWTOWER_H
0003 
0004 #include "RawTowerDefs.h"
0005 
0006 #include <phool/PHObject.h>
0007 #include <phool/phool.h>
0008 
0009 #include <cstddef>  // for size_t
0010 #include <iostream>
0011 #include <limits>
0012 #include <map>
0013 #include <string>  // for string
0014 #include <utility>
0015 
0016 class RawTower : public PHObject
0017 {
0018  public:
0019   //! key type for cell map which should be consistent with CellKeyType
0020   typedef unsigned long long CellKeyType;
0021 
0022   typedef std::map<CellKeyType, float> CellMap;
0023   typedef CellMap::iterator CellIterator;
0024   typedef CellMap::const_iterator CellConstIterator;
0025   typedef std::pair<CellIterator, CellIterator> CellRange;
0026   typedef std::pair<CellConstIterator, CellConstIterator> CellConstRange;
0027 
0028   typedef std::map<int, float> ShowerMap;
0029   typedef ShowerMap::iterator ShowerIterator;
0030   typedef ShowerMap::const_iterator ShowerConstIterator;
0031   typedef std::pair<ShowerIterator, ShowerIterator> ShowerRange;
0032   typedef std::pair<ShowerConstIterator, ShowerConstIterator> ShowerConstRange;
0033 
0034   ~RawTower() override {}
0035 
0036   void Reset() override { PHOOL_VIRTUAL_WARNING; }
0037   int isValid() const override
0038   {
0039     PHOOL_VIRTUAL_WARN("isValid()");
0040     return 0;
0041   }
0042   void identify(std::ostream& /*os*/ = std::cout) const override { PHOOL_VIRTUAL_WARN("identify()"); }
0043 
0044   virtual void set_id(RawTowerDefs::keytype) { PHOOL_VIRTUAL_WARN("set_id()"); }
0045   virtual RawTowerDefs::keytype get_id() const
0046   {
0047     PHOOL_VIRTUAL_WARN("get_id()");
0048     return 0;
0049   }
0050 
0051   virtual void set_key(RawTowerDefs::keytype id) { set_id(id); }
0052   virtual RawTowerDefs::keytype get_key() const { return get_id(); }
0053 
0054   virtual int get_bineta() const
0055   {
0056     PHOOL_VIRTUAL_WARN("get_bineta()");
0057     return -1;
0058   }
0059 
0060   virtual int get_bintheta() const
0061   {
0062     return get_bineta();
0063   }
0064 
0065   virtual int get_binphi() const
0066   {
0067     PHOOL_VIRTUAL_WARN("get_binphi()");
0068     return -1;
0069   }
0070 
0071   //! return layer ID assigned to tower
0072   virtual int get_binl() const
0073   {
0074     PHOOL_VIRTUAL_WARN("get_binl()");
0075     return -1;
0076   }
0077   virtual int get_column() const
0078   {
0079     PHOOL_VIRTUAL_WARN("get_column()");
0080     return -1;
0081   }
0082   virtual int get_row() const
0083   {
0084     PHOOL_VIRTUAL_WARN("get_row()");
0085     return -1;
0086   }
0087 
0088   //! energy assigned to the tower. Depending on stage of process and DST node name, it could be energy deposition, light yield or calibrated energies
0089   virtual double get_energy() const
0090   {
0091     PHOOL_VIRTUAL_WARN("get_energy()");
0092     return 0.0;
0093   }
0094   //! energy assigned to the tower. Depending on stage of process and DST node name, it could be energy deposition, light yield or calibrated energies
0095   virtual void set_energy(const double)
0096   {
0097     PHOOL_VIRTUAL_WARN("set_energy()");
0098     return;
0099   }
0100 
0101   //! energy assigned to the tower. Depending on stage of process and DST node name, it could be energy deposition, light yield or calibrated energies
0102   virtual double get_scint_gammas() const
0103   {
0104     PHOOL_VIRTUAL_WARN("get_scint_gammas()");
0105     return 0.0;
0106   }
0107   //! scint_gammas assigned to the tower. Depending on stage of process and DST node name, it could be scint_gammas deposition, light yield or calibrated energies
0108   virtual void set_scint_gammas(const double)
0109   {
0110     PHOOL_VIRTUAL_WARN("set_scint_gammas()");
0111     return;
0112   }
0113 
0114   //! energy assigned to the tower. Depending on stage of process and DST node name, it could be energy deposition, light yield or calibrated energies
0115   virtual double get_cerenkov_gammas() const
0116   {
0117     PHOOL_VIRTUAL_WARN("get_cerenkov_gammas()");
0118     return 0.0;
0119   }
0120   //! cerenkov_gammas assigned to the tower. Depending on stage of process and DST node name, it could be cerenkov_gammas deposition, light yield or calibrated energies
0121   virtual void set_cerenkov_gammas(const double)
0122   {
0123     PHOOL_VIRTUAL_WARN("set_cerenkov_gammas()");
0124     return;
0125   }
0126 
0127   //! Time stamp assigned to the tower. Depending on the tower maker, it could be rise time or peak time.
0128   virtual float get_time() const
0129   {
0130     PHOOL_VIRTUAL_WARN("get_time()");
0131     return std::numeric_limits<float>::signaling_NaN();
0132   }
0133   //! Time stamp assigned to the tower. Depending on the tower maker, it could be rise time or peak time.
0134   virtual void set_time(const float)
0135   {
0136     PHOOL_VIRTUAL_WARN("set_time()");
0137     return;
0138   }
0139 
0140   virtual bool empty_g4cells() const { return true; }
0141   virtual size_t size_g4cells() const { return 0; }
0142   virtual CellConstRange get_g4cells() const;
0143   virtual CellIterator find_g4cell(CellKeyType id);
0144   virtual CellConstIterator find_g4cell(CellKeyType id) const;
0145   virtual void add_ecell(const CellKeyType /*g4cellid*/, const float /*ecell*/)
0146   {
0147     PHOOL_VIRTUAL_WARN("add_ecell(const CellKeyType g4cellid, const float ecell)");
0148     return;
0149   }
0150   virtual void clear_g4cells() {}
0151 
0152   virtual bool empty_g4showers() const { return true; }
0153   virtual size_t size_g4showers() const { return 0; }
0154   virtual ShowerConstRange get_g4showers() const;
0155   virtual ShowerIterator find_g4shower(int /*id*/);
0156   virtual ShowerConstIterator find_g4shower(int /*id*/) const;
0157   virtual void add_eshower(const int /*g4showerid*/, const float /*eshower*/)
0158   {
0159     PHOOL_VIRTUAL_WARN("add_eshower(const unsigned int g4showerid, const float eshower)");
0160     return;
0161   }
0162   virtual void clear_g4showers() {}
0163 
0164   //! Procedure to add a new PROPERTY tag:
0165   //! 1.add new tag below with unique value,
0166   //! 2.add a short name to RawTower::get_property_info
0167   enum PROPERTY
0168   {  //
0169 
0170     //! Scintillation photon count or energy
0171     prop_scint_gammas = 1,
0172 
0173     //! Cherenkov photon count or energy
0174     prop_cerenkov_gammas = 2,
0175 
0176     //! max limit in order to fit into 8 bit unsigned number
0177     prop_MAX_NUMBER = std::numeric_limits<unsigned char>::max()
0178   };
0179 
0180   virtual bool has_property(const PROPERTY /*prop_id*/) const { return false; }
0181   virtual double get_property(const PROPERTY /*prop_id*/) const { return std::numeric_limits<float>::signaling_NaN(); }
0182   virtual void set_property(const PROPERTY /*prop_id*/, const double /*value*/) { return; }
0183   static const std::string get_property_info(PROPERTY prop_id);
0184 
0185  protected:
0186   RawTower() {}
0187 
0188   virtual unsigned int get_property_nocheck(const PROPERTY /*prop_id*/) const { return std::numeric_limits<unsigned int>::max(); }
0189   virtual void set_property_nocheck(const PROPERTY /*prop_id*/, const unsigned int) { return; }
0190 
0191   ClassDefOverride(RawTower, 1)
0192 };
0193 
0194 #endif