Changeset 8399
- Timestamp:
- 04/12/07 14:08:56 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mgeom
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r8385 r8399 20 20 ! Author(s): Markus Gaug 03/2004 <mailto:markus@ifae.es> 21 21 ! 22 ! Copyright: MAGIC Software Development, 2000-200 522 ! Copyright: MAGIC Software Development, 2000-2007 23 23 ! 24 24 \* ======================================================================== */ … … 48 48 // ---------- 49 49 // - added fNumAreas 50 // - added fNumSectors 51 // 52 // Version 4: 53 // ---------- 54 // - added fMaxRadius 55 // - added fMinRadius 56 // 57 // Version 5: 58 // ---------- 59 // - added fNumPixInSector 60 // - added fNumPixWithAidx 61 // - removed fNumSectors 62 // - removed fNumAreas 50 63 // 51 64 ///////////////////////////////////////////////////////////////////////////// … … 72 85 MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title) 73 86 : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), 74 87 fPixels(npix), fMaxRadius(1), fMinRadius(1), fPixRatio(npix), fPixRatioSqrt(npix) 75 88 { 76 89 fName = name ? name : "MGeomCam"; … … 145 158 void MGeomCam::CalcNumSectors() 146 159 { 147 fNumSectors = 0;148 149 160 for (UInt_t i=0; i<fNumPixels; i++) 150 161 { 151 162 const Int_t s = (*this)[i].GetSector(); 152 163 153 if (s> fNumSectors)154 fNum Sectors = s;155 } 156 157 fNumSectors++;164 if (s>=fNumPixInSector.GetSize()) 165 fNumPixInSector.Set(s+1); 166 167 fNumPixInSector[s]++; 168 } 158 169 } 159 170 … … 165 176 void MGeomCam::CalcNumAreas() 166 177 { 167 fNumAreas = 0;168 169 178 for (UInt_t i=0; i<fNumPixels; i++) 170 179 { 171 180 const Int_t s = (*this)[i].GetAidx(); 172 181 173 if (s> fNumAreas)174 fNum Areas = s;175 } 176 177 fNumAreas++;182 if (s>=fNumPixWithAidx.GetSize()) 183 fNumPixWithAidx.Set(s+1); 184 185 fNumPixWithAidx[s]++; 186 } 178 187 } 179 188 … … 184 193 void MGeomCam::CalcMaxRadius() 185 194 { 186 fMaxRadius.Set( fNumAreas+1);187 fMinRadius.Set( fNumAreas+1);188 189 for ( Int_t i=0; i<fNumAreas+1; i++)195 fMaxRadius.Set(GetNumAreas()+1); 196 fMinRadius.Set(GetNumAreas()+1); 197 198 for (UInt_t i=0; i<GetNumAreas()+1; i++) 190 199 { 191 200 fMaxRadius[i] = 0.; … … 299 308 Float_t MGeomCam::GetMaxRadius(const Int_t i) const 300 309 { 301 return i<-1 || i> fNumAreas? -1 : fMaxRadius[i+1];310 return i<-1 || i>=(Int_t)GetNumAreas() ? -1 : fMaxRadius[i+1]; 302 311 } 303 312 … … 308 317 Float_t MGeomCam::GetMinRadius(const Int_t i) const 309 318 { 310 return i<-1 || i> fNumAreas? -1 : fMinRadius[i+1];319 return i<-1 || i>=(Int_t)GetNumAreas() ? -1 : fMinRadius[i+1]; 311 320 } 312 321 -
trunk/MagicSoft/Mars/mgeom/MGeomCam.h
r7360 r8399 11 11 #include <TArrayF.h> 12 12 #endif 13 #ifndef ROOT_TArrayS 14 #include <TArrayS.h> 15 #endif 13 16 14 17 class TVector2; … … 19 22 { 20 23 private: 21 UInt_t fNumPixels; // Number of pixels in this camera24 UInt_t fNumPixels; // Number of pixels in this camera 22 25 23 Float_t fCamDist; // [m] Average distance of the camera from the mirror24 Float_t fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees26 Float_t fCamDist; // [m] Average distance of the camera from the mirror 27 Float_t fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees 25 28 26 TObjArray fPixels; // Array of singel pixels storing the geometry29 TObjArray fPixels; // Array of singel pixels storing the geometry 27 30 28 TArrayF fMaxRadius; // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout)29 TArrayF fMinRadius; // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout)30 TArrayF fPixRatio; // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons)31 TArrayF fPixRatioSqrt; // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons)31 TArrayF fMaxRadius; // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout) 32 TArrayF fMinRadius; // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout) 33 TArrayF fPixRatio; // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons) 34 TArrayF fPixRatioSqrt; // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons) 32 35 33 Int_t fNumSectors; // Number of sectors 34 Int_t fNumAreas; // Number of different pixel sizes 36 TArrayS fNumPixInSector; // Number of pixels in sector 37 TArrayS fNumPixWithAidx; // Number of pixels with one pixel sizes 38 39 // Int_t fNumSectors; // Number of sectors 40 // Int_t fNumAreas; // Number of different pixel sizes 35 41 36 42 protected: … … 71 77 Float_t GetAngle(UShort_t i, UShort_t j=0) const; 72 78 73 UInt_t GetNumSectors() const { return fNumSectors; } 74 UInt_t GetNumAreas() const { return fNumAreas; } 75 Float_t GetPixRatio(UInt_t i) const; 76 Float_t GetPixRatioSqrt(UInt_t i) const; 79 Float_t GetPixRatio(UInt_t i) const; 80 Float_t GetPixRatioSqrt(UInt_t i) const; 81 82 UInt_t GetNumSectors() const { return fNumPixInSector.GetSize(); } 83 UInt_t GetNumAreas() const { return fNumPixWithAidx.GetSize(); } 84 85 UShort_t GetNumPixInSector(UInt_t i) const { return (UShort_t)fNumPixInSector[i]; } 86 UShort_t GetNumPixWithAidx(UInt_t i) const { return (UShort_t)fNumPixWithAidx[i]; } 77 87 78 88 MGeomPix &operator[](Int_t i); … … 94 104 virtual void Print(Option_t *opt=NULL) const; 95 105 96 ClassDef(MGeomCam, 4) // Geometry base class for the camera106 ClassDef(MGeomCam, 5) // Geometry base class for the camera 97 107 }; 98 108
Note:
See TracChangeset
for help on using the changeset viewer.