Changeset 9947
- Timestamp:
- 09/29/10 08:07:08 (14 years ago)
- Location:
- trunk/Mars
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/Changelog
r9945 r9947 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2010/09/29 Thomas Bretz 22 23 * msimreflector/MMirrorHex.[h,cc]: 24 - implemented WriteM 25 - implemented new class MMirrorHex90 26 27 * msimreflector/SimReflectorLinkDef.h: 28 - added MMirrorHex90 29 30 * msimreflector/MMirrorDisk.[h,cc], msimreflector/MMirrorSquare.[h,cc]: 31 - implemented WriteM 32 33 * msimreflector/MReflector.[h,cc]: 34 - added function to write a file with a reflector definition 35 36 * msimreflector/MMirror.h: 37 - added virtual WriteM 38 - added several Getter for Z, Nx, Ny, Nz and Shape 39 40 20 41 21 42 2010/09/28 Thomas Bretz -
trunk/Mars/NEWS
r9937 r9947 69 69 70 70 * Added reading of re-used corsika showers (only supported if MMCS is used) 71 72 * Added new mirror type MMirrorHex90 (MMirrorHex rotated by 90deg) 71 73 72 74 ;star: -
trunk/Mars/msimreflector/MMirror.h
r9565 r9947 56 56 Double_t X() const { return fPos.X(); } 57 57 Double_t Y() const { return fPos.Y(); } 58 Double_t Z() const { return fPos.Z(); } 59 60 Double_t Nx() const { return fNorm.X(); } 61 Double_t Ny() const { return fNorm.Y(); } 62 Double_t Nz() const { return fNorm.Z(); } 58 63 59 64 TVector2 GetPosXY() const { return fPos.XYvector(); } … … 65 70 66 71 Double_t GetDist() const { return fPos.Perp(); } 72 Int_t GetShape() const { return fShape; } 67 73 68 74 virtual Double_t GetMaxR() const=0;// { return TMath::Max(fMaxRX, fMaxRY); } … … 86 92 87 93 virtual Int_t ReadM(const TObjArray &tok)=0; 94 virtual void WriteM(std::ostream &out) const=0; 88 95 89 96 // TObject -
trunk/Mars/msimreflector/MMirrorDisk.cc
r9594 r9947 166 166 return 1; 167 167 } 168 169 // ------------------------------------------------------------------------ 170 // 171 void MMirrorDisk::WriteM(ostream &out) const 172 { 173 out << fR*2; 174 } -
trunk/Mars/msimreflector/MMirrorDisk.h
r9371 r9947 22 22 23 23 Int_t ReadM(const TObjArray &tok); 24 void WriteM(std::ostream &out) const; 24 25 25 26 //TObject -
trunk/Mars/msimreflector/MMirrorHex.cc
r9371 r9947 184 184 return 1; 185 185 } 186 187 // ------------------------------------------------------------------------ 188 // 189 void MMirrorHex::WriteM(ostream &out) const 190 { 191 out << fD*2; 192 } 193 194 // ------------------------------------------------------------------------ 195 // 196 // Check if the given position coincides with the mirror. The position 197 // is assumed to be the incident point on the mirror's surface. 198 // 199 // The coordinates are in the mirrors coordinate frame. 200 // 201 // The action should coincide with what is painted in Paint() 202 // 203 Bool_t MMirrorHex90::HasHit(const MQuaternion &p) const 204 { 205 // p is the incident point in the mirror in the mirror's 206 // coordinate frame 207 208 // Black spot in the mirror center (here we can fairly ignore 209 // the distance from the plane to the mirror surface, as long 210 // as the black spot does not become too large) 211 if (p.R2()<0.5*0.5) 212 return kFALSE; 213 214 // 215 // Now check if point is outside of hexagon; just check x coordinate 216 // in three coordinate systems: the default one, in which two sides of 217 // the hexagon are paralel to the y axis (see camera displays) and two 218 // more, rotated with respect to that one by +- 60 degrees. 219 // 220 if (TMath::Abs(p.Y())>fD) 221 return kFALSE; 222 223 const Double_t dxs = p.X()*fgSin60; 224 const Double_t dyc = p.Y()*fgCos60; 225 226 if (TMath::Abs(dxs+dyc)>fD) 227 return kFALSE; 228 229 if (TMath::Abs(dxs-dyc)>fD) 230 return kFALSE; 231 232 return kTRUE; 233 } 234 235 // ------------------------------------------------------------------------ 236 // 237 // Paint the mirror in x/y. 238 // 239 // The graphic should coincide with the action in HasHit 240 // 241 void MMirrorHex90::Paint(Option_t *opt) 242 { 243 MHexagon h; 244 TEllipse e; 245 h.SetFillColor(18); 246 if (!TString(opt).Contains("line", TString::kIgnoreCase)) 247 { 248 h.SetFillColor(17); 249 h.SetLineStyle(0); 250 e.SetLineStyle(0); 251 e.SetFillColor(gPad->GetFillColor()); 252 } 253 254 if (TString(opt).Contains("same", TString::kIgnoreCase)) 255 { 256 h.SetFillStyle(0); 257 e.SetFillStyle(0); 258 } 259 260 h.PaintHexagon(X(), Y(), fD*2, TMath::Pi()/2); 261 262 if (!TString(opt).Contains("border", TString::kIgnoreCase)) 263 e.PaintEllipse(X(), Y(), 0.5, 0.5, 0, 360, 0); 264 } -
trunk/Mars/msimreflector/MMirrorHex.h
r9573 r9947 8 8 class MMirrorHex : public MMirror 9 9 { 10 pr ivate:10 protected: 11 11 const static Double_t fgCos30; 12 12 const static Double_t fgCos60; … … 30 30 31 31 Int_t ReadM(const TObjArray &tok); 32 void WriteM(std::ostream &out) const; 32 33 33 34 // TObject … … 38 39 }; 39 40 41 class MMirrorHex90 : public MMirrorHex 42 { 43 public: 44 MMirrorHex90() : MMirrorHex() { } 45 46 // MMirror 47 Bool_t HasHit(const MQuaternion &p) const; 48 49 // TObject 50 void Paint(Option_t *); 51 52 ClassDef(MMirrorHex90, 1) // A spherical hexagon type mirror (MMirrorHex rotated by 90deg) 53 }; 54 40 55 #endif -
trunk/Mars/msimreflector/MReflector.cc
r9565 r9947 351 351 } 352 352 353 // ------------------------------------------------------------------------ 354 // 355 Bool_t MReflector::WriteFile(TString fname) const 356 { 357 gSystem->ExpandPathName(fname); 358 359 ofstream fout(fname); 360 if (!fout) 361 { 362 *fLog << err << "Cannot open file " << fname << ": "; 363 *fLog << (errno!=0?strerror(errno):"Insufficient memory for decompression") << endl; 364 return kFALSE; 365 } 366 367 TIter Next(&fMirrors); 368 MMirror *m = 0; 369 while ((m=static_cast<MMirror*>(Next()))) 370 { 371 // x: x-coordinate of the mirror's center 372 // y: y-coordinate of the mirror's center 373 // z: z-coordinate of the mirror's center 374 // nx: x-component of the normal vecor in the mirror center 375 // ny: y-component of the normal vecor in the mirror center 376 // nz: z-component of the normal vecor in the mirror center 377 // [shape]: S for spherical <default>, P for parabolic 378 // F: Focal distance of a spherical mirror 379 // [psf]: This number is the psf given in the units of x,y,z and 380 // defined at the focal distance F. It can be used to overwrite 381 // the second argument given in ReadFile for individual mirrors. 382 // Type: A instance of a mirrot of the class Type MMirrorType is created 383 // (Type can be, for example, Hex for for MMirrorHex). 384 // ...: Additional arguments as defined in MMirrorType::ReadM 385 386 fout << setw(12) << m->X() << " "; 387 fout << setw(12) << m->Y() << " "; 388 fout << setw(12) << m->Z() << " "; 389 fout << setw(12) << m->Nx() << " "; 390 fout << setw(12) << m->Ny() << " "; 391 fout << setw(12) << m->Nz() << " "; 392 if (m->GetShape()==1) 393 fout << "P "; 394 fout << m->GetFocalLength() << " "; 395 // cout << m->GetSigmaPSF() << " "; 396 fout << m->ClassName()+7 << " "; 397 m->WriteM(fout); 398 fout << endl; 399 } 400 return kTRUE; 401 } 402 353 403 // -------------------------------------------------------------------------- 354 404 // -
trunk/Mars/msimreflector/MReflector.h
r9371 r9947 43 43 44 44 Bool_t ReadFile(TString fname, Double_t defpsf=-1); 45 Bool_t WriteFile(TString fname) const; 45 46 46 47 Double_t GetMaxR() const { return fMaxR; } -
trunk/Mars/msimreflector/SimReflectorLinkDef.h
r9903 r9947 13 13 #pragma link C++ class MMirrorDisk+; 14 14 #pragma link C++ class MMirrorHex+; 15 #pragma link C++ class MMirrorHex90+; 15 16 16 17 #endif
Note:
See TracChangeset
for help on using the changeset viewer.