Index: /trunk/WuerzburgSoft/Thomas/mphys/MParticle.h
===================================================================
--- /trunk/WuerzburgSoft/Thomas/mphys/MParticle.h	(revision 1361)
+++ /trunk/WuerzburgSoft/Thomas/mphys/MParticle.h	(revision 1362)
@@ -15,5 +15,5 @@
 {
 public:
-    typedef enum { kEGamma, kEElectron, kEPositron } ParticleType_t;
+    typedef enum { kEGamma, kEElectron, kEPositron, kENone } ParticleType_t;
     enum { kEIsPrimary = BIT(14) };
 
@@ -32,5 +32,5 @@
 
 public:
-    MParticle(ParticleType_t t, const char *name=NULL, const char *title=NULL);
+    MParticle(ParticleType_t t=kENone, const char *name=NULL, const char *title=NULL);
 
     static Double_t ZofR(Double_t *x, Double_t *k=NULL);
@@ -51,5 +51,5 @@
     // ----------------------------------------------------------------
 
-    virtual Double_t GetInteractionLength() const = 0;
+    virtual Double_t GetInteractionLength() const { AbstractMethod("GetInteractionLength"); return 0; }
 
     void SetEnergy(Double_t e) { fEnergy = e; }
Index: /trunk/WuerzburgSoft/Thomas/mphys/anale.C
===================================================================
--- /trunk/WuerzburgSoft/Thomas/mphys/anale.C	(revision 1362)
+++ /trunk/WuerzburgSoft/Thomas/mphys/anale.C	(revision 1362)
@@ -0,0 +1,133 @@
+//Double_t kRad2Deg = 180./TMath::Pi();
+
+void anale()
+{
+    TChain chain("Electrons");
+    chain.Add("cascade01.root");
+    chain.Add("cascade02.root");
+
+    MElectron *e = new MElectron;
+    chain.SetBranchAddress("MElectron.", &e);
+
+    Int_t n = chain.GetEntries();
+
+    cout << "Found " << n << " entries." << endl;
+
+    MBinning binsx;
+    MBinning binsy;
+    MBinning binsr;
+    binsx.SetEdgesLog(80, 1e1, 1e9);
+    binsy.SetEdgesLog(80, 1e1, 1e9);
+    binsr.SetEdgesLog(84, 1e-5, 1.8);
+
+    TH2D h;
+    h.SetName("Photons");
+    h.SetTitle(" Photons from inv.Compton ");
+    h.SetXTitle("E_{e} [GeV]");
+    h.SetYTitle("E\\gamma [GeV]");
+    h.SetZTitle("Counts");
+    MH::SetBinning(&h, &binsx, &binsy);
+
+    TH2D r;
+    r.SetName("ratio");
+    r.SetTitle("Ratio E\\gamma / E_{e}");
+    r.SetXTitle("E_{e} [GeV]");
+    r.SetYTitle("Ratio");
+    r.SetZTitle("Counts");
+    MH::SetBinning(&r, &binsx, &binsr);
+
+    Double_t E = -1;
+    for (int i=0; i<n; i++)
+    {
+        chain.GetEntry(i);
+
+        if (e->IsPrimary())
+        {
+            E = e->GetEnergy();
+            continue;
+        }
+
+        Double_t dE = E - e->GetEnergy();
+
+        h.Fill(E, dE);
+        r.Fill(E, dE/E);
+
+        E = e->GetEnergy();
+    }
+
+    delete e;
+
+    gStyle->SetOptStat(10);
+
+    TLine line;
+    line.SetLineColor(kBlack);
+    line.SetLineWidth(1);
+
+    TCanvas *c = new TCanvas("c1", "name");
+    c->Divide(2,2);
+
+    c->cd(1);
+    gPad->SetLogx();
+    gPad->SetLogy();
+    h.GetXaxis()->SetRangeUser(1e4, 1e9);
+    h.GetXaxis()->SetLabelOffset(-0.015);
+    h.GetXaxis()->SetTitleOffset(1.1);
+    h.GetXaxis()->SetRangeUser(1e4, 1e9);
+    h.GetYaxis()->SetTitleOffset(1.1);
+    h.DrawCopy();
+    TH1 *p=h.ProfileX();
+    p->SetBit(kCanDelete);
+    p->SetTitle("Profile e^{-} / \\gamma ");
+    p->SetLineColor(kRed);
+    p->GetXaxis()->SetLabelOffset(-0.015);
+    p->GetXaxis()->SetTitleOffset(1.1);
+    p->SetXTitle("E_{e} [GeV]");
+    p->SetYTitle("E\\gamma [GeV]");
+    p->SetMinimum(1e3);
+    p->SetMaximum(1e9);
+    p->GetXaxis()->SetRangeUser(1e3, 1e9);
+    p->Draw("same");
+    line.DrawLine(4.2, 4.2, 8.8, 8.8);
+
+    c->cd(2);
+    gPad->SetLogx();
+    gPad->SetLogy();
+    r.GetXaxis()->SetLabelOffset(-0.015);
+    r.GetXaxis()->SetTitleOffset(1.1);
+    r.GetXaxis()->SetRangeUser(1e4, 1e9);
+    r.DrawCopy();
+    p=r.ProfileX();
+    p->SetBit(kCanDelete);
+    p->SetLineColor(kRed);
+    p->Draw("same");
+
+    c->cd(3);
+    gPad->SetLogx();
+    p=h.ProjectionX();
+    p->SetBit(kCanDelete);
+    p->SetTitle("e^{-} / \\gamma Distribution");
+    p->GetXaxis()->SetLabelOffset(-0.015);
+    p->GetXaxis()->SetTitleOffset(1.1);
+    p->GetYaxis()->SetTitleOffset(1.3);
+    p->SetXTitle("E [GeV]");
+    p->SetYTitle("Counts");
+    p->Draw();
+    p=h.ProjectionY();
+    p->SetBit(kCanDelete);
+    p->SetTitle("Projection Y");
+    p->SetLineColor(kBlue);
+    p->Draw("same");
+
+    c->cd(4);
+    gPad->SetLogx();
+    p=r.ProjectionY();
+    p->SetBit(kCanDelete);
+    p->SetTitle("Ratio E\\gamma / E_{e}");
+    p->GetXaxis()->SetLabelOffset(-0.015);
+    p->GetXaxis()->SetTitleOffset(1.1);
+    p->GetYaxis()->SetTitleOffset(1.3);
+    p->SetXTitle("Ratio");
+    p->SetYTitle("Counts");
+    p->SetLineColor(kBlue);
+    p->Draw();
+}
Index: /trunk/WuerzburgSoft/Thomas/mphys/analp.C
===================================================================
--- /trunk/WuerzburgSoft/Thomas/mphys/analp.C	(revision 1362)
+++ /trunk/WuerzburgSoft/Thomas/mphys/analp.C	(revision 1362)
@@ -0,0 +1,136 @@
+//Double_t kRad2Deg = 180./TMath::Pi();
+
+void analp()
+{
+    TChain chain("Photons");
+    chain.Add("cascade01.root");
+    chain.Add("cascade02.root");
+
+    MPhoton *p = new MPhoton;
+    chain.SetBranchAddress("MPhoton.", &p);
+
+    Int_t n = chain.GetEntries();
+
+    cout << "Found " << n << " entries." << endl;
+
+    MBinning binsx;
+    binsx.SetEdgesLog(21, 1e4, 1e11);
+
+    MBinning binspolx;
+    MBinning binspoly1;
+    MBinning binspoly2;
+    binspolx.SetEdges(16, -180, 180);
+    binspoly1.SetEdges(20, 0, 5e-9);
+    binspoly2.SetEdges(20, 0, 2e-7);
+
+    TH1D h;
+    h.SetName("Photons");
+    h.SetTitle(" E^{2} Spectra ");
+    h.SetXTitle("E\\gamma [GeV]");
+    h.SetYTitle("E^{2} * Counts");
+    MH::SetBinning(&h, &binsx);
+
+    TH1D prim;
+    MH::SetBinning(&prim, &binsx);
+
+    TH2D r;
+    TH2D a;
+    MH::SetBinning(&a, &binspolx, &binspoly1);
+    MH::SetBinning(&r, &binspolx, &binspoly2);
+
+    Double_t weight = 0;
+    Double_t alpha = -2;
+    for (int i=0; i<n; i++)
+    {
+        chain.GetEntry(i);
+
+        Double_t Ep = p->GetEnergy();
+
+        if (i==0)
+            weight = pow(Ep, alpha);
+
+        if (p->IsPrimary())
+        {
+            weight = pow(Ep, alpha);
+            prim.Fill(Ep, Ep*Ep * weight);
+            continue;
+        }
+
+        h.Fill(Ep, Ep*Ep * weight);
+        r.Fill(p->GetPhi()*kRad2Deg, p->GetR(), weight);
+        a.Fill(p->GetPsi()*kRad2Deg, p->GetTheta()*kRad2Deg, weight);
+    }
+
+    delete p;
+
+    gStyle->SetOptStat(10);
+
+    TLine line;
+    line.SetLineColor(kBlack);
+    line.SetLineWidth(1);
+
+    TCanvas *c = new TCanvas("c1", "name");
+    c->Divide(2,2);
+
+    c->cd(1);
+    gPad->SetLogx();
+    gPad->SetLogy();
+
+    gPad->SetLogx();
+    gPad->SetLogy();
+    prim.SetFillStyle(0);
+    h.SetFillStyle(0);
+    h.GetXaxis()->SetLabelOffset(-0.015);
+    h.GetXaxis()->SetTitleOffset(1.1);
+    h.GetXaxis()->SetRangeUser(1e4, 1e9);
+    prim.SetMarkerStyle(kPlus);
+    h.SetMarkerStyle(kMultiply);
+    prim.SetMarkerColor(kRed);
+    prim.SetLineColor(kRed);
+
+    h.DrawCopy("P");
+    prim.DrawCopy("Psame");
+    prim.DrawCopy("Csame");
+    h.DrawCopy("Csame");
+ 
+    c->cd(2);
+    r.SetTitle(" Distance from Observer ");
+    r.GetXaxis()->SetLabelOffset(-0.015);
+    r.GetXaxis()->SetTitleOffset(1.1);
+    r.GetXaxis()->SetRangeUser(1e4, 1e9);
+    r.SetXTitle("\\Phi [\\circ]");
+    r.SetYTitle("R [kpc]");
+    r.DrawCopy("surf1pol");
+
+    c->cd(3);
+    a.SetTitle(" Hit Angle for Observer ");
+    a.GetXaxis()->SetLabelOffset(-0.015);
+    a.GetXaxis()->SetTitleOffset(1.1);
+    a.GetXaxis()->SetRangeUser(1e4, 1e9);
+    a.SetXTitle("\\Psi [\\circ]");
+    a.SetYTitle("\\Theta [\\circ]");
+    a.DrawCopy("surf1pol");
+
+    c->cd(4);
+    /*
+     TH1 *g=a.ProjectionY();
+     g->SetBit(kCanDelete);
+     g->SetTitle("Hit Angle");
+     g->GetXaxis()->SetLabelOffset(0);
+     g->GetXaxis()->SetTitleOffset(1.1);
+     g->GetYaxis()->SetTitleOffset(1.3);
+     g->SetXTitle("\\Phi [\\circ]");
+     g->SetYTitle("Counts");
+     g->Draw();
+     */
+    gPad->SetLogx();
+    TH1D div;
+    MH::SetBinning(&div, &binsx);
+    div.Divide(&h, &prim);
+    div.SetTitle("Spectrum / Primara Spectrum");
+    div.GetXaxis()->SetLabelOffset(-0.015);
+    div.GetXaxis()->SetTitleOffset(1.1);
+    div.SetXTitle("E\\gamma [GeV]");
+    div.SetYTitle("Ratio");
+    div.DrawCopy();
+}
