Index: /trunk/Mars/Changelog
===================================================================
--- /trunk/Mars/Changelog	(revision 10089)
+++ /trunk/Mars/Changelog	(revision 10090)
@@ -37,2 +37,14 @@
      - added GetL
 
+   * mgeom/MGeomCamDwarf.cc:
+     - use the HitFrame from the base class with a slightly 
+       increased radius (no change in behaviour)
+
+   * mgeom/MGeomCam.[h,cc]:
+     - added HitFrame                                          
+
+   * msimreflector/MSimReflector.[h,cc]:
+     - implemented the possibility to overwrite the absorbing
+       size of the detector
+     - added fDetectorFrame
+
Index: /trunk/Mars/mgeom/MGeomCam.cc
===================================================================
--- /trunk/Mars/mgeom/MGeomCam.cc	(revision 10089)
+++ /trunk/Mars/mgeom/MGeomCam.cc	(revision 10090)
@@ -422,4 +422,25 @@
 // --------------------------------------------------------------------------
 //
+// Check if the photon which is flying along the trajectory u has passed
+// (or will pass) the frame of the camera (and consequently get
+// absorbed). The position p and direction u must be in the
+// telescope coordinate frame, which is z parallel to the focal plane,
+// x to the right and y upwards, looking from the mirror towards the camera.
+//
+// The units are cm.
+//
+Bool_t MGeomCam::HitFrame(MQuaternion p, const MQuaternion &u, Double_t margin) const
+{
+    if (margin<=0)
+        return HitFrame(p, u);
+
+    // z is defined from the mirror (0) to the camera (z>0).
+    // Thus we just propagate to the focal plane (z=fDist)
+    p.PropagateZ(u, GetCameraDist()*100); // m->cm
+    return p.R()<margin;
+}
+
+// --------------------------------------------------------------------------
+//
 // Check if the position given in the focal plane (so z can be ignored)
 // is a position which might hit the detector. It is meant to be a rough
@@ -583,5 +604,5 @@
 //  at the end.
 //
-// All pixel swith a center withing 1.75*GetT() are considered neiighbors,
+// All pixels with a center withing 1.75*GetT() are considered neighbors,
 // Only six neighbors are allowed.
 //
Index: /trunk/Mars/mgeom/MGeomCam.h
===================================================================
--- /trunk/Mars/mgeom/MGeomCam.h	(revision 10089)
+++ /trunk/Mars/mgeom/MGeomCam.h	(revision 10090)
@@ -122,4 +122,5 @@
 
     virtual Bool_t HitFrame(MQuaternion p, const MQuaternion &u) const { return kFALSE; }
+            Bool_t HitFrame(MQuaternion p, const MQuaternion &u, Double_t margin) const;
     virtual Bool_t HitDetector(const MQuaternion &p, Double_t offset=0) const;
 
Index: /trunk/Mars/mgeom/MGeomCamDwarf.cc
===================================================================
--- /trunk/Mars/mgeom/MGeomCamDwarf.cc	(revision 10089)
+++ /trunk/Mars/mgeom/MGeomCamDwarf.cc	(revision 10090)
@@ -101,11 +101,7 @@
 Bool_t MGeomCamDwarf::HitFrame(MQuaternion p, const MQuaternion &u) const
 {
-    // z is defined from the mirror (0) to the camera (z>0).
-    // Thus we just propagate to the focal plane (z=fDist)
-    //p -= 1700./u.Z()*u;
-    p.PropagateZ(u, GetCameraDist()*100); // m->cm
-
     // Add 10% to the max radius and convert from mm to cm
-    return p.R()<GetMaxRadius()*0.11;//TMath::Abs(p.X())<65 && TMath::Abs(p.Y())<65;
+    // FIXME: Why does the compiler complain without this cast?
+    return static_cast<const MGeomCam*>(this)->HitFrame(p, u, GetMaxRadius()*0.11);
 }
 
Index: /trunk/Mars/msimreflector/MSimReflector.cc
===================================================================
--- /trunk/Mars/msimreflector/MSimReflector.cc	(revision 10089)
+++ /trunk/Mars/msimreflector/MSimReflector.cc	(revision 10090)
@@ -27,4 +27,9 @@
 //  MSimReflector
 //
+//  fDetectorFrame is a radius in centimeter, defining a disk in the focal
+//  plane around the focal point, in which photons are absorbed. If
+//  fDetectorFrame<=0 the virtual HitFrame function of the camera
+//  geometry container is used instead.
+//
 //  fDetectorMargin is a margin (in mm) which is given to the
 //  MGeomCam::HitDetector. It should define a margin around the area
@@ -76,5 +81,5 @@
     fMirror4(0), /*fRunHeader(0),*/ fEvtHeader(0), fReflector(0),
     fGeomCam(0), fPointing(0), fNameReflector("MReflector"),
-    fDetectorMargin(0)
+    fDetectorFrame(0), fDetectorMargin(0)
 {
     fName  = name  ? name  : "MSimReflector";
@@ -502,5 +507,5 @@
 
         // Check if the photon has hit the camera housing and holding
-        if (fGeomCam->HitFrame(p, w))
+        if (fGeomCam->HitFrame(p, w, fDetectorFrame))
             continue;
 
@@ -579,4 +584,9 @@
 {
     Bool_t rc = kFALSE;
+    if (IsEnvDefined(env, prefix, "DetectorFrame", print))
+    {
+        rc = kTRUE;
+        fDetectorFrame = GetEnvValue(env, prefix, "DetectorFrame", 0);
+    }
     if (IsEnvDefined(env, prefix, "DetectorMargin", print))
     {
Index: /trunk/Mars/msimreflector/MSimReflector.h
===================================================================
--- /trunk/Mars/msimreflector/MSimReflector.h	(revision 10089)
+++ /trunk/Mars/msimreflector/MSimReflector.h	(revision 10090)
@@ -33,4 +33,5 @@
     TString fNameReflector;      // Name of the container storing the reflector geometry 
 
+    Double_t fDetectorFrame;     // A disk of radius DetectorFrame around the focal point absorbing photons
     Double_t fDetectorMargin;    // A margin around the detector (MGeomCam::HitCamera) in which photons are also stored
 
@@ -49,5 +50,6 @@
     void SetNameReflector(const char *name="MReflector") { fNameReflector = name; }
 
-    void SetDetectorMargin(Double_t m=0) { fDetectorMargin = m; }
+    void SetDetectorFrame(Double_t cm=0)  { fDetectorFrame  = cm; }
+    void SetDetectorMargin(Double_t mm=0) { fDetectorMargin = mm; }
 
     ClassDef(MSimReflector, 0) // Task to calculate reflection on a mirror
