Changeset 9863
- Timestamp:
- 08/16/10 09:04:57 (14 years ago)
- Location:
- trunk/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/Changelog
r9862 r9863 26 26 * mgeom/MGeomCamFACT.[h,cc]: 27 27 - added 28 29 * mgeom/MGeomCamDwarf.[h,cc], mgeom/MGeomPix.[h,cc]: 30 - moved CalcXY to MGeomPix 31 - removed obsolete includes 32 33 * mgeom/MGeomCamFact.cc: 34 - removed obsolete includes 28 35 29 36 -
trunk/Mars/mgeom/MGeomCamDwarf.cc
r9462 r9863 43 43 #include "MGeomCamDwarf.h" 44 44 45 #include <iostream>46 47 45 #include <TMath.h> 48 #include <TArrayI.h>49 46 50 47 #include "MGeomPix.h" … … 116 113 // 117 114 // Calculate in the direction 0-5 (kind of sector) in the ring-th ring 118 // the x and y coordinate of the i-th pixel. The unitx are unity,119 // distance to (0,0) is retruned.120 //121 Double_t MGeomCamDwarf::CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y)122 {123 const Double_t kSqrt32 = MGeomPix::gsSin60;124 125 switch (dir)126 {127 case kDirCenter: // Center128 x = 0;129 y = 0;130 break;131 132 case kDirNE: // Direction North East133 x = ring-i*0.5;134 y = i*kSqrt32;135 break;136 137 case kDirN: // Direction North138 x = ring*0.5-i;139 y = ring*kSqrt32;140 break;141 142 case kDirNW: // Direction North West143 x = -(ring+i)*0.5;144 y = (ring-i)*kSqrt32;145 break;146 147 case kDirSW: // Direction South West148 x = 0.5*i-ring;149 y = -i*kSqrt32;150 break;151 152 case kDirS: // Direction South153 x = i-ring*0.5;154 y = -ring*kSqrt32;155 break;156 157 case kDirSE: // Direction South East158 x = (ring+i)*0.5;159 y = (-ring+i)*kSqrt32;160 break;161 }162 return TMath::Hypot(x, y);163 }164 165 // --------------------------------------------------------------------------166 //167 // Calculate in the direction 0-5 (kind of sector) in the ring-th ring168 115 // the x and y coordinate of the i-th pixel. The units are unity, 169 116 // distance to (0,0) is retruned. … … 193 140 Int_t MGeomCamDwarf::CalcNumPix(Double_t rad) 194 141 { 142 const Double_t r2 = rad*rad; 143 195 144 // 196 145 // add the first pixel to the list … … 206 155 // starting number to the ending number 207 156 // 208 for (Int_t dir= kDirNE; dir<=kDirSE; dir++)157 for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++) 209 158 { 210 159 for (int i=0; i<ring; i++) 211 160 { 212 161 Double_t x, y; 213 if ( CalcXY(dir, ring, i, x, y)<rad)162 if (MGeomPix::CalcXY(dir, ring, i, x, y)<r2) 214 163 n++; 215 164 } … … 244 193 for (int ring=1; ring<=rings; ring++) 245 194 { 246 for (Int_t dir= kDirNE; dir<=kDirSE; dir++)195 for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++) 247 196 { 248 197 for (int i=0; i<ring; i++) 249 198 { 250 199 Double_t x, y; 251 CalcXY(dir, ring, i, x, y);200 MGeomPix::CalcXY(dir, ring, i, x, y); 252 201 SetAt(cnt++, MGeomPix(x*diameter, y*diameter, diameter)); 253 202 } … … 264 213 // units for diameter are mm 265 214 215 const Double_t r2 = rad*rad; 216 266 217 // 267 218 // add the first pixel to the list … … 276 227 Int_t n = 0; 277 228 278 for (Int_t dir= kDirNE; dir<=kDirSE; dir++)229 for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++) 279 230 { 280 231 for (int i=0; i<ring; i++) 281 232 { 282 233 Double_t x, y; 283 if ( CalcXY(dir, ring, i, x, y)<rad)234 if (MGeomPix::CalcXY(dir, ring, i, x, y)<r2) 284 235 SetAt(cnt+n++, MGeomPix(x*diameter, y*diameter, diameter)); 285 236 } -
trunk/Mars/mgeom/MGeomCamDwarf.h
r9385 r9863 9 9 { 10 10 private: 11 enum { kDirCenter, kDirNE, kDirN, kDirNW, kDirSW, kDirS, kDirSE }; 11 static Int_t CalcNumPix(Double_t rad); 12 static Int_t CalcNumPix(Int_t rings); 12 13 13 static Double_t CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y); 14 15 static Int_t CalcNumPix(Double_t rad); 16 static Int_t CalcNumPix(Int_t rings); 17 18 void CreateCam(Double_t diameter, Double_t rad); 19 void CreateCam(Double_t diameter, Int_t rings); 14 void CreateCam(Double_t diameter, Double_t rad); 15 void CreateCam(Double_t diameter, Int_t rings); 20 16 21 17 public: -
trunk/Mars/mgeom/MGeomCamFact.cc
r9464 r9863 39 39 #include "MGeomCamFact.h" 40 40 41 #include <iostream>42 41 43 42 #include <TMath.h> 44 #include <TArrayI.h>45 43 46 44 #include "MGeomCamDwarf.h" -
trunk/Mars/mgeom/MGeomPix.cc
r9385 r9863 209 209 } 210 210 211 // -------------------------------------------------------------------------- 212 // 213 // Calculate in the direction 0-5 (kind of sector) in the ring-th ring 214 // the x and y coordinate of the i-th pixel. The unitx are unity, 215 // distance to (0,0) is retruned. 216 // 217 Double_t MGeomPix::CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y) 218 { 219 switch (dir) 220 { 221 case kDirCenter: // Center 222 x = 0; 223 y = 0; 224 break; 225 226 case kDirNE: // Direction North East 227 x = ring-i*0.5; 228 y = i*gsSin60; 229 break; 230 231 case kDirN: // Direction North 232 x = ring*0.5-i; 233 y = ring*gsSin60; 234 break; 235 236 case kDirNW: // Direction North West 237 x = -(ring+i)*0.5; 238 y = (ring-i)*gsSin60; 239 break; 240 241 case kDirSW: // Direction South West 242 x = 0.5*i-ring; 243 y = -i*gsSin60; 244 break; 245 246 case kDirS: // Direction South 247 x = i-ring*0.5; 248 y = -ring*gsSin60; 249 break; 250 251 case kDirSE: // Direction South East 252 x = (ring+i)*0.5; 253 y = (-ring+i)*gsSin60; 254 break; 255 } 256 return x*x + y*y; 257 } 258 211 259 // ============================================================================== 212 260 /*
Note:
See TracChangeset
for help on using the changeset viewer.