Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 6857)
+++ trunk/MagicSoft/Mars/Changelog	(revision 6858)
@@ -21,4 +21,126 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2005/03/18 Thomas Bretz
+
+   * Makefile:
+     - removed mone from list of compiled programs
+
+   * mars.cc:
+     - replaced the MARS display by the Camera Display directly
+
+   * manalysis/MCameraData.[h,cc], mcalib/MCalibrateData.[h,cc],
+     mbadpixels/MBadPixelsTreat.[h,cc], mcalib/MCalibrateRelTimes.[h,cc],
+     mimage/MCameraSmooth.[h,cc], mimage/MConcentration.[h,cc],
+     mimage/MHillas.[h,cc], mimage/MHillasExt.[h,cc], 
+     mimage/MImgCleanStd.[h,cc], mimage/MNewImagePar.[h,cc],
+     mimage/MImagePar.[h,cc], MNewImagePar.[h,cc],
+     mjobs/MJCalibTest.cc, mhcalib/MHCalibrationTestCam.[h,cc],
+     mpedestal/MPedPhotCalc.[h,cc], mjobs/MJCalibrateSignal.cc:
+     - removed dependancy on MArrivalTime, information now
+       found in MSignalCam
+     - replaced MCerPhotEvt by MSignalCam
+     - it was renamed because it will be completely incompatible
+       anyhow
+
+   * mjobs/MJCalibrateSignal.cc:
+     - use new MSignalCam type to display pulse position of cosmics
+
+   * mcalib/MCalibrateData.cc:
+     - calculate number of saturated pixels
+
+   * manalysis/MCerPhotEvt.[h,cc]:
+     - removed possibility for zero-supression. Now the index
+       is identical with the position in the array
+     - renamed and moved to msignal/MSignalCam.[h,cc]
+
+   * manalysis/MCerPhotPix.cc:
+     - removed obsolete values
+     - added arrival time
+     - renamed and moved to msignal/MSignalPix.[h,cc]
+
+   * mcalib/MCalibrationChargeCalc.cc:
+     - some cosmetic changes and small fixed from the Munich cvs
+       (undocumented)
+
+   * mfileio/MWriteRootFile.cc:
+     - fixed bug in RecursiveRemove which caused crashed with real
+       data
+
+   * mhft/MGeomCamMagicEnhance.cc, mhft/MHexagonalFTCalc.cc:
+     - updated, but untested
+
+   * mhist/MHCamEvent.[h,cc]:
+     - some fixes in Draw to get a correct display in root 4.02/00
+       (at least on 64-bit systems)
+     - removed kSqrtVariance it is included in kProfile now
+
+   * mhist/MHCamera.[h,cc]:
+     - removed sqrtvariance option which is included in profile now
+     - the profile now uses the new array fBinEntries to display
+       a more accurate profile
+
+   * mhist/MHEvent.cc:
+     - set to type 6 for arrival times
+
+   * mimage/MHillasCalc.cc:
+     - updated text for error=1
+
+   * mimage/MImagePar.cc:
+     - copy number of saturated pixels from MSignalCam
+
+   * mjobs/MJStar.cc:
+     - enhanced title of some histogram
+
+   * mjobs/MSequence.cc:
+     - updated path to fit data center (D.Dorner)
+
+   * mmain/MEventDisplay.cc:
+     - display Arrival Time from MSignalCam now
+
+   * msignal/MArrivalTimeCam.cc:
+     - implemented a new case 6 which is identical with the 
+       default case AND arrival time from MSignalCam
+
+   * manalysis/Makefile, manalysis/AnalysisLinkDef.h,
+     manalysis/:
+     - removed MCerPhotEvt
+     - removed MCerPHotPix
+     - removed MCerPhotAnal
+     - removed MCerPhotAnal2
+     - removed MCerPhotCalc
+
+   * mimage/Makefile, manalysis/ImageLinkDef.h:
+     - removed MHillasSrcCalc
+
+   * manalysis/MSupercutsCalc.cc:
+     - removed an obsolete include
+
+   * mhist/Makefile, mhist/HistLinkDef.h:
+     - removed MHSigmaTheta
+
+   * mmain/Makefile, mmain/HistLinkDef.h:
+     - removed MDataCheck
+     - removed Mars
+     - removed MAnalysis
+     - removed MMonteCarlo
+     - removed MGDisplayAdc
+     - removed MOnlineDisplay
+     - removed MOnlineDump
+
+   * msignal/Makefile, msignal/HistLinkDef.h, msignal/:
+     - added MSignalCam
+     - added MSignalPix
+     - added MSignalCalc
+
+   * msql/Makefile, msql/SqlLinkDef.h:
+     - removed MSqlInsertRun
+
+   * mfilter/Makefile, mfilter/FilterLinkDef.h:
+     - removed MFSelBasic
+     - removed MFSelStandard
+     - removed MFSelFinal
+
+
+
  2005/03/17 Thomas Bretz
 
@@ -41,4 +163,31 @@
      - moved to manalysisct1
 
+   * mfilter/Makefile, mfilter/FilterLinkDef.h:
+     - removed MFCT1SelBasic
+     - removed MFCT1SelStandard
+     - removed MFCT1SelFinal
+
+   * manalysis/Makefile, manalysis/AnalysisLinkDef.h:
+     - removed MPad
+     - removed MMakePadHistograms
+     - removed MSigmabar
+     - removed MSigmabarParam
+     - removed MSigmabarCalc
+
+   * mimage/Makefile, mimage/ImageLinkDef.h:
+     - removed MImgCleanTGB
+
+   * mmontecarlo/Makefile, mmontecarlo/MonteCarloLinkDef.h
+     - removed MMcEnergyEst
+     - removed MMcTimeGenerate
+
+   * msignal/Makefile, msignal/SignalLinkDef.h:
+     - removed MArrivalTime
+     - removed MArrivalTimeCalc
+     - removed MArrivalTimeCalc2
+
+   * mjobs/MJCalibration.cc:
+     - followed some undocumented changes from the other cvs
+
 
 
@@ -47,5 +196,5 @@
    * callisto.cc:
      - set changed extractor in MJCalibrateSignal from MJPedestal
-      - don't process 'range finding' for MonteCarlo data
+     - don't process 'range finding' for MonteCarlo data
 
    * callisto.rc:
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 6857)
+++ trunk/MagicSoft/Mars/NEWS	(revision 6858)
@@ -86,4 +86,12 @@
       accurate now
 
+    - completely revised the container in which the signal is stored
+      MCerPhotEvt/Pix, MArrivalTime --> MSignalCam/Pix
+       * the new implementation is faster and
+       * needs less storage space
+
+     - FIRST version which can process Monte Carlos through the 
+       whole chain of programs (callisto, star, etc)
+
 
 
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc	(revision 6858)
@@ -53,5 +53,5 @@
 //
 //  Input Containers:
-//   MCerPhotEvt
+//   MSignalCam
 //   MPedPhotCam
 //   MBadPixelsCam
@@ -59,5 +59,5 @@
 //
 //  Output Containers:
-//   MCerPhotEvt
+//   MSignalCam
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -79,6 +79,6 @@
 #include "MGeomCam.h"
 
-#include "MCerPhotPix.h"
-#include "MCerPhotEvt.h"
+#include "MSignalPix.h"
+#include "MSignalCam.h"
 
 #include "MPedPhotPix.h"
@@ -88,5 +88,5 @@
 #include "MBadPixelsCam.h"
 
-#include "MArrivalTime.h"
+//#include "MArrivalTime.h"
 
 ClassImp(MBadPixelsTreat);
@@ -132,5 +132,5 @@
 //
 //  - Try to find or create MBlindPixels in parameter list.
-//  - get the MCerPhotEvt from the parlist (abort if missing)
+//  - get the MSignalCam from the parlist (abort if missing)
 //  - if no pixels are given by the user try to determin the starfield
 //    from the monte carlo run header.
@@ -145,8 +145,8 @@
     }
 
-    fEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt"));
+    fEvt = (MSignalCam*)pList->FindObject(AddSerialNumber("MSignalCam"));
     if (!fEvt)
     {
-        *fLog << err << AddSerialNumber("MCerPhotEvt") << " not found... aborting." << endl;
+        *fLog << err << AddSerialNumber("MSignalCam") << " not found... aborting." << endl;
         return kFALSE;
     }
@@ -191,23 +191,8 @@
             {
                 *fLog << err << AddSerialNumber(o->GetName()) << " [MPedPhotCam] not found... aborting." << endl;
-                //*fLog << " Use  MBadPixelsTreat::SetProcessPedestalRun(kFALSE)  and" << endl;
-                //*fLog << " MBadPixelsTreat::SetProcessPedestalEvt(kFALSE) to switch" << endl;
-                //*fLog << " Pedestal treatment off." << endl;
                 return kFALSE;
             }
 
             fPedPhotCams.Add(p);
-        }
-    }
-
-    fTimes = 0;
-    if (IsProcessTimes())
-    {
-        fTimes = (MArrivalTime*)pList->FindObject(AddSerialNumber("MArrivalTime"));
-        if (!fTimes)
-        {
-            *fLog << err << AddSerialNumber("MArrivalTime") << " not found... aborting." << endl;
-            *fLog << " Use MBadPixelsTreat::SetProcessTimes(kFALSE) to switch time interpolation off." << endl;
-            return kFALSE;
         }
     }
@@ -245,5 +230,5 @@
     for (UShort_t i=0; i<entries; i++)
     {
-        MCerPhotPix *pix = fEvt->GetPixById(i);
+        MSignalPix *pix = fEvt->GetPixById(i);
 
         //
@@ -255,5 +240,5 @@
         //
         // Get a pointer to this pixel. If it is not yet existing
-        // create a new entry for this pixel in MCerPhotEvt
+        // create a new entry for this pixel in MSignalCam
         //
         if (!pix)
@@ -301,5 +286,5 @@
             // Check whether the neighbor has a signal stored
             //
-            const MCerPhotPix *evtpix = fEvt->GetPixById(nidx);
+            const MSignalPix *evtpix = fEvt->GetPixById(nidx);
             if (!evtpix)
                 continue;
@@ -416,5 +401,5 @@
         if (num < fNumMinNeighbors)
         {
-            MCerPhotPix *pix =fEvt->GetPixById(i);
+            MSignalPix *pix =fEvt->GetPixById(i);
             if (!pix)
                 pix = fEvt->AddPixel(i, 0, 0);
@@ -454,5 +439,5 @@
 void MBadPixelsTreat::InterpolateTimes() const
 {
-    Int_t n = fTimes->GetSize();
+    Int_t n = fEvt->GetNumPixels();
 
     for (int i=0; i<n; i++)
@@ -474,5 +459,5 @@
         for (unsigned int j=0; j<time.GetSize(); j++)
         {
-            const Double_t t = (*fTimes)[gpix.GetNeighbor(j)];
+            const Double_t t = (*fEvt)[j].GetArrivalTime();
             if (t>=0)
                 time[n0++] = t;
@@ -498,163 +483,7 @@
         // FIXME: Request a minimum number of neighbors to take action?
         if (p0>=0 && p1>=0 && TMath::Abs(time[p0] - time[p1])<250)
-            fTimes->SetTime(i, (time[p0]+time[p1])/2);
-    }
-}
-
-// --------------------------------------------------------------------------
-//
-//  Replaces each pixel (signal, signal error, pedestal, pedestal rms)
-//  by the average of its surrounding pixels.
-//  If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also
-//  included.
-//
-//  NT: Informations about the interpolated pedestals are added. 
-//      When the option Interpolated is called, the blind pixel with the new
-//      values of signal and fluttuation is included in the calculation of
-//      the Image Parameters.
-//
-/*
-void MBadPixelsTreat::Interpolate() const
-{
-    const UShort_t entries = fGeomCam->GetNumPixels();
-
-    //
-    // Create arrays
-    //
-    TArrayD nphot(entries);
-    TArrayD perr(entries);
-    TArrayD ped(entries);
-    TArrayD pedrms(entries);
- 
-    //
-    // Loop over all pixels
-    //
-    for (UShort_t i=0; i<entries; i++)
-    {
-        MCerPhotPix *pix = fEvt->GetPixById(i);
-
-        //
-        // Check whether pixel with idx i is blind
-        //
-        if (pix && (*fBadPixels)[i].IsOK())
-            continue;
-
-        //
-        // Get a pointer to this pixel. If it is not yet existing
-        // create a new entry for this pixel in MCerPhotEvt
-        //
-        if (!pix)
-        {
-            pix = fEvt->AddPixel(i, 0, 0);
-            (*fBadPixels)[i].SetUnsuitable(MBadPixelsPix::kUnsuitableEvt);
-        }
-
-        //
-        // Get the corresponding geometry and pedestal
-        //
-        const MGeomPix &gpix    = (*fGeomCam)[i];
-        const MPedPhotPix &ppix = (*fPedPhot)[i];
-
-        // Do Not-Use-Central-Pixel
-        const Bool_t nucp = !TESTBIT(fFlags, kUseCentralPixel);
-
-        Int_t num = nucp ? 0 : 1;
-
-        nphot[i]  = nucp ? 0 : pix->GetNumPhotons();
-        ped[i]    = nucp ? 0 : ppix.GetMean();
-        perr[i]   = nucp ? 0 : Pow2(pix->GetErrorPhot());
-        pedrms[i] = nucp ? 0 : Pow2(ppix.GetRms());
-
-        //
-	// The values are rescaled to the small pixels area for the right comparison
-        //
-        const Double_t ratio = fGeomCam->GetPixRatio(i);
-
-        if (nucp)
-        {
-            nphot[i]  *= ratio;
-            perr[i]   *= ratio;
-            ped[i]    *= ratio;
-            pedrms[i] *= ratio;
-        }
-
-        //
-        // Loop over all its neighbors
-        //
-        const Int_t n = gpix.GetNumNeighbors();
-        for (int j=0; j<n; j++)
-        {
-            const UShort_t nidx = gpix.GetNeighbor(j);
-
-            //
-            // Do not use blind neighbors
-            //
-            if ((*fBadPixels)[nidx].IsBad())
-                continue;
-
-            //
-            // Check whether the neighbor has a signal stored
-            //
-            const MCerPhotPix *evtpix = fEvt->GetPixById(nidx);
-            if (!evtpix)
-                continue;
-
-            //
-            // Get the geometry for the neighbor
-            //
-            const Double_t nratio = fGeomCam->GetPixRatio(nidx);
-            MPedPhotPix &nppix    = (*fPedPhot)[nidx];
-
-            //
-	    // The error is calculated as the quadratic sum of the errors
-	    //
-            nphot[i]  += nratio*evtpix->GetNumPhotons();
-            ped[i]    += nratio*nppix.GetMean();
-            perr[i]   += nratio*Pow2(evtpix->GetErrorPhot());
-	    pedrms[i] += nratio*Pow2(nppix.GetRms());
-
-            num++;
-        }
-
-        if (num<fNumMinNeighbors)
-        {
-            pix->SetPixelUnmapped();
-            nphot[i]  = 0;
-            ped[i]    = 0;
-            perr[i]   = 0;
-            pedrms[i] = 0;
-            continue;
-        }
-
-        //
-	// Now the mean is calculated and the values rescaled back to the pixel area
-        //
-	nphot[i] /= num*ratio;
-        ped[i]   /= num*ratio;
-        perr[i]   = TMath::Sqrt(perr[i]/(num*ratio));
-        pedrms[i] = TMath::Sqrt(pedrms[i]/(num*ratio));
-
-    }
-
-    //
-    // Now the new pixel values are calculated and can be replaced in
-    // the corresponding containers
-    //
-    for (UShort_t i=0; i<entries; i++)
-    {
-        //
-        // Do not use blind neighbors
-        //
-        if ((*fBadPixels)[i].IsOK())
-            continue;
-
-        //
-        // It must exist, we have created it in the loop before.
-        //
-        fEvt->GetPixById(i)->Set(nphot[i], perr[i]);
-        (*fPedPhot)[i].Set(ped[i], pedrms[i]);
-    }
-}
-*/
+            (*fEvt)[i].SetArrivalTime((time[p0]+time[p1])/2);
+    }
+}
 
 // --------------------------------------------------------------------------
@@ -673,8 +502,6 @@
     for (UShort_t i=0; i<entries; i++)
     {
-        MCerPhotPix &pix = (*fEvt)[i];
-
-        if (IsPixelBad(pix.GetPixId()))
-            pix.SetPixelUnmapped();
+        if (IsPixelBad(i))
+            (*fEvt)[i].SetPixelUnmapped();
     }
 }
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h	(revision 6857)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h	(revision 6858)
@@ -7,7 +7,6 @@
 
 class MGeomCam;
-class MCerPhotEvt;
+class MSignalCam;
 class MPedPhotCam;
-class MArrivalTime;
 class MBadPixelsCam;
 
@@ -16,7 +15,5 @@
 private:
     MGeomCam      *fGeomCam;   //!
-    //MPedPhotCam   *fPedPhot;   //!
-    MCerPhotEvt   *fEvt;       //!
-    MArrivalTime  *fTimes;     //!
+    MSignalCam    *fEvt;       //!
     MBadPixelsCam *fBadPixels; //!
 
@@ -26,5 +23,4 @@
     Byte_t fNumMinNeighbors;
 
-    //TString fNamePedPhotCam; // name of the 'MPedPhotCam' container
     TList fNamePedPhotCams;
 
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 6858)
@@ -287,5 +287,5 @@
         return;
 
-    *fLog << all << underline << "File: " << GetFileName() << endl;
+    *fLog << all << underline << "File: " << GetFileName() << dec << endl;
 
     if (fTrees.GetEntries()==0)
@@ -1047,5 +1047,5 @@
 void MWriteRootFile::RecursiveRemove(TObject *obj)
 {
-    if (obj==fOut && TestBit(kIsNotOwner))
+    if (obj==fOut)
         fOut=0;
 }
Index: trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h	(revision 6857)
+++ trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h	(revision 6858)
@@ -12,7 +12,4 @@
 #pragma link C++ class MFParticleId+;
 
-#pragma link C++ class MFSelBasic+;
-#pragma link C++ class MFSelStandard+;
-#pragma link C++ class MFSelFinal+;
 #pragma link C++ class MFSoftwareTrigger+;
 #pragma link C++ class MFCosmics+;
Index: trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc	(revision 6858)
@@ -57,10 +57,9 @@
 //
 //  WARNING: Using trigger type kAllPattern resets the BIT(21) bit
-//           of all pixels in MCerPhotEvt
+//           of all pixels in MSignalCam
 //
 //
 //  Input:
-//    MCerPhotEvt
-//    MArrivalTime
+//    MSignalCam
 //    MGeomCam
 //
@@ -76,6 +75,6 @@
 #include "MGeomCam.h"
 
-#include "MCerPhotEvt.h"
-#include "MArrivalTime.h"
+#include "MSignalCam.h"
+//#include "MArrivalTime.h"
 
 ClassImp(MFSoftwareTrigger);
@@ -88,5 +87,5 @@
 //
 MFSoftwareTrigger::MFSoftwareTrigger(const char *name, const char *title)
-    : fCam(NULL), fEvt(NULL), fTme(NULL), fThreshold(5),
+    : fCam(NULL), fEvt(NULL), fThreshold(5),
     fTimeWindow(0.5), fNumNeighbors(4), fType(kSinglePixelNeighbors)
 {
@@ -112,5 +111,5 @@
 {
     // Try to get the pixel information of a pixel with this index
-    MCerPhotPix *pix = fEvt->GetPixById(idx);
+    MSignalPix *pix = fEvt->GetPixById(idx);
 
     // If a pixel with this index is not existing... do nothing.
@@ -133,6 +132,6 @@
         return 0;
 
-    const Float_t tm1 = fTme ? (*fTme)[idx] : 0;
-    if (fTme && TMath::Abs(tm1-tm0)>fTimeWindow)
+    const Float_t tm1 = pix->GetArrivalTime();
+    if (TMath::Abs(tm1-tm0)>fTimeWindow)
         return 0;
 
@@ -157,5 +156,5 @@
 {
     // Try to get the pixel information of a pixel with this index
-    MCerPhotPix *pix = fEvt->GetPixById(idx);
+    MSignalPix *pix = fEvt->GetPixById(idx);
 
     // If a pixel with this index is not existing... do nothing.
@@ -210,11 +209,24 @@
     ResetBits(kWasChecked);
 
+    const UInt_t npixevt = fEvt->GetNumPixels();
+    for (UInt_t idx=0; idx<npixevt; idx++)
+    {
+        const MSignalPix &pix = (*fEvt)[idx];
+        if (!pix.IsPixelUsed())
+            continue;
+
+        // Check if trigger condition is fullfilled for this pixel
+        if (CountPixels(idx, pix.GetArrivalTime()) >= fNumNeighbors)
+            return kTRUE;
+    }
+
+/*
     // Reset bit
-    MCerPhotPix *pix=0;
+    MSignalPix *pix=0;
 
     // We could loop over all indices which looks more straight
     // forward but should be a lot slower (assuming zero supression)
     TIter Next(*fEvt);
-    while ((pix=static_cast<MCerPhotPix*>(Next())))
+    while ((pix=static_cast<MSignalPix*>(Next())))
     {
         // Check if trigger condition is fullfilled for this pixel
@@ -223,5 +235,5 @@
             return kTRUE;
     }
-
+  */
     return kFALSE;
 }
@@ -230,5 +242,5 @@
 {
     // Try to get the pixel information of a pixel with this index
-    MCerPhotPix *pix = fEvt->GetPixById(idx);
+    MSignalPix *pix = fEvt->GetPixById(idx);
 
     // If a pixel with this index is not existing... do nothing.
@@ -283,10 +295,10 @@
 {
     // Reset bit
-    MCerPhotPix *pix=0;
+    MSignalPix *pix=0;
 
     // We could loop over all indices which looks more straight
     // forward but should be a lot slower (assuming zero supression)
     TIter Next(*fEvt);
-    while ((pix=static_cast<MCerPhotPix*>(Next())))
+    while ((pix=static_cast<MSignalPix*>(Next())))
     {
         ResetBits(kWasChecked|kIsCoincident);
@@ -302,16 +314,18 @@
 */
 
-Bool_t MFSoftwareTrigger::CheckPixel(const MCerPhotPix &pix) const
-{
+const MSignalPix *MFSoftwareTrigger::CheckPixel(Int_t i) const
+{
+    const MSignalPix &pix = (*fEvt)[i];
+
     if (!pix.IsPixelUsed())
-        return kFALSE;
-
-    if (pix.GetNumPhotons()*fCam->GetPixRatio(pix.GetPixId())<fThreshold)
-        return kFALSE;
-
-    if ((*fCam)[pix.GetPixId()].IsInOutermostRing())
-        return kFALSE;
-
-    return kTRUE;
+        return NULL;
+
+    if (pix.GetNumPhotons()*fCam->GetPixRatio(i)<fThreshold)
+        return NULL;
+
+    if ((*fCam)[i].IsInOutermostRing())
+        return NULL;
+
+    return &pix;
 }
 
@@ -326,11 +340,11 @@
     for (Int_t i=0; i<entries; i++)
     {
-        const MCerPhotPix &pix0 = (*fEvt)[i];
-        if (!CheckPixel(pix0))
+        const MSignalPix *pix0 = CheckPixel(i);
+        if (!pix0)
             continue;
 
         Int_t num = 1;
 
-        const MGeomPix &gpix = (*fCam)[pix0.GetPixId()];
+        const MGeomPix &gpix = (*fCam)[i];
 
         const Int_t nneighbors = gpix.GetNumNeighbors();
@@ -338,15 +352,14 @@
         {
             const Int_t idx1 = gpix.GetNeighbor(n);
-            if (!CheckPixel(*fEvt->GetPixById(idx1)))
+
+            const MSignalPix *pix1 = CheckPixel(idx1);
+            if (!pix1)
                 continue;
 
-            if (fTme)
-            {
-                const Float_t t0 = (*fTme)[pix0.GetPixId()];
-                const Float_t t1 = (*fTme)[idx1];
-
-                if (TMath::Abs(t0-t1)>fTimeWindow)
-                    continue;
-            }
+            const Float_t t0 = pix0->GetArrivalTime();
+            const Float_t t1 = pix1->GetArrivalTime();
+
+            if (TMath::Abs(t0-t1)>fTimeWindow)
+                continue;
 
             if (++num==fNumNeighbors)
@@ -359,12 +372,12 @@
 // --------------------------------------------------------------------------
 //
-// Request pointer to MCerPhotEvt and MGeomCam from paremeter list
+// Request pointer to MSignalCam and MGeomCam from paremeter list
 //
 Int_t MFSoftwareTrigger::PreProcess(MParList *pList)
 {
-    fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
+    fEvt = (MSignalCam*)pList->FindObject("MSignalCam");
     if (!fEvt)
     {
-        *fLog << err << "MCerPhotEvt not found... aborting." << endl;
+        *fLog << err << "MSignalCam not found... aborting." << endl;
         return kFALSE;
     }
@@ -375,15 +388,4 @@
         *fLog << err << "MGeomCam not found... aborting." << endl;
         return kFALSE;
-    }
-
-    fTme = 0;
-    if (fTimeWindow>0)
-    {
-        fTme = (MArrivalTime*)pList->FindObject("MArrivalTime");
-        if (!fTme)
-        {
-            *fLog << err << "MArrivalTime not found... aborting." << endl;
-            return kFALSE;
-        }
     }
 
Index: trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.h
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.h	(revision 6857)
+++ trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.h	(revision 6858)
@@ -8,6 +8,6 @@
 class MMcEvt;
 class MGeomCam;
-class MCerPhotEvt;
-class MCerPhotPix;
+class MSignalCam;
+class MSignalPix;
 class MArrivalTime;
 
@@ -23,5 +23,5 @@
 private:
     const MGeomCam     *fCam; // Camera Geometry
-    const MCerPhotEvt  *fEvt; // Cerenkov Photon Event
+    const MSignalCam   *fEvt; // Cerenkov Photon Event
     const MArrivalTime *fTme;
 
@@ -47,5 +47,5 @@
 
     void ResetBits(Int_t bits) const;
-    Bool_t CheckPixel(const MCerPhotPix &pix) const;
+    const MSignalPix *CheckPixel(Int_t i) const;
     Bool_t SwTrigger() const;
     Bool_t SwCoincidence() const;
Index: trunk/MagicSoft/Mars/mfilter/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mfilter/Makefile	(revision 6857)
+++ trunk/MagicSoft/Mars/mfilter/Makefile	(revision 6858)
@@ -24,7 +24,4 @@
 	   MFParticleId.cc \
 	   MFAlpha.cc \
-	   MFSelBasic.cc \
-	   MFSelStandard.cc \
-	   MFSelFinal.cc \
            MFSoftwareTrigger.cc \
            MFCosmics.cc \
Index: trunk/MagicSoft/Mars/mhcalib/MHCalibrationTestTimeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHCalibrationTestTimeCam.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mhcalib/MHCalibrationTestTimeCam.cc	(revision 6858)
@@ -94,5 +94,6 @@
 #include "MCalibrationPix.h"
 
-#include "MArrivalTime.h"
+#include "MSignalCam.h"
+#include "MSignalPix.h"
 
 #include "MGeomCam.h"
@@ -116,4 +117,5 @@
 const TString MHCalibrationTestTimeCam::gsHistXTitle = "Arrival Time [FADC slices]";
 const TString MHCalibrationTestTimeCam::gsHistYTitle = "Nr. events";
+
 // --------------------------------------------------------------------------
 //
@@ -168,11 +170,4 @@
     return kFALSE;
 
-  MArrivalTime *signal = (MArrivalTime*)pList->FindObject("MArrivalTime");
-  if (!signal)
-  {
-      *fLog << err << "MArrivalTime not found... abort." << endl;
-      return kFALSE;
-  }
-
   const Int_t npixels  = fGeom->GetNumPixels();
   const Int_t nsectors = fGeom->GetNumSectors();
@@ -203,5 +198,5 @@
 {
 
-  MArrivalTime *calibration = (MArrivalTime*)par;
+  MSignalCam *calibration = (MSignalCam*)par;
   if (!calibration)
     {
@@ -227,5 +222,5 @@
 	continue;
 
-      const Float_t  time = (*calibration)[i];
+      const Float_t  time = (*calibration)[i].GetArrivalTime();
       const Int_t  aidx   = (*fGeom)[i].GetAidx();
       const Int_t  sector = (*fGeom)[i].GetSector();
Index: trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc	(revision 6858)
@@ -50,4 +50,5 @@
 #include "MHCamera.h"
 
+#include "MSignalCam.h"
 #include "MPedestalCam.h"
 #include "MPedPhotCam.h"
@@ -56,6 +57,4 @@
 #include "MBadPixelsCalc.h"
 #include "MBadPixelsMerge.h"
-#include "MCerPhotEvt.h"
-#include "MArrivalTime.h"
 #include "MCalibrationChargeCam.h"
 #include "MCalibrationRelTimeCam.h"
@@ -392,5 +391,5 @@
   plist.AddToList(&tmcam);
 
-  MCerPhotEvt          cerphot;
+  MSignalCam           cerphot;
   MPedPhotCam          pedphot;
   MHCalibrationTestCam testcam;
@@ -479,12 +478,12 @@
   MHCamEvent evt0(0,"Signal", "Un-Calibrated Signal;;S [FADC cnts]" );
   MHCamEvent evt1(0,"CalSig", "Cal. and Interp. Sig. by Pixel Size Ratio;;S [phe]");
-  MHCamEvent evt2(0,"Times" , "Arrival Time;;T [slice]");
+  MHCamEvent evt2(6,"Times" , "Arrival Time;;T [slice]");
 
   MFillH fill0(&evt0, "MExtractedSignalCam", "FillUncalibrated");
-  MFillH fill1(&evt1, "MCerPhotEvt", "FillCalibrated");
-  MFillH fill2(&evt2, "MArrivalTime","FillTimes");
-  
-  MFillH fillcam("MHCalibrationTestCam",     "MCerPhotEvt" ,"FillTest");
-  MFillH filltme("MHCalibrationTestTimeCam", "MArrivalTime","FillTestTime");
+  MFillH fill1(&evt1, "MSignalCam", "FillCalibrated");
+  MFillH fill2(&evt2, "MSignalCam", "FillTimes");
+  
+  MFillH fillcam("MHCalibrationTestCam",     "MSignalCam" ,"FillTest");
+  MFillH filltme("MHCalibrationTestTimeCam", "MSignalCam", "FillTestTime");
   fillcam.SetBit(MFillH::kDoNotDisplay);
   filltme.SetBit(MFillH::kDoNotDisplay);
Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 6858)
@@ -53,4 +53,5 @@
 #include "MGeomCam.h"
 #include "MHCamEvent.h"
+//#include "MHCamEventTH.h"
 #include "MPedestalCam.h"
 #include "MBadPixelsCam.h"
@@ -610,8 +611,13 @@
     MHCamEvent evt5(0, "Interp'd",   "Interpolated Signal;;S [phe]");
     MHCamEvent evt6(2, "Unsuitable", "Fraction of unsuitable events per Pixel;;[1]");
-    MHCamEvent evt7(0, "Times",      "Calibrated Arrival Time;;T [fadc sl]");
+    MHCamEvent evt7(6, "Times",      "Calibrated Arrival Time;;T [fadc sl]");
     MHCamEvent evt8(0, "Conv",       "Calibration Conv. Factors;;[phe/fadc cnts]");
-    //MHCamEvent evt9(0, "PulsePos",   "Pulse Position of cosmics"); //Calibration Conv. Factors;;[phe/fadc cnts]
-
+    MHCamEvent evt9(7, "PulsePos",  "Pulse Position of cosmics (>15phe);;T"); //Calibration Conv. Factors;;[phe/fadc cnts]
+    /*
+     MHCamEventTH evt9(6, "PulsePos",  "Pulse Position of cosmics"); //Calibration Conv. Factors;;[phe/fadc cnts]
+     evt9.SetNameThreshold("MCerPhotEvt");
+     evt9.SetThreshold(15);
+     */
+/*
     evt0.EnableSqrtVariance();
     evt1.EnableSqrtVariance();
@@ -622,5 +628,5 @@
     evt7.EnableSqrtVariance();
     evt8.EnableSqrtVariance();
-
+  */
     MFillH fill0(&evt0, "MPedestalFundamental",    "FillPedFLG");
     MFillH fill1(&evt1, "MPedestalFromExtractorRndm", "FillPedRmsFLG");
@@ -630,15 +636,10 @@
     MFillH fill5(&evt5, "MCerPhotEvt",             "FillInterpolated");
     MFillH fill6(&evt6, "MBadPixelsCam",           "FillUnsuitable");
-    MFillH fill7(&evt7, "MArrivalTime",            "FillTimes");
+    MFillH fill7(&evt7, "MCerPhotEvt",             "FillTimes");
     MFillH fill8(&evt8, "MCalibConstCam",          "FillConv");
-    //MFillH fill9(&evt9, "MCalibConstCam",          "FillPulse");
+    MFillH fill9(&evt9, "MCerPhotEvt",             "FillPulse");
 
     MTaskEnv fillflorian("FinalFantasy");
     fillflorian.SetDefault();
-
-    // Write the special MC tree
-    MWriteRootFile writemc(2, fname, fOverwrite?"RECREATE":"NEW");
-    writemc.SetName("WriteMC");
-    writemc.AddContainer("MMcEvtBasic", "OriginalMC");
 
     // The second rule is for the case reading raw-files!
@@ -664,5 +665,5 @@
     write.AddContainer("MTime",                     "Events",     kFALSE);
     write.AddContainer("MRawEvtHeader",             "Events");
-    write.AddContainer("MArrivalTime",              "Events",     kFALSE);
+    //write.AddContainer("MArrivalTime",              "Events",     kFALSE);
     write.AddContainer("MPointingPos",              "Events",     kFALSE);
     // Slow-Control: Current-tree
@@ -688,4 +689,9 @@
     write.AddContainer("MReportCC",                 "CC",         kFALSE);
     write.AddContainer("MTimeCC",                   "CC",         kFALSE);
+
+    // Write the special MC tree
+    MWriteRootFile writemc(2, fname, fOverwrite?"RECREATE":"NEW");
+    writemc.SetName("WriteMC");
+    writemc.AddContainer("MMcEvtBasic", "OriginalMC");
 
     // Now setup tasklist for events
@@ -754,4 +760,5 @@
     if (extractor2 || extractor1->InheritsFrom("MExtractTimeAndCharge"))
       tlist2.AddToList(&fill7);
+    tlist2.AddToList(&fill9);
 
     tlist2.AddToList(&fillflorian);
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 6858)
@@ -19,8 +19,9 @@
 !   Author(s): Markus Gaug, 02/2004 <mailto:markus@ifae.es>
 !
-!   Copyright: MAGIC Software Development, 2000-2004
+!   Copyright: MAGIC Software Development, 2000-2005
 !
 !
 \* ======================================================================== */
+
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -178,4 +179,5 @@
 const TString MJCalibration::fgReferenceFile = "mjobs/calibrationref.rc";
 const TString MJCalibration::fgHiLoCalibFile = "mjobs/hilocalib_df4.root";
+
 // --------------------------------------------------------------------------
 //
@@ -1479,4 +1481,9 @@
 
   TFile file(fHiLoCalibFile,"READ");
+  if (!file.IsOpen())
+  {
+    *fLog << err << "ERROR - Couldn't open hi-lo intercalibration file " << fHiLoCalibFile << " for reading..." << endl;
+    return kFALSE;
+  }
 
   MCalibrationHiLoCam hilocam;
@@ -1774,8 +1781,9 @@
         plist.AddToList(&fIntensQECam);
         plist.AddToList(&fIntensCalibCam);
-        plist.AddToList(&fIntensBlindCam);
         //        plist.AddToList(&fIntensCalibrationPINDiode);
         plist.AddToList(&fIntensRelTimeCam);
         plist.AddToList(&fIntensBadCam);
+        if (IsUseBlindPixel())
+            plist.AddToList(&fIntensBlindCam);
     }
     else
@@ -1783,7 +1791,9 @@
         plist.AddToList(&fQECam);
         plist.AddToList(&fCalibrationCam);
-        plist.AddToList(&fCalibrationBlindCam);
-        plist.AddToList(&fCalibrationPINDiode);
         plist.AddToList(&fRelTimeCam);
+        if (IsUseBlindPixel())
+            plist.AddToList(&fCalibrationBlindCam);
+        if (IsUsePINDiode())
+            plist.AddToList(&fCalibrationPINDiode);
     }
 
@@ -1829,5 +1839,6 @@
     MExtractBlindPixel       blindext;
 
-    InitBlindPixel(blindext, blindcam);
+    if (IsUseBlindPixel())
+        InitBlindPixel(blindext, blindcam);
 
     MExtractSlidingWindow    extract2;
@@ -2157,42 +2168,42 @@
 Bool_t MJCalibration::WriteResult(MParList &plist)
 {
+    if (IsNoStorage())
+        return kTRUE;
+
     TObjArray cont;
 
-    if (!IsNoStorage())
-    {
-        if (IsIntensity())
-        {
-            cont.Add(&fIntensBadCam);
-            cont.Add(&fIntensCalibCam);
-            cont.Add(&fIntensQECam);
-            cont.Add(&fIntensBlindCam);
-        }
-        else
-        {
-            cont.Add(&fBadPixels);
-            cont.Add(&fCalibrationCam);
-            cont.Add(&fQECam);
-            cont.Add(&fCalibrationBlindCam);
-        }
-        cont.Add(&fCalibrationPINDiode);
-
-        //if (IsRelTimes())
-        cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam);
-
-	if (fExtractorCam.GetSize() != 0)
-	  cont.Add(&fExtractorCam);
-	
-	TObject *pedcam = plist.FindObject("MPedestalCam");
-        if (!pedcam)
-	  *fLog << warn << " - WARNING - MPedestalCam (fundamental)... not found for writing!" << endl;
-        else
-	  cont.Add(pedcam);
-	
-        TObject *geom = plist.FindObject("MGeomCam");
-        if (!geom)
-            *fLog << warn << " - WARNING - MGeomCam... not found for writing!" << endl;
-        else
-            cont.Add(geom);
-    }
+    if (IsIntensity())
+    {
+        cont.Add(&fIntensBadCam);
+        cont.Add(&fIntensCalibCam);
+        cont.Add(&fIntensQECam);
+        cont.Add(&fIntensBlindCam);
+    }
+    else
+    {
+        cont.Add(&fBadPixels);
+        cont.Add(&fCalibrationCam);
+        cont.Add(&fQECam);
+        cont.Add(&fCalibrationBlindCam);
+    }
+    cont.Add(&fCalibrationPINDiode);
+
+    //if (IsRelTimes())
+    cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam);
+
+    if (fExtractorCam.GetSize() != 0)
+        cont.Add(&fExtractorCam);
+
+    TObject *pedcam = plist.FindObject("MPedestalCam");
+    if (!pedcam)
+        *fLog << warn << " - WARNING - MPedestalCam (fundamental)... not found for writing!" << endl;
+    else
+        cont.Add(pedcam);
+
+    TObject *geom = plist.FindObject("MGeomCam");
+    if (!geom)
+        *fLog << warn << " - WARNING - MGeomCam... not found for writing!" << endl;
+    else
+        cont.Add(geom);
 
     if (IsHistsStorage())
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 6858)
@@ -1233,72 +1233,112 @@
     if (fIsPulsePosCheck)
       {
-
-        MHCalibrationPulseTimeCam *hcam = (MHCalibrationPulseTimeCam*)plist.FindObject("MHCalibrationPulseTimeCam");
-        if (fIsPixelCheck)
+        
+        Int_t numhigainsamples = 0;
+        Int_t numlogainsamples = 0;
+        Float_t meanpulsetime  = 0.;
+        Float_t rmspulsetime   = 0.;
+
+        if (IsUseMC())
           {
-            hcam->DrawClone();
-            gPad->SaveAs(Form("%s/PulsePosTest_all.root",fPathOut.Data()));
-            MHCalibrationPix &pix = (*hcam)[fCheckedPixId];
-            pix.DrawClone();
-            gPad->SaveAs(Form("%s/PulsePosTest_Pixel%04d.root",fPathOut.Data(),fCheckedPixId));
-          }
-        
-        MCalibrationPulseTimeCam *cam = (MCalibrationPulseTimeCam*)plist.FindObject("MCalibrationPulseTimeCam");
-        MRawEvtData *data = (MRawEvtData*)plist.FindObject("MRawEvtData");
-        if (cam)
-          {
-            const Float_t meanpulsetime = cam->GetAverageArea(0).GetHiGainMean();
-            const Float_t rmspulsetime = cam->GetAverageArea(0).GetHiGainRms();
-            *fLog << all << "Mean pulse time (cosmics): " << meanpulsetime << "+-" << rmspulsetime << endl;
-            const Int_t newfirst = (Int_t)(meanpulsetime-fExtractWinLeft);
-            Int_t wshigain = fExtractor->InheritsFrom("MExtractTimeAndCharge") 
-              ?  ((MExtractTimeAndCharge*)fExtractor)->GetWindowSizeHiGain()
-              : 6;
-            if (wshigain > 6)
-              wshigain = 6;
-            Int_t wslogain = fExtractor->InheritsFrom("MExtractTimeAndCharge") 
-              ? ((MExtractTimeAndCharge*)fExtractor)->GetWindowSizeLoGain()
-              : 6;
-            if (wslogain > 6)
-              wslogain = 6;
-            const Int_t newlast  = (Int_t)(meanpulsetime+fExtractWinRight);
-            *fLog << all << underline 
-                  << "Try to set new range limits: ("<<newfirst<<","<<newlast<<"+"<<wshigain
-                  <<","<<newfirst-1<<","<<newlast<<"+"<<wslogain<<")"<<endl;
-            if (newfirst < 0)
-              {
-                *fLog << err << "Pulse is too much to the left, cannot go below 0! " << endl;
-                return kFALSE;
-              }
-            if (newlast+wshigain > data->GetNumHiGainSamples()+data->GetNumLoGainSamples()-1)
-              {
-                *fLog << err << "Pulse is too much to the right, cannot go beyond limits! " << endl;
-                *fLog << " Cannot extract at all! ... " << endl;
-                return kFALSE;
-              }
-            if (newlast+wslogain > data->GetNumLoGainSamples())
-              {
-                *fLog << err << "Pulse is too much to the right, cannot go beyond logain limits! " << endl;
-                *fLog << endl;
-                *fLog << "Try to use a different extractor (e.g. with a window size of only 4 sl.) or:" << endl;
-                *fLog << "Set the limit to a lower value (callisto.rc: line 310): " << endl;
-                *fLog << "    MJPedestalY2:ExtractWinRight: 5.0           " << endl;
-                *fLog << "(ATTENTION, you will lose late cosmics pulses!)" << endl;
-                *fLog << endl;
-                return kFALSE;
-              }
-            fExtractor->SetRange(newfirst,newlast+wshigain,
-                                 newfirst>0?newfirst-1:newfirst,data->GetNumLoGainSamples()-1);
-            /*if (!WriteExtractor())
-              {
-                *fLog << err << "Could not write the changes to disk, abort... " << endl;
-                return kFALSE;
-              }*/
+            //
+            // FIXME:
+            // The MC cannot run over the first 2000 pedestal events since almost all
+            // events are empty, therefore a pulse pos. check is not possible, either. 
+            // For the moment, have to fix the problem hardcoded...
+            //
+            //            MMcEvt *evt = (MMcEvt*)plist.FindObject("MMcEvt");
+            //            const Float_t meanpulsetime = evt->GetFadcTimeJitter();
+            meanpulsetime = 4.5;
+            rmspulsetime  = 1.0;
+
+            *fLog << all << "Mean pulse time (MC): " << meanpulsetime << "+-" << rmspulsetime << endl;
+
+            numhigainsamples = 15;
+            numlogainsamples = 15;
+
           }
         else
           {
-            *fLog << err << "Could not determine mean pulse position, abort... " << endl;
+            MHCalibrationPulseTimeCam *hcam = (MHCalibrationPulseTimeCam*)plist.FindObject("MHCalibrationPulseTimeCam");
+            if (fIsPixelCheck)
+              {
+                hcam->DrawClone();
+                gPad->SaveAs(Form("%s/PulsePosTest_all.root",fPathOut.Data()));
+                MHCalibrationPix &pix = (*hcam)[fCheckedPixId];
+                pix.DrawClone();
+                gPad->SaveAs(Form("%s/PulsePosTest_Pixel%04d.root",fPathOut.Data(),fCheckedPixId));
+              }
+            
+            MCalibrationPulseTimeCam *cam = (MCalibrationPulseTimeCam*)plist.FindObject("MCalibrationPulseTimeCam");
+            if (!cam)
+              {
+                *fLog << err << "Could not determine mean pulse position, abort... " << endl;
+                return kFALSE;
+              }
+            
+            meanpulsetime = cam->GetAverageArea(0).GetHiGainMean();
+            rmspulsetime  = cam->GetAverageArea(0).GetHiGainRms();
+
+            *fLog << all << "Mean pulse time (cosmics): " << meanpulsetime << "+-" << rmspulsetime << endl;
+
+            MRawEvtData *data = (MRawEvtData*)plist.FindObject("MRawEvtData");
+
+            numhigainsamples = data->GetNumHiGainSamples();
+            numlogainsamples = data->GetNumLoGainSamples();
+          }
+        
+        //
+        // Get the ranges for the new extractor setting
+        //
+        const Int_t newfirst = (Int_t)(meanpulsetime-fExtractWinLeft);
+        Int_t wshigain = fExtractor->InheritsFrom("MExtractTimeAndCharge") 
+          ?  ((MExtractTimeAndCharge*)fExtractor)->GetWindowSizeHiGain()
+          : 6;
+
+        if (wshigain > 6)
+          wshigain = 6;
+
+        Int_t wslogain = fExtractor->InheritsFrom("MExtractTimeAndCharge") 
+          ? ((MExtractTimeAndCharge*)fExtractor)->GetWindowSizeLoGain()
+          : 6;
+        if (wslogain > 6)
+          wslogain = 6;
+
+        const Int_t newlast  = (Int_t)(meanpulsetime+fExtractWinRight);
+
+        *fLog << all << underline 
+              << "Try to set new range limits: ("<<newfirst<<","<<newlast<<"+"<<wshigain
+              <<","<<newfirst-1<<","<<newlast<<"+"<<wslogain<<")"<<endl;
+        //
+        // Check the ranges for the new extractor setting
+        //
+        if (newfirst < 0)
+          {
+            *fLog << err << "Pulse is too much to the left, cannot go below 0! " << endl;
             return kFALSE;
           }
+        if (newlast+wshigain > numhigainsamples+numlogainsamples-1)
+          {
+            *fLog << err << "Pulse is too much to the right, cannot go beyond limits: " 
+                  << numhigainsamples << "+" << numlogainsamples << "-1" << endl;
+            *fLog << " Cannot extract at all! ... " << endl;
+            return kFALSE;
+          }
+        if (newlast+wslogain > numlogainsamples)
+          {
+            *fLog << err << "Pulse is too much to the right, cannot go beyond logain limits! " << endl;
+            *fLog << endl;
+            *fLog << "Try to use a different extractor (e.g. with a window size of only 4 sl.) or:" << endl;
+            *fLog << "Set the limit to a lower value (callisto.rc: line 329): " << endl;
+            *fLog << "    MJPedestalY2:ExtractWinRight: 5.0           " << endl;
+            *fLog << "(ATTENTION, you will lose late cosmics pulses!)" << endl;
+            *fLog << endl;
+            return kFALSE;
+          }
+        //
+        // Set and store the new ranges 
+        //
+        fExtractor->SetRange(newfirst,newlast+wshigain,
+                             newfirst>0?newfirst-1:newfirst,numlogainsamples-1);
       }
     
Index: trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 6858)
@@ -203,5 +203,5 @@
     // ------------------ Setup histograms and fill tasks ----------------
     MHCamEvent evt0a(0, "Cleaned", "Signal after Cleaning;;S [\\gamma]");
-    MHCamEvent evt0b(0, "UsedPix", "Pixels marked Used;;Used [%]");
+    MHCamEvent evt0b(0, "UsedPix", "Fraction of Events in which Pixels are used;;Fraction");
     evt0b.SetThreshold(0);
 
Index: trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 6857)
+++ trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 6858)
@@ -175,6 +175,6 @@
 const TString MSequence::GetStandardPath(Bool_t raw) const
 {
-    TString d = MString::Form("/data/MAGIC/Period%03d/", fPeriod);
-    d += raw ? "rawdata/" : "rootdata/";
+    TString d("/magic/data/");
+    d += raw ? "rawfiles/" : "merpp/";
     return d;
 }
@@ -188,5 +188,5 @@
     {
         d = GetStandardPath(raw);
-        d += fNight.GetStringFmt("%Y_%m_%d");
+        d += fNight.GetStringFmt("%Y/%m/%d");
     }
     else
Index: trunk/MagicSoft/Mars/msignal/MArrivalTime.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MArrivalTime.cc	(revision 6857)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Sebastian Raducci, 12/2003 <mailto:raducci@fisica.uniud.it>
-!   Author(s): Markus Gaug        04/2004 <mailto:markus@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MArrivalTime
-//
-// Times are calculated using the TSpline5 Root Class
-// 
-/////////////////////////////////////////////////////////////////////////////
-#include "MArrivalTime.h"
-
-#include "MGeomCam.h"
-#include "MGeomPix.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MRawEvtPixelIter.h"
-#include "MRawEvtData.h"
-
-ClassImp(MArrivalTime);
-
-using namespace std;
-
-
-// --------------------------------------------------------------------------
-//
-// Creates an object containing the arrival time for each pixel in the event
-//
-MArrivalTime::MArrivalTime(const char *name, const char *title)
-{
-    fName  = name  ? name  : "MArrivalTime";
-    fTitle = title ? title : "Photons arrival times Information";
-}
-
-// -------------------------------------------------------------------------
-//
-// Sets every pixel arrival time to -1
-//
-void MArrivalTime::Reset()
-{
-    fData.Reset(-1);
-}
-
-void MArrivalTime::InitSize(const UInt_t i)
-{
-    fData.Set(i);
-}
-
-// -------------------------------------------------------------------------
-// 
-// Set the arrival time in one pixel
-//
-void MArrivalTime::SetTime(const Int_t i, const Float_t t)
-{
-    fData[i] = t;
-}
-      
-
-void MArrivalTime::Print(Option_t *o) const
-{
-    *fLog << all << GetDescriptor() << ":" << endl;
-    for (int i=0; i<fData.GetSize(); i++)
-      *fLog << Form("Pixel %04d:  Arr.Time: %4.3f",i,fData[i]) << endl;
-    *fLog << endl;
-}
-
-// --------------------------------------------------------------------------
-//
-// Returns the arrival time value
-//
-Bool_t MArrivalTime::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
-{
-    if (idx<0 || idx>=fData.GetSize())
-        return kFALSE;
-
-    switch (type)
-    {
-    case 0:
-        val = fData[idx];
-        break;
-    default:
-        return kFALSE;
-    }
-
-    return val>=0;
-}
-
-void MArrivalTime::DrawPixelContent(Int_t num) const
-{
-    *fLog << warn << "MArrivalTime::DrawPixelContent - not available." << endl;
-}
Index: trunk/MagicSoft/Mars/msignal/MArrivalTime.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MArrivalTime.h	(revision 6857)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#ifndef MARS_MArrivalTime
-#define MARS_MArrivalTime
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-#ifndef MARS_MCamEvent
-#include "MCamEvent.h"
-#endif
-
-#ifndef ROOT_TArrayF
-#include <TArrayF.h>
-#endif
-#ifndef ROOT_TArrayS
-#include <TArrayS.h>
-#endif
-
-class MRawEvtData;
-
-class MArrivalTime : public MParContainer, public MCamEvent
-{
-private:
-  TArrayF fData;     // Stores the calibrated arrival times
-
-public:
-
-    MArrivalTime(const char *name=NULL, const char *title=NULL);
-    ~MArrivalTime() { }
-
-    void   Reset();
-    void   InitSize(const UInt_t i);
-
-    UInt_t GetSize() const { return fData.GetSize(); }
-
-    void SetTime(const Int_t i, const Float_t time);
-
-    const TArrayF &GetData() const { return fData; }
-
-    Double_t operator[](int i)       { return fData[i]; }
-    Double_t operator[](int i) const { return fData[i]; }
-
-    void Print(Option_t *o="") const;
-
-    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
-    void DrawPixelContent(Int_t num) const;
-
-     ClassDef(MArrivalTime, 2)    // class for an event containing the arrival times
-};
-
-#endif
