Index: /trunk/FACT++/spectrum/display.C
===================================================================
--- /trunk/FACT++/spectrum/display.C	(revision 19899)
+++ /trunk/FACT++/spectrum/display.C	(revision 19900)
@@ -199,5 +199,5 @@
     c->cd(4);
     gPad->SetLogy();
-    file.GetObject("Data/Energy/Excess", h1);
+    file.GetObject("Data/Energy/Differential/Excess", h1);
     h1->SetTitle("Measured Signal (blue) / Simulated Excess (black)");
     h1->SetLineColor(kBlue);
@@ -214,9 +214,9 @@
     c = new TCanvas("Integral Spectrum", "Integral Spectrum");
     c->SetLogy();
-    file.GetObject("Data/Energy/IntegratedSpectrum", h1);
+    file.GetObject("Data/Energy/Differential/IntegratedSpectrum", h1);
     h1->SetLineColor(kGray);
     h1->SetMarkerColor(kGray);
     h1->DrawCopy("P");
-    file.GetObject("Data/Energy/IntegralSpectrum", h1);
+    file.GetObject("Data/Energy/Integral/Spectrum", h1);
     h1->DrawCopy("P same");
 
@@ -230,5 +230,5 @@
     cout << endl;
 
-    file.GetObject("Data/Energy/RolkeIntegralUL", h1);
+    file.GetObject("Data/Energy/Integral/RolkeUL", h1);
     h1->SetMarkerStyle(23);
     h1->DrawCopy("P same");
@@ -242,5 +242,5 @@
     c = new TCanvas("Differential Spectrum", "Differential Spectrum");
     c->SetLogy();
-    file.GetObject("Data/Energy/Spectrum", h1);
+    file.GetObject("Data/Energy/Differential/Spectrum", h1);
     h1->DrawCopy("P");
 
@@ -254,5 +254,5 @@
     cout << endl;
 
-    file.GetObject("Data/Energy/RolkeUL", h1);
+    file.GetObject("Data/Energy/Differential/RolkeUL", h1);
     h1->SetMarkerStyle(23);
     h1->DrawCopy("P same");
Index: /trunk/FACT++/spectrum/spectrum.sql
===================================================================
--- /trunk/FACT++/spectrum/spectrum.sql	(revision 19899)
+++ /trunk/FACT++/spectrum/spectrum.sql	(revision 19900)
@@ -17,8 +17,8 @@
    SELECT
       *,
-      SUM(`Signal`)     OVER Integral     AS  IntegralSignal,
-      SUM(`Background`) OVER Integral /5  AS  IntegralBackground,
-      SUM(SumEnergyEst) OVER Integral     AS  IntegralEnergyEst,
-      SUM(SumW)         OVER Integral     AS  IntegralSumW
+      SUM(`Signal`)     OVER Integral     AS  SignalI,
+      SUM(`Background`) OVER Integral /5  AS  BackgroundI,
+      SUM(SumEnergyEst) OVER Integral     AS  EnergyEstI,
+      SUM(SumW)         OVER Integral     AS  SumWI
    FROM
       BinnedData
@@ -39,32 +39,32 @@
       `Background`,
 
-      IntegralSignal,
-      IntegralBackground,
+      SignalI,
+      BackgroundI,
 
-      `Signal` - `Background`                     AS  Excess,
-      SQRT(`Signal`)                              AS  ErrSignal,
-      SQRT(`Background`)                          AS  ErrBackground,
-      ExcErr(`Signal`, `Background`)              AS  ErrExcess,
-      LiMa(  `Signal`, `Background`)              AS  Significance,
+      `Signal` - `Background`         AS  Excess,
+      SQRT(`Signal`)                  AS  ErrSignal,
+      SQRT(`Background`)              AS  ErrBackground,
+      ExcErr(`Signal`, `Background`)  AS  ErrExcess,
+      LiMa(  `Signal`, `Background`)  AS  Significance,
 
-      IntegralSignal - IntegralBackground         AS  IntegralExcess,
-      SQRT(IntegralSignal)                        AS  ErrIntegralSignal,
-      SQRT(IntegralBackground)                    AS  ErrIntegralBackground,
-      ExcErr(IntegralSignal, IntegralBackground)  AS  ErrIntegralExcess,
-      LiMa(  IntegralSignal, IntegralBackground)  AS  IntegralSignificance,
+      SignalI - BackgroundI           AS  ExcessI,
+      SQRT(SignalI)                   AS  ErrSignalI,
+      SQRT(BackgroundI)               AS  ErrBackgroundI,
+      ExcErr(SignalI, BackgroundI)    AS  ErrExcessI,
+      LiMa(  SignalI, BackgroundI)    AS  SignificanceI,
 
-      SumEnergyEst/SumW  AS  AvgEnergyEst,
-      IntegralEnergyEst/IntegralSumW  AS  IntegralAvgEnergyEst,
+      SumEnergyEst/SumW               AS  AvgEnergyEst,
+      EnergyEstI/SumWI                AS  AvgEnergyEstI,
 
-      %102:id.ExcessFluxW  AS  SimExcess,
-      %102:id.ErrExcessFluxW  AS  ErrSimExcess,
-      %102:id.IntegralExcessFluxW  AS  IntegralSimExcess,
-      %102:id.ErrIntegralExcessFluxW  AS  ErrIntegralSimExcess,
+      %102:id.ExcessFluxW              AS  SimExcess,
+      %102:id.ErrExcessFluxW           AS  ErrSimExcess,
+      %102:id.IntegralExcessFluxW      AS  SimExcessI,
+      %102:id.ErrIntegralExcessFluxW   AS  ErrSimExcessI,
 
       -- For flux-vs-theta: Correction for already applied ZdWeights
       Sim.SimFluxW/%103:weight  AS  SimFluxW,
       Sim.ErrSimFluxW/%104:errweight  AS  ErrSimFluxW,
-      Sim.IntegralSimFluxW/%103:weight  AS  IntegralSimFluxW,
-      Sim.ErrIntegralSimFluxW/%104:errweight  AS  ErrIntegralSimFluxW
+      Sim.IntegralSimFluxW/%103:weight  AS  SimFluxI,
+      Sim.ErrIntegralSimFluxW/%104:errweight  AS  ErrSimFluxI
    FROM
       Data
@@ -101,21 +101,21 @@
    -- Integral Spectrum
 
-   IntegralSimExcess/IntegralSimFluxW  AS  IntegralEfficiency,
+   SimExcessI/SimFluxI  AS  EfficiencyI,
 
-   IntegralExcess/IntegralSimExcess/AreaTime  AS  IntegralExcessRatio,
-   IntegralExcess/IntegralSimExcess/AreaTime
+   ExcessI/SimExcessI/AreaTime  AS  ExcessRatioI,
+   ExcessI/SimExcessI/AreaTime
       * SQRT(
-          + POW(ErrIntegralExcess    / IntegralExcess,    2)
-          + POW(ErrIntegralSimExcess / IntegralSimExcess, 2)
-        )  AS  ErrIntegralExcessRatio,
+          + POW(ErrExcessI    / ExcessI,    2)
+          + POW(ErrSimExcessI / SimExcessI, 2)
+        )  AS  ErrExcessRatioI,
 
 
-   IntegralExcess/IntegralSimExcess*IntegralSimFluxW/AreaTime  AS  IntegralFlux,
-   IntegralExcess/IntegralSimExcess*IntegralSimFluxW/AreaTime
+   ExcessI/SimExcessI*SimFluxI/AreaTime  AS  FluxI,
+   ExcessI/SimExcessI*SimFluxI/AreaTime
       * SQRT(
-          + POW(ErrIntegralExcess    / IntegralExcess,    2)
-          + POW(ErrIntegralSimExcess / IntegralSimExcess, 2)
-          + POW(ErrIntegralSimFluxW  / IntegralSimFluxW,  2)
-        )  AS  ErrIntegralFlux
+          + POW(ErrExcessI    / ExcessI,    2)
+          + POW(ErrSimExcessI / SimExcessI, 2)
+          + POW(ErrSimFluxI   / SimFluxI,   2)
+        )  AS  ErrFluxI
 
 FROM
Index: /trunk/FACT++/src/spectrum.cc
===================================================================
--- /trunk/FACT++/src/spectrum.cc	(revision 19899)
+++ /trunk/FACT++/src/spectrum.cc	(revision 19900)
@@ -1895,7 +1895,5 @@
                 const mysqlpp::Row &row = *ir;
 
-                const size_t bin      = row[*ib=="Theta" ? ".theta" : ".sparse_est"];
-                const double flux     = row["Flux"];
-                const double error    = row["ErrFlux"];
+                const size_t bin = row[*ib=="Theta" ? ".theta" : ".sparse_est"];
 
 #ifdef HAVE_ROOT
@@ -1903,9 +1901,9 @@
                 const double dat_bg   = row["Background"];
 
-                const double dat_isig = row["IntegralSignal"];
-                const double dat_ibg  = row["IntegralBackground"];
+                const double dat_isig = row["SignalI"];
+                const double dat_ibg  = row["BackgroundI"];
 
                 const double eff      = row["Efficiency"];
-                const double ieff     = row["IntegralEfficiency"];
+                const double ieff     = row["EfficiencyI"];
 
                 const double areatime = row["AreaTime"];
@@ -1926,8 +1924,8 @@
                 if (verbose>0)
                 {
-                    cout << setw(5)  << row["center"] << ": ";
-                    cout << setw(10) << row["Excess"] << " ";
-                    cout << setw(10) << flux << " ";
-                    cout << setw(10) << error << " ";
+                    cout << setw(5)  << row["center"]  << ": ";
+                    cout << setw(10) << row["Excess"]  << " ";
+                    cout << setw(10) << row["Flux"]    << " ";
+                    cout << setw(10) << row["ErrFlux"] << " ";
                     cout << setw(10) << row["Significance"] << '\n';
                 }
@@ -1935,5 +1933,4 @@
 
             Histogram hist;
-            hist.dir      = "Data/"+*ib;
             hist.table    = table;
             hist.binningx = *ib=="Theta" ? binning_theta : binning_sparse;
@@ -1942,7 +1939,9 @@
             hist.stats    = false;
 
-            const vector<string> types = *ib=="Theta" ? vector<string>{ "" } : vector<string>{ "", "Integral" };
+            const vector<string> types = *ib=="Theta" ? vector<string>{ "" } : vector<string>{ "", "I" };
             for (auto it=types.cbegin(); it!=types.cend(); it++)
             {
+                hist.dir = *ib=="Theta" ? "Data/Theta" : (it->empty() ? "Data/Energy/Differential" : "Data/Energy/Integral");
+
                 hist.axisy = "Counts";
                 if (*ib=="Energy")
@@ -1950,20 +1949,20 @@
 
                 hist.title = "";
-                hist.v     = *it+"Signal";
-                hist.err   = "Err"+*it+"Signal";
+                hist.v     = "Signal"+*it;
+                hist.err   = "ErrSignal"+*it;
                 WriteHistogram(connection, hist);
 
                 hist.title = "";
-                hist.v     = *it+"Background";
-                hist.err   = "Err"+*it+"Background";
+                hist.v     = "Background"+*it;
+                hist.err   = "ErrBackground"+*it;
                 WriteHistogram(connection, hist);
 
                 hist.title = "";
-                hist.v     = *it+"Excess";
-                hist.err   = "Err"+*it+"Excess";
+                hist.v     = "Excess"+*it;
+                hist.err   = "ErrExcess"+*it;
                 WriteHistogram(connection, hist);
 
                 hist.title = "";
-                hist.v     = *it+"Significance";
+                hist.v     = "Significance"+*it;
                 hist.err   = "";
                 hist.axisy = "#sigma";
@@ -1973,5 +1972,5 @@
 
                 hist.title = "";
-                hist.v     = *it+"AvgEnergyEst";
+                hist.v     = "AvgEnergyEst"+*it;
                 hist.err   = "";
                 hist.axisy = "<E_{est}>/GeV";
@@ -1981,6 +1980,6 @@
 
                 hist.title = "";
-                hist.v     = *it+"ExcessRatio";
-                hist.err   = "Err"+*it+"ExcessRatio";
+                hist.v     = "ExcessRatio"+*it;
+                hist.err   = "ErrExcessRatio"+*it;
                 hist.axisy = "Ratio";
                 if (*ib=="Energy")
@@ -1989,4 +1988,5 @@
             }
 
+            hist.dir = *ib=="Theta" ? "Data/Theta" : "Data/Energy/Differential";
             hist.axisy = "dN/dE ";
             if (*ib=="Energy")
@@ -2003,9 +2003,11 @@
                 hist.axisy = "dN/dE (E>E_{lo}) [cm^{-2} s^{-1}]";
 
-                hist.name  = "IntegralSpectrum";
-                hist.v     = "IntegralFlux";
-                hist.err   = "ErrIntegralFlux";
+                hist.dir   = "Data/Energy/Integral";
+                hist.name  = "Spectrum";
+                hist.v     = "FluxI";
+                hist.err   = "ErrFluxI";
                 WriteHistogram(connection, hist);
 
+                hist.dir   = "Data/Energy/Differential";
                 hist.name  = "IntegratedSpectrum";
                 hist.v     = "IntegratedFlux";
@@ -2015,4 +2017,5 @@
 
 #ifdef HAVE_ROOT
+            hist.dir   = *ib=="Theta" ? "Data/Theta" : "Data/Energy/Differential";
             hist.axisy = *ib=="Theta" ? "UL [cm^{-2} s^{-1}]" : "UL [cm^{-2} s^{-1} TeV^{-1}]";
 
@@ -2031,5 +2034,6 @@
             if (*ib=="Energy")
             {
-                hist.name = "IntegralRolkeUL";
+                hist.dir  = "Data/Energy/Integral";
+                hist.name = "RolkeUL";
                 WriteHistogram(connection, hist, rolke_int);
             }
