Index: trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 7066)
+++ trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc	(revision 7091)
@@ -357,7 +357,7 @@
     case kEntries:     *fLog << "entries.";      break;
     case kIntegral:    *fLog << "integral.";     break;
-    case kOffRegion:   *fLog << "off region.";   break;
-    case kBackground:  *fLog << "background.";   break;
-    case kLeastSquare: *fLog << "least square."; break;
+    case kOffRegion:   *fLog << "off region (intgeral between " << fScaleMin << " and " << fScaleMax << ")"; break;
+    case kBackground:  *fLog << "background (integral between " << fBgMin    << " and " << fBgMax    << ")"; break;
+    case kLeastSquare: *fLog << "least square (N/A)"; break;
     case kUserScale:   *fLog << "user def (" << fScaleUser << ")"; break;
     }
Index: trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc	(revision 7066)
+++ trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc	(revision 7091)
@@ -75,4 +75,183 @@
 //    MTimeEffectiveOnTime [MTime]
 //
+//
+// ==========================================================================
+// Dear Colleagues,
+//
+// for the case that we are taking calibration events interleaved with
+// cosmics events the calculation of the effective observation time has to
+// be modified. I have summarized the proposed procedures in the note at the
+// end of this message. The formulas have been checked by a simulation.
+//
+// Comments are welcome.
+//
+// Regards,  Wolfgang
+// --------------------------------------------------------------------------
+//                                                       Wolfgang Wittek
+//                                                         2 Dec. 2004
+//
+// Calculation of the effective observation time when cosmics and calibration
+// events are taken simultaneously.
+// --------------------------------
+//
+// I. Introduction
+// ---------------
+// It is planned to take light calibration events (at a certain fixed frequency
+// lambda_calib) interlaced with cosmics events. The advantages of this
+// procedure are :
+//
+// - the pedestals, which would be determined from the cosmics, could be
+//   used for both the calibration and the cosmics events
+//
+// - because calibration and cosmics events are taken quasi simultaneously,
+//   rapid variations (in the order of a few minutes) of base lines and of the
+//   photon/ADC conversion factors could be recognized and taken into account
+//
+// The effective observation time T_eff is defined as that time range, within
+// which the recorded number of events N_cosmics would be obtained under ideal
+// conditions (only cosmics, no dead time, no calibration events, ...).
+//
+// In the absence of calibration events the effective observation time can
+// be determined from the distribution of time differences 'dt' between
+// successive cosmics events (see first figure in the attached ps file).
+// The exponential slope 'lambda' of this distribution is the ideal cosmics
+// event rate. If 'N_cosmics' is the total number of recorded cosmics events,
+// T_eff is obtained by
+//
+//    T_eff = N_cosmics / lambda
+//
+// In the case of a finite dead time 'dead', the distribution (for dt > dead) is
+// still exponential with the same slope 'lambda'. 'lambda' should be determined
+// in a region of 'dt' which is not affected by the dead time, i.e. at not too
+// low 'dt'.
+//
+//
+//
+// II. Problems in the presence of calibration events
+// --------------------------------------------------
+// If calibration events are taken interlaced with cosmics, and if the dead time
+// is negligible, the distribution of time differences 'dt' between cosmics can
+// be used for calculating the effective observation time, as if the calibration
+// events were not present.
+//
+// In the case of a non-negligible dead time 'dead', however, the distribution of
+// time differences between cosmics is distorted, because a cosmics event may be
+// lost due to the dead time after a calibration event. Even if the time
+// intervals are ignored which contain a calibration event,
+//
+//
+//        ---|---------o--------|--------->  t
+//
+//        cosmics    calib    cosmics
+//
+//            <---------------->           <==== time interval to be ignored
+//
+//
+// the distribution of 'dt' is still distorted, because there would be no
+// 'dt' with dt > tau_calib = 1/lambda_calib. The distribution would also be
+// distorted in the region dt < tau_calib, due to calibration events occuring
+// shortly after cosmics events. As a result, the slope of the distribution of
+// 'dt' would not reflect the ideal cosmics event rate (see second figure; the
+// values assumed in the simulation are lambda = 200 Hz, lambda_calib = 50
+// Hz, dead = 0.001 sec, total time = 500 sec, number of generated cosmics
+// events = 100 000).
+//
+//
+// Note also that some calibration events will not be recorded due to the dead
+// time after a cosmics event.
+//
+//
+// III. Proposed procedures
+// ------------------------
+//
+// A) The ideal event rate 'lambda' may be calculated from the distribution of
+// the time difference 'dt_first' between a calibration event and the first
+// recorded cosmics event after the calibration event. In the region
+//
+//     dead < dt_first < tau_calib
+//
+// the probability distribution of dt_first is given by
+//
+//     p(dt_first) = c * exp(-lambda*dt_first)
+//
+// where c is a normalization constant. 'lambda' can be obtained by a simple
+// exponential fit to the experimental distribution of dt_first (see third
+// figure). The fit range should start well above the average value of the dead
+// time 'dead'.
+//
+//
+// B) One may consider those time intervals between recorded cosmics events, which
+// are completely contained in the region
+//
+//    t_calib < t < t_calib + tau_calib
+//
+// where t_calib is the time of a recorded calibration event.
+//
+//
+//          <--------------- tau_calib ----------->
+//
+//
+//           0   1  2   3 4  5   6  7    8  9   10
+//      --|-o---|-|---|--|-|----|--|---|---|-|----o-|---|-|--------->  t
+//          ^                                     ^
+//          |                                     |
+//        t_calib                               t_calib + tau_calib
+//
+//
+// In this example, of the time intervals 0 to 10 only the intervals 1 to 9
+// should be retained and plotted. The distribution of the length 'dt' of these
+// intervals in the region
+//
+//     dead < dt < tau_calib
+//
+// is given by
+//
+//     p(dt) = c * (tau_calib-dt-dead) * exp(-lambda*dt)
+//
+// A fit of this expression to the experimental distribution of 'dt' yields
+// 'lambda' (see fourth figure). For 'dead' an average value of the dead time
+// should be chosen, and the fit range should end well before dt = tau_calib-dead.
+//
+//
+// Method A has the advantage that the p(dt_first) does not depend on 'dead'.
+// 'dead' has to be considered when defining the fit range, both in method A and
+// in method B. In method B the event statistics is larger leading to a smaller
+// fitted error of 'lambda' than method A (see the figures).
+//
+//
+// The effective observation time is again obtained by
+//
+//    T_eff = N_cosmics / lambda
+//
+// where N_cosmics is the total number of recorded cosmics events. Note that
+// N_cosmics is equal to
+//
+//    N_cosmics = N_tot - N_calib
+//
+// where N_tot is the total number of recorded events (including the calibration
+// events) and N_calib is the number of recorded calibration events.
+//
+// Note that if time intervals are discarded for the determination of lambda,
+// the corresponding cosmics events need not and should not be discarded.
+//
+//
+// IV. Procedure if the calibration events are taken in bunches
+// ------------------------------------------------------------
+// In November 2004 the rate of calibration events is not constant. The events
+// are taken in 200 Hz bunches every second, such that the rate is 200 Hz for
+// 0.25 sec, followed by a gap of 0.75 sec. Then follows the next 200 Hz bunch.
+//
+// In this case it is proposed to consider for the calculation of 'lambda' only
+// the cosmics events within the gaps of 0.75 sec. For these cosmics events one
+// of the methods described in III. can be applied.
+//
+//
+// V. Alternative pocedure
+// -----------------------
+// The effective observation time can also be determined from the total
+// observation time and the total dead time. The latter is written out by the DAQ.
+// In this case it has to be made sure that the dead time is available in Mars
+// when the effective observation time is calculated.
+//
 //////////////////////////////////////////////////////////////////////////////
 #include "MHEffectiveOnTime.h"
@@ -646,6 +825,4 @@
 void MHEffectiveOnTime::Paint(Option_t *opt)
 {
-    *fLog << all << "Paint: '" << opt << "'" << endl;
-
     TH1D *h=0;
     TPaveStats *st=0;
Index: trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc	(revision 7066)
+++ trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc	(revision 7091)
@@ -69,10 +69,10 @@
     fHist.SetName("Theta");
     fHist.SetTitle("Theta");
-    fHist.SetZTitle("\\theta^{2} [deg^{2}]");
+    fHist.SetZTitle("\\vartheta^{2} [deg^{2}]");
     fHist.SetDirectory(NULL);
 
     // Main histogram
     fHistTime.SetName("Theta");
-    fHistTime.SetXTitle("\\theta^{2} [deg^{2}]");
+    fHistTime.SetXTitle("\\vartheta^{2} [deg^{2}]");
     fHistTime.SetDirectory(NULL);
 
