Index: trunk/MagicSoft/Cosy/tpoint/tpoint0508.txt
===================================================================
--- trunk/MagicSoft/Cosy/tpoint/tpoint0508.txt	(revision 7348)
+++ trunk/MagicSoft/Cosy/tpoint/tpoint0508.txt	(revision 7349)
@@ -110,5 +110,5 @@
 -158.9329 59.25593 343.5209 50.3878 22.09639 -0.3197222 -0.02317719 -0.02940316 53605.07934 225.9 3.172
 47.22569 36.54395 189.7476 27.57011 3.405278 49.86111 0.003862221 -0.01007162 53605.086996 226.7 2.778
-47.2862 19.15062 189.8253 10.21207 5.278056 45.99806 0.0391389 -0.01657546 53605.094364 237.2 2.561
+##47.2862 19.15062 189.8253 10.21207 5.278056 45.99806 0.0391389 -0.01657546 53605.094364 237.2 2.561
 79.92895 16.68103 222.4622 7.706874 4.598611 16.50917 0.006277146 -0.01605437 53605.099187 230.2 2.585
 11.01569 58.63599 153.4992 49.66254 0.1530556 59.14972 -6.578275e-05 -0.01359514 53605.10435 223.9 2.947
@@ -155,7 +155,7 @@
 161.8803 89.35793 299.7242 80.34576 23.06278 28.08278 -0.03738417 -0.6555016 53606.086711 215.8 2.898
 163.6731 89.36407 301.0457 80.35055 23.06278 28.08278 -0.03805907 -0.4174269 53606.086771 214.9 2.896
-170.8408 89.39057 308.8955 80.37092 23.06278 28.08278 -0.04531978 -1.103237 53606.087063 228.1 2.895
--121.2917 88.79779 18.18017 79.92512 23.06278 28.08278 -0.031293 0.1311272 53606.090658 221.6 2.902
--112.6175 88.38288 27.57605 79.51355 23.06278 28.08278 -0.02953879 0.156851 53606.092121 221.5 2.902
+##170.8408 89.39057 308.8955 80.37092 23.06278 28.08278 -0.04531978 -1.103237 53606.087063 228.1 2.895
+##-121.2917 88.79779 18.18017 79.92512 23.06278 28.08278 -0.031293 0.1311272 53606.090658 221.6 2.902
+##-112.6175 88.38288 27.57605 79.51355 23.06278 28.08278 -0.02953879 0.156851 53606.092121 221.5 2.902
 -103.036 87.27255 38.36263 78.4079 23.06278 28.08278 -0.02274183 -0.1285554 53606.095774 213.3 2.923
 -92.98912 82.61974 49.06547 73.75633 23.06278 28.08278 -0.0221741 0.02493934 53606.110593 224.7 2.903
@@ -170,6 +170,5 @@
 ##*7.06407 89.70317 142.6589 80.73923 0.1397222 29.09056 -0.06803369 -2.191836 53606.131926 220 2.919
 ##*-1.52248 89.78481 133.9971 80.7929 0.1397222 29.09056 -0.1449181 -1.988184 53606.132103 225.2 2.841
-
--70.9905 88.95418 69.08482 80.07318 0.1397222 29.09056 -0.0393356 -0.6531291 53606.135354 219.2 2.819
+##*-70.9905 88.95418 69.08482 80.07318 0.1397222 29.09056 -0.0393356 -0.6531291 53606.135354 219.2 2.819
 -80.35903 87.83797 60.95691 78.94047 0.1397222 29.09056 -0.05321397 -0.3171041 53606.139033 217.9 2.857
 -84.43938 85.18967 57.44097 76.32055 0.1397222 29.09056 -0.0288866 -0.0387353 53606.147394 216.6 2.818
@@ -179,2 +178,45 @@
 -167.0579 42.31837 335.4432 33.45653 0.7263889 -17.98667 -0.01660967 -0.03691953 53606.184352 234.8 2.789
 -158.024 40.35643 344.4685 31.50261 0.7263889 -17.98667 -0.009747074 -0.02461631 53606.204881 233.7 2.818
+
+# --- 24.08.2005 --- 23:41:30.939
+-88.52282 74.10703 53.84712 65.24541 19.51194 27.95972 -0.02750961 -0.03491044 53606.987164 213.8 3.427
+79.64065 66.37057 222.1052 57.38383 22.71667 30.22139 -0.01569475 -0.03328937 53606.99492 215.1 3.497
+108.8526 58.61587 251.3392 49.62471 23.07944 15.20528 -0.01559677 -0.03124082 53607.000179 223.8 3.241
+-146.2146 26.10693 356.2921 17.24867 18.92111 -26.29667 -0.01329312 -0.02184206 53607.006437 223.2 2.767
+79.03573 53.83671 221.5285 44.84998 0.1397222 29.09056 -0.01088316 -0.01395283 53607.014225 212.1 2.952
+129.5383 70.16923 271.9313 61.15977 23.07944 15.20528 -0.03507286 -0.007031984 53607.041652 219.1 3.171
+138.9459 72.75265 281.3576 63.73993 23.07944 15.20528 -0.03690827 -0.05554516 53607.053024 218.6 3.189
+149.0339 74.53999 291.4158 65.53781 23.07944 15.20528 -0.02730475 -0.0541191 53607.062671 213.9 3.206
+158.7699 75.62856 301.1194 66.63109 23.07944 15.20528 -0.02360277 -0.0386339 53607.07051 207.6 3.243
+168.9346 76.287 311.2789 67.27668 23.07944 15.20528 -0.03681018 -0.04302131 53607.077839 229.3 3.207
+175.1255 76.47321 317.4505 67.46098 23.07944 15.20528 -0.03834842 -0.03953659 53607.082066 230.8 3.233
+178.0896 76.50303 320.4081 67.49782 23.07944 15.20528 -0.03119906 -0.04128377 53607.084064 216 3.236
+-137.2408 46.33325 5.238231 37.47317 21.52583 -5.571111 -0.01792448 -0.02143795 53607.098696 210.6 3.541
+-120.8641 58.21629 21.58423 49.35524 21.73639 9.875 -0.01912545 -0.01850997 53607.105274 219.9 3.151
+-135.0097 51.84021 7.463116 42.96863 22.09639 -0.3197222 -0.0268074 -0.02402511 53607.116329 225.7 3.499
+-128.5283 40.99052 13.95289 32.14789 21.52583 -5.571111 -0.0002818328 -0.01540228 53607.121639 215.2 3.475
+-162.2549 29.26456 340.2528 20.39384 22.96083 -29.62222 -0.02528453 -0.02697356 53607.129839 217.6 2.774
+106.8439 12.75349 249.3786 3.778848 5.242222 -8.201667 0.001284024 -0.02305091 53607.145795 225.9 2.752
+89.60168 35.56171 232.1273 26.58736 4.598611 16.50917 0.003685579 -0.02187178 53607.153803 228.6 2.591
+
+# --- 26.08.2005 --- 00:45:50.900
+32.79023 42.52508 175.3046 33.56231 1.430278 60.23528 0.01006835 -0.008733998 53608.031839 212.9 3.49
+32.2829 43.65327 174.8099 34.67476 1.430278 60.23528 -0.003129167 -0.02000797 53608.03839 219.2 3.508
+173.1806 31.3109 315.6816 22.35161 22.96083 -29.62222 0.01467388 -0.02192207 53608.059185 225.3 2.748
+143.9767 34.81 286.488 25.8176 0.7263889 -17.98667 -0.01653577 -0.03336686 53608.066557 212.9 3.62
+120.7174 66.50854 263.1535 57.51825 0.2205556 15.18361 -0.01252493 -0.02600608 53608.072355 216.5 3.431
+14.98074 57.76191 157.4607 48.78977 0.1530556 59.14972 0.001612599 -0.006773034 53608.083932 223 3.107
+47.28834 39.15133 189.8232 30.1962 3.405278 49.86111 0.02284424 -0.02540887 53608.09011 214 2.836
+
+# --- 26.08.2005 --- 02:25:29.032
+-79.00837 79.39428 63.24001 70.52811 22.71667 30.22139 -0.0237752 -0.016141 53608.10103 211.6 3.493
+##-0.2182925 41.17548 142.2996 32.2714 23.65583 77.6325 -0.05855314 -0.01400654 53608.108525 214.1 3.688
+##-27.29195 15.54849 115.2259 6.607565 16.39972 61.51417 -0.0961527 -0.003416656 53608.115434 222.7 4.936
+-11.24401 16.81794 131.2871 7.944027 14.845 74.15556 -0.04142678 -0.005003276 53608.119542 229 3.481
+
+# --- 29.08.2005 --- 04:02:47.274
+133.9884 79.0162 276.2545 69.99347 1.910556 20.80806 -0.04442089 -0.03447289 53611.168603 211 3.469
+##-7.227646 39.66832 135.2945 30.74782 23.65583 77.6325 -0.07557766 -0.01717359 53611.172917 222.9 4.587
+-15.7744 59.06227 126.6965 50.20527 0.8183333 57.81583 -0.01223994 -0.007022888 53611.18887 206.3 3.915
+-111.3784 60.62536 31.06256 51.76868 0.2205556 15.18361 -0.01512168 -0.01669907 53611.200159 220.2 3.583
+75.35055 69.13086 217.7907 60.14197 3.902222 31.88361 -0.01222134 -0.02654317 53611.208418 209.7 3.52
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 7348)
+++ trunk/MagicSoft/Mars/NEWS	(revision 7349)
@@ -8,4 +8,19 @@
    * general: added a new game. Start it from the interpreter with
         MagicJam j;
+
+   * callisto: MBadPixelsCalc now raises an error instead of simply stopping
+     the eventloop if something went wrong. This is necessary for the
+     automatic processing
+
+   * callisto: Fixed a bug in the treatment of times in the bad pixel
+     treatment. No neighbors have been taken into account, the new
+     arrival time was always calculated by the pixels 0 to 5.
+
+   * callisto: Fixed a bug which caused the random and peak-search pedestal
+     extracted with an extractor to be exchanged for the first (roughly)
+     500 events. (The were simple exchanged in callisto.cc) This bug might
+     have been introduced in Mars 0.9.4 when the order of calculation of the
+     two types of pedestal in callisto got exchanged. The bug only effects
+     the first seconds of data of each sequence.
 
 
Index: trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- trunk/MagicSoft/Mars/callisto.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/callisto.cc	(revision 7349)
@@ -598,5 +598,5 @@
 
         // Where to search for calibration files
-        if (!job4.Process(job1.GetPedestalCam(), job2.GetPedestalCam(), job3.GetPedestalCam()))
+        if (!job4.Process(job1.GetPedestalCam(), job3.GetPedestalCam(), job2.GetPedestalCam()))
             return 2;
 
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc	(revision 7349)
@@ -137,5 +137,5 @@
 // too high pedestal Rms with respect to the mean.
 // 
-Bool_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsPix::UnsuitableType_t type) const
+Int_t MBadPixelsCalc::CheckPedestalRms(MBadPixelsPix::UnsuitableType_t type) const
 {
     const Bool_t checklo = fPedestalLevelVarianceLo>0;
@@ -310,5 +310,8 @@
 Int_t MBadPixelsCalc::Process()
 {
-    return fCheckInProcess ? CheckPedestalRms(MBadPixelsPix::kUnsuitableEvt) : kTRUE;
+    if (!fCheckInProcess)
+        return kTRUE;
+
+    return CheckPedestalRms(MBadPixelsPix::kUnsuitableEvt) ? kTRUE : kERROR;
 }
 
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc	(revision 7349)
@@ -441,6 +441,8 @@
         for (unsigned int j=0; j<time.GetSize(); j++)
         {
-            const Double_t t = (*fEvt)[j].GetArrivalTime();
-            if (t>=0)
+            const Int_t nn = gpix.GetNeighbor(j);
+
+            const Double_t t = (*fEvt)[nn].GetArrivalTime();
+            if (t>=0 && !IsPixelBad(nn))
                 time[n0++] = t;
         }
Index: trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 7349)
@@ -2045,5 +2045,5 @@
         //if (!GetCanvas(c->GetName()))
         if (!tab || c->GetName()==(TString)tab)
-            DrawClonePad(AddTab(c->GetName()), *c);
+            DrawClonePad(c->GetName(), *c);
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 7348)
+++ trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 7349)
@@ -204,4 +204,9 @@
      void   Update() { HandleTimer(&fTimer); HandleTimer(&fLogTimer); }
 
+     void DrawClonePad(const char *tab, TCanvas &oldc)
+     {
+         DrawClonePad(AddTab(tab), oldc);
+     }
+
      void SetNoContextMenu(Bool_t flag=kTRUE);
 
Index: trunk/MagicSoft/Mars/mgui/MCamEvent.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamEvent.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mgui/MCamEvent.cc	(revision 7349)
@@ -55,2 +55,22 @@
     InitSize(geom.GetNumPixels());
 }
+
+// --------------------------------------------------------------------------
+//
+// Return the mean of all corresponding GetPixelContent
+//
+Double_t MCamEvent::GetCameraMean(const MGeomCam &cam, Int_t type) const
+{
+    Int_t    num  = 0;
+    Double_t mean = 0;
+    for (unsigned int i=0; i<cam.GetNumPixels(); i++)
+    {
+        Double_t val;
+        if (!GetPixelContent(val, i, cam, type))
+            continue;
+
+        mean += val;
+        num ++;
+    }
+    return num == 0 ? 0 : mean/num;
+}
Index: trunk/MagicSoft/Mars/mgui/MCamEvent.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamEvent.h	(revision 7348)
+++ trunk/MagicSoft/Mars/mgui/MCamEvent.h	(revision 7349)
@@ -17,4 +17,6 @@
     virtual void   InitSize(const UInt_t i) { } // Used by MGeomApply see Init()
 
+    virtual Double_t GetCameraMean(const MGeomCam &cam, Int_t type=0) const;
+
     ClassDef(MCamEvent, 0) // A camera event
 };
Index: trunk/MagicSoft/Mars/mhflux/MHThreshold.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHThreshold.h	(revision 7348)
+++ trunk/MagicSoft/Mars/mhflux/MHThreshold.h	(revision 7349)
@@ -15,5 +15,5 @@
 {
 private:
-    const MMcEvt *fMcEvt; //! POinter to MC energy
+    const MMcEvt *fMcEvt; //! Pointer to MC energy
 
     TH1D fHEnergy;
Index: trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc	(revision 7349)
@@ -86,5 +86,5 @@
 using namespace std;
 
-const TString MHSectorVsTime::gsDefName  = "MSectorHVsTime";
+const TString MHSectorVsTime::gsDefName  = "MHSectorVsTime";
 const TString MHSectorVsTime::gsDefTitle = "Graph of sector mean vs. time";
 
Index: trunk/MagicSoft/Mars/mjobs/MDataSet.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 7349)
@@ -110,5 +110,11 @@
     while (!runs.IsNull())
     {
-        TString num = runs(regexp);
+        const TString num = runs(regexp);
+
+        if (num.IsNull())
+        {
+            *fLog << warn << "WARNING - Sequence is NaN (not a number): " << runs << endl;
+            break;
+        }
 
         const Int_t seq = atoi(num.Data());
@@ -122,5 +128,5 @@
 
         if (i<n)
-            *fLog << warn << "WARNING - Sequence #" << seq << " alraedy in list... skipped." << endl;
+            *fLog << warn << "WARNING - Sequence #" << seq << " already in list... skipped." << endl;
         else
         {
Index: trunk/MagicSoft/Mars/mjobs/MJCut.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCut.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mjobs/MJCut.cc	(revision 7349)
@@ -171,4 +171,5 @@
     p += "/";
     p += fNameOutput.IsNull() ? Form("ganymed%08d.root", num) : fNameOutput.Data();
+    gSystem->ExpandPathName(p);
     return p;
 }
Index: trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 7349)
@@ -166,5 +166,11 @@
     while (!runs.IsNull())
     {
-        TString num = runs(regexp);
+        const TString num = runs(regexp);
+
+        if (num.IsNull())
+        {
+            *fLog << warn << "WARNING - Run is NaN (not a number): " << runs << endl;
+            break;
+        }
 
         const Int_t run = atoi(num.Data());
@@ -178,5 +184,5 @@
 
         if (i<n)
-            *fLog << warn << "WARNING - Run #" << run << " alraedy in list... skipped." << endl;
+            *fLog << warn << "WARNING - Run #" << run << " already in list... skipped." << endl;
         else
         {
Index: trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.cc	(revision 7349)
@@ -357,5 +357,5 @@
         break;
     case 5:
-        val = (*this)[idx].GetRms()*TMath::Sqrt(cam.GetPixRatio(idx));
+        val = (*this)[idx].GetRms()*cam.GetPixRatioSqrt(idx);
         break;
     default:
Index: trunk/MagicSoft/Mars/msignal/MSignalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MSignalCam.cc	(revision 7348)
+++ trunk/MagicSoft/Mars/msignal/MSignalCam.cc	(revision 7349)
@@ -252,5 +252,5 @@
         Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot();
         if (geom)
-            testval *= TMath::Sqrt(geom->GetPixRatio(i/*pix.GetPixId()*/));
+            testval *= geom->GetPixRatioSqrt(i/*pix.GetPixId()*/);
 
         if (testval < minval)
@@ -280,5 +280,5 @@
         Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot();
         if (geom)
-            testval *= TMath::Sqrt(geom->GetPixRatio(i/*pix.GetPixId()*/));
+            testval *= geom->GetPixRatioSqrt(i/*pix.GetPixId()*/);
 
         if (testval > maxval)
Index: trunk/MagicSoft/Mars/msignal/MSignalCam.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MSignalCam.h	(revision 7348)
+++ trunk/MagicSoft/Mars/msignal/MSignalCam.h	(revision 7349)
@@ -46,4 +46,8 @@
     }
 
+    // Setter functions for use in image cleaning classes only
+    void SetSinglePixels(Short_t num, Float_t size)  { fNumSinglePixels=num; fSizeSinglePixels=size; }
+    void SetNumPixelsSaturated(UInt_t hi, UInt_t lo) { fNumPixelsSaturatedHiGain=hi;fNumPixelsSaturatedLoGain=lo; }
+
     // Getter functions
     UInt_t  GetNumPixels() const { return fPixels->GetEntriesFast(); }
@@ -55,8 +59,4 @@
     Int_t   GetNumPixelsSaturatedHiGain() const { return fNumPixelsSaturatedHiGain; }
     Int_t   GetNumPixelsSaturatedLoGain() const { return fNumPixelsSaturatedLoGain; }
-
-    // Setter functions for use in image cleaning classes only
-    void SetSinglePixels(Short_t num, Float_t size)  { fNumSinglePixels=num; fSizeSinglePixels=size; }
-    void SetNumPixelsSaturated(UInt_t hi, UInt_t lo) { fNumPixelsSaturatedHiGain=hi;fNumPixelsSaturatedLoGain=lo; }
 
     Bool_t  IsPixelExisting(Int_t id) const;
