00001 #ifndef IG_OPEN_INVENTOR_IG_SO_LEGO_PLOT_H 00002 # define IG_OPEN_INVENTOR_IG_SO_LEGO_PLOT_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "Iguana/Inventor/interface/IgSoShapeKit.h" 00007 # include <Inventor/fields/SoSFFloat.h> 00008 # include <Inventor/fields/SoSFInt32.h> 00009 # include <Inventor/fields/SoSFBool.h> 00010 # include <map> 00011 # ifdef WIN32 00012 # include <SoWinLeaveScope.h> 00013 # endif 00014 00015 //<<<<<< PUBLIC DEFINES >>>>>> 00016 //<<<<<< PUBLIC CONSTANTS >>>>>> 00017 //<<<<<< PUBLIC TYPES >>>>>> 00018 //<<<<<< PUBLIC VARIABLES >>>>>> 00019 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00020 //<<<<<< CLASS DECLARATIONS >>>>>> 00021 00024 class IgSbLegoValue 00025 { 00026 public: 00027 IgSbLegoValue (const float emEnergy, const float Energy) : emE (emEnergy), E (Energy) {} 00028 IgSbLegoValue &operator+= (const IgSbLegoValue &x) { emE += x.emE; E += x.E; return *this; } 00029 00030 float emE; 00031 float E; 00032 }; 00033 00036 class IgSbLegoBin 00037 { 00038 public: 00039 IgSbLegoBin (const int i, const int j) : ix (i), iy (j) {} 00040 int ix; 00041 int iy; 00042 }; 00043 00044 struct IgSbLegoBinCompare 00045 { 00046 bool operator() (const IgSbLegoBin &lb1, const IgSbLegoBin &lb2) const 00047 { 00048 return lb1.ix < lb2.ix || (lb1.ix == lb2.ix && lb1.iy < lb2.iy); 00049 } 00050 }; 00051 00052 typedef std::map<IgSbLegoBin, IgSbLegoValue, IgSbLegoBinCompare> IgSbLegoHistogram; 00053 00058 class IG_OPEN_INVENTOR_API IgSoLegoPlot : public IgSoShapeKit 00059 { 00060 SO_KIT_HEADER (IgSoLegoPlot); 00061 SO_KIT_CATALOG_ENTRY_HEADER (phiLabels); 00062 SO_KIT_CATALOG_ENTRY_HEADER (etaLabels); 00063 SO_KIT_CATALOG_ENTRY_HEADER (grid); 00064 SO_KIT_CATALOG_ENTRY_HEADER (font); 00065 SO_KIT_CATALOG_ENTRY_HEADER (labels); 00066 SO_KIT_CATALOG_ENTRY_HEADER (labelScale); 00067 SO_KIT_CATALOG_ENTRY_HEADER (labelScaleFont); 00068 SO_KIT_CATALOG_ENTRY_HEADER (labelScaleOffset); 00069 SO_KIT_CATALOG_ENTRY_HEADER (labelScaleText); 00070 SO_KIT_CATALOG_ENTRY_HEADER (labelX); 00071 SO_KIT_CATALOG_ENTRY_HEADER (labelXOffset); 00072 SO_KIT_CATALOG_ENTRY_HEADER (labelXText); 00073 SO_KIT_CATALOG_ENTRY_HEADER (labelZ); 00074 SO_KIT_CATALOG_ENTRY_HEADER (labelZOffset); 00075 SO_KIT_CATALOG_ENTRY_HEADER (labelZText); 00076 SO_KIT_CATALOG_ENTRY_HEADER (legos); 00077 00078 public: 00079 IgSoLegoPlot (void); 00080 static void initClass (void); 00081 00082 SoSFInt32 divsPhi; 00083 SoSFInt32 divsEta; 00084 SoSFFloat heightScale; 00085 SoSFFloat maxEta; 00086 SoSFFloat minEnergy; //< sets the minimum enery to be displayed 00087 SoSFBool displayNegTowers; //< switch ON/OFF the display of negative towers 00088 00089 void setData (const IgSbLegoHistogram &histo); 00090 00091 protected: 00092 virtual void refresh (void); 00093 }; 00094 00095 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00096 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00097 00098 # ifdef WIN32 00099 # include <SoWinEnterScope.h> 00100 # endif 00101 #endif // IG_OPEN_INVENTOR_IG_SO_LEGO_PLOT_H