Changeset 2463 for trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
- Timestamp:
- 11/04/03 11:32:57 (21 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.