Index: trunk/MagicSoft/Mars/macros/flux.C
===================================================================
--- trunk/MagicSoft/Mars/macros/flux.C	(revision 1211)
+++ trunk/MagicSoft/Mars/macros/flux.C	(revision 1215)
@@ -54,5 +54,5 @@
 
     MBinning binstheta("BinningTheta");
-    binstheta.SetEdges(5, 2.5, 27.5);
+    binstheta.SetEdges(7, -2.5, 32.5);
 
     MBinning binstime("BinningTime");
@@ -72,4 +72,5 @@
     //
     MReadMarsFile reader("Events", "~/data/Gamma*.root");
+    reader.EnableBranch("MMcEvt.fTheta");
 
     MGeomCamMagic geomcam;
@@ -168,106 +169,117 @@
     tasklist.PrintStatistics();
 
-    return;
-
-    parlist.FindObject("MHMcCollectionArea")->DrawClone();
-    parlist.FindObject("MHStarMap")->DrawClone();
-
-    // ------------ Eff On Time -----------------
-
-    MHEnergyTime  &alltime  = *(MHEnergyTime*)parlist.FindObject("AllTime");
-    MHEnergyTheta &alltheta = *(MHEnergyTheta*)parlist.FindObject("AllTheta");
-    MHEnergyTime  &seltime  = *(MHEnergyTime*)parlist.FindObject("SelTime");
-    MHEnergyTheta &seltheta = *(MHEnergyTheta*)parlist.FindObject("SelTheta");
-
-    MHEnergyTime collareatime;
-    MHEnergyTheta collareatheta;
-    collareatime.Divide(&seltime, &alltime);
-    collareatheta.Divide(&seltheta, &alltheta);
-
-    MHTimeDiffTime  &effontime  =  *(MHTimeDiffTime*)parlist.FindObject("EffOnTime");
+    /*
+     parlist.FindObject("HSource")->DrawClone();;
+     parlist.FindObject("MHHillas")->DrawClone();
+     parlist.FindObject("MHStarMap")->DrawClone();
+     parlist.FindObject("HAntiSource")->DrawClone();
+     parlist.FindObject("MHMcCollectionArea")->DrawClone();
+     */
+
+    /*
+     MHEnergyTime  &alltime  = *(MHEnergyTime*)parlist.FindObject("AllTime");
+     MHEnergyTheta &alltheta = *(MHEnergyTheta*)parlist.FindObject("AllTheta");
+     MHEnergyTime  &seltime  = *(MHEnergyTime*)parlist.FindObject("SelTime");
+     MHEnergyTheta &seltheta = *(MHEnergyTheta*)parlist.FindObject("SelTheta");
+
+     MHEnergyTime collareatime;
+     MHEnergyTheta collareatheta;
+     collareatime.Divide(&seltime, &alltime);
+     collareatheta.Divide(&seltheta, &alltheta);
+     */
+
+    MHTimeDiffTime  &effontime  = *(MHTimeDiffTime*)parlist.FindObject("EffOnTime");
     MHTimeDiffTheta &effontheta = *(MHTimeDiffTheta*)parlist.FindObject("EffOnTheta");
 
-    effontime.DrawClone();
-    effontheta.DrawClone();
-
-    MHEffOnTimeTime  ontime;
-    MHEffOnTimeTheta ontheta;
-    ontime.SetupFill(&parlist);
-    ontheta.SetupFill(&parlist);
-
-    ontime.Calc(effontime.GetHist());
-    ontheta.Calc(effontheta.GetHist());
-
-    ontime.DrawClone();
-    ontheta.DrawClone();
-
-    parlist.FindObject("HSource")->DrawClone();;
-    parlist.FindObject("HAntiSource")->DrawClone();
-    parlist.FindObject("MHHillas")->DrawClone();
-
-    MHAlphaEnergyTime  &fluxsp       = *(MHAlphaEnergyTime)parlist.FindObject("HillasSrc");
-    MHAlphaEnergyTime  &fluxasp      = *(MHAlphaEnergyTime)parlist.FindObject("HillasAntiSrc");
-    MHAlphaEnergyTheta &fluxsptheta  = *(MHAlphaEnergyTime)parlist.FindObject("HillasSrc");
-    MHAlphaEnergyTheta &fluxasptheta = *(MHAlphaEnergyTime)parlist.FindObject("HillasAntiSrc");
-
-    fluxsp.DrawClone();
-    fluxasp.DrawClone();
-    fluxsptheta.DrawClone();
-    fluxasptheta.DrawClone();
-
-    MHAlphaEnergyTheta resulttime;
-    MHAlphaEnergyTheta resulttheta;
-    resulttime.Substract(&fluxsp, &fluxasp);
-    resulttheta.Substract(&fluxsptheta, &fluxasptheta);
-
-    resulttime.DrawClone();
-    resulttheta.DrawClone();
-
-    TH2D &projecttime  = *resulttime.GetAlphaProjection(-10, 10);
-    TH2D &projecttheta = *resulttheta.GetAlphaProjection(-10, 10);
-
-    projecttime.SetTitle("Number of Gammas vs. EnergyEst and Time (Alpha integrated between -10, 10deg)");
-    projecttheta.SetTitle("Number of Gammas vs. EnergyEst and Theta (Alpha integrated between -10, 10deg)");
-
-    c = new TCanvas("To be unfolded");
-    c->Divide(2,2);
-    c->cd(1);
-    projecttime.DrawCopy();
-    c->cd(2);
-    projecttheta.DrawCopy();
-
-    for (int i=1; i<=binstime.GetNumBins(); i++)
-    {
-        if (ontime.GetHist()->GetBinContent(i)==0)
-            continue;
-
-	TH1D &hist = *projecttime.ProjectionX("Number of Gammas vs. EnergyEst for a fixed time", i, i);
-
-        /* UNFOLDING */
-
-	//hist->Divide(collareatime);
-        hist.Scale(1./ontime.GetHist()->GetBinContent(i));
-
-        for (int j=1; j<=binse.GetNumBins(); j++)
-	  hist.SetBinContent(j, hist.GetBinContent(j)/hist.GetBinWidth(j));
-
-        hist.SetName("Flux");
-        hist.SetTitle("Flux[Gammas/s/m^2/GeV] vs. EnergyTrue for a fixed Time");
-
-        char n[100];
-        sprintf(n, "Canv%d", j);
-        c= new TCanvas(n, "Title");
-        hist.DrawCopy();
-    }
-
-    delete &projecttime;
-    delete &projecttheta;
-
-    return;
-
-    // ------------------------------------------
-
-    MHMcCollectionArea carea;
-    TH1D *collareatime  = carea.GetHist();  // FIXME!
-    TH1D *collareatheta = carea.GetHist();  // FIXME!
+     /*
+      effontime.DrawClone();
+      effontheta.DrawClone();
+     */
+
+     MHEffOnTimeTime  ontime;
+     MHEffOnTimeTheta ontheta;
+     ontime.SetupFill(&parlist);
+     ontheta.SetupFill(&parlist);
+
+     ontime.Calc(effontime.GetHist());
+     ontheta.Calc(effontheta.GetHist());
+
+     /*
+      ontime.DrawClone();
+      ontheta.DrawClone();
+      */
+
+     MHAlphaEnergyTime  &fluxsp       = *(MHAlphaEnergyTime*)parlist.FindObject("FluxSrcTime");
+     MHAlphaEnergyTime  &fluxasp      = *(MHAlphaEnergyTime*)parlist.FindObject("FluxASrcTime");
+     MHAlphaEnergyTheta &fluxsptheta  = *(MHAlphaEnergyTheta*)parlist.FindObject("FluxSrcTheta");
+     MHAlphaEnergyTheta &fluxasptheta = *(MHAlphaEnergyTheta*)parlist.FindObject("FluxASrcTheta");
+
+     /*
+      fluxsp.DrawClone();
+      fluxasp.DrawClone();
+      fluxsptheta.DrawClone();
+      fluxasptheta.DrawClone();
+      */
+
+     MHAlphaEnergyTime  resulttime;
+     MHAlphaEnergyTheta resulttheta;
+     resulttime.Substract(&fluxsp, &fluxasp);
+     resulttheta.Substract(&fluxsptheta, &fluxasptheta);
+
+     /*
+      resulttime.DrawClone();
+      resulttheta.DrawClone();
+      */
+
+     TH2D &projecttime  = *resulttime.GetAlphaProjection(-10, 10);
+     TH2D &projecttheta = *resulttheta.GetAlphaProjection(-10, 10);
+
+     projecttime.SetTitle("Number of Gammas vs. EnergyEst and Time (Alpha integrated between -10, 10deg)");
+     projecttheta.SetTitle("Number of Gammas vs. EnergyEst and Theta (Alpha integrated between -10, 10deg)");
+
+     /*
+      TCanvas *c = new TCanvas("Unfold", "To be unfolded", 350, 500);
+      c->Divide(1, 2);
+      c->cd(1);
+      projecttime.DrawCopy();
+      c->cd(2);
+      projecttheta.DrawCopy();
+      */
+
+     return;
+
+     for (int i=1; i<=binstime.GetNumBins(); i++)
+     {
+         if (ontime.GetHist()->GetBinContent(i)==0)
+             continue;
+
+         TH1D &hist = *projecttime.ProjectionX("Number of Gammas vs. EnergyEst for a fixed time", i, i);
+
+         /* UNFOLDING */
+
+         //hist->Divide(collareatime);
+         hist.Scale(1./ontime.GetHist()->GetBinContent(i));
+
+         for (int j=1; j<=binse.GetNumBins(); j++)
+             hist.SetBinContent(j, hist.GetBinContent(j)/hist.GetBinWidth(j));
+
+         hist.SetName("Flux");
+         hist.SetTitle("Flux[Gammas/s/m^2/GeV] vs. EnergyTrue for a fixed Time");
+
+         char n[100];
+         sprintf(n, "Canv%d", j);
+         c= new TCanvas(n, "Title");
+         hist.DrawCopy();
+     }
+
+     delete &projecttime;
+     delete &projecttheta;
+
+     return;
+
+     // ------------------------------------------
+
+     MHMcCollectionArea carea;
+     TH1D *collareatime  = carea.GetHist();  // FIXME!
+     TH1D *collareatheta = carea.GetHist();  // FIXME!
 }
