Index: trunk/Mars/resmc/hawcseye/ceres.rc
===================================================================
--- trunk/Mars/resmc/hawcseye/ceres.rc	(revision 19680)
+++ trunk/Mars/resmc/hawcseye/ceres.rc	(revision 19702)
@@ -43,9 +43,9 @@
 # BinningEnergy.Raw:      100      1    100000  log
 # BinningSize.Raw:        100      1  10000000  log
-BinningImpact.Raw:       60   0       600
+BinningImpact.Raw:       40   0       400
 # BinningHeight.Raw:       50      0        12
 # BinningAz.Raw:          360   -360       360
 # BinningZd.Raw:           70      0        70
-BinningViewCone.Raw:     56      0        14
+BinningViewCone.Raw:     32      0        8
 BinningTrigPos.Raw:     100     -5        45
 BinningTotLength.Raw:   150      0       150
@@ -61,4 +61,7 @@
 BinningDist.Raw:         25    0    15
 
+# Note that you might not exactly get this binning limit as
+# the limits are internally optimized (or to have N bins of size 1)
+HPhotonEventGround.MaxImpact: 250
 
 # -------------------------------------------------------------------------
@@ -94,22 +97,25 @@
 # For details see MSimPointingPos
 # -------------------------------------------------------------------------
-MSimPointingPos.OffTargetDistance: 0.6
+#MSimPointingPos.OffTargetDistance: 0.6
 #MSimPointingPos.OffTargetPhi: -1
 
 
 # -------------------------------------------------------------------------
-# Setup the reflector and camera geometry
+# Setup the optics
 # -------------------------------------------------------------------------
 #Reflector.Constructor: MReflector();
 Reflector.Constructor: MFresnelLens();
 
+# -------------------------------------------------------------------------
+# Note that this is the setup for the 'Reflector' being MFresnelLens
 Reflector.Transmission.FileName: resmc/hawcseye/transmission-pmma-3mm.txt
 Reflector.Transmission.Thickness: 0.3
-Reflector.Transmission.FresnelCorrection: True
-Reflector.SurfaceRoughness: 0.001
-
+Reflector.Transmission.FresnelCorrection: true
+#Reflector.SurfaceRoughness: 0.001
+
+# -------------------------------------------------------------------------
+# Note that this is the setup for the 'Reflector' being MReflector
 
 # For the file definition see MReflector::ReadFile
-
 Reflector.FileName: resmc/hawcseye/fake-reflector.txt
 # Units mm: ~0.02° 
@@ -132,8 +138,16 @@
 #paraboloid_focal   488.87
 
+# -------------------------------------------------------------------------
+# Setup the camera geometry
+# -------------------------------------------------------------------------
+
 #MGeomCam.Constructor:   MGeomCamDwarf(189.8,  9.5,  4.8887);
 MGeomCam.Constructor:   MGeomCamFAMOUS(0.502,false);
 
 #MSimBundlePhotons.FileName: resmc/fact/dwarf-fact.txt
+
+# -------------------------------------------------------------------------
+# Setup the sensors
+# -------------------------------------------------------------------------
 
 # Set the APD type (1: 30x30 <default>, 2: 60x60, 3:60x60(ct=15%))
@@ -221,7 +235,14 @@
 MSimTrigger.FileNameRouteAC: resmc/hawcseye/trigger.txt
 
-# DiscriminatorThreshold is 9*offset(-1850)+21*gain(22.375)=16180.125
-#MSimTrigger.DiscriminatorThreshold: -16180.125
-MSimTrigger.DiscriminatorThreshold: -192.387
+# DiscriminatorThreshold is in arbitrary units
+# This is the FACT default
+#MSimTrigger.DiscriminatorThreshold: -192.387
+# This is optimized to trigger not more than 1 out of 1000 simulated pedestal events
+MSimTrigger.DiscriminatorThreshold: 700  # The units correspond to DRS4 ADC counts (FIXME: Conversion to DAC cnts)
+
+# In FACT: 300 DAC counts are roughly 21pe. 1pe is roughly 10 mV / 20 ADC counts (see MSimCamera.DefaultGain)
+# Therefore, the conversion from ADC to DAC is therefore (300/21.)/22.553 = 0.63
+# A simulated DiscriminatorThreshold or 700 therefore corresponds to a DAC threshold of about 450
+
 # Note that this is in SAMPLES! I have taken the values from the SW trigger
 MSimTrigger.CableDelay: 21 
@@ -229,4 +250,17 @@
 MSimTrigger.CoincidenceTime: 0.5
 
+# The baseline shift (unfortunately -- as well as the A/C coupling!) is already added 
+# before the trigger electornics to the signal. If the sum-trigger is calculated,
+# the baseline is summed as N*pixels - 0.96*N*pixels and therefore shifts indiviudally
+# according to the number of pixels in a patch (I believe that this is wrong).
+# Therefore, this effect can be correct be a shift of N*(1-0.96)
+MSimTrigger.ShiftBaseline: Yes
+
+# Setting this resource allows to copy the sum signal back to the source pixels
+# so that instead of the original signal, the sum-signal is digitzed in the eleotronics
+#MSimTrigger.DebugTrigger: Yes
+
+# Use this to turn off the trigger electronics. A trigger is always issued.
+#MSimTrigger.SimulateElectronics: No
 
 # Every Pixel(!) should see the same signal independant of its size
@@ -259,7 +293,7 @@
 MRawRunHeader.FadcResolution:      12
 
-MSimCamera.DefaultOffset: -1850.0
-MSimCamera.DefaultNoise:    2.8125
-MSimCamera.DefaultGain:    22.553
+MSimCamera.DefaultOffset: -1850.0    # ADC counts
+MSimCamera.DefaultNoise:    2.8125   # ADC counts
+MSimCamera.DefaultGain:    22.553    # Conversion for the pulse to ADC counts
 
 # Value for the fudgefactor in the calculation of the accoupling:
@@ -305,4 +339,7 @@
 ContEmpty3.Condition: MPhotonEvent.GetNumPhotons<10
 
+# Take a fixed position in the camera.... for now!
+MSrcPosCalc.FixedPos: 0 0
+
 MFixTimeOffset.FileName: resmc/fact/pixel_delays_ALL_ZERO.csv
 # MFixTimeOffset.FileName: resmc/fact/AllPhidoFiles_delays.csv
