Changeset 9947 for trunk/Mars/msimreflector/MMirrorHex.cc
- Timestamp:
- 09/29/10 08:07:08 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.