Changeset 2463 for trunk/MagicSoft/Mars/mgeom
- Timestamp:
- 11/04/03 11:32:57 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mgeom
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r2236 r2463 32 32 // interface of how to acccess the geometry information. 33 33 // 34 // 35 // Version 1: 36 // ---------- 37 // - first implementation 38 // 39 // Version 2: 40 // ---------- 41 // - added fPixRatio 42 // - added fPixRatioSqrt 43 // 44 // 34 45 /////////////////////////////////////////////////////////////////////// 35 46 #include "MGeomCam.h" … … 59 70 // 60 71 MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title) 61 : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), fPixels(npix) 72 : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), fPixels(npix), fPixRatio(npix), fPixRatioSqrt(npix) 62 73 { 63 74 fName = name ? name : "MGeomCam"; … … 87 98 // -------------------------------------------------------------------------- 88 99 // 100 // Calculate and fill the arrays storing the ratio of the area of a pixel 101 // i to the pixel 0 and its square root. 102 // The precalculation is done for speed reasons. Having an event the 103 // ratio would be calculated at least once for each pixel which is 104 // an enormous amount of numerical calculations, which are time 105 // consuming and which can be avoided doing the precalculation. 106 // 107 void MGeomCam::CalcPixRatio() 108 { 109 const Double_t a0 = (*this)[0].GetA(); 110 111 for (UInt_t i=0; i<fNumPixels; i++) 112 { 113 fPixRatio[i] = a0/(*this)[i].GetA(); 114 fPixRatioSqrt[i] = TMath::Sqrt(fPixRatio[i]); 115 } 116 } 117 118 // -------------------------------------------------------------------------- 119 // 89 120 // Set the kIsOuterRing flag for all pixels which have a outermost pixel 90 121 // as Next Neighbor and don't have the kIsOutermostRing flag itself. … … 103 134 { 104 135 fNumSectors = 0; 136 137 for (UInt_t i=0; i<fNumPixels; i++) 138 { 139 const UInt_t s = (*this)[i].GetSector(); 140 141 if (s>fNumSectors) 142 fNumSectors = s; 143 } 144 145 fNumSectors++; 146 } 147 148 // -------------------------------------------------------------------------- 149 // 150 // Calculate the maximum radius of the camera. This is ment for GUI layout. 151 // 152 void MGeomCam::CalcMaxRadius() 153 { 154 fMaxRadius = 0; 105 155 106 156 for (UInt_t i=0; i<fNumPixels; i++) 107 157 { 108 158 const MGeomPix &pix = (*this)[i]; 109 const UInt_t s = pix.GetSector();110 111 if (s>fNumSectors)112 fNumSectors = s;113 }114 115 fNumSectors++;116 }117 118 // --------------------------------------------------------------------------119 //120 // Calculate the maximum radius of the camera. This is ment for GUI layout.121 //122 void MGeomCam::CalcMaxRadius()123 {124 fMaxRadius = 0;125 126 for (UInt_t i=0; i<fNumPixels; i++)127 {128 const MGeomPix &pix = (*this)[i];129 159 130 160 const Float_t x = pix.GetX(); … … 147 177 Float_t MGeomCam::GetPixRatio(UInt_t i) const 148 178 { 149 return i<fNumPixels ? (*this)[0].GetA()/(*this)[i].GetA() : 0; 179 // Former: (*this)[0].GetA()/(*this)[i].GetA(); 180 // The const_cast is necessary to support older root version 181 return i<fNumPixels ? const_cast<TArrayF&>(fPixRatio)[i] : 0; 182 } 183 184 // -------------------------------------------------------------------------- 185 // 186 // returns the square root of the ratio of the area of the pixel with 187 // index 0 to the pixel with the specified index i. 0 Is returned if 188 // the index argument is out of range. 189 // 190 Float_t MGeomCam::GetPixRatioSqrt(UInt_t i) const 191 { 192 // The const_cast is necessary to support older root version 193 return i<fNumPixels ? const_cast<TArrayF&>(fPixRatioSqrt)[i] : 0; 150 194 } 151 195 -
trunk/MagicSoft/Mars/mgeom/MGeomCam.h
r2236 r2463 8 8 #include <TObjArray.h> 9 9 #endif 10 #ifndef ROOT_TArrayF 11 #include <TArrayF.h> 12 #endif 10 13 11 14 class MGeomPix; … … 14 17 { 15 18 private: 16 UInt_t fNumPixels; // Number of pixels in this camera17 Float_t fMaxRadius; // maximum radius of the camera (eg. for GUI layout)19 UInt_t fNumPixels; // Number of pixels in this camera 20 Float_t fMaxRadius; // maximum radius of the camera (eg. for GUI layout) 18 21 19 Float_t fCamDist; // [m] Average distance of the camera from the mirror20 Float_t fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees22 Float_t fCamDist; // [m] Average distance of the camera from the mirror 23 Float_t fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees 21 24 22 TObjArray fPixels; // Array of singel pixels storing the geometry25 TObjArray fPixels; // Array of singel pixels storing the geometry 23 26 24 UInt_t fNumSectors; // Number of sectors 27 TArrayF fPixRatio; // Array storing the ratio between size of pixel idx and pixel 0 (for speed reasons) 28 TArrayF fPixRatioSqrt; // Array storing the square root ratio between size of pixel idx and pixel 0 (for speed reasons) 29 30 UInt_t fNumSectors; // Number of sectors 25 31 26 32 protected: 33 void CalcPixRatio(); 27 34 void CalcMaxRadius(); 28 35 void CalcNumSectors(); … … 42 49 UInt_t GetNumSectors() const { return fNumSectors; } 43 50 Float_t GetPixRatio(UInt_t i) const; 51 Float_t GetPixRatioSqrt(UInt_t i) const; 44 52 45 53 MGeomPix &operator[](Int_t i); … … 48 56 virtual void Print(Option_t *opt=NULL) const; 49 57 50 ClassDef(MGeomCam, 1) // Geometry base class for the camera58 ClassDef(MGeomCam, 2) // Geometry base class for the camera 51 59 }; 52 60 -
trunk/MagicSoft/Mars/mgeom/MGeomCamCT1.cc
r2236 r2463 58 58 CalcNumSectors(); 59 59 CalcMaxRadius(); 60 CalcPixRatio(); 60 61 } 61 62 -
trunk/MagicSoft/Mars/mgeom/MGeomCamCT1Daniel.cc
r2441 r2463 46 46 #include <math.h> // floor 47 47 48 /*49 #include "MLog.h"50 #include "MLogManip.h"51 */52 53 48 #include "MGeomPix.h" 54 49 … … 60 55 // CreateCam and CreateNN 61 56 // 62 //MGeomCamCT1::MGeomCamCT1(const char *name)63 // : MGeomCam(127, 4.88, name, "Geometry information of CT1 camera")64 // This is the geometry as used by Daniel :65 57 MGeomCamCT1Daniel::MGeomCamCT1Daniel(const char *name) 66 58 : MGeomCam(127, 4.8129, name, "Geometry information of CT1 camera") … … 70 62 CalcNumSectors(); 71 63 CalcMaxRadius(); 64 CalcPixRatio(); 72 65 } 73 66 -
trunk/MagicSoft/Mars/mgeom/MGeomCamECO1000.cc
r2236 r2463 48 48 // 49 49 MGeomCamECO1000::MGeomCamECO1000(const char *name) 50 : MGeomCam(577, 17, name, "Geometry information of Magic Camera")50 : MGeomCam(577, 34.5, name, "Geometry information of Magic Camera") 51 51 { 52 52 CreateCam(); … … 54 54 CalcNumSectors(); 55 55 CalcMaxRadius(); 56 CalcPixRatio(); 56 57 } 57 58 -
trunk/MagicSoft/Mars/mgeom/MGeomCamECO1000HG.cc
r2236 r2463 58 58 CalcNumSectors(); 59 59 CalcMaxRadius(); 60 CalcPixRatio(); 60 61 } 61 62 -
trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.cc
r2236 r2463 34 34 #include "MGeomCamMagic.h" 35 35 36 /*37 #include "MLog.h"38 #include "MLogManip.h"39 */40 41 36 #include "MGeomPix.h" 42 37 … … 53 48 CreateCam(); 54 49 CreateNN(); 50 CalcPixRatio(); 55 51 CalcNumSectors(); 56 52 CalcMaxRadius(); 53 CalcPixRatio(); 57 54 } 58 55 -
trunk/MagicSoft/Mars/mgeom/MGeomCamMagic919.cc
r2277 r2463 34 34 #include "MGeomCamMagic919.h" 35 35 36 /*37 #include "MLog.h"38 #include "MLogManip.h"39 */40 41 36 #include "MGeomPix.h" 42 37 … … 55 50 CreateNN(); 56 51 CalcMaxRadius(); 52 CalcPixRatio(); 57 53 } 58 54 -
trunk/MagicSoft/Mars/mgeom/MGeomCamMagicHG.cc
r2236 r2463 34 34 #include "MGeomCamMagicHG.h" 35 35 36 /*37 #include "MLog.h"38 #include "MLogManip.h"39 */40 41 36 #include "MGeomPix.h" 42 37 … … 55 50 CalcNumSectors(); 56 51 CalcMaxRadius(); 52 CalcPixRatio(); 57 53 } 58 54 -
trunk/MagicSoft/Mars/mgeom/MGeomCorsikaCT.cc
r2283 r2463 66 66 67 67 } 68 69 70 71 72 -
trunk/MagicSoft/Mars/mgeom/MGeomPix.cc
r2236 r2463 35 35 // MGeomPix. 36 36 // 37 // 38 // Version 1: 39 // ---------- 40 // - first implementation 41 // 42 // Version 2: 43 // ---------- 44 // - added fA 45 // 46 // 37 47 // FIXME: According to an agreement we have to change the name 'Id' 38 48 // to 'idx' … … 52 62 using namespace std; 53 63 64 const Float_t MGeomPix::gsTan60 = tan(60/kRad2Deg); 65 54 66 // -------------------------------------------------------------------------- 55 67 // 56 68 // Initializes one pixel 57 69 // 58 MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r, UInt_t s) : fX(x), fY(y), fD(r), fSector(s)70 MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r, UInt_t s) 59 71 { 60 72 // default constructor 61 } 62 63 // -------------------------------------------------------------------------- 64 // 65 // Return the area of the pixel. A hexagonal shape is assumed. 66 // 67 Float_t MGeomPix::GetA() const 68 { 69 return fD*fD*tan(60/kRad2Deg); 73 Set(x, y, r, s); 70 74 } 71 75 … … 126 130 << " y= " << fY 127 131 << " d= " << fD 132 << " A= " << fA 128 133 << endl ; 129 134 } -
trunk/MagicSoft/Mars/mgeom/MGeomPix.h
r2236 r2463 11 11 { 12 12 private: 13 static const Float_t gsTan60; // tan(60/kRad2Deg); 14 13 15 enum { 14 16 kIsInOutermostRing = BIT(22), 15 17 kIsInOuterRing = BIT(23), 16 18 kUserBits = 0x1fc000 // 14-21 are allowed 17 18 19 }; 19 20 20 Float_t fX; // [mm] the x coordinate of the center 21 Float_t fY; // [mm] the y coordinate of the center 22 Float_t fD; // [mm] the d coordinate of the pixel (dist between two parallel sides) 21 Float_t fX; // [mm] the x coordinate of the center 22 Float_t fY; // [mm] the y coordinate of the center 23 Float_t fD; // [mm] the d coordinate of the pixel (dist between two parallel sides) 24 Float_t fA; // [mm^2] Area of the pixel 23 25 24 26 Byte_t fNumNeighbors; // number of valid neighbors 25 27 Short_t fNeighbors[6]; // the IDs of the pixel next to it (we are assuming an hexagonal geometry) 26 28 27 UInt_t fSector; // Number of sector the pixels corresponds to29 UInt_t fSector; // Number of sector the pixels corresponds to 28 30 29 31 public: … … 32 34 void Print(Option_t *opt=NULL) const; 33 35 34 void Set(Float_t x, Float_t y, Float_t d, UInt_t s=0) { fX=x; fY=y; fD=d; f Sector=s; }36 void Set(Float_t x, Float_t y, Float_t d, UInt_t s=0) { fX=x; fY=y; fD=d; fA=d*d*gsTan60; fSector=s; } 35 37 36 38 void SetNeighbors(Short_t i0=-1, Short_t i1=-1, Short_t i2=-1, … … 38 40 39 41 void CheckOuterRing(const MGeomCam &cam); 40 /*41 void SetX(Float_t x) { fX = x; }42 void SetY(Float_t y) { fY = y; }43 void SetD(Float_t d) { fD = d; }44 void SetSector(UInt_t s) { fSector = s; }45 */46 42 47 43 Float_t GetX() const { return fX; } … … 50 46 UInt_t GetSector() const { return fSector; } 51 47 52 Float_t GetA() const ;48 Float_t GetA() const { return fA; /*fD*fD*gsTan60;*/ } 53 49 54 50 Byte_t GetNumNeighbors() const { return fNumNeighbors; }
Note:
See TracChangeset
for help on using the changeset viewer.