00001 #ifndef IG_OPEN_INVENTOR_IG_SO_RECT_COL_HIST_H
00002 # define IG_OPEN_INVENTOR_IG_SO_RECT_COL_HIST_H
00003
00004
00005
00006 # include "Iguana/Inventor/interface/IgSoShapeKit.h"
00007 # include <Inventor/fields/SoSFFloat.h>
00008 # include <Inventor/fields/SoSFUInt32.h>
00009 # include <Inventor/fields/SoSFBool.h>
00010 # include <Inventor/fields/SoMFFloat.h>
00011 # include <Inventor/fields/SoSFVec3f.h>
00012 # include <Inventor/fields/SoMFColor.h>
00013 # include <Inventor/fields/SoSFColor.h>
00014 # include <Inventor/SbVec3f.h>
00015
00016
00017
00018 # include <vector>
00019 # ifdef WIN32
00020 # include <SoWinLeaveScope.h>
00021 # endif
00022
00023
00024
00025
00026
00027
00028
00029 class IG_OPEN_INVENTOR_API IgSoRectColHist: public IgSoShapeKit
00030 {
00031
00032 SO_KIT_HEADER (IgSoRectColHist);
00033 SO_KIT_CATALOG_ENTRY_HEADER (shapeHints);
00034 SO_KIT_CATALOG_ENTRY_HEADER (faceSet);
00035
00036
00037
00038
00039 SO_KIT_CATALOG_ENTRY_HEADER (lineSet);
00040
00041
00042
00043 public:
00044 IgSoRectColHist ();
00045 static void initClass (void);
00046
00047 SoSFFloat radiusR;
00048 SoSFFloat radiusZ;
00049 SoSFFloat offsetR;
00050 SoSFFloat offsetZ;
00051 SoSFUInt32 numR;
00052 SoSFUInt32 numZ;
00053 SoMFFloat energies;
00054 SoSFFloat layer;
00055 SoSFVec3f center;
00056 SoMFColor faceColors;
00057 SoSFColor lineColor;
00058
00059
00060 SoSFBool logScale;
00061 SoSFFloat scaleFactor;
00062 SoSFFloat maxDist;
00063
00064 SoSFFloat barrelMaxEta;
00065 SoSFFloat beamPipeTheta;
00066 SoSFFloat endcapMaxTheta;
00067
00068
00069
00070
00071 enum n_placement {TOP, RIGHT, BOTTOM, LEFT};
00072
00073 protected:
00074 virtual void refresh (void);
00075
00076 private:
00077 float m_maxEnergy;
00078 float m_barrelDeltaEta;
00079 float m_barrelMaxEta;
00080 float m_endcapDeltaTheta;
00081 float m_endcapMaxTheta;
00082 bool m_deltasSet;
00083
00084 const static unsigned IN;
00085 const static unsigned OUT;
00086
00087 void addOffset (SbVec3f& point, unsigned binNum);
00088 float angleToLeftHanded (float rightHandedAngle);
00089 std::vector<int> assignIndices (std::vector<std::vector<float> >& localEnergies, std::vector<int>& colorIndices);
00090 SbVec3f calcAnglePoint (float angle, float x, float y);
00091 void calcBinCorner (unsigned i, SbVec3f& left, SbVec3f& right);
00092 float calcLocalRadius (const SbVec3f& point, const SbVec3f& center) const;
00093 void calcLogEnergies (std::vector<std::vector<float> >& logEnergies);
00094 float convertAngle (float angle);
00095 SbVec3f convertCoordinates (const float radius, const float phi, const SbVec3f& center);
00096 void determineAngularDelta (void);
00097 n_placement findBinPlacement (const unsigned binIndex);
00098 int findMaxEnergyBin (std::vector<std::vector<float> >& energies);
00099 float getBinAngle (unsigned binNum, bool isLeftPoint);
00100 SbVec3f projectPoint (const float energy, const SbVec3f& point, const SbVec3f& center);
00101 void scaleEnergies (std::vector<std::vector<float> >& energies);
00102 void setLogEnergies (std::vector<std::vector<float> >& energies);
00103
00104 float etaToTheta (float eta);
00105 float thetaToEta (float theta);
00106 };
00107
00108
00109
00110
00111 # ifdef WIN32
00112 # include <SoWinEnterScope.h>
00113 # endif
00114
00115 #endif // IG_OPEN_INVENTOR_IG_SO_RECT_HIST_H
00116