Index: trunk/MagicSoft/Mars/macros/derotatedc.C
===================================================================
--- trunk/MagicSoft/Mars/macros/derotatedc.C	(revision 7158)
+++ 	(revision )
@@ -1,104 +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): Thomas Bretz, 4/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// derotatedc.C
-// ============
-//
-// Derotate a MCamEvent and fill a histogram with derotated data
-// (sky-plot).
-//
-// As an input you need a merpped root file conataining DC information
-// from a camera report file. To be able to derotate you also need
-// aproproitate time-stamps and the corresponding pointing information.
-//
-// All events are filled into a 2D histograms - derotated.
-//
-// The example shows the usage of MHCamEventRot. The output is the derotated
-// sky-plot.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-void derotatedc()
-{
-    //
-    // Create a empty Parameter List and an empty Task List
-    // The tasklist is identified in the eventloop by its name
-    //
-    MParList  plist;
-
-    MTaskList tlist;
-    plist.AddToList(&tlist);
-
-    // Define Observatory location (for derotation)
-    MObservatory obs;
-    plist.AddToList(&obs);
-
-    // Set the camera geometry (for histogram size)
-    MGeomCamMagic cam;
-    plist.AddToList(&cam);
-
-    // setup pointing position
-    MPointingPos ppos;
-    ppos.SetSkyPosition(MAstro::Hms2Hor(5, 34, 31.9), MAstro::Dms2Deg(22, 0, 52.0));
-    plist.AddToList(&ppos);
-
-    // Define which file to read
-    MReadTree read("Currents", "../dc.root");
-    read.DisableAutoScheme();
-
-    // Derotated histogram to fill
-    MHCamEventRot hist;
-
-    // Set name of time container corresponding to your data
-    hist.SetNameTime("MTimeCurrents");
-
-    // Setup fill task
-    MFillH fill(&hist, "MCameraDC");
-
-    // Set a draw option for your 2D histogram
-    //fill.SetDrawOption("colz");
-
-    // Setup tasklist
-    tlist.AddToList(&read);
-    tlist.AddToList(&fill);
-
-    //
-    // Create and setup the eventloop
-    //
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    MStatusDisplay *d = new MStatusDisplay;
-    evtloop.SetDisplay(d);
-
-    //
-    // Execute your analysis
-    //
-    if (!evtloop.Eventloop())
-        return;
-
-    tlist.PrintStatistics();
-}
Index: trunk/MagicSoft/Mars/macros/evtrate.C
===================================================================
--- trunk/MagicSoft/Mars/macros/evtrate.C	(revision 7158)
+++ 	(revision )
@@ -1,78 +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): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-///////////////////////////////////////////////////////////////////////////
-//
-// evtrate.C
-// =========
-//
-// Example macro how to calulate the eventrate (per event) and display
-// the result versus time.
-//
-// As an input you need a merpped raw-data file containing correct times.
-// The output is the plot: Eventrate vs. time.
-//
-///////////////////////////////////////////////////////////////////////////
-
-void evtrate()
-{
-    // Setup parameter- and tasklist
-    MParList plist;
-    MTaskList tlist;
-    plist.AddToList(&tlist);
-
-    // Setup reading task
-    MReadMarsFile read("Events");
-    read.DisableAutoScheme();
-    read.AddFile("test-time.root");
-
-    // Setup event rate calculator
-    MEventRateCalc calc;
-    // Setup number of events to be averaged
-    calc.SetNumEvents(200);
-
-    // Setup histogram to be filles with rate
-    MHVsTime rate("MEventRate.fRate");
-
-    // Setup task to fill the histogram
-    MFillH fill(&rate, "MTime");
-
-    // Setup tasklist
-    tlist.AddToList(&read);
-    tlist.AddToList(&calc);
-    tlist.AddToList(&fill);
-
-    // Execute your eventloop
-    MEvtLoop loop;
-    loop.SetParList(&plist);
-
-    if (!loop.Eventloop())
-        return;
-
-    // print some execution statistics
-    tlist.PrintStatistics();
-
-    // Draw result
-    rate.DrawClone();
-}
Index: trunk/MagicSoft/Mars/macros/extendcam.C
===================================================================
--- trunk/MagicSoft/Mars/macros/extendcam.C	(revision 7158)
+++ 	(revision )
@@ -1,235 +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): Thomas Bretz,  12/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2004-2005
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// extendcam.C
-//
-// This macro demonstrates how to extend the magic camera and performes
-// a fourier transformation on it
-//
-/////////////////////////////////////////////////////////////////////////////////
-
-Bool_t HandleInput()
-{
-    // This must be there to get accesss to the GUI while the macro
-    // is still running!
-
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-TCanvas   *c;
-MHCamera *d1=new MHCamera(MGeomCamMagic());
-MHCamera *d2=new MHCamera;
-MHCamera *d3=new MHCamera;
-MHCamera *d4=new MHCamera;
-MHCamera *d5=new MHCamera;
-MHCamera *d6=new MHCamera(MGeomCamMagicXT());
-
-MCerPhotEvt *evt=0;
-MMcEvt *mc;
-
-MHexagonFreqSpace *fFreq1;
-MHexagonFreqSpace *fFreq2;
-
-Int_t PreProcess(MParList *plist)
-{
-    fFreq1 = (MHexagonFreqSpace*)plist->FindObject("MHexagonFreqSpace1");
-    if (!fFreq1)
-        return kFALSE;
-    fFreq2 = (MHexagonFreqSpace*)plist->FindObject("MHexagonFreqSpace2");
-    if (!fFreq2)
-        return kFALSE;
-
-    //Für Real-Raum
-    evt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
-    if (!evt)
-    {
-        cout << "Fehler: MCerPhotEvt" << endl;
-        return kFALSE;
-    }
-
-    mc = (MMcEvt*)plist->FindObject("MMcEvt");
-    if (!mc)
-    {
-        cout << "Fehler: MMcEvt" << endl;
-        return kFALSE;
-    }
-
-    c = new TCanvas("Events", "Real Events", 900, 600);
-    c->SetBorderMode(0);
-    c->Divide(3,2);
-
-    MGeomCam *geomfreq=fFreq1->NewGeomCam();
-    geomfreq->SetName("FreqSpace");
-
-    c->cd(1);
-    d1->SetPrettyPalette();
-    d1->Draw();
-    c->cd(2);
-    d2->SetGeometry(MGeomCamMagicXT());
-    d2->SetPrettyPalette();
-    d2->Draw();
-    c->cd(4);
-    d3->SetGeometry(*geomfreq);
-    d3->SetPrettyPalette();
-    d3->Draw();
-    c->cd(5);
-    d4->SetGeometry(MGeomCamMagicXT());
-    d4->SetPrettyPalette();
-    d4->Draw();
-    c->cd(3);
-    d5->SetGeometry(MGeomCamMagicXT());
-    d5->SetPrettyPalette();
-    d5->Draw();
-    c->cd(6);
-    //d6->SetGeometry(MGeomCamMagicXT());
-    d6->SetPrettyPalette();
-    d6->Draw();
-    return kTRUE;
-}
-
-MClone *cl1;
-MClone *cl2;
-MClone *cl3;
-MClone *cl4;
-
-Int_t Process()
-{
-    d1->SetCamContent(*(MCerPhotEvt*)cl1->GetClone());
-    d2->SetCamContent(*(MCerPhotEvt*)cl2->GetClone());
-    d3->SetCamContent(*fFreq2);
-    d4->SetCamContent(*(MCerPhotEvt*)cl4->GetClone());
-    d5->SetCamContent(*(MCerPhotEvt*)cl3->GetClone());
-    d6->SetCamContent(*evt);
-
-    d2->SetMaximum(-1111);
-    d4->SetMaximum(-1111);
-    d2->SetMinimum(0);
-    d4->SetMinimum(0);
-    d2->SetMaximum(TMath::Max(d2->GetMaximum(), d4->GetMaximum()));
-    d4->SetMaximum(d2->GetMaximum());
-
-    for (int i=1; i<7; i++)
-    {
-        c->GetPad(i)->GetPad(1)->Modified();
-        c->GetPad(i)->GetPad(1)->Update();
-    }
-
-    c->Modified();
-    c->Update();
-
-
-    return HandleInput();
-}
-
-void extendcam()
-{
-    MParList  plist;
-    MTaskList tlist;
-
-    MGeomCamMagicXT geom("MGeomCamMagicXT");
-    plist.AddToList(&geom);
-
-    plist.AddToList(&tlist);
-
-    MReadMarsFile read("Events");
-    read.DisableAutoScheme();
-    read.AddFile("/home/kolodziejski/Diplomarbeit/marsdata/mcdata/*.root");
-    //read.AddFile("/home/hoehne/data/mcdata/gammas/calib/calib_gamma_zbin0.root");
-    //read.AddFile("/home/hoehne/data/mcdata/hadrons/calib/calib_proton_zbin0.root");
-
-
-    // Setup intercative task calling the functions defined above
-    MGeomApply           apply; //necessary for evt
-    MGeomCamMagicEnhance enhance;
-    // enhance.SetNameCerPhotEvtOut("MCerPhotEvt2");
-
-    MClone clone1("MCerPhotEvt", "Clone1");
-    MClone clone2("MCerPhotEvt", "Clone2");
-    MClone clone3("MCerPhotEvt", "Clone3");
-    MClone clone4("MCerPhotEvt", "Clone4");
-
-    cl1 = &clone1;
-    cl2 = &clone2;
-    cl3 = &clone3;
-    cl4 = &clone4;
-
-    MHexagonalFTCalc     ftcalc;
-    ftcalc.SetNameGeomCam("MGeomCamMagicXT");
-    // ftcalc.SetNameCerPhotEvt("MCerPhotEvt2");
-
-    MTaskInteractive mytask;
-    mytask.SetPreProcess(PreProcess);
-    mytask.SetProcess(Process);
-
-    MImgCleanStd clean1(26, 18);
-    clean1.SetMethod(MImgCleanStd::kAbsolute);
-    clean1.SetNameGeomCam("MGeomCamMagicXT");
-
-    MImgCleanStd clean2(26, 18);
-    clean2.SetMethod(MImgCleanStd::kAbsolute);
-    clean2.SetNameGeomCam("MGeomCamMagicXT");
-
-    // Setup your tasklist
-    tlist.AddToList(&read);
-    tlist.AddToList(&apply);
-    tlist.AddToList(&clone1);
-    tlist.AddToList(&enhance);
-    tlist.AddToList(&clone2);
-    tlist.AddToList(&clean1);
-    tlist.AddToList(&clone3);
-    tlist.AddToList(&ftcalc);
-    tlist.AddToList(&clone4);
-    tlist.AddToList(&clean2);
-    tlist.AddToList(&mytask);
-
-    // Run your analysis
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    if (!evtloop.Eventloop())
-        return;
-
-    // Print statistics information about your loop
-    tlist.PrintStatistics();
-}
-
Index: trunk/MagicSoft/Mars/macros/hft.C
===================================================================
--- trunk/MagicSoft/Mars/macros/hft.C	(revision 7158)
+++ 	(revision )
@@ -1,236 +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): Thomas Bretz  12/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2004-2005
-!
-!
-\* ======================================================================== */
-
-///////////////////////////////////////////////////////////////////////////
-//
-// hft.C
-//
-// example of using MHexagonal*
-//
-///////////////////////////////////////////////////////////////////////////
-
-Bool_t HandleInput()
-{
-    // This must be there to get accesss to the GUI while the macro
-    // is still running!
-
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-//
-// Setup the data-members of your 'virtual' class
-//
-MHCamera display[5];
-
-TCanvas   *c;
-MParList  *fParList;
-MTaskList *fTaskList;
-
-MHexagonalFTCalc  hft;
-MHexagonFreqSpace *fFreq1;
-MHexagonFreqSpace *fFreq2;
-
-MGeomCam *geomfreq;
-
-TH1F histo("", "", 35, -0.5, 35);
-
-//
-// Called like all PreProcess functions of tasks. Get the access to
-// the containers necessary for you.
-//
-Int_t PreProcess(MParList *plist)
-{
-    fFreq1 = (MHexagonFreqSpace*)plist->FindObject("MHexagonFreqSpace1");
-    if (!fFreq1)
-        return kFALSE;
-    fFreq2 = (MHexagonFreqSpace*)plist->FindObject("MHexagonFreqSpace2");
-    if (!fFreq2)
-        return kFALSE;
-
-    geomfreq=fFreq1->NewGeomCam();
-    geomfreq->SetName("FreqSpace");
-    plist->AddToList(geomfreq);
-
-    //    return kTRUE;
-
-    // Get parameter and tasklist, see Process
-    fParList = plist;
-    fTaskList = (MTaskList*)plist->FindObject("MTaskList");
-
-    // Get camera geoemtry
-    MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam");
-
-    // setup canvas and camera-histograms
-    c = new TCanvas("Events", "Real Events", 900, 600);
-    c->SetBorderMode(0);
-    c->Divide(3,2);
-    for (int i=0; i<3; i++)
-    {
-        display[i].SetGeometry(*geomfreq);
-        display[i].SetPrettyPalette();
-        c->cd(i+1);
-        display[i].Draw();
-    }
-
-    display[1].SetName("In");
-    display[2].SetName("Out");
-    display[0].SetName("Freq");
-
-    return kTRUE;
-}
-
-//
-// Called like all Process functions of tasks. Process a single
-// event - here display it.
-//
-Int_t Process()
-{
-    // For simplicity we search in the Process function for the
-    // objects. This is deprectaed! Store the pointers to the objects
-    // as data member and get the pointers in PreProcess.
-    MClone *clone1 = (MClone*)fTaskList->FindObject("Clone1");
-    MClone *clone2 = (MClone*)fTaskList->FindObject("Clone2");
-    MGeomCam *geom = (MGeomCam*)fParList->FindObject("MGeomCam");
-
-    // Fill the data into your camera-histograms
-    display[1].SetCamContent(*fFreq1, 1);
-    display[2].SetCamContent(*fFreq1, 2);
-    display[0].SetCamContent(*fFreq2, 0);
-
-    display[1].SetMaximum(-1111);
-    display[2].SetMaximum(-1111);
-    display[1].SetMinimum(0);
-    display[2].SetMinimum(0);
-    display[1].SetMaximum(TMath::Max(display[1].GetMaximum(),
-                                     display[2].GetMaximum()));
-    display[2].SetMaximum(display[1].GetMaximum());
-
-    MHexagonalFT *ft = &hft.GetHFT();
-
-    histo.Reset();
-    for (int i=0; i<ft->GetNumKnots(); i++)
-    {
-        Double_t val=0;
-        fFreq2->GetPixelContent(val, i, *display[1].GetGeometry());
-        histo.Fill(ft->GetRow(i), val/(i+1));
-    }
-
-    c->cd(4);
-    histo.Draw();
-
-    c->cd(5);
-
-    TH1D *obj1 = (TH1D*)display[1].Projection("Proj1");
-    obj1->SetLineColor(kBlue);
-    obj1->Draw();
-    obj1 = (TH1D*)display[2].Projection("Proj2");
-    obj1->Draw("same");
-
-    c->cd(6);
-    display[0].DrawProjection();
-
-    // Update the display
-    for (int i=1; i<=3; i++)
-    {
-        c->GetPad(i)->GetPad(1)->Modified();
-        c->GetPad(i)->GetPad(1)->Update();
-    }
-
-    return HandleInput();
-}
-
-//
-// Called like all PostProcess functions of tasks. Delete
-// instanciated objects.
-//
-Int_t PostProcess()
-{
-    delete c;
-    delete geomfreq;
-}
-
-void hft(const char *fname="/home/hoehne/data/mcdata/hadrons/calib/calib_proton_zbin0.root")
-{
-    // Setup parameter- and tasklist
-    MParList  plist;
-    MTaskList tlist;
-
-    plist.AddToList(&tlist);
-
-    // setup reading task
-    MReadMarsFile read("Events", fname);
-    read.DisableAutoScheme();
-
-    // Clone MCerPhotEvt befor eimage cleaning
-    MClone clone1("MCerPhotEvt", "Clone1");
-
-    // Setup image cleaning
-    MImgCleanStd clean(24, 12);
-    clean.SetMethod(MImgCleanStd::kAbsolute);
-
-    // Clone MCerPhotEvt befor eimage cleaning
-    MClone clone2("MCerPhotEvt", "Clone2");
-
-    // Setup intercative task calling the functions defined above
-    MTaskInteractive  mytask;
-
-    mytask.SetPreProcess(PreProcess);
-    mytask.SetProcess(Process);
-
-    // Setup your tasklist
-    tlist.AddToList(&read);
-    tlist.AddToList(&clone1);
-    tlist.AddToList(&hft);
-    tlist.AddToList(&clone2);
-    tlist.AddToList(&clean);
-    tlist.AddToList(&mytask);
-
-    // Run your analysis
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    if (!evtloop.Eventloop())
-        return;
-
-    // Print statistics information about your loop
-    tlist.PrintStatistics();
-}
-
Index: trunk/MagicSoft/Mars/macros/pedestalvstime.C
===================================================================
--- trunk/MagicSoft/Mars/macros/pedestalvstime.C	(revision 7158)
+++ 	(revision )
@@ -1,138 +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): Thomas Bretz, 6/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2003
-!
-!
-\* ======================================================================== */
-
-void ProcessFile(TString fname, Int_t idx)
-{
-    //
-    // Create a empty Parameter List and an empty Task List
-    // The tasklist is identified in the eventloop by its name
-    //
-    MParList  plist;
-
-    MTaskList tlist;
-    plist.AddToList(&tlist);
-
-    //
-    // Now setup the tasks and tasklist:
-    // ---------------------------------
-    //
-
-    // First Task: Read file with image parameters
-    // (created with the star.C macro)
-
-    MReadMarsFile read("Events", fname);
-    read.DisableAutoScheme();
-
-    MGeomApply geomapl;
-
-    MCerPhotAnal2 ncalc;
-
-    tlist.AddToList(&read);
-    tlist.AddToList(&geomapl);
-    tlist.AddToList(&ncalc);
-
-    MHPixVsTime hist1(idx, "Pedestal");
-    MHPixVsTime hist2(idx, "PedestalRMS");
-    hist2.SetType(1);
-    plist.AddToList(&hist1);
-    plist.AddToList(&hist2);
-
-    MFillH fill1("Pedestal",    "MPedestalCam");
-    MFillH fill2("PedestalRMS", "MPedestalCam");
-    tlist.AddToList(&fill1);
-    tlist.AddToList(&fill2);
-
-    //
-    // Create and setup the eventloop
-    //
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    //
-    // Execute your analysis
-    //
-    if (!evtloop.Eventloop())
-        return;
-
-    tlist.PrintStatistics();
-
-    TCanvas *c = MH::MakeDefCanvas();
-    c->Divide(2,2);
-
-    c->cd(1);
-    TGraph &g1 = hist1.GetGraph();
-    TH1 *h1 = g1.GetHistogram();
-    h1->SetXTitle("Time [au]");
-    h1->SetYTitle("P [au]");
-    g1.DrawClone("A*");
-
-    c->cd(2);
-    TH1F h1f("Pedestal", "Pedestals", 21, 46, 56);
-    h1f.SetXTitle("P");
-    h1f.SetYTitle("Counts");
-    for (int i=0;i<g1.GetN(); i++)
-        h1f.Fill(g1.GetY()[i]);
-    ((TH1F*)h1f.DrawCopy())->Fit("gaus");
-
-    c->cd(3);
-    TGraph &g2 = hist2.GetGraph();
-    TH1 *h2 = g2.GetHistogram();
-    h2->SetXTitle("Time [au]");
-    h2->SetYTitle("P_{rms} [au]");
-    g2.DrawClone("A*");
-
-    c->cd(4);
-    TH1F h2f("PedestalRMS", "Pedestals RMS", 26, 0, 3.5);
-    h2f.SetXTitle("P_{rms}");
-    h2f.SetYTitle("Counts");
-    for (int i=0;i<g2.GetN(); i++)
-        h2f.Fill(g2.GetY()[i]);
-    ((TH1F*)h2f.DrawCopy())->Fit("gaus");
-
-    c->SaveAs(fname(0, fname.Last('.')+1) + "ps");
-    //c->SaveAs(fname(0, fname.Last('.')+1) + "root");
-}
-
-// -------------------------------------------------------------------------
-//
-//  plot.C
-//
-//  This macro shows how to fill and display a histogram using Mars
-//
-void pedestalvstime(Int_t idx=0, const char *dirname=".")
-{
-    MDirIter Next;
-    Next.AddDirectory(dirname, "raw*.root", -1);
-
-    TString fname;
-    while (1)
-    {
-        fname = Next();
-        if (fname.IsNull())
-            break;
-
-        ProcessFile(fname, idx);
-        return;
-    }
-}
Index: trunk/MagicSoft/Mars/macros/pedvsevent.C
===================================================================
--- trunk/MagicSoft/Mars/macros/pedvsevent.C	(revision 7158)
+++ 	(revision )
@@ -1,214 +1,0 @@
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// Author(s): S.C. Commichau,  Javier Rico, 12/2003                        //
-//                                                                         //
-// Macro to generate pedestal vs time (event) plot for a single pixel      //
-//                                                                         // 
-/////////////////////////////////////////////////////////////////////////////
-
-
-const Int_t default_pixel = 1 ;
-
-void pedvsevent(Int_t pixel = default_pixel, 
-		TString pname = "/disc02/Data/rootdata/Miscellaneous/2003_11_29/20031128_03118_P_Park-camera-closed_E.root")
-{
-
-    TH1F* Pedestal    = new TH1F("Pedestal","Pedestals",100,0,20);
-    TH1F* PedestalRMS = new TH1F("PedestalRMS","Pedestal RMS",100,0,10);
-  
-    //Create an empty parameter list and an empty task list
-    //the tasklist is identified in the eventloop by ist name
-    MParList       plist;
-    MTaskList      tlist;
-
-    //Creates a MPedestalPix object for each pixel, i.e. it is a
-    //storage container for all Pedestal information in the camera
-    MPedestalCam   cam;  
-  
-    plist.AddToList(&cam);
-
-    //MHCamEvent hist;
-    //hist.SetType(1);
-    //plist.AddToList(&hist);
-
-    plist.AddToList(&tlist);
-
-    //Setup task and tasklist for the pedestals
-    MReadMarsFile read("Events", pname);
-    read.DisableAutoScheme();
-
-    //Apply the geometry to geometry dependant containers.
-    //MGeomApply changes the size of the arrays in the containers to a size
-    //matching the number of pixels, eg: MPedestalCam, MBlindPixels
-    //Default geometry is MGeomCamMagic
-    MGeomApply      geomapl;
-   
-    //Task to calculate pedestals
-    MPedCalcPedRun  ped;
-
-    tlist.AddToList(&read);
-    tlist.AddToList(&geomapl);
-    tlist.AddToList(&ped); 
-
-    //ped.SetPixel(pixel);
-    //ped.Draw();
-
-    //Create and setup the 1st Eventloop  
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    //Execute first analysis, pedestals...
-     if (!tlist.PreProcess(&plist))
-         return;
-
-     const Int_t nevents = read.GetEntries();
-
-     Float_t x[nevents], rms[nevents], mean[nevents];
-
-
-     Int_t i = 0;     
-     while (tlist.Process())
-     {
-	 mean[i] = cam[pixel].GetPedestal();
-         rms[i] = cam[pixel].GetPedestalRms();
-         x[i] = i;
-	 i++; 
-     }
-
-     TGraphErrors* pedgraph = new TGraphErrors(nevents,x,mean,NULL,NULL);
-     TGraphErrors* rmsgraph = new TGraphErrors(nevents,x,rms,NULL,NULL);
-
-	 //plist.FindObject("MPedestalCam")->Print();
-    
-     tlist.PostProcess(); 
-     //if (!evtloop.Eventloop())
-     // return;
-
-     Float_t finalmean = cam[pixel].GetPedestal();
-     Float_t finalrms = cam[pixel].GetPedestalRms();
-   
-     TLine* pedline = new TLine(0,finalmean,nevents,finalmean);
-     TLine* rmsline = new TLine(0,finalrms,nevents,finalrms);
-    
-     //The draw area
-     
-
-
-     gROOT->Reset();
-     gStyle->SetOptStat(0);
-     // Set statistics options, 1111111
-     //                         |||||||
-     //                         ||||||histogram name
-     //                         |||||number of entries
-     //                         ||||mean value
-     //                         |||RMS
-     //                         ||underflows
-     //                         |overflows
-     //                         sum of bins
-     
-     // Set gPad options
-     gStyle->SetFrameBorderMode(0);
-     gStyle->SetPalette(1);
-     // Delete Frames of subCanvas' does not work, hook it Mr. gPad!
-     gStyle->SetFrameBorderSize(0);
-     gStyle->SetCanvasColor(0);
-     gStyle->SetFrameFillColor(0);
-     gStyle->SetTitleFont(102);
-     gStyle->SetTitleFillColor(0);
-     gStyle->SetTitleBorderSize(0);
-     gStyle->SetStatColor(0);
-     gStyle->SetStatBorderSize(0);
-     
-     // Set Canvas options
-     TCanvas *MyC1 = new TCanvas("MyC","Pedestal vs Event", 0, 100, 900, 500);
-     MyC->SetBorderMode(0);    // Delete the Canvas' border line
-     
-     MyC->cd();
-     gPad->SetBorderMode(0);
-     
-     //  TLine* pedline = new TLine(0,finalmean,nevents,finalmean);
-     //TLine* rmsline = new TLine(0,finalrms,nevents,finalrms);
-     
-     tlist.PrintStatistics();
-     //plist.FindObject("MPedestalCam")->Print();
-     Size_t pos = pname.Last('/')+10;
-     TString iRun = TString(pname(pos,5));
-     
-     char str[64];
-     
-     sprintf(str,"Run %s Pixel %d",iRun.Data(),pixel);
-     
-     pedgraph->SetMaximum(30);
-     pedgraph->SetMinimum(0);
-     pedgraph->SetMarkerStyle(24);
-     pedgraph->SetMarkerSize(.5);
-     pedgraph->GetXaxis()->SetTitleFont(102);
-     pedgraph->GetYaxis()->SetTitleFont(102);
-     pedgraph->GetXaxis()->SetLabelFont(102);
-     pedgraph->GetYaxis()->SetLabelFont(102);
-     pedgraph->SetTitle(str); 
-//     pedgraph->SetTitleFont(102);
-     pedgraph->GetYaxis()->SetTitleFont(102);
-     pedgraph->GetXaxis()->SetTitle("Event");
-     pedgraph->GetYaxis()->SetTitle("[FADC Counts]");
-     pedgraph->GetXaxis()->SetLimits(0,nevents-1);
-     
-     rmsgraph->SetMarkerStyle(25);
-     rmsgraph->SetMarkerSize(.5);
-     rmsgraph->SetMarkerColor(8);
-
-     pedline->SetLineColor(2);
-     rmsline->SetLineColor(4);
-     pedline->SetLineWidth(2);
-     rmsline->SetLineWidth(2);
-
-     pedgraph->Draw("AP");
-     rmsgraph->Draw("P");
-     
-     pedline->Draw("same");
-     rmsline->Draw("same");
-     
-     TLegend* leg = new TLegend(.14,.68,.39,.88);
-     leg->SetHeader("");
-     leg->AddEntry(pedgraph,"Event based Pedestal","P");
-     leg->AddEntry(pedline,"Run based Pedestal","L");
-     leg->AddEntry(rmsgraph,"Event based RMS","P");
-     leg->AddEntry(rmsline,"Run based RMS","L");
-     leg->SetFillColor(0);
-     leg->SetLineColor(1);
-     leg->SetBorderSize(1);
-
-
-     leg->Draw("same");
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/macros/pixfirerate.C
===================================================================
--- trunk/MagicSoft/Mars/macros/pixfirerate.C	(revision 7158)
+++ 	(revision )
@@ -1,133 +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): Abelardo Moralejo <mailto:moralejo@pd.infn.it>
-!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// pixfirerate.C
-// =============
-//
-// This macro can help to  find "hot" pixels firing too often
-// or pixels firing too rarely. It plots camera displays showing how many 
-// times the FADC integral of each pixel has been found to be above pedestal
-// by 10, 20, 50, 100 or 200 ADC counts. As "pedestal"  we now use simply 
-// the signal in the first ADC slice, which seemed reasonable from a first
-// look at the available test data.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-void pixfirerate(TString filename="rawfile.root")
-{
-    //
-    // Update frequency by default = 1Hz
-    //
-    MStatusDisplay *d = new MStatusDisplay;
-
-    // Set update time to 5s
-    // d->SetUpdateTime(5000);
-
-    // Disable online update
-    // d->SetUpdateTime(-1);
-
-    d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
-    gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
-    //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
-
-    //
-    // Create a empty Parameter List and an empty Task List
-    // The tasklist is identified in the eventloop by its name
-    //
-    MTaskList tlist;
-    MParList  plist;
-    plist.AddToList(&tlist);
-
-    //
-    // Now setup the tasks and tasklist:
-    // ---------------------------------
-    //
-    MReadMarsFile read("Events");
-    read.DisableAutoScheme();
-    read.AddFile(filename);
-    tlist.AddToList(&read);
-
-    MGeomApply geomapl;
-    tlist.AddToList(&geomapl);
-
-    // A list of threshold which should be displayed. The last entry
-    // MUST be -1.
-    Double_t threshold[] = { 10, 20, 100, 200, -1 };
-
-    Int_t cnt = 0;
-    while (threshold[cnt]>0) cnt++;
-
-    // Create the corresponding fill tasks and containers
-    for (int i=0; i<cnt; i++)
-    {
-        TString name = "Above ";
-        TString num;
-        num += threshold[i];
-        name += num.Strip(TString::kBoth);
-        TString title = "Firerate [%] of pixels with signal > ";
-        title += num.Strip(TString::kBoth);
-
-        MHTriggerLvl0 *trigmap = new MHTriggerLvl0(threshold[i], name, title);
-        MFillH *fillh = new MFillH(trigmap, "MRawEvtData");
-        trigmap->SetBit(kCanDelete);
-        fillh->SetBit(kCanDelete);
-        plist.AddToList(trigmap);
-        tlist.AddToList(fillh);
-    }
-
-    // create the eventloop
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-    evtloop.SetDisplay(d);
-
-    //
-    // Execute your analysis
-    //
-    if (!evtloop.Eventloop())
-        return;
-
-    tlist.PrintStatistics();
-
-    //
-    // Make sure the display hasn't been deleted by the user while the
-    // eventloop was running.
-    //
-    if ((d = evtloop.GetDisplay()))
-    {
-        // Save data in a postscriptfile (status.ps)
-        d->SaveAsPS();
-        /*
-         * ----------- Write status to a root file ------------
-         *
-         TFile file("status.root", "RECREATE");
-         d->Write();
-         file.Close();
-         delete d;
-         */
-    }
-
-}
Index: trunk/MagicSoft/Mars/macros/pixsatrate.C
===================================================================
--- trunk/MagicSoft/Mars/macros/pixsatrate.C	(revision 7158)
+++ 	(revision )
@@ -1,120 +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): Abelardo Moralejo <mailto:moralejo@pd.infn.it>
-!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// pixfirerate.C
-// =============
-//
-// This macro can help to  find "hot" pixels firing too often
-// or pixels firing too rarely. It plots camera displays showing how many 
-// times the FADC integral of each pixel has been found to be above pedestal
-// by 10, 20, 50, 100 or 200 ADC counts. As "pedestal"  we now use simply 
-// the signal in the first ADC slice, which seemed reasonable from a first
-// look at the available test data.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-void pixsatrate(TString filename="rawfile.root")
-{
-    //
-    // Update frequency by default = 1Hz
-    //
-    MStatusDisplay *d = new MStatusDisplay;
-
-    // Set update time to 5s
-    // d->SetUpdateTime(5000);
-
-    // Disable online update
-    // d->SetUpdateTime(-1);
-
-    d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
-    gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
-    //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
-
-    //
-    // Create a empty Parameter List and an empty Task List
-    // The tasklist is identified in the eventloop by its name
-    //
-    MTaskList tlist;
-    MParList  plist;
-    plist.AddToList(&tlist);
-
-    //
-    // Now setup the tasks and tasklist:
-    // ---------------------------------
-    //
-    MReadMarsFile read("Events");
-    read.DisableAutoScheme();
-    read.AddFile(filename);
-    tlist.AddToList(&read);
-
-    MGeomApply geomapl;
-    tlist.AddToList(&geomapl);
-
-    // Create histograms with saturation limits at 254
-    MHTriggerLvl0 trighi(254, "SaturationHi", "Saturation Rate of Hi Gains");
-    MHTriggerLvl0 triglo(254, "SaturationLo", "Saturation Rate of Lo Gains");
-    trighi.SetType(1);
-    triglo.SetType(2);
-
-    // craete fill tasks to fill the histogarms
-    MFillH fillhi(&trighi, "MRawEvtData");
-    MFillH filllo(&triglo, "MRawEvtData");
-    tlist.AddToList(&fillhi);
-    tlist.AddToList(&filllo);
-
-    // create eventloop
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-    evtloop.SetDisplay(d);
-
-    //
-    // Execute your analysis
-    //
-    if (!evtloop.Eventloop())
-        return;
-
-    tlist.PrintStatistics();
-
-    //
-    // Make sure the display hasn't been deleted by the user while the
-    // eventloop was running.
-    //
-    if ((d = evtloop.GetDisplay()))
-    {
-        // Save data in a postscriptfile (status.ps)
-        d->SaveAsPS();
-        /*
-         * ----------- Write status to a root file ------------
-         *
-         TFile file("status.root", "RECREATE");
-         d->Write();
-         file.Close();
-         delete d;
-         */
-    }
-
-}
Index: trunk/MagicSoft/Mars/macros/readpix.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readpix.C	(revision 7158)
+++ 	(revision )
@@ -1,97 +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): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-
-#include <iomanip>
-
-void readpix()
-{
-    //
-    // open the file
-    //
-    TFile input("delme.root", "READ");
-
-    //
-    // open the Run Header tree
-    //
-    TTree *runtree = (TTree*) input.Get("RunHeaders") ;
-
-    if (!runtree)
-        return;
-
-    cout << " Entries in Tree RunHeaders: " << runtree->GetEntries() << endl ;
-
-    //
-    // create an instance of MRawRunHeader, enable the branch and
-    // read the header, print it
-    //
-    MRawRunHeader *runheader = new MRawRunHeader();
-    runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader);
-    runtree->GetEvent(0);
-    runheader->Print();
-
-    //
-    // open the Data Tree
-    //
-    TTree *evttree = (TTree*) input.Get("Data") ;
-
-    //
-    // create the instances of the data to read in
-    //
-    MRawEvtData *evtdata = new MRawEvtData();
-
-    //
-    // enable the corresponding branches
-    //
-    evttree->GetBranch("MRawEvtData")->SetAddress(&evtdata);
-
-    evttree->GetEvent(0);
-
-    MRawEvtPixelIter pixel(evtdata);
-
-    while (pixel.Next())
-    {
-       
-       cout << "Pixel Nr: " << dec << pixel.GetPixelId() << " ";
-       cout << setfill('0') << endl;
-      
-       cout << "Hi Gains: ";
-       for (int i=0; i<evtdata->GetNumHiGainSamples(); i++)
-	  cout << setw(3) << (UInt_t)pixel.GetHiGainFadcSamples()[i];
-       cout << endl;
-      
-       cout << "Lo Gains: ";
-       if (pixel.IsLoGain())
-	  for (int i=0; i<evtdata->GetNumLoGainSamples(); i++)
-	     cout << setw(3) << (UInt_t)pixel.GetLoGainFadcSamples()[i];
-       cout << endl << endl;
-
-       if (pixel.GetPixelId() == 11)
-	 pixel.Draw();
-    };
-}
-
-
-
-
Index: trunk/MagicSoft/Mars/macros/readraw.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readraw.C	(revision 7158)
+++ 	(revision )
@@ -1,95 +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): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-
-void readraw(const char *fname="/data/MAGIC/Period016/mcdata/spot_1cm/standard/gamma/Gamma_zbin9_90_7_1740to1749_w0.root")
-{
-    //
-    // open the file
-    //
-    TFile input(fname, "READ");
-
-    //
-    // open the Run Header tree
-    //
-    TTree *runtree = (TTree*) input.Get("RunHeaders") ;
-
-    if (!runtree)
-        return;
-
-    cout << " Entries in Tree RunHeaders: " << runtree->GetEntries() << endl ;
-
-    //
-    // create an instance of MRawRunHeader, enable the branch and
-    // read the header, print it
-    //
-    MRawRunHeader *runheader = new MRawRunHeader();
-    runtree->GetBranch("MRawRunHeader.")->SetAddress(&runheader);
-    runtree->GetEvent(0);
-    runheader->Print();
-
-    //
-    // open the Data Tree
-    //
-    TTree *evttree = (TTree*) input.Get("Events");
-
-    //
-    // create the instances of the data to read in
-    //
-    MRawEvtHeader  *evtheader = 0;
-    MTime          *evttime   = 0;
-    MRawEvtData    *evtdata   = 0;
-    MRawCrateArray *evtcrate  = 0;
-
-    //
-    // enable the corresponding branches
-    //
-    evttree->GetBranch("MRawEvtHeader.")->SetAddress(&evtheader);
-    evttree->GetBranch("MRawEvtData.")->SetAddress(&evtdata);
-
-    // Use this for real data only
-    //evttree->GetBranch("MTime.")->SetAddress(&evttime);
-    //evttree->GetBranch("MRawCrateArray.")->SetAddress(&evtcrate);
-
-    //
-    // loop over all events and print the information
-    //
-    Int_t iEnt = evttree->GetEntries();
-    cout << " Entries in Tree Data: " << iEnt << endl;
-
-    for (Int_t i = 0; i<iEnt; i++)
-    {
-      // readin event with the selected branches
-      evttree->GetEvent(i);
-
-      evtheader->Print();
-      evtdata->Print();
-
-      // Use this for real data only
-      //evttime->Print();
-      //evtcrate->Print();
-    } 
-}
-
-
Index: trunk/MagicSoft/Mars/macros/readrep.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readrep.C	(revision 7158)
+++ 	(revision )
@@ -1,125 +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): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2003
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// This macro demonstrates how to read a central control report file.
-// (rootification, see merpp, too)
-//
-// In a second eventloop it gives an example on how to read such a root file.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-void readrep(const char *fname="CC_2003_11_04_23_53_18.rep")
-{
-    //
-    // Read a report file and write containers into a root file
-    //
-    MParList  plist;
-    MTaskList tlist;
-    plist.AddToList(&tlist);
-
-    MReportFileRead read(fname);
-    tlist.AddToList(&read);
-
-    read.AddToList("DAQ");
-    read.AddToList("Drive");
-    read.AddToList("Camera");
-    read.AddToList("Trigger");
-
-    MWriteRootFile write("test.root");
-    write.AddContainer("MReportCamera",      "Camera");
-    write.AddContainer("MTimeCamera",        "Camera");
-    write.AddContainer("MCameraAUX",         "Camera");
-    write.AddContainer("MCameraCalibration", "Camera");
-    write.AddContainer("MCameraCooling",     "Camera");
-    write.AddContainer("MCameraHV",          "Camera");
-    write.AddContainer("MCameraLV",          "Camera");
-    write.AddContainer("MCameraLids",        "Camera");
-    write.AddContainer("MReportTrigger",     "Trigger");
-    write.AddContainer("MTimeTrigger",       "Trigger");
-    write.AddContainer("MReportDrive",       "Drive");
-    write.AddContainer("MTimeDrive",         "Drive");
-    tlist.AddToList(&write);
-
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    if (!evtloop.Eventloop())
-        return;
-
-    tlist.PrintStatistics();
-
-    // ----------------------------------------------------------------
-    //
-    // Read a report file and write containers into a root file
-    //
-    MTaskList tlist2;
-    plist.Replace(&tlist2);
-
-    // Create a tasklist to process the read events from the Camera tree
-    MTaskList list1("ProcessCamera");
-    MPrint print1("MTimeCamera");
-    list1.AddToList(&print1);
-
-    // Create a tasklist to process the read events from the Drive tree
-    MTaskList list2("ProcessDrive");
-    MPrint print2("MTimeDrive");
-    list2.AddToList(&print2);
-
-    // Tell the reader to read the trees Drive, Trigger and Camera
-    MReadReports read;
-    read.AddTree("Drive");
-    read.AddTree("Trigger");
-    read.AddTree("Camera");
-    //read.AddTree("Events", "MTime."); // for later use!
-
-    // Now (not earlier!) set the file to read!
-    read.AddFile("test.root");
-
-    // First read the events
-    tlist.AddToList(&read);
-    // Process the events from the Camera tree with the task list list1
-    tlist.AddToList(&list1, "Camera");
-    // Process the events from the Camera tree with the task list list2
-    tlist.AddToList(&list2, "Drive");
-
-    // The task lists list1 and list2 are only executed (according to
-    // their stream id - the second argument of AddToList) if a
-    // corresponding event was read and MReadReports has set the stream
-    // id accoringly. MReadReports always sets the stream id to the name
-    // of the tree from which the event was read
-
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    //
-    // Execute the eventloop which should print the time-stamps of the subsystem
-    // events from Drive and Camera in the correct order...
-    //
-    if (!evtloop.Eventloop())
-        return;
-
-    tlist.PrintStatistics();
-}
Index: trunk/MagicSoft/Mars/macros/readrfl.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readrfl.C	(revision 7158)
+++ 	(revision )
@@ -1,106 +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): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2003
-!
-!
-\* ======================================================================== */
-
-Bool_t HandleInput()
-{
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-Bool_t JumpTo(MTaskList &tlist, MReadRflFile &read, int runno, int evtno)
-{
-    if (runno<0 || evtno<0)
-        return tlist.Process();
-
-    return read.SearchFor(runno, evtno);
-}
-
-void readrfl(int runno=-1, int evtno=-1, const char *fname="Gamma_zbin0_90_7_50700to50704_w0.rfl")
-{
-    MParList plist;
-
-    MGeomCamMagic geomcam;
-    MRflEvtData   event;
-    MRflEvtHeader evthead;
-    MRflRunHeader runhead;
-    MTaskList     tlist;
-
-    plist.AddToList(&geomcam);
-    plist.AddToList(&event);
-    plist.AddToList(&evthead);
-    plist.AddToList(&runhead);
-    plist.AddToList(&tlist);
-
-    MReadRflFile read(fname);
-    tlist.AddToList(&read);
-
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    if (!evtloop.PreProcess())
-        return;
-
-    MHCamera display(geomcam);
-    display.Draw();
-    gPad->cd(1);
-    event.Draw();
-
-
-
-    cout << "Runno: " << runno << "  Eventno: " << evtno << endl;
-
-    while (JumpTo(tlist, read, runno, evtno))
-    {
-        runno = -1;
-
-        cout << "Run #" << runhead.GetRunNumber() << "   ";
-        cout << "Event #" << evthead.GetEvtNumber() << endl;
-
-	display.SetCamContent(event);
-
-	gPad->Modified();
-	gPad->Update();
-	
-        if (!HandleInput())
-            break;
-    } 
-
-    evtloop.PostProcess();
-}
Index: trunk/MagicSoft/Mars/macros/runbook.C
===================================================================
--- trunk/MagicSoft/Mars/macros/runbook.C	(revision 7158)
+++ 	(revision )
@@ -1,150 +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): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-///////////////////////////////////////////////////////////////////////////
-//
-// runbook.C
-// =========
-//
-// This is an example macro how to extract the runbook information of
-// a given date from the runbook files.
-//
-// The argument is a date in regexp format, eg.
-//   .x runbook.C("2004-05-1[0-9]")
-//
-// With an MDirIter you can tell the macro which directories and files
-// should be searched.
-//
-// The output are the runbook entries matching your query.
-//
-///////////////////////////////////////////////////////////////////////////
-
-void Wrap(TString &str)
-{
-    // Wrap lines to 80 chars
-    while (str.Length()>80)
-    {
-        TString ss = str(0, 80);
-        Int_t l = ss.Last(' ');
-        if (l<0)
-            break;
-        cout << str(0, l) << endl;
-        str.Remove(0, l);
-    }
-    cout << str << endl;
-}
-
-void ProcessFile(TString fname, TString date)
-{
-    // File processed
-    cout << fname << endl;
-
-    // Open file
-    ifstream fin(fname);
-
-    TString line;
-
-    int i=81;
-
-    TRegexp r0("20[0-2][0-9]-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]");
-    TRegexp r1(date+" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]");
-
-    int lcnt=0;
-
-    int print = 0;
-
-    while (!fin.eof())
-    {
-        // Read file line by line
-        char *txt=new char[i];
-        fin.getline(txt, i-1);
-
-        if (lcnt++<4)
-            continue;
-
-        if (!fin)
-            txt[i-1]=0;
-
-        line += txt;
-        delete txt;
-
-        if (line.Length()==0)
-        {
-            if (print)
-                cout << endl;
-            continue;
-        }
-
-        if (!fin)
-        {
-            i *= 2;
-            fin.clear();
-            continue;
-        }
-
-        // Check whether line matches regexp
-        if (!line(r0).IsNull())
-            print = !line(r1).IsNull();
-
-        // Wrap lines to 80 chars
-        if (print)
-            Wrap(line);
-        line = "";
-        i=81;
-    }
-    cout << "DONE." << endl;
-}
-
-void runbook(const char *d="20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]")
-{
-    // Regexp to check for valid date
-    TString regexp = "20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]";
-
-    if (regexp!=d)
-    {
-        TRegexp r(regexp);
-
-        TString date=d;
-        if (date(r).IsNull())
-        {
-            cout << "ERROR - Date has wrong format (2003-05-06)" << endl;
-            return;
-        }
-    }
-
-    // Tell which dierctories and files to search
-    MDirIter Next;
-    Next.AddDirectory("/home/MAGIC/online_data/runbook", "CC_*.rbk");
-
-    // Loop over files
-    TString name;
-    while (1)
-    {
-        name=Next();
-        if (name.IsNull())
-            break;
-
-        ProcessFile(name, d);
-    }
-}
Index: trunk/MagicSoft/Mars/macros/sectorvstime.C
===================================================================
--- trunk/MagicSoft/Mars/macros/sectorvstime.C	(revision 7158)
+++ 	(revision )
@@ -1,100 +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): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// sectorvstime.C
-// ==============
-//
-// In this example we plot the mean content of the right and left half of
-// camera. As an input we use a class derived from MCamEvent. Here this
-// are dc currents read directly from a camera control report file.
-//
-// The output are two histograms one for each half.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-void sectorvstime()
-{
-    // Initialize Mars environment
-    MParList  plist;
-    MTaskList tlist;
-    plist.AddToList(&tlist);
-
-    // Create Magic camera geometry
-    MGeomCamMagic cam;
-    plist.AddToList(&cam);
-
-    // Which DC file to read?
-    MReportFileRead read("/data/MAGIC/Period013/cacodata/2004_01_26/dc_2004_01_26_05_35_10_12117_OffMrk421-1.txt");
-    read.SetHasNoHeader();
-    read.AddToList("MReportCurrents");
-
-    // Initialize histogram
-    MHSectorVsTime hist1;
-    hist1.SetNameTime("MTimeCurrents");
-
-    // Define sectors you want to display the mean from
-    TArrayI s0(3);
-    s0[0] = 6;
-    s0[1] = 1;
-    s0[2] = 2;
-
-    // Define area index [0=inner, 1=outer]
-    TArrayI inner(1);
-    inner[0] = 0;
-
-    // Don't call this if you want to have all sectors
-    hist1.SetSectors(s0);
-
-    // Don't call this if you want to have all area indices
-    hist1.SetAreaIndex(inner);
-
-    // Task to fill the histogram
-    MFillH fill1(&hist1, "MCameraDC");
-
-    // Also fill a histogram with the mean of all pixels
-    MHCamEvent hist2;
-    MFillH fill2(&hist2, "MCameraDC");
-
-    // Setup Tasklist
-    tlist.AddToList(&read);
-    tlist.AddToList(&fill1);
-    tlist.AddToList(&fill2);
-
-    // Setup Eventloop
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    // Run Eventloop
-    if (!evtloop.Eventloop())
-        return;
-
-    // Print some statistics
-    tlist.PrintStatistics();
-
-    // Draw clones of the histograms
-    hist1.DrawClone();
-    hist2.DrawClone();
-}
Index: trunk/MagicSoft/Mars/macros/spline.C
===================================================================
--- trunk/MagicSoft/Mars/macros/spline.C	(revision 7158)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/* This macro is defined as a class for debugging (with CInt) reasons
-
-To use it at the root prompt type:
-
-root [0] .L spline.C
-root [1] TestSpline::sp()
-*/
-/* Example of a spline. You can use it as Test. If you think there are some
-   bugs in the MCubicSpline class please mail to: raducci@fisica.uniud.it */
-
-class TestSpline
-{
-public:
-    void sp();
-};
-
-void TestSpline::sp()
-{
-gROOT -> Reset();
-
-//Here are defined the points. X goes from 0 to 14 (as the fadc slices...)
-//Y are arbitrary values
-
-/* User Change */
-const Byte_t y[]={0x0F,0x10,0x2F,0x7F,0xAA,0x6C,0x14,0x13,0x15,0x18,0x21,0x12,0x11,0x14,0x13};
-/* End user Change */
-const Byte_t x[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E};
-
-/*This cast is needed only to show graphically the output. Don' t needed if you
-  use the spline to calc the arrival times       */
-
-Int_t *newX = new Int_t[15];
-Int_t *newY = new Int_t[15];
-
-for (Int_t i = 0; i < 15; i++)
-{
-    newX[i] = (Int_t) x[i];
-    newY[i] = (Int_t) y[i];
-}
-
-//Canvas to display output
-TCanvas *c = new TCanvas ("c1","c1",800,600);
-
-//Graph containting only the points (displayed as stars)
-TGraph *g1 = new TGraph(15,newX,newY);
-
-g1 -> Draw("A*");
-
-//Spline constructor(specialized for 15 slices using Bytes as values. There exist another constructor.
-MCubicSpline *s = new MCubicSpline(y);
-
-//*spline and *ab are two arrays containing some values evaluated from the spline
-Double_t *spline = new Double_t[139];
-Double_t *ab     = new Double_t[139];
-Double_t step = 0.0;
-
-for (Int_t i = 0; i < 139; i++)
-{
-    spline[i] = s->Eval(step);
-    ab[i] = step;
-    step += 0.1;
-}
-
-//Graph of the sline. The points calculated are joined with a red line. If the stars lie
-//on the red line, then the Spline class is working properly
-TGraph *g2 = new TGraph(139,ab,spline);
-
-g2 -> SetLineColor(2);
-g2 -> Draw("C");
-
-//Maximum and minimum evaluation
-Double_t *mm   = new Double_t[2];
-Double_t *abmm = new Double_t[2];
-
-mm[0] = s->EvalMin();
-mm[1] = s->EvalMax();
-abmm[0] = s->EvalAbMin();
-abmm[1] = s->EvalAbMax();
-
-//Display the max and the min using two black squares. If they lie on the max and min
-//of the red line, then the Spline class is working properly
-
-TGraph *g3 = new TGraph(2,abmm,mm);
-
-g3 -> SetMarkerStyle(21);
-g3 -> Draw("P");
-
-//Test of the Cardan formula. Find the point(abval) where the Spline value is val
-Double_t val = 82.5;
-Double_t abval = s->FindVal(val, abmm[1], 'l');
-
-//Display this point. Again, if it lies on the red line, then we are right.
-//It's a black triangle
-
-TGraph *g4 = new TGraph(1,&abval,&val);
-
-g4 -> SetMarkerStyle(22);
-g4 -> Draw("P");
-
-//Free memory
-s->~MCubicSpline();
-delete [] newX;
-delete [] newY;
-delete [] spline;
-delete [] ab;
-delete [] mm;
-delete [] abmm;
-
-} 
Index: trunk/MagicSoft/Mars/macros/starplot.C
===================================================================
--- trunk/MagicSoft/Mars/macros/starplot.C	(revision 7158)
+++ 	(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): Thomas Bretz et al, 08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2002
-!
-!
-\* ======================================================================== */
-
-
-void starplot(const char *filename="Gamma_*.root")
-{
-    //
-    // This is a demonstration program which plots the Hillas
-    // parameter from a file created with star.C
-    //
-
-    //
-    // Create a empty Parameter List and an empty Task List
-    // The tasklist is identified in the eventloop by its name
-    //
-    MParList plist;
-
-
-    MTaskList tlist;
-    plist.AddToList(&tlist);
-
-    //
-    // Use this if you want to change the binning of one of
-    // the histograms. You can use:
-    // BinningConc, BinningConc1, BinningAsym, BinningM3Long,
-    // BinningM3Trans, BinningWidth, BinningLength, BinningDist,
-    // BinningHeadTail, BinningAlpha, BinningSize, BinningDelta,
-    // BinningPixels and BinningCamera
-    //
-    // For more information see MBinning and the corresponding
-    // histograms
-    //
-    // MBinning binsalpha("BinningAlpha");
-    // binsalpha.SetEdges(90, 0, 90);       // 90 bins from 0 to 90 deg
-    // plist.AddToList(&binsalpha);
-
-    // MBinning binssize("BinningSize");
-    // binssize.SetEdgesLog(50, 1, 1e7);
-    // plist.AddToList(&binssize);
-
-    //
-    // Now setup the tasks and tasklist:
-    // ---------------------------------
-    //
-    // The first argument is the tree you want to read.
-    //   Events:     Cosmic ray events
-    //   PedEvents:  Pedestal Events
-    //   CalEvents:  Calibration Events
-    //
-    MReadMarsFile read("Events", filename);
-    read.DisableAutoScheme();
-
-    MGeomApply geomapl;
-
-    MFillH hfill1("MHHillas", "MHillas");
-    MFillH hfill2("MHHillasExt");
-    MFillH hfill3("MHStarMap", "MHillas");
-    MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
-    MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
-
-    tlist.AddToList(&read);
-    tlist.AddToList(&geomapl);
-    tlist.AddToList(&hfill1);
-    tlist.AddToList(&hfill2);
-    tlist.AddToList(&hfill3);
-    tlist.AddToList(&hfill4);
-    tlist.AddToList(&hfill5);
-
-    //
-    // Create and setup the eventloop
-    //
-    MEvtLoop evtloop;
-    evtloop.SetParList(&plist);
-
-    //
-    // Execute your analysis
-    //
-    MProgressBar bar;
-    evtloop.SetProgressBar(&bar);
-    if (!evtloop.Eventloop())
-        return;
-
-    tlist.PrintStatistics();
-
-    //
-    // After the analysis is finished we can display the histograms
-    //
-    plist.FindObject("MHHillas")->DrawClone();
-    plist.FindObject("MHHillasExt")->DrawClone();
-    plist.FindObject("MHStarMap")->DrawClone();
-    plist.FindObject("HistSource")->DrawClone();
-    plist.FindObject("HistExtSource")->DrawClone();
-}
-
Index: trunk/MagicSoft/Mars/macros/testenv.C
===================================================================
--- trunk/MagicSoft/Mars/macros/testenv.C	(revision 7158)
+++ 	(revision )
@@ -1,120 +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): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-///////////////////////////////////////////////////////////////////////////
-//
-// testenv.C
-// =========
-//
-// This example reads an config-file (steering card, input card, ...)
-// The contents of the file a forwarded to the apropriate eventloop
-// setup in your file.
-//
-// All tasks and containers in an eventloop should implement the
-// ReadEnv/WriteEnv function (for an example see the tasks used below).
-//
-// The functions gets the corresponding setup data from the file as an
-// argument and can change their behaviour and setup on this information.
-//
-///////////////////////////////////////////////////////////////////////////
-
-void testenv()
-{
-    // Setup for all MHMatrix objects is done by:
-    // MHMatrix.Column0: ...
-    //
-    // This can be overwritten for a MHMatrix called MatrixGammas by:
-    // MatrixGammas.Column0;
-    //
-    // This can be overwritten for all MHMatrix in one Job by:
-    // Job1.MHMatrix.Column0;
-    //
-    // This can be overwritten for a MHMatrix called MatrixGammas in one Job by:
-    // Job1.MatrixGammas.Column0;
-    //
-    TEnv env(".marsrc");
-
-    //
-    // For developers: Set this to kTRUE to see how the TEnv file
-    // entries are checked.
-    //
-    Bool_t print = kFALSE;
-
-    // ------------ Job 1 -------------------
-    if (env.GetValue("Job1", kFALSE))
-    {
-        cout << "++++++++++++++++++ Job 1 +++++++++++++++++++" << endl;
-        MParList plist1;
-        MTaskList tlist1;
-
-        plist1.AddToList(&tlist1);
-
-        MReadMarsFile read1("Events");
-
-        MHMatrix matrix1("MatrixGammas");
-
-        MFillH fillm1(&matrix1);
-        plist1.AddToList(&matrix1);
-
-        tlist1.AddToList(&read1);
-        tlist1.AddToList(&fillm1);
-
-        MEvtLoop evtloop1("Job1");
-        evtloop1.SetParList(&plist1);
-        cout << "--------------------------------------------" << endl;
-        evtloop1.ReadEnv(env, "", print);
-        cout << "--------------------------------------------" << endl;
-        evtloop1.Eventloop();
-        cout << endl;
-    }
-
-    // ------------ Job 2 -------------------
-
-    if (env.GetValue("Job2", kTRUE))
-    {
-        cout << "++++++++++++++++++ Job 2 +++++++++++++++++++" << endl;
-        MParList plist2;
-        MTaskList tlist2;
-
-        plist2.AddToList(&tlist2);
-
-        MReadMarsFile read2("Events");
-
-        MHMatrix matrix2("MatrixGammas");
-
-        MFillH fillm2(&matrix2);
-        plist2.AddToList(&matrix2);
-
-        tlist2.AddToList(&read2);
-        tlist2.AddToList(&fillm2);
-
-        MEvtLoop evtloop2("Job2");
-        evtloop2.SetParList(&plist2);
-        cout << "--------------------------------------------" << endl;
-        evtloop2.ReadEnv(env, "", print);
-        cout << "--------------------------------------------" << endl;
-        evtloop2.Eventloop();
-        cout << endl;
-    }
-}
Index: trunk/MagicSoft/Mars/macros/tutorials/derotatedc.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/derotatedc.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/derotatedc.C	(revision 7159)
@@ -0,0 +1,104 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 4/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// derotatedc.C
+// ============
+//
+// Derotate a MCamEvent and fill a histogram with derotated data
+// (sky-plot).
+//
+// As an input you need a merpped root file conataining DC information
+// from a camera report file. To be able to derotate you also need
+// aproproitate time-stamps and the corresponding pointing information.
+//
+// All events are filled into a 2D histograms - derotated.
+//
+// The example shows the usage of MHCamEventRot. The output is the derotated
+// sky-plot.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+void derotatedc()
+{
+    //
+    // Create a empty Parameter List and an empty Task List
+    // The tasklist is identified in the eventloop by its name
+    //
+    MParList  plist;
+
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    // Define Observatory location (for derotation)
+    MObservatory obs;
+    plist.AddToList(&obs);
+
+    // Set the camera geometry (for histogram size)
+    MGeomCamMagic cam;
+    plist.AddToList(&cam);
+
+    // setup pointing position
+    MPointingPos ppos;
+    ppos.SetSkyPosition(MAstro::Hms2Hor(5, 34, 31.9), MAstro::Dms2Deg(22, 0, 52.0));
+    plist.AddToList(&ppos);
+
+    // Define which file to read
+    MReadTree read("Currents", "../dc.root");
+    read.DisableAutoScheme();
+
+    // Derotated histogram to fill
+    MHCamEventRot hist;
+
+    // Set name of time container corresponding to your data
+    hist.SetNameTime("MTimeCurrents");
+
+    // Setup fill task
+    MFillH fill(&hist, "MCameraDC");
+
+    // Set a draw option for your 2D histogram
+    //fill.SetDrawOption("colz");
+
+    // Setup tasklist
+    tlist.AddToList(&read);
+    tlist.AddToList(&fill);
+
+    //
+    // Create and setup the eventloop
+    //
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    MStatusDisplay *d = new MStatusDisplay;
+    evtloop.SetDisplay(d);
+
+    //
+    // Execute your analysis
+    //
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/evtrate.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/evtrate.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/evtrate.C	(revision 7159)
@@ -0,0 +1,78 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+///////////////////////////////////////////////////////////////////////////
+//
+// evtrate.C
+// =========
+//
+// Example macro how to calulate the eventrate (per event) and display
+// the result versus time.
+//
+// As an input you need a merpped raw-data file containing correct times.
+// The output is the plot: Eventrate vs. time.
+//
+///////////////////////////////////////////////////////////////////////////
+
+void evtrate()
+{
+    // Setup parameter- and tasklist
+    MParList plist;
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    // Setup reading task
+    MReadMarsFile read("Events");
+    read.DisableAutoScheme();
+    read.AddFile("test-time.root");
+
+    // Setup event rate calculator
+    MEventRateCalc calc;
+    // Setup number of events to be averaged
+    calc.SetNumEvents(200);
+
+    // Setup histogram to be filles with rate
+    MHVsTime rate("MEventRate.fRate");
+
+    // Setup task to fill the histogram
+    MFillH fill(&rate, "MTime");
+
+    // Setup tasklist
+    tlist.AddToList(&read);
+    tlist.AddToList(&calc);
+    tlist.AddToList(&fill);
+
+    // Execute your eventloop
+    MEvtLoop loop;
+    loop.SetParList(&plist);
+
+    if (!loop.Eventloop())
+        return;
+
+    // print some execution statistics
+    tlist.PrintStatistics();
+
+    // Draw result
+    rate.DrawClone();
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/extendcam.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/extendcam.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/extendcam.C	(revision 7159)
@@ -0,0 +1,235 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz,  12/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2004-2005
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// extendcam.C
+//
+// This macro demonstrates how to extend the magic camera and performes
+// a fourier transformation on it
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+Bool_t HandleInput()
+{
+    // This must be there to get accesss to the GUI while the macro
+    // is still running!
+
+    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
+    while (1)
+    {
+        //
+        // While reading the input process gui events asynchronously
+        //
+        timer.TurnOn();
+        TString input = Getline("Type 'q' to exit, <return> to go on: ");
+        timer.TurnOff();
+
+        if (input=="q\n")
+            return kFALSE;
+
+        if (input=="\n")
+            return kTRUE;
+    };
+
+    return kFALSE;
+}
+
+TCanvas   *c;
+MHCamera *d1=new MHCamera(MGeomCamMagic());
+MHCamera *d2=new MHCamera;
+MHCamera *d3=new MHCamera;
+MHCamera *d4=new MHCamera;
+MHCamera *d5=new MHCamera;
+MHCamera *d6=new MHCamera(MGeomCamMagicXT());
+
+MCerPhotEvt *evt=0;
+MMcEvt *mc;
+
+MHexagonFreqSpace *fFreq1;
+MHexagonFreqSpace *fFreq2;
+
+Int_t PreProcess(MParList *plist)
+{
+    fFreq1 = (MHexagonFreqSpace*)plist->FindObject("MHexagonFreqSpace1");
+    if (!fFreq1)
+        return kFALSE;
+    fFreq2 = (MHexagonFreqSpace*)plist->FindObject("MHexagonFreqSpace2");
+    if (!fFreq2)
+        return kFALSE;
+
+    //Für Real-Raum
+    evt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
+    if (!evt)
+    {
+        cout << "Fehler: MCerPhotEvt" << endl;
+        return kFALSE;
+    }
+
+    mc = (MMcEvt*)plist->FindObject("MMcEvt");
+    if (!mc)
+    {
+        cout << "Fehler: MMcEvt" << endl;
+        return kFALSE;
+    }
+
+    c = new TCanvas("Events", "Real Events", 900, 600);
+    c->SetBorderMode(0);
+    c->Divide(3,2);
+
+    MGeomCam *geomfreq=fFreq1->NewGeomCam();
+    geomfreq->SetName("FreqSpace");
+
+    c->cd(1);
+    d1->SetPrettyPalette();
+    d1->Draw();
+    c->cd(2);
+    d2->SetGeometry(MGeomCamMagicXT());
+    d2->SetPrettyPalette();
+    d2->Draw();
+    c->cd(4);
+    d3->SetGeometry(*geomfreq);
+    d3->SetPrettyPalette();
+    d3->Draw();
+    c->cd(5);
+    d4->SetGeometry(MGeomCamMagicXT());
+    d4->SetPrettyPalette();
+    d4->Draw();
+    c->cd(3);
+    d5->SetGeometry(MGeomCamMagicXT());
+    d5->SetPrettyPalette();
+    d5->Draw();
+    c->cd(6);
+    //d6->SetGeometry(MGeomCamMagicXT());
+    d6->SetPrettyPalette();
+    d6->Draw();
+    return kTRUE;
+}
+
+MClone *cl1;
+MClone *cl2;
+MClone *cl3;
+MClone *cl4;
+
+Int_t Process()
+{
+    d1->SetCamContent(*(MCerPhotEvt*)cl1->GetClone());
+    d2->SetCamContent(*(MCerPhotEvt*)cl2->GetClone());
+    d3->SetCamContent(*fFreq2);
+    d4->SetCamContent(*(MCerPhotEvt*)cl4->GetClone());
+    d5->SetCamContent(*(MCerPhotEvt*)cl3->GetClone());
+    d6->SetCamContent(*evt);
+
+    d2->SetMaximum(-1111);
+    d4->SetMaximum(-1111);
+    d2->SetMinimum(0);
+    d4->SetMinimum(0);
+    d2->SetMaximum(TMath::Max(d2->GetMaximum(), d4->GetMaximum()));
+    d4->SetMaximum(d2->GetMaximum());
+
+    for (int i=1; i<7; i++)
+    {
+        c->GetPad(i)->GetPad(1)->Modified();
+        c->GetPad(i)->GetPad(1)->Update();
+    }
+
+    c->Modified();
+    c->Update();
+
+
+    return HandleInput();
+}
+
+void extendcam()
+{
+    MParList  plist;
+    MTaskList tlist;
+
+    MGeomCamMagicXT geom("MGeomCamMagicXT");
+    plist.AddToList(&geom);
+
+    plist.AddToList(&tlist);
+
+    MReadMarsFile read("Events");
+    read.DisableAutoScheme();
+    read.AddFile("/home/kolodziejski/Diplomarbeit/marsdata/mcdata/*.root");
+    //read.AddFile("/home/hoehne/data/mcdata/gammas/calib/calib_gamma_zbin0.root");
+    //read.AddFile("/home/hoehne/data/mcdata/hadrons/calib/calib_proton_zbin0.root");
+
+
+    // Setup intercative task calling the functions defined above
+    MGeomApply           apply; //necessary for evt
+    MGeomCamMagicEnhance enhance;
+    // enhance.SetNameCerPhotEvtOut("MCerPhotEvt2");
+
+    MClone clone1("MCerPhotEvt", "Clone1");
+    MClone clone2("MCerPhotEvt", "Clone2");
+    MClone clone3("MCerPhotEvt", "Clone3");
+    MClone clone4("MCerPhotEvt", "Clone4");
+
+    cl1 = &clone1;
+    cl2 = &clone2;
+    cl3 = &clone3;
+    cl4 = &clone4;
+
+    MHexagonalFTCalc     ftcalc;
+    ftcalc.SetNameGeomCam("MGeomCamMagicXT");
+    // ftcalc.SetNameCerPhotEvt("MCerPhotEvt2");
+
+    MTaskInteractive mytask;
+    mytask.SetPreProcess(PreProcess);
+    mytask.SetProcess(Process);
+
+    MImgCleanStd clean1(26, 18);
+    clean1.SetMethod(MImgCleanStd::kAbsolute);
+    clean1.SetNameGeomCam("MGeomCamMagicXT");
+
+    MImgCleanStd clean2(26, 18);
+    clean2.SetMethod(MImgCleanStd::kAbsolute);
+    clean2.SetNameGeomCam("MGeomCamMagicXT");
+
+    // Setup your tasklist
+    tlist.AddToList(&read);
+    tlist.AddToList(&apply);
+    tlist.AddToList(&clone1);
+    tlist.AddToList(&enhance);
+    tlist.AddToList(&clone2);
+    tlist.AddToList(&clean1);
+    tlist.AddToList(&clone3);
+    tlist.AddToList(&ftcalc);
+    tlist.AddToList(&clone4);
+    tlist.AddToList(&clean2);
+    tlist.AddToList(&mytask);
+
+    // Run your analysis
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    if (!evtloop.Eventloop())
+        return;
+
+    // Print statistics information about your loop
+    tlist.PrintStatistics();
+}
+
Index: trunk/MagicSoft/Mars/macros/tutorials/hft.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/hft.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/hft.C	(revision 7159)
@@ -0,0 +1,236 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz  12/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2004-2005
+!
+!
+\* ======================================================================== */
+
+///////////////////////////////////////////////////////////////////////////
+//
+// hft.C
+//
+// example of using MHexagonal*
+//
+///////////////////////////////////////////////////////////////////////////
+
+Bool_t HandleInput()
+{
+    // This must be there to get accesss to the GUI while the macro
+    // is still running!
+
+    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
+    while (1)
+    {
+        //
+        // While reading the input process gui events asynchronously
+        //
+        timer.TurnOn();
+        TString input = Getline("Type 'q' to exit, <return> to go on: ");
+        timer.TurnOff();
+
+        if (input=="q\n")
+            return kFALSE;
+
+        if (input=="\n")
+            return kTRUE;
+    };
+
+    return kFALSE;
+}
+
+//
+// Setup the data-members of your 'virtual' class
+//
+MHCamera display[5];
+
+TCanvas   *c;
+MParList  *fParList;
+MTaskList *fTaskList;
+
+MHexagonalFTCalc  hft;
+MHexagonFreqSpace *fFreq1;
+MHexagonFreqSpace *fFreq2;
+
+MGeomCam *geomfreq;
+
+TH1F histo("", "", 35, -0.5, 35);
+
+//
+// Called like all PreProcess functions of tasks. Get the access to
+// the containers necessary for you.
+//
+Int_t PreProcess(MParList *plist)
+{
+    fFreq1 = (MHexagonFreqSpace*)plist->FindObject("MHexagonFreqSpace1");
+    if (!fFreq1)
+        return kFALSE;
+    fFreq2 = (MHexagonFreqSpace*)plist->FindObject("MHexagonFreqSpace2");
+    if (!fFreq2)
+        return kFALSE;
+
+    geomfreq=fFreq1->NewGeomCam();
+    geomfreq->SetName("FreqSpace");
+    plist->AddToList(geomfreq);
+
+    //    return kTRUE;
+
+    // Get parameter and tasklist, see Process
+    fParList = plist;
+    fTaskList = (MTaskList*)plist->FindObject("MTaskList");
+
+    // Get camera geoemtry
+    MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam");
+
+    // setup canvas and camera-histograms
+    c = new TCanvas("Events", "Real Events", 900, 600);
+    c->SetBorderMode(0);
+    c->Divide(3,2);
+    for (int i=0; i<3; i++)
+    {
+        display[i].SetGeometry(*geomfreq);
+        display[i].SetPrettyPalette();
+        c->cd(i+1);
+        display[i].Draw();
+    }
+
+    display[1].SetName("In");
+    display[2].SetName("Out");
+    display[0].SetName("Freq");
+
+    return kTRUE;
+}
+
+//
+// Called like all Process functions of tasks. Process a single
+// event - here display it.
+//
+Int_t Process()
+{
+    // For simplicity we search in the Process function for the
+    // objects. This is deprectaed! Store the pointers to the objects
+    // as data member and get the pointers in PreProcess.
+    MClone *clone1 = (MClone*)fTaskList->FindObject("Clone1");
+    MClone *clone2 = (MClone*)fTaskList->FindObject("Clone2");
+    MGeomCam *geom = (MGeomCam*)fParList->FindObject("MGeomCam");
+
+    // Fill the data into your camera-histograms
+    display[1].SetCamContent(*fFreq1, 1);
+    display[2].SetCamContent(*fFreq1, 2);
+    display[0].SetCamContent(*fFreq2, 0);
+
+    display[1].SetMaximum(-1111);
+    display[2].SetMaximum(-1111);
+    display[1].SetMinimum(0);
+    display[2].SetMinimum(0);
+    display[1].SetMaximum(TMath::Max(display[1].GetMaximum(),
+                                     display[2].GetMaximum()));
+    display[2].SetMaximum(display[1].GetMaximum());
+
+    MHexagonalFT *ft = &hft.GetHFT();
+
+    histo.Reset();
+    for (int i=0; i<ft->GetNumKnots(); i++)
+    {
+        Double_t val=0;
+        fFreq2->GetPixelContent(val, i, *display[1].GetGeometry());
+        histo.Fill(ft->GetRow(i), val/(i+1));
+    }
+
+    c->cd(4);
+    histo.Draw();
+
+    c->cd(5);
+
+    TH1D *obj1 = (TH1D*)display[1].Projection("Proj1");
+    obj1->SetLineColor(kBlue);
+    obj1->Draw();
+    obj1 = (TH1D*)display[2].Projection("Proj2");
+    obj1->Draw("same");
+
+    c->cd(6);
+    display[0].DrawProjection();
+
+    // Update the display
+    for (int i=1; i<=3; i++)
+    {
+        c->GetPad(i)->GetPad(1)->Modified();
+        c->GetPad(i)->GetPad(1)->Update();
+    }
+
+    return HandleInput();
+}
+
+//
+// Called like all PostProcess functions of tasks. Delete
+// instanciated objects.
+//
+Int_t PostProcess()
+{
+    delete c;
+    delete geomfreq;
+}
+
+void hft(const char *fname="/home/hoehne/data/mcdata/hadrons/calib/calib_proton_zbin0.root")
+{
+    // Setup parameter- and tasklist
+    MParList  plist;
+    MTaskList tlist;
+
+    plist.AddToList(&tlist);
+
+    // setup reading task
+    MReadMarsFile read("Events", fname);
+    read.DisableAutoScheme();
+
+    // Clone MCerPhotEvt befor eimage cleaning
+    MClone clone1("MCerPhotEvt", "Clone1");
+
+    // Setup image cleaning
+    MImgCleanStd clean(24, 12);
+    clean.SetMethod(MImgCleanStd::kAbsolute);
+
+    // Clone MCerPhotEvt befor eimage cleaning
+    MClone clone2("MCerPhotEvt", "Clone2");
+
+    // Setup intercative task calling the functions defined above
+    MTaskInteractive  mytask;
+
+    mytask.SetPreProcess(PreProcess);
+    mytask.SetProcess(Process);
+
+    // Setup your tasklist
+    tlist.AddToList(&read);
+    tlist.AddToList(&clone1);
+    tlist.AddToList(&hft);
+    tlist.AddToList(&clone2);
+    tlist.AddToList(&clean);
+    tlist.AddToList(&mytask);
+
+    // Run your analysis
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    if (!evtloop.Eventloop())
+        return;
+
+    // Print statistics information about your loop
+    tlist.PrintStatistics();
+}
+
Index: trunk/MagicSoft/Mars/macros/tutorials/pedestalvstime.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/pedestalvstime.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/pedestalvstime.C	(revision 7159)
@@ -0,0 +1,138 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 6/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+void ProcessFile(TString fname, Int_t idx)
+{
+    //
+    // Create a empty Parameter List and an empty Task List
+    // The tasklist is identified in the eventloop by its name
+    //
+    MParList  plist;
+
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    //
+    // Now setup the tasks and tasklist:
+    // ---------------------------------
+    //
+
+    // First Task: Read file with image parameters
+    // (created with the star.C macro)
+
+    MReadMarsFile read("Events", fname);
+    read.DisableAutoScheme();
+
+    MGeomApply geomapl;
+
+    MCerPhotAnal2 ncalc;
+
+    tlist.AddToList(&read);
+    tlist.AddToList(&geomapl);
+    tlist.AddToList(&ncalc);
+
+    MHPixVsTime hist1(idx, "Pedestal");
+    MHPixVsTime hist2(idx, "PedestalRMS");
+    hist2.SetType(1);
+    plist.AddToList(&hist1);
+    plist.AddToList(&hist2);
+
+    MFillH fill1("Pedestal",    "MPedestalCam");
+    MFillH fill2("PedestalRMS", "MPedestalCam");
+    tlist.AddToList(&fill1);
+    tlist.AddToList(&fill2);
+
+    //
+    // Create and setup the eventloop
+    //
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    //
+    // Execute your analysis
+    //
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+
+    TCanvas *c = MH::MakeDefCanvas();
+    c->Divide(2,2);
+
+    c->cd(1);
+    TGraph &g1 = hist1.GetGraph();
+    TH1 *h1 = g1.GetHistogram();
+    h1->SetXTitle("Time [au]");
+    h1->SetYTitle("P [au]");
+    g1.DrawClone("A*");
+
+    c->cd(2);
+    TH1F h1f("Pedestal", "Pedestals", 21, 46, 56);
+    h1f.SetXTitle("P");
+    h1f.SetYTitle("Counts");
+    for (int i=0;i<g1.GetN(); i++)
+        h1f.Fill(g1.GetY()[i]);
+    ((TH1F*)h1f.DrawCopy())->Fit("gaus");
+
+    c->cd(3);
+    TGraph &g2 = hist2.GetGraph();
+    TH1 *h2 = g2.GetHistogram();
+    h2->SetXTitle("Time [au]");
+    h2->SetYTitle("P_{rms} [au]");
+    g2.DrawClone("A*");
+
+    c->cd(4);
+    TH1F h2f("PedestalRMS", "Pedestals RMS", 26, 0, 3.5);
+    h2f.SetXTitle("P_{rms}");
+    h2f.SetYTitle("Counts");
+    for (int i=0;i<g2.GetN(); i++)
+        h2f.Fill(g2.GetY()[i]);
+    ((TH1F*)h2f.DrawCopy())->Fit("gaus");
+
+    c->SaveAs(fname(0, fname.Last('.')+1) + "ps");
+    //c->SaveAs(fname(0, fname.Last('.')+1) + "root");
+}
+
+// -------------------------------------------------------------------------
+//
+//  plot.C
+//
+//  This macro shows how to fill and display a histogram using Mars
+//
+void pedestalvstime(Int_t idx=0, const char *dirname=".")
+{
+    MDirIter Next;
+    Next.AddDirectory(dirname, "raw*.root", -1);
+
+    TString fname;
+    while (1)
+    {
+        fname = Next();
+        if (fname.IsNull())
+            break;
+
+        ProcessFile(fname, idx);
+        return;
+    }
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/pedvsevent.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/pedvsevent.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/pedvsevent.C	(revision 7159)
@@ -0,0 +1,214 @@
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// Author(s): S.C. Commichau,  Javier Rico, 12/2003                        //
+//                                                                         //
+// Macro to generate pedestal vs time (event) plot for a single pixel      //
+//                                                                         // 
+/////////////////////////////////////////////////////////////////////////////
+
+
+const Int_t default_pixel = 1 ;
+
+void pedvsevent(Int_t pixel = default_pixel, 
+		TString pname = "/disc02/Data/rootdata/Miscellaneous/2003_11_29/20031128_03118_P_Park-camera-closed_E.root")
+{
+
+    TH1F* Pedestal    = new TH1F("Pedestal","Pedestals",100,0,20);
+    TH1F* PedestalRMS = new TH1F("PedestalRMS","Pedestal RMS",100,0,10);
+  
+    //Create an empty parameter list and an empty task list
+    //the tasklist is identified in the eventloop by ist name
+    MParList       plist;
+    MTaskList      tlist;
+
+    //Creates a MPedestalPix object for each pixel, i.e. it is a
+    //storage container for all Pedestal information in the camera
+    MPedestalCam   cam;  
+  
+    plist.AddToList(&cam);
+
+    //MHCamEvent hist;
+    //hist.SetType(1);
+    //plist.AddToList(&hist);
+
+    plist.AddToList(&tlist);
+
+    //Setup task and tasklist for the pedestals
+    MReadMarsFile read("Events", pname);
+    read.DisableAutoScheme();
+
+    //Apply the geometry to geometry dependant containers.
+    //MGeomApply changes the size of the arrays in the containers to a size
+    //matching the number of pixels, eg: MPedestalCam, MBlindPixels
+    //Default geometry is MGeomCamMagic
+    MGeomApply      geomapl;
+   
+    //Task to calculate pedestals
+    MPedCalcPedRun  ped;
+
+    tlist.AddToList(&read);
+    tlist.AddToList(&geomapl);
+    tlist.AddToList(&ped); 
+
+    //ped.SetPixel(pixel);
+    //ped.Draw();
+
+    //Create and setup the 1st Eventloop  
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    //Execute first analysis, pedestals...
+     if (!tlist.PreProcess(&plist))
+         return;
+
+     const Int_t nevents = read.GetEntries();
+
+     Float_t x[nevents], rms[nevents], mean[nevents];
+
+
+     Int_t i = 0;     
+     while (tlist.Process())
+     {
+	 mean[i] = cam[pixel].GetPedestal();
+         rms[i] = cam[pixel].GetPedestalRms();
+         x[i] = i;
+	 i++; 
+     }
+
+     TGraphErrors* pedgraph = new TGraphErrors(nevents,x,mean,NULL,NULL);
+     TGraphErrors* rmsgraph = new TGraphErrors(nevents,x,rms,NULL,NULL);
+
+	 //plist.FindObject("MPedestalCam")->Print();
+    
+     tlist.PostProcess(); 
+     //if (!evtloop.Eventloop())
+     // return;
+
+     Float_t finalmean = cam[pixel].GetPedestal();
+     Float_t finalrms = cam[pixel].GetPedestalRms();
+   
+     TLine* pedline = new TLine(0,finalmean,nevents,finalmean);
+     TLine* rmsline = new TLine(0,finalrms,nevents,finalrms);
+    
+     //The draw area
+     
+
+
+     gROOT->Reset();
+     gStyle->SetOptStat(0);
+     // Set statistics options, 1111111
+     //                         |||||||
+     //                         ||||||histogram name
+     //                         |||||number of entries
+     //                         ||||mean value
+     //                         |||RMS
+     //                         ||underflows
+     //                         |overflows
+     //                         sum of bins
+     
+     // Set gPad options
+     gStyle->SetFrameBorderMode(0);
+     gStyle->SetPalette(1);
+     // Delete Frames of subCanvas' does not work, hook it Mr. gPad!
+     gStyle->SetFrameBorderSize(0);
+     gStyle->SetCanvasColor(0);
+     gStyle->SetFrameFillColor(0);
+     gStyle->SetTitleFont(102);
+     gStyle->SetTitleFillColor(0);
+     gStyle->SetTitleBorderSize(0);
+     gStyle->SetStatColor(0);
+     gStyle->SetStatBorderSize(0);
+     
+     // Set Canvas options
+     TCanvas *MyC1 = new TCanvas("MyC","Pedestal vs Event", 0, 100, 900, 500);
+     MyC->SetBorderMode(0);    // Delete the Canvas' border line
+     
+     MyC->cd();
+     gPad->SetBorderMode(0);
+     
+     //  TLine* pedline = new TLine(0,finalmean,nevents,finalmean);
+     //TLine* rmsline = new TLine(0,finalrms,nevents,finalrms);
+     
+     tlist.PrintStatistics();
+     //plist.FindObject("MPedestalCam")->Print();
+     Size_t pos = pname.Last('/')+10;
+     TString iRun = TString(pname(pos,5));
+     
+     char str[64];
+     
+     sprintf(str,"Run %s Pixel %d",iRun.Data(),pixel);
+     
+     pedgraph->SetMaximum(30);
+     pedgraph->SetMinimum(0);
+     pedgraph->SetMarkerStyle(24);
+     pedgraph->SetMarkerSize(.5);
+     pedgraph->GetXaxis()->SetTitleFont(102);
+     pedgraph->GetYaxis()->SetTitleFont(102);
+     pedgraph->GetXaxis()->SetLabelFont(102);
+     pedgraph->GetYaxis()->SetLabelFont(102);
+     pedgraph->SetTitle(str); 
+//     pedgraph->SetTitleFont(102);
+     pedgraph->GetYaxis()->SetTitleFont(102);
+     pedgraph->GetXaxis()->SetTitle("Event");
+     pedgraph->GetYaxis()->SetTitle("[FADC Counts]");
+     pedgraph->GetXaxis()->SetLimits(0,nevents-1);
+     
+     rmsgraph->SetMarkerStyle(25);
+     rmsgraph->SetMarkerSize(.5);
+     rmsgraph->SetMarkerColor(8);
+
+     pedline->SetLineColor(2);
+     rmsline->SetLineColor(4);
+     pedline->SetLineWidth(2);
+     rmsline->SetLineWidth(2);
+
+     pedgraph->Draw("AP");
+     rmsgraph->Draw("P");
+     
+     pedline->Draw("same");
+     rmsline->Draw("same");
+     
+     TLegend* leg = new TLegend(.14,.68,.39,.88);
+     leg->SetHeader("");
+     leg->AddEntry(pedgraph,"Event based Pedestal","P");
+     leg->AddEntry(pedline,"Run based Pedestal","L");
+     leg->AddEntry(rmsgraph,"Event based RMS","P");
+     leg->AddEntry(rmsline,"Run based RMS","L");
+     leg->SetFillColor(0);
+     leg->SetLineColor(1);
+     leg->SetBorderSize(1);
+
+
+     leg->Draw("same");
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/MagicSoft/Mars/macros/tutorials/pixfirerate.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/pixfirerate.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/pixfirerate.C	(revision 7159)
@@ -0,0 +1,133 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Abelardo Moralejo <mailto:moralejo@pd.infn.it>
+!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// pixfirerate.C
+// =============
+//
+// This macro can help to  find "hot" pixels firing too often
+// or pixels firing too rarely. It plots camera displays showing how many 
+// times the FADC integral of each pixel has been found to be above pedestal
+// by 10, 20, 50, 100 or 200 ADC counts. As "pedestal"  we now use simply 
+// the signal in the first ADC slice, which seemed reasonable from a first
+// look at the available test data.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+void pixfirerate(TString filename="rawfile.root")
+{
+    //
+    // Update frequency by default = 1Hz
+    //
+    MStatusDisplay *d = new MStatusDisplay;
+
+    // Set update time to 5s
+    // d->SetUpdateTime(5000);
+
+    // Disable online update
+    // d->SetUpdateTime(-1);
+
+    d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
+    gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
+    //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
+
+    //
+    // Create a empty Parameter List and an empty Task List
+    // The tasklist is identified in the eventloop by its name
+    //
+    MTaskList tlist;
+    MParList  plist;
+    plist.AddToList(&tlist);
+
+    //
+    // Now setup the tasks and tasklist:
+    // ---------------------------------
+    //
+    MReadMarsFile read("Events");
+    read.DisableAutoScheme();
+    read.AddFile(filename);
+    tlist.AddToList(&read);
+
+    MGeomApply geomapl;
+    tlist.AddToList(&geomapl);
+
+    // A list of threshold which should be displayed. The last entry
+    // MUST be -1.
+    Double_t threshold[] = { 10, 20, 100, 200, -1 };
+
+    Int_t cnt = 0;
+    while (threshold[cnt]>0) cnt++;
+
+    // Create the corresponding fill tasks and containers
+    for (int i=0; i<cnt; i++)
+    {
+        TString name = "Above ";
+        TString num;
+        num += threshold[i];
+        name += num.Strip(TString::kBoth);
+        TString title = "Firerate [%] of pixels with signal > ";
+        title += num.Strip(TString::kBoth);
+
+        MHTriggerLvl0 *trigmap = new MHTriggerLvl0(threshold[i], name, title);
+        MFillH *fillh = new MFillH(trigmap, "MRawEvtData");
+        trigmap->SetBit(kCanDelete);
+        fillh->SetBit(kCanDelete);
+        plist.AddToList(trigmap);
+        tlist.AddToList(fillh);
+    }
+
+    // create the eventloop
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+    evtloop.SetDisplay(d);
+
+    //
+    // Execute your analysis
+    //
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+
+    //
+    // Make sure the display hasn't been deleted by the user while the
+    // eventloop was running.
+    //
+    if ((d = evtloop.GetDisplay()))
+    {
+        // Save data in a postscriptfile (status.ps)
+        d->SaveAsPS();
+        /*
+         * ----------- Write status to a root file ------------
+         *
+         TFile file("status.root", "RECREATE");
+         d->Write();
+         file.Close();
+         delete d;
+         */
+    }
+
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/pixsatrate.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/pixsatrate.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/pixsatrate.C	(revision 7159)
@@ -0,0 +1,120 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Abelardo Moralejo <mailto:moralejo@pd.infn.it>
+!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// pixfirerate.C
+// =============
+//
+// This macro can help to  find "hot" pixels firing too often
+// or pixels firing too rarely. It plots camera displays showing how many 
+// times the FADC integral of each pixel has been found to be above pedestal
+// by 10, 20, 50, 100 or 200 ADC counts. As "pedestal"  we now use simply 
+// the signal in the first ADC slice, which seemed reasonable from a first
+// look at the available test data.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+void pixsatrate(TString filename="rawfile.root")
+{
+    //
+    // Update frequency by default = 1Hz
+    //
+    MStatusDisplay *d = new MStatusDisplay;
+
+    // Set update time to 5s
+    // d->SetUpdateTime(5000);
+
+    // Disable online update
+    // d->SetUpdateTime(-1);
+
+    d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
+    gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
+    //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
+
+    //
+    // Create a empty Parameter List and an empty Task List
+    // The tasklist is identified in the eventloop by its name
+    //
+    MTaskList tlist;
+    MParList  plist;
+    plist.AddToList(&tlist);
+
+    //
+    // Now setup the tasks and tasklist:
+    // ---------------------------------
+    //
+    MReadMarsFile read("Events");
+    read.DisableAutoScheme();
+    read.AddFile(filename);
+    tlist.AddToList(&read);
+
+    MGeomApply geomapl;
+    tlist.AddToList(&geomapl);
+
+    // Create histograms with saturation limits at 254
+    MHTriggerLvl0 trighi(254, "SaturationHi", "Saturation Rate of Hi Gains");
+    MHTriggerLvl0 triglo(254, "SaturationLo", "Saturation Rate of Lo Gains");
+    trighi.SetType(1);
+    triglo.SetType(2);
+
+    // craete fill tasks to fill the histogarms
+    MFillH fillhi(&trighi, "MRawEvtData");
+    MFillH filllo(&triglo, "MRawEvtData");
+    tlist.AddToList(&fillhi);
+    tlist.AddToList(&filllo);
+
+    // create eventloop
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+    evtloop.SetDisplay(d);
+
+    //
+    // Execute your analysis
+    //
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+
+    //
+    // Make sure the display hasn't been deleted by the user while the
+    // eventloop was running.
+    //
+    if ((d = evtloop.GetDisplay()))
+    {
+        // Save data in a postscriptfile (status.ps)
+        d->SaveAsPS();
+        /*
+         * ----------- Write status to a root file ------------
+         *
+         TFile file("status.root", "RECREATE");
+         d->Write();
+         file.Close();
+         delete d;
+         */
+    }
+
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/readpix.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/readpix.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/readpix.C	(revision 7159)
@@ -0,0 +1,97 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
+!
+!   Copyright: MAGIC Software Development, 2000-2001
+!
+!
+\* ======================================================================== */
+
+
+#include <iomanip>
+
+void readpix()
+{
+    //
+    // open the file
+    //
+    TFile input("delme.root", "READ");
+
+    //
+    // open the Run Header tree
+    //
+    TTree *runtree = (TTree*) input.Get("RunHeaders") ;
+
+    if (!runtree)
+        return;
+
+    cout << " Entries in Tree RunHeaders: " << runtree->GetEntries() << endl ;
+
+    //
+    // create an instance of MRawRunHeader, enable the branch and
+    // read the header, print it
+    //
+    MRawRunHeader *runheader = new MRawRunHeader();
+    runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader);
+    runtree->GetEvent(0);
+    runheader->Print();
+
+    //
+    // open the Data Tree
+    //
+    TTree *evttree = (TTree*) input.Get("Data") ;
+
+    //
+    // create the instances of the data to read in
+    //
+    MRawEvtData *evtdata = new MRawEvtData();
+
+    //
+    // enable the corresponding branches
+    //
+    evttree->GetBranch("MRawEvtData")->SetAddress(&evtdata);
+
+    evttree->GetEvent(0);
+
+    MRawEvtPixelIter pixel(evtdata);
+
+    while (pixel.Next())
+    {
+       
+       cout << "Pixel Nr: " << dec << pixel.GetPixelId() << " ";
+       cout << setfill('0') << endl;
+      
+       cout << "Hi Gains: ";
+       for (int i=0; i<evtdata->GetNumHiGainSamples(); i++)
+	  cout << setw(3) << (UInt_t)pixel.GetHiGainFadcSamples()[i];
+       cout << endl;
+      
+       cout << "Lo Gains: ";
+       if (pixel.IsLoGain())
+	  for (int i=0; i<evtdata->GetNumLoGainSamples(); i++)
+	     cout << setw(3) << (UInt_t)pixel.GetLoGainFadcSamples()[i];
+       cout << endl << endl;
+
+       if (pixel.GetPixelId() == 11)
+	 pixel.Draw();
+    };
+}
+
+
+
+
Index: trunk/MagicSoft/Mars/macros/tutorials/readraw.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/readraw.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/readraw.C	(revision 7159)
@@ -0,0 +1,95 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+
+void readraw(const char *fname="/data/MAGIC/Period016/mcdata/spot_1cm/standard/gamma/Gamma_zbin9_90_7_1740to1749_w0.root")
+{
+    //
+    // open the file
+    //
+    TFile input(fname, "READ");
+
+    //
+    // open the Run Header tree
+    //
+    TTree *runtree = (TTree*) input.Get("RunHeaders") ;
+
+    if (!runtree)
+        return;
+
+    cout << " Entries in Tree RunHeaders: " << runtree->GetEntries() << endl ;
+
+    //
+    // create an instance of MRawRunHeader, enable the branch and
+    // read the header, print it
+    //
+    MRawRunHeader *runheader = new MRawRunHeader();
+    runtree->GetBranch("MRawRunHeader.")->SetAddress(&runheader);
+    runtree->GetEvent(0);
+    runheader->Print();
+
+    //
+    // open the Data Tree
+    //
+    TTree *evttree = (TTree*) input.Get("Events");
+
+    //
+    // create the instances of the data to read in
+    //
+    MRawEvtHeader  *evtheader = 0;
+    MTime          *evttime   = 0;
+    MRawEvtData    *evtdata   = 0;
+    MRawCrateArray *evtcrate  = 0;
+
+    //
+    // enable the corresponding branches
+    //
+    evttree->GetBranch("MRawEvtHeader.")->SetAddress(&evtheader);
+    evttree->GetBranch("MRawEvtData.")->SetAddress(&evtdata);
+
+    // Use this for real data only
+    //evttree->GetBranch("MTime.")->SetAddress(&evttime);
+    //evttree->GetBranch("MRawCrateArray.")->SetAddress(&evtcrate);
+
+    //
+    // loop over all events and print the information
+    //
+    Int_t iEnt = evttree->GetEntries();
+    cout << " Entries in Tree Data: " << iEnt << endl;
+
+    for (Int_t i = 0; i<iEnt; i++)
+    {
+      // readin event with the selected branches
+      evttree->GetEvent(i);
+
+      evtheader->Print();
+      evtdata->Print();
+
+      // Use this for real data only
+      //evttime->Print();
+      //evtcrate->Print();
+    } 
+}
+
+
Index: trunk/MagicSoft/Mars/macros/tutorials/readrep.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/readrep.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/readrep.C	(revision 7159)
@@ -0,0 +1,125 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// This macro demonstrates how to read a central control report file.
+// (rootification, see merpp, too)
+//
+// In a second eventloop it gives an example on how to read such a root file.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+void readrep(const char *fname="CC_2003_11_04_23_53_18.rep")
+{
+    //
+    // Read a report file and write containers into a root file
+    //
+    MParList  plist;
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    MReportFileRead read(fname);
+    tlist.AddToList(&read);
+
+    read.AddToList("DAQ");
+    read.AddToList("Drive");
+    read.AddToList("Camera");
+    read.AddToList("Trigger");
+
+    MWriteRootFile write("test.root");
+    write.AddContainer("MReportCamera",      "Camera");
+    write.AddContainer("MTimeCamera",        "Camera");
+    write.AddContainer("MCameraAUX",         "Camera");
+    write.AddContainer("MCameraCalibration", "Camera");
+    write.AddContainer("MCameraCooling",     "Camera");
+    write.AddContainer("MCameraHV",          "Camera");
+    write.AddContainer("MCameraLV",          "Camera");
+    write.AddContainer("MCameraLids",        "Camera");
+    write.AddContainer("MReportTrigger",     "Trigger");
+    write.AddContainer("MTimeTrigger",       "Trigger");
+    write.AddContainer("MReportDrive",       "Drive");
+    write.AddContainer("MTimeDrive",         "Drive");
+    tlist.AddToList(&write);
+
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+
+    // ----------------------------------------------------------------
+    //
+    // Read a report file and write containers into a root file
+    //
+    MTaskList tlist2;
+    plist.Replace(&tlist2);
+
+    // Create a tasklist to process the read events from the Camera tree
+    MTaskList list1("ProcessCamera");
+    MPrint print1("MTimeCamera");
+    list1.AddToList(&print1);
+
+    // Create a tasklist to process the read events from the Drive tree
+    MTaskList list2("ProcessDrive");
+    MPrint print2("MTimeDrive");
+    list2.AddToList(&print2);
+
+    // Tell the reader to read the trees Drive, Trigger and Camera
+    MReadReports read;
+    read.AddTree("Drive");
+    read.AddTree("Trigger");
+    read.AddTree("Camera");
+    //read.AddTree("Events", "MTime."); // for later use!
+
+    // Now (not earlier!) set the file to read!
+    read.AddFile("test.root");
+
+    // First read the events
+    tlist.AddToList(&read);
+    // Process the events from the Camera tree with the task list list1
+    tlist.AddToList(&list1, "Camera");
+    // Process the events from the Camera tree with the task list list2
+    tlist.AddToList(&list2, "Drive");
+
+    // The task lists list1 and list2 are only executed (according to
+    // their stream id - the second argument of AddToList) if a
+    // corresponding event was read and MReadReports has set the stream
+    // id accoringly. MReadReports always sets the stream id to the name
+    // of the tree from which the event was read
+
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    //
+    // Execute the eventloop which should print the time-stamps of the subsystem
+    // events from Drive and Camera in the correct order...
+    //
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/readrfl.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/readrfl.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/readrfl.C	(revision 7159)
@@ -0,0 +1,106 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+Bool_t HandleInput()
+{
+    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
+    while (1)
+    {
+        //
+        // While reading the input process gui events asynchronously
+        //
+        timer.TurnOn();
+        TString input = Getline("Type 'q' to exit, <return> to go on: ");
+        timer.TurnOff();
+
+        if (input=="q\n")
+            return kFALSE;
+
+        if (input=="\n")
+            return kTRUE;
+    };
+
+    return kFALSE;
+}
+
+Bool_t JumpTo(MTaskList &tlist, MReadRflFile &read, int runno, int evtno)
+{
+    if (runno<0 || evtno<0)
+        return tlist.Process();
+
+    return read.SearchFor(runno, evtno);
+}
+
+void readrfl(int runno=-1, int evtno=-1, const char *fname="Gamma_zbin0_90_7_50700to50704_w0.rfl")
+{
+    MParList plist;
+
+    MGeomCamMagic geomcam;
+    MRflEvtData   event;
+    MRflEvtHeader evthead;
+    MRflRunHeader runhead;
+    MTaskList     tlist;
+
+    plist.AddToList(&geomcam);
+    plist.AddToList(&event);
+    plist.AddToList(&evthead);
+    plist.AddToList(&runhead);
+    plist.AddToList(&tlist);
+
+    MReadRflFile read(fname);
+    tlist.AddToList(&read);
+
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    if (!evtloop.PreProcess())
+        return;
+
+    MHCamera display(geomcam);
+    display.Draw();
+    gPad->cd(1);
+    event.Draw();
+
+
+
+    cout << "Runno: " << runno << "  Eventno: " << evtno << endl;
+
+    while (JumpTo(tlist, read, runno, evtno))
+    {
+        runno = -1;
+
+        cout << "Run #" << runhead.GetRunNumber() << "   ";
+        cout << "Event #" << evthead.GetEvtNumber() << endl;
+
+	display.SetCamContent(event);
+
+	gPad->Modified();
+	gPad->Update();
+	
+        if (!HandleInput())
+            break;
+    } 
+
+    evtloop.PostProcess();
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/runbook.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/runbook.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/runbook.C	(revision 7159)
@@ -0,0 +1,150 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+///////////////////////////////////////////////////////////////////////////
+//
+// runbook.C
+// =========
+//
+// This is an example macro how to extract the runbook information of
+// a given date from the runbook files.
+//
+// The argument is a date in regexp format, eg.
+//   .x runbook.C("2004-05-1[0-9]")
+//
+// With an MDirIter you can tell the macro which directories and files
+// should be searched.
+//
+// The output are the runbook entries matching your query.
+//
+///////////////////////////////////////////////////////////////////////////
+
+void Wrap(TString &str)
+{
+    // Wrap lines to 80 chars
+    while (str.Length()>80)
+    {
+        TString ss = str(0, 80);
+        Int_t l = ss.Last(' ');
+        if (l<0)
+            break;
+        cout << str(0, l) << endl;
+        str.Remove(0, l);
+    }
+    cout << str << endl;
+}
+
+void ProcessFile(TString fname, TString date)
+{
+    // File processed
+    cout << fname << endl;
+
+    // Open file
+    ifstream fin(fname);
+
+    TString line;
+
+    int i=81;
+
+    TRegexp r0("20[0-2][0-9]-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]");
+    TRegexp r1(date+" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]");
+
+    int lcnt=0;
+
+    int print = 0;
+
+    while (!fin.eof())
+    {
+        // Read file line by line
+        char *txt=new char[i];
+        fin.getline(txt, i-1);
+
+        if (lcnt++<4)
+            continue;
+
+        if (!fin)
+            txt[i-1]=0;
+
+        line += txt;
+        delete txt;
+
+        if (line.Length()==0)
+        {
+            if (print)
+                cout << endl;
+            continue;
+        }
+
+        if (!fin)
+        {
+            i *= 2;
+            fin.clear();
+            continue;
+        }
+
+        // Check whether line matches regexp
+        if (!line(r0).IsNull())
+            print = !line(r1).IsNull();
+
+        // Wrap lines to 80 chars
+        if (print)
+            Wrap(line);
+        line = "";
+        i=81;
+    }
+    cout << "DONE." << endl;
+}
+
+void runbook(const char *d="20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]")
+{
+    // Regexp to check for valid date
+    TString regexp = "20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]";
+
+    if (regexp!=d)
+    {
+        TRegexp r(regexp);
+
+        TString date=d;
+        if (date(r).IsNull())
+        {
+            cout << "ERROR - Date has wrong format (2003-05-06)" << endl;
+            return;
+        }
+    }
+
+    // Tell which dierctories and files to search
+    MDirIter Next;
+    Next.AddDirectory("/home/MAGIC/online_data/runbook", "CC_*.rbk");
+
+    // Loop over files
+    TString name;
+    while (1)
+    {
+        name=Next();
+        if (name.IsNull())
+            break;
+
+        ProcessFile(name, d);
+    }
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/sectorvstime.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/sectorvstime.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/sectorvstime.C	(revision 7159)
@@ -0,0 +1,100 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// sectorvstime.C
+// ==============
+//
+// In this example we plot the mean content of the right and left half of
+// camera. As an input we use a class derived from MCamEvent. Here this
+// are dc currents read directly from a camera control report file.
+//
+// The output are two histograms one for each half.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+void sectorvstime()
+{
+    // Initialize Mars environment
+    MParList  plist;
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    // Create Magic camera geometry
+    MGeomCamMagic cam;
+    plist.AddToList(&cam);
+
+    // Which DC file to read?
+    MReportFileRead read("/data/MAGIC/Period013/cacodata/2004_01_26/dc_2004_01_26_05_35_10_12117_OffMrk421-1.txt");
+    read.SetHasNoHeader();
+    read.AddToList("MReportCurrents");
+
+    // Initialize histogram
+    MHSectorVsTime hist1;
+    hist1.SetNameTime("MTimeCurrents");
+
+    // Define sectors you want to display the mean from
+    TArrayI s0(3);
+    s0[0] = 6;
+    s0[1] = 1;
+    s0[2] = 2;
+
+    // Define area index [0=inner, 1=outer]
+    TArrayI inner(1);
+    inner[0] = 0;
+
+    // Don't call this if you want to have all sectors
+    hist1.SetSectors(s0);
+
+    // Don't call this if you want to have all area indices
+    hist1.SetAreaIndex(inner);
+
+    // Task to fill the histogram
+    MFillH fill1(&hist1, "MCameraDC");
+
+    // Also fill a histogram with the mean of all pixels
+    MHCamEvent hist2;
+    MFillH fill2(&hist2, "MCameraDC");
+
+    // Setup Tasklist
+    tlist.AddToList(&read);
+    tlist.AddToList(&fill1);
+    tlist.AddToList(&fill2);
+
+    // Setup Eventloop
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    // Run Eventloop
+    if (!evtloop.Eventloop())
+        return;
+
+    // Print some statistics
+    tlist.PrintStatistics();
+
+    // Draw clones of the histograms
+    hist1.DrawClone();
+    hist2.DrawClone();
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/spline.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/spline.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/spline.C	(revision 7159)
@@ -0,0 +1,109 @@
+/* This macro is defined as a class for debugging (with CInt) reasons
+
+To use it at the root prompt type:
+
+root [0] .L spline.C
+root [1] TestSpline::sp()
+*/
+/* Example of a spline. You can use it as Test. If you think there are some
+   bugs in the MCubicSpline class please mail to: raducci@fisica.uniud.it */
+
+class TestSpline
+{
+public:
+    void sp();
+};
+
+void TestSpline::sp()
+{
+gROOT -> Reset();
+
+//Here are defined the points. X goes from 0 to 14 (as the fadc slices...)
+//Y are arbitrary values
+
+/* User Change */
+const Byte_t y[]={0x0F,0x10,0x2F,0x7F,0xAA,0x6C,0x14,0x13,0x15,0x18,0x21,0x12,0x11,0x14,0x13};
+/* End user Change */
+const Byte_t x[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E};
+
+/*This cast is needed only to show graphically the output. Don' t needed if you
+  use the spline to calc the arrival times       */
+
+Int_t *newX = new Int_t[15];
+Int_t *newY = new Int_t[15];
+
+for (Int_t i = 0; i < 15; i++)
+{
+    newX[i] = (Int_t) x[i];
+    newY[i] = (Int_t) y[i];
+}
+
+//Canvas to display output
+TCanvas *c = new TCanvas ("c1","c1",800,600);
+
+//Graph containting only the points (displayed as stars)
+TGraph *g1 = new TGraph(15,newX,newY);
+
+g1 -> Draw("A*");
+
+//Spline constructor(specialized for 15 slices using Bytes as values. There exist another constructor.
+MCubicSpline *s = new MCubicSpline(y);
+
+//*spline and *ab are two arrays containing some values evaluated from the spline
+Double_t *spline = new Double_t[139];
+Double_t *ab     = new Double_t[139];
+Double_t step = 0.0;
+
+for (Int_t i = 0; i < 139; i++)
+{
+    spline[i] = s->Eval(step);
+    ab[i] = step;
+    step += 0.1;
+}
+
+//Graph of the sline. The points calculated are joined with a red line. If the stars lie
+//on the red line, then the Spline class is working properly
+TGraph *g2 = new TGraph(139,ab,spline);
+
+g2 -> SetLineColor(2);
+g2 -> Draw("C");
+
+//Maximum and minimum evaluation
+Double_t *mm   = new Double_t[2];
+Double_t *abmm = new Double_t[2];
+
+mm[0] = s->EvalMin();
+mm[1] = s->EvalMax();
+abmm[0] = s->EvalAbMin();
+abmm[1] = s->EvalAbMax();
+
+//Display the max and the min using two black squares. If they lie on the max and min
+//of the red line, then the Spline class is working properly
+
+TGraph *g3 = new TGraph(2,abmm,mm);
+
+g3 -> SetMarkerStyle(21);
+g3 -> Draw("P");
+
+//Test of the Cardan formula. Find the point(abval) where the Spline value is val
+Double_t val = 82.5;
+Double_t abval = s->FindVal(val, abmm[1], 'l');
+
+//Display this point. Again, if it lies on the red line, then we are right.
+//It's a black triangle
+
+TGraph *g4 = new TGraph(1,&abval,&val);
+
+g4 -> SetMarkerStyle(22);
+g4 -> Draw("P");
+
+//Free memory
+s->~MCubicSpline();
+delete [] newX;
+delete [] newY;
+delete [] spline;
+delete [] ab;
+delete [] mm;
+delete [] abmm;
+
+} 
Index: trunk/MagicSoft/Mars/macros/tutorials/starplot.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/starplot.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/starplot.C	(revision 7159)
@@ -0,0 +1,115 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz et al, 08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+
+void starplot(const char *filename="Gamma_*.root")
+{
+    //
+    // This is a demonstration program which plots the Hillas
+    // parameter from a file created with star.C
+    //
+
+    //
+    // Create a empty Parameter List and an empty Task List
+    // The tasklist is identified in the eventloop by its name
+    //
+    MParList plist;
+
+
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    //
+    // Use this if you want to change the binning of one of
+    // the histograms. You can use:
+    // BinningConc, BinningConc1, BinningAsym, BinningM3Long,
+    // BinningM3Trans, BinningWidth, BinningLength, BinningDist,
+    // BinningHeadTail, BinningAlpha, BinningSize, BinningDelta,
+    // BinningPixels and BinningCamera
+    //
+    // For more information see MBinning and the corresponding
+    // histograms
+    //
+    // MBinning binsalpha("BinningAlpha");
+    // binsalpha.SetEdges(90, 0, 90);       // 90 bins from 0 to 90 deg
+    // plist.AddToList(&binsalpha);
+
+    // MBinning binssize("BinningSize");
+    // binssize.SetEdgesLog(50, 1, 1e7);
+    // plist.AddToList(&binssize);
+
+    //
+    // Now setup the tasks and tasklist:
+    // ---------------------------------
+    //
+    // The first argument is the tree you want to read.
+    //   Events:     Cosmic ray events
+    //   PedEvents:  Pedestal Events
+    //   CalEvents:  Calibration Events
+    //
+    MReadMarsFile read("Events", filename);
+    read.DisableAutoScheme();
+
+    MGeomApply geomapl;
+
+    MFillH hfill1("MHHillas", "MHillas");
+    MFillH hfill2("MHHillasExt");
+    MFillH hfill3("MHStarMap", "MHillas");
+    MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
+    MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
+
+    tlist.AddToList(&read);
+    tlist.AddToList(&geomapl);
+    tlist.AddToList(&hfill1);
+    tlist.AddToList(&hfill2);
+    tlist.AddToList(&hfill3);
+    tlist.AddToList(&hfill4);
+    tlist.AddToList(&hfill5);
+
+    //
+    // Create and setup the eventloop
+    //
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    //
+    // Execute your analysis
+    //
+    MProgressBar bar;
+    evtloop.SetProgressBar(&bar);
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+
+    //
+    // After the analysis is finished we can display the histograms
+    //
+    plist.FindObject("MHHillas")->DrawClone();
+    plist.FindObject("MHHillasExt")->DrawClone();
+    plist.FindObject("MHStarMap")->DrawClone();
+    plist.FindObject("HistSource")->DrawClone();
+    plist.FindObject("HistExtSource")->DrawClone();
+}
+
Index: trunk/MagicSoft/Mars/macros/tutorials/testenv.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/testenv.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/testenv.C	(revision 7159)
@@ -0,0 +1,120 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+///////////////////////////////////////////////////////////////////////////
+//
+// testenv.C
+// =========
+//
+// This example reads an config-file (steering card, input card, ...)
+// The contents of the file a forwarded to the apropriate eventloop
+// setup in your file.
+//
+// All tasks and containers in an eventloop should implement the
+// ReadEnv/WriteEnv function (for an example see the tasks used below).
+//
+// The functions gets the corresponding setup data from the file as an
+// argument and can change their behaviour and setup on this information.
+//
+///////////////////////////////////////////////////////////////////////////
+
+void testenv()
+{
+    // Setup for all MHMatrix objects is done by:
+    // MHMatrix.Column0: ...
+    //
+    // This can be overwritten for a MHMatrix called MatrixGammas by:
+    // MatrixGammas.Column0;
+    //
+    // This can be overwritten for all MHMatrix in one Job by:
+    // Job1.MHMatrix.Column0;
+    //
+    // This can be overwritten for a MHMatrix called MatrixGammas in one Job by:
+    // Job1.MatrixGammas.Column0;
+    //
+    TEnv env(".marsrc");
+
+    //
+    // For developers: Set this to kTRUE to see how the TEnv file
+    // entries are checked.
+    //
+    Bool_t print = kFALSE;
+
+    // ------------ Job 1 -------------------
+    if (env.GetValue("Job1", kFALSE))
+    {
+        cout << "++++++++++++++++++ Job 1 +++++++++++++++++++" << endl;
+        MParList plist1;
+        MTaskList tlist1;
+
+        plist1.AddToList(&tlist1);
+
+        MReadMarsFile read1("Events");
+
+        MHMatrix matrix1("MatrixGammas");
+
+        MFillH fillm1(&matrix1);
+        plist1.AddToList(&matrix1);
+
+        tlist1.AddToList(&read1);
+        tlist1.AddToList(&fillm1);
+
+        MEvtLoop evtloop1("Job1");
+        evtloop1.SetParList(&plist1);
+        cout << "--------------------------------------------" << endl;
+        evtloop1.ReadEnv(env, "", print);
+        cout << "--------------------------------------------" << endl;
+        evtloop1.Eventloop();
+        cout << endl;
+    }
+
+    // ------------ Job 2 -------------------
+
+    if (env.GetValue("Job2", kTRUE))
+    {
+        cout << "++++++++++++++++++ Job 2 +++++++++++++++++++" << endl;
+        MParList plist2;
+        MTaskList tlist2;
+
+        plist2.AddToList(&tlist2);
+
+        MReadMarsFile read2("Events");
+
+        MHMatrix matrix2("MatrixGammas");
+
+        MFillH fillm2(&matrix2);
+        plist2.AddToList(&matrix2);
+
+        tlist2.AddToList(&read2);
+        tlist2.AddToList(&fillm2);
+
+        MEvtLoop evtloop2("Job2");
+        evtloop2.SetParList(&plist2);
+        cout << "--------------------------------------------" << endl;
+        evtloop2.ReadEnv(env, "", print);
+        cout << "--------------------------------------------" << endl;
+        evtloop2.Eventloop();
+        cout << endl;
+    }
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/weights.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/weights.C	(revision 7159)
+++ trunk/MagicSoft/Mars/macros/tutorials/weights.C	(revision 7159)
@@ -0,0 +1,138 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Marcos Lopez, 10/2003 <mailto:marcos@gae.ucm.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// weights.C
+// =========
+//
+// This macro shows how to use the class MMcWeightEnergySpecCalc
+// to convert the energy spectrum of the MC showers generated with Corsika,
+// to a different one.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+Double_t myfunction(Double_t *x, Double_t *par)
+{
+  Double_t xx = x[0];
+
+  return pow(xx,-2)*exp(-xx/20);  
+}
+
+void weights(TString filename="/up1/data/Magic-MC/CameraAll/Gammas/zbin0/Gamma_zbin0_0_7_1000to1009_w0-4:4:2.root")
+{
+
+    //
+    // PartList
+    //
+    MParList  parlist;
+    MTaskList tasklist;
+    
+    MHMcEnergyImpact h1("h1");
+    MHMcEnergyImpact h2("h2");
+    parlist.AddToList(&h1);
+    parlist.AddToList(&h2);
+
+    MBinning binsenergy("BinningEnergy");
+    binsenergy.SetEdgesLog(100, 1, 1e5);
+    parlist.AddToList(&binsenergy);
+
+    MBinning binsimpact("BinningImpact");
+    binsimpact.SetEdges(100, 0, 450);
+    parlist.AddToList(&binsimpact);
+
+    parlist.AddToList(&tasklist);
+
+
+    //
+    // TaskList
+    //
+    MReadMarsFile reader("Events", filename);
+    reader.EnableBranch("fEnergy");
+    reader.EnableBranch("fImpact");
+
+
+    // -------------------------------------------------------------
+    //
+    // Option 1. Just change the slope of the MC power law spectrum
+    //
+    //MMcWeightEnergySpecCalc wcalc(-2.0);                //<-- Uncomment me
+
+    //
+    // Option 2. A completely differente specturm pass as a TF1 function
+    //           e.g. spectrum with exponential cutoff
+    //
+    //TF1 spec("spectrum","pow(x,[0])*exp(-x/[1])");      //<-- Uncomment me
+    //spec->SetParameter(0,-2.0);                         //<-- Uncomment me
+    //spec->SetParameter(1,50);                           //<-- Uncomment me
+    //MMcWeightEnergySpecCalc wcalc(spec);                //<-- Uncomment me
+ 
+    //
+    // Option 3. A completely differente specturm pass as a cahr*
+    //           
+    //char* func = "pow(x,-2)";                           //<-- Uncomment me
+    //MMcWeightEnergySpecCalc wcalc(func);                //<-- Uncomment me
+
+    //
+    // Option 4. A completely differente specturm pass as a c++ function
+    //     
+    MMcWeightEnergySpecCalc wcalc((void*)myfunction);   //<-- Uncomment me
+    //
+    //-------------------------------------------------------------
+
+    MFillH hfill(&h1,"MMcEvt");
+    MFillH hfill2(&h2,"MMcEvt");
+    hfill2.SetWeight("MWeight");
+
+    tasklist.AddToList(&reader);
+    tasklist.AddToList(&wcalc);
+    tasklist.AddToList(&hfill);
+    tasklist.AddToList(&hfill2);
+
+    //
+    // EventLoop
+    //
+    MEvtLoop magic;
+    magic.SetParList(&parlist);
+
+    if (!magic.Eventloop())
+        return;
+
+    tasklist.PrintStatistics();
+    parlist.Print();
+
+    //
+    // Draw the Results
+    //
+    TCanvas *c = new TCanvas();
+    c->SetLogy();
+    c->SetLogx();
+
+    TH1D* hist1 = (h1->GetHist())->ProjectionX();
+    TH1D* hist2 = (h2->GetHist())->ProjectionX();
+    hist2->SetLineColor(2);
+
+    hist1->DrawClone();
+    hist2->DrawClone("same");    
+}
Index: trunk/MagicSoft/Mars/macros/weights.C
===================================================================
--- trunk/MagicSoft/Mars/macros/weights.C	(revision 7158)
+++ 	(revision )
@@ -1,138 +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): Marcos Lopez, 10/2003 <mailto:marcos@gae.ucm.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// weights.C
-// =========
-//
-// This macro shows how to use the class MMcWeightEnergySpecCalc
-// to convert the energy spectrum of the MC showers generated with Corsika,
-// to a different one.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-Double_t myfunction(Double_t *x, Double_t *par)
-{
-  Double_t xx = x[0];
-
-  return pow(xx,-2)*exp(-xx/20);  
-}
-
-void weights(TString filename="/up1/data/Magic-MC/CameraAll/Gammas/zbin0/Gamma_zbin0_0_7_1000to1009_w0-4:4:2.root")
-{
-
-    //
-    // PartList
-    //
-    MParList  parlist;
-    MTaskList tasklist;
-    
-    MHMcEnergyImpact h1("h1");
-    MHMcEnergyImpact h2("h2");
-    parlist.AddToList(&h1);
-    parlist.AddToList(&h2);
-
-    MBinning binsenergy("BinningEnergy");
-    binsenergy.SetEdgesLog(100, 1, 1e5);
-    parlist.AddToList(&binsenergy);
-
-    MBinning binsimpact("BinningImpact");
-    binsimpact.SetEdges(100, 0, 450);
-    parlist.AddToList(&binsimpact);
-
-    parlist.AddToList(&tasklist);
-
-
-    //
-    // TaskList
-    //
-    MReadMarsFile reader("Events", filename);
-    reader.EnableBranch("fEnergy");
-    reader.EnableBranch("fImpact");
-
-
-    // -------------------------------------------------------------
-    //
-    // Option 1. Just change the slope of the MC power law spectrum
-    //
-    //MMcWeightEnergySpecCalc wcalc(-2.0);                //<-- Uncomment me
-
-    //
-    // Option 2. A completely differente specturm pass as a TF1 function
-    //           e.g. spectrum with exponential cutoff
-    //
-    //TF1 spec("spectrum","pow(x,[0])*exp(-x/[1])");      //<-- Uncomment me
-    //spec->SetParameter(0,-2.0);                         //<-- Uncomment me
-    //spec->SetParameter(1,50);                           //<-- Uncomment me
-    //MMcWeightEnergySpecCalc wcalc(spec);                //<-- Uncomment me
- 
-    //
-    // Option 3. A completely differente specturm pass as a cahr*
-    //           
-    //char* func = "pow(x,-2)";                           //<-- Uncomment me
-    //MMcWeightEnergySpecCalc wcalc(func);                //<-- Uncomment me
-
-    //
-    // Option 4. A completely differente specturm pass as a c++ function
-    //     
-    MMcWeightEnergySpecCalc wcalc((void*)myfunction);   //<-- Uncomment me
-    //
-    //-------------------------------------------------------------
-
-    MFillH hfill(&h1,"MMcEvt");
-    MFillH hfill2(&h2,"MMcEvt");
-    hfill2.SetWeight("MWeight");
-
-    tasklist.AddToList(&reader);
-    tasklist.AddToList(&wcalc);
-    tasklist.AddToList(&hfill);
-    tasklist.AddToList(&hfill2);
-
-    //
-    // EventLoop
-    //
-    MEvtLoop magic;
-    magic.SetParList(&parlist);
-
-    if (!magic.Eventloop())
-        return;
-
-    tasklist.PrintStatistics();
-    parlist.Print();
-
-    //
-    // Draw the Results
-    //
-    TCanvas *c = new TCanvas();
-    c->SetLogy();
-    c->SetLogx();
-
-    TH1D* hist1 = (h1->GetHist())->ProjectionX();
-    TH1D* hist2 = (h2->GetHist())->ProjectionX();
-    hist2->SetLineColor(2);
-
-    hist1->DrawClone();
-    hist2->DrawClone("same");    
-}
