Index: trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C	(revision 8930)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C	(revision 8931)
@@ -149,11 +149,6 @@
     }
 
-    Float_t meani = h->GetMean();
-    Float_t rmsi  = h->GetRMS();
-    meani = TMath::Nint(meani*10)/10.;
-    rmsi  = TMath::Nint(rmsi*100)/100.;
-    TString meaninner = Form("%5.1f", meani);
-    TString rmsinner  = Form("%6.2f", rmsi);
-
+    TString meaninner = Form("%5.1f", h->GetMean());
+    TString rmsinner  = Form("%6.2f", h->GetRMS());
 
     //getting the mean and rms from the arrival time (outer cam)
@@ -165,11 +160,6 @@
     }
 
-    Float_t meano = h->GetMean();
-    Float_t rmso  = h->GetRMS();
-    meano = TMath::Nint(meano*10)/10.;
-    rmso  = TMath::Nint(rmso*100)/100.;
-    TString meanouter = Form("%5.1f", meano);
-    TString rmsouter  = Form("%6.2f", rmso);
-
+    TString meanouter = Form("%5.1f", h->GetMean());
+    TString rmsouter  = Form("%6.2f", h->GetRMS());
 
     //Getting conversion factors
@@ -189,6 +179,4 @@
     Stat_t meanconvi = c->GetMeanSectors(TArrayI(6, s0), inner);
     Stat_t meanconvo = c->GetMeanSectors(TArrayI(6, s0), outer);
-    meanconvi = TMath::Nint(meanconvi*1000)/1000.;
-    meanconvo = TMath::Nint(meanconvo*1000)/1000.;
     TString meanconvinner=Form("%6.3f", meanconvi);
     TString meanconvouter=Form("%6.3f", meanconvo);
Index: trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 8930)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 8931)
@@ -62,4 +62,5 @@
 #include <TRegexp.h>
 
+#include <TH2.h>
 #include <TFile.h>
 #include <TGraph.h>
@@ -86,6 +87,6 @@
     }
 
-    Float_t meanextpul = -1;
-    Float_t rmsextpul  = -1;
+    TString meanextpulpos("NULL");
+    TString rmsextpulpos("NULL");
 
     MCalibrationPulseTimeCam *pt;
@@ -93,10 +94,14 @@
     if (pt)
     {
-        meanextpul = pt->GetAverageArea(0).GetHiGainMean();
-        rmsextpul  = pt->GetAverageArea(0).GetHiGainRms();
-
-        meanextpul = TMath::Nint(meanextpul*100)/100.;
-        rmsextpul  = TMath::Nint(rmsextpul*100)/100.;
-    }
+        Double_t meanextpul = pt->GetAverageArea(0).GetHiGainMean();
+        Double_t rmsextpul  = pt->GetAverageArea(0).GetHiGainRms();
+
+        if (meanextpul>=0 || rmsextpulpos>=0)
+        {
+            meanextpulpos.Form("%6.2f", meanextpul);
+            rmsextpulpos.Form("%6.2f", rmsextpul);
+        }
+    }
+
 
     MStatusArray arr;
@@ -145,10 +150,4 @@
 
     Int_t seq = atoi(sequence.Data()+6);
-
-    Double_t medoff;
-    Double_t devoff;
-
-    Double_t medcal;
-    Double_t devcal;
 
     TString medpuloff("NULL");
@@ -173,14 +172,8 @@
         }
 
-        medoff = TMath::Nint(hilooff->GetMedian()*10000)/10000.;
-        devoff = TMath::Nint(hilooff->GetDev()   *10000)/10000.;
-
-        medcal = TMath::Nint(hilocal->GetMedian()*100)/100.;
-        devcal = TMath::Nint(hilocal->GetDev()   *100)/100.;
-
-        medpuloff.Form("%7.4f", medoff);
-        devpuloff.Form("%7.4f", devoff);
-        medhilocal.Form("%6.2f", medcal);
-        devhilocal.Form("%6.2f", devcal);
+        medpuloff.Form("%7.4f",  hilooff->GetMedian());
+        devpuloff.Form("%7.4f",  hilooff->GetDev());
+        medhilocal.Form("%6.2f", hilocal->GetMedian());
+        devhilocal.Form("%6.2f", hilocal->GetDev());
     }
 
@@ -204,6 +197,6 @@
     }
 
-    meanrmsi = TMath::Nint(meanrmsi*100)/100.;
-    meanrmso = TMath::Nint(meanrmso*100)/100.;
+    TString meanrmsinner=Form("%6.2f", meanrmsi);
+    TString meanrmsouter=Form("%6.2f", meanrmso);
 
     cam = (MHCamera*)arr.FindObjectInCanvas("Interp'd;avg", "MHCamera", "Interp'd");
@@ -225,45 +218,17 @@
     }
 
-    meansigi = TMath::Nint(meansigi*100)/100.;
-    meansigo = TMath::Nint(meansigo*100)/100.;
-
-    Stat_t meanpul = pul->GetMean();
-    Stat_t rmspul  = pul->GetRMS();
-
-    if (meanpul<0 || rmspul<0)
+    TString meansiginner =Form("%6.2f", meansigi);
+    TString meansigouter =Form("%6.2f", meansigo);
+
+    if (pul->GetMean()<0 || pul->GetRMS()<0)
     {
         cout << "WARNING - PulsePos'd mean or rms < 0 " << endl;
-        cout << "PulsePos'd mean " << meanpul << endl;
-        cout << "PulsePos'd rms  " << rmspul << endl;
-        return 2;
-    }
-
-    meanpul = TMath::Nint(meanpul*100)/100.;
-    rmspul  = TMath::Nint(rmspul *100)/100.;
-
-    cam = (MHCamera*)arr.FindObjectInCanvas("Unsuitable;avg", "MHCamera", "Unsuitable");
-    if (!cam)
-    {
-        cout << "WARNING - Reading of Unsuitable;avg failed." << endl;
-        return 2;
-    }
-
-    Int_t unsuitable50 = cam->GetNumBinsAboveThreshold(0.50);
-    Int_t unsuitable01 = cam->GetNumBinsAboveThreshold(0.01);
-
-    TString unsuitablemax = "NULL";
-    TString deadmax       = "NULL";
-
-    TGraph *gr = (TGraph*)arr.FindObjectInCanvas("BadPixTm", "TGraph", "BadPixTm");
-    if (gr)
-    {
-        const Int_t p = TMath::FloorNint(gr->GetN()*0.999);
-        unsuitablemax = Form("%d", TMath::Nint(TMath::KOrdStat(gr->GetN(), gr->GetY(), p)));
-    }
-
-    gr = (TGraph*)arr.FindObjectInCanvas("DeadPixTm", "TGraph", "DeadPixTm");
-    if (gr)
-        deadmax = Form("%d", TMath::Nint(TMath::MaxElement(gr->GetN(), gr->GetY())));
-
+        cout << "PulsePos'd mean " << pul->GetMean() << endl;
+        cout << "PulsePos'd rms  " << pul->GetRMS() << endl;
+        return 2;
+    }
+
+    TString meanpulpos = Form("%6.2f", pul->GetMean());
+    TString rmspulpos  = Form("%6.2f", pul->GetRMS());
 
 /*
@@ -278,18 +243,7 @@
     Double_t meanoff = TMath::Nint(pullo->GetMean()*100.)/100.;
     Double_t rmsoff  = TMath::Nint(pullo->GetRMS() *100.)/100.;
-    */
 
     // USE MEDIAN INSTEAD? GetQuantiles(Int_t nprobSum, Double_t *q, const Double_t *probSum=0);
 
-
-    TString meanrmsinner =Form("%6.2f", meanrmsi);
-    TString meanrmsouter =Form("%6.2f", meanrmso);
-    TString meansiginner =Form("%6.2f", meansigi);
-    TString meansigouter =Form("%6.2f", meansigo);
-    TString meanpulpos   =Form("%6.2f", meanpul);
-    TString rmspulpos    =Form("%6.2f", rmspul);
-    TString meanextpulpos=Form("%6.2f", meanextpul);
-    TString rmsextpulpos =Form("%6.2f", rmsextpul);
-   /*
     TString meanpulhi    =Form("%6.2f", meanhi);
     TString rmspulhi     =Form("%6.2f", rmshi);
@@ -299,8 +253,58 @@
     */
 
-    if (meanextpul<0 && rmsextpul<0)
-    {
-        meanextpulpos = "NULL";
-        rmsextpulpos  = "NULL";
+    cam = (MHCamera*)arr.FindObjectInCanvas("Unsuitable;avg", "MHCamera", "Unsuitable");
+    if (!cam)
+    {
+        cout << "WARNING - Reading of Unsuitable;avg failed." << endl;
+        return 2;
+    }
+
+    Int_t unsuitable50 = cam->GetNumBinsAboveThreshold(0.50);
+    Int_t unsuitable01 = cam->GetNumBinsAboveThreshold(0.01);
+
+    TString unsuitablemax = "NULL";
+    TString deadmax       = "NULL";
+
+    TGraph *gr = (TGraph*)arr.FindObjectInCanvas("BadPixTm", "TGraph", "BadPixTm");
+    if (gr)
+    {
+        const Int_t p = TMath::FloorNint(gr->GetN()*0.999);
+        unsuitablemax = Form("%d", TMath::Nint(TMath::KOrdStat(gr->GetN(), gr->GetY(), p)));
+    }
+
+    gr = (TGraph*)arr.FindObjectInCanvas("DeadPixTm", "TGraph", "DeadPixTm");
+    if (gr)
+        deadmax = Form("%d", TMath::Nint(TMath::MaxElement(gr->GetN(), gr->GetY())));
+
+    TString rateped  = "NULL";
+    TString rateped2 = "NULL";
+    TString ratecal  = "NULL";
+    TString ratetrig = "NULL";
+    TString ratesum  = "NULL";
+    TString ratena   = "NULL";
+    TString ratenull = "NULL";
+
+    TH2D *htp = (TH2D*)arr.FindObjectInCanvas("TrigPat", "TH2D", "TrigPat");
+    if (htp)
+    {
+        htp->ResetBit(TH1::kCanRebin);
+
+        Int_t iped  = htp->GetYaxis()->FindBin("Ped");
+        Int_t iped2 = htp->GetYaxis()->FindBin("Ped+Trig");
+        Int_t ical  = htp->GetYaxis()->FindBin("Cal");
+        Int_t itrig = htp->GetYaxis()->FindBin("Trig");
+        Int_t isum  = htp->GetYaxis()->FindBin("Sum");
+        Int_t inull = htp->GetYaxis()->FindBin("0");
+        Int_t ina   = htp->GetYaxis()->FindBin("UNKNOWN");
+
+        Int_t nx = htp->GetNbinsX();
+
+        rateped  = Form("%8.1f", iped <0 ? 0 : htp->Integral(1, nx, iped,  iped)  / nx);
+        rateped2 = Form("%7.2f", iped2<0 ? 0 : htp->Integral(1, nx, iped2, iped2) / nx);
+        ratecal  = Form("%8.1f", ical <0 ? 0 : htp->Integral(1, nx, ical,  ical)  / nx);
+        ratetrig = Form("%8.1f", itrig<0 ? 0 : htp->Integral(1, nx, itrig, itrig) / nx);
+        ratesum  = Form("%8.1f", isum <0 ? 0 : htp->Integral(1, nx, isum,  isum)  / nx);
+        ratenull = Form("%8.1f", inull<0 ? 0 : htp->Integral(1, nx, inull, inull) / nx);
+        ratena   = Form("%7.2f", ina  <0 ? 0 : htp->Integral(1, nx, ina,   ina)   / nx);
     }
 
@@ -325,4 +329,11 @@
     cout << "  UnsuitableMax (99.9%)   " << setw(6) << unsuitablemax << endl;
     cout << "  DeadMax                 " << setw(6) << deadmax << endl;
+    cout << "  Rate Trigger       [Hz] "  << rateped  << endl;
+    cout << "  Rate SUM           [Hz] "  << ratesum  << endl;
+    cout << "  Rate Ped+Trigger   [Hz]  " << rateped2 << endl;
+    cout << "  Rate Pedestal      [Hz] "  << rateped  << endl;
+    cout << "  Rate Calibration   [Hz] "  << ratecal  << endl;
+    cout << "  Rate 0             [Hz] "  << ratenull << endl;
+    cout << "  Rate UNKNOWN       [Hz]  " << ratena   << endl;
     cout << endl;
 
@@ -340,5 +351,9 @@
                         " fHiLoGainRatioMed=%s,  fHiLoGainRatioDev=%s, "
                         " fUnsuitable50=%d,      fUnsuitable01=%d, "
-                        " fUnsuitableMax=%s,     fDeadMax=%s "
+                        " fUnsuitableMax=%s,     fDeadMax=%s, "
+                        " fRateTrigEvts=%s,      fRateSumEvts=%s, "
+                        " fRatePedTrigEvts=%s,   fRatePedEvts=%s, "
+                        " fRateCalEvts=%s,       fRateNullEvts=%s, "
+                        " fRateUnknownEvts=%s ",
                          meanrmsinner.Data(),  meanrmsouter.Data(),
                          meansiginner.Data(),  meansigouter.Data(),
@@ -350,7 +365,13 @@
                          medhilocal.Data(),    devhilocal.Data(),
                          unsuitable50,         unsuitable01,
-                         unsuitablemax.Data(), deadmax.Data());
-
-    return serv.Update("Calibration", vars, Form("fSequenceFirst=%d", seq), vars);
+                         unsuitablemax.Data(), deadmax.Data(),
+                         ratetrig.Data(),      ratesum.Data(),
+                         rateped2.Data(),      rateped.Data(),
+                         ratecal.Data(),       ratenull.Data(),
+                         ratena.Data()
+                       );
+
+
+    return serv.Update("Calibration", vars, Form("fSequenceFirst=%d", seq));
 }
 
Index: trunk/MagicSoft/Mars/datacenter/macros/fillstar.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillstar.C	(revision 8930)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillstar.C	(revision 8931)
@@ -134,8 +134,5 @@
     Float_t mw    = hmuon->GetMeanWidth();
     Float_t psf   = 70.205*mw - 28.055;
-    psf = TMath::Nint(psf*10)/10.;
-    if (psf<0)
-        psf=0;
-    TString PSF = Form("%5.1f", psf);
+    TString PSF = Form("%5.1f", psf<0?0:psf);
     Int_t   num = (int)hmuon->GetEntries();
 
@@ -150,7 +147,5 @@
     }
 
-    Float_t quality = h->GetMean();
-    quality = TMath::Nint(quality*100)/100.;
-    TString islands = Form("%6.2f", quality);
+    TString islands = Form("%6.2f", h->GetMean());
 
     h = (TH1*)arr.FindObjectInCanvas("EffOnTheta", "TH1D", "EffOnTime");
@@ -163,8 +158,5 @@
     Float_t effon = h->Integral();
     Float_t mrate  = num/effon;
-    mrate = TMath::Nint(mrate*100)/100.;
-    if (mrate<0)
-        mrate=0;
-    TString muonrate = Form("%6.2f", mrate);
+    TString muonrate = Form("%6.2f", mrate<0?0:mrate);
     Int_t effontime = TMath::Nint(effon);
 
