Index: trunk/MagicSoft/Mars/mhist/MHHadroness.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHHadroness.cc	(revision 1354)
+++ trunk/MagicSoft/Mars/mhist/MHHadroness.cc	(revision 1554)
@@ -105,7 +105,11 @@
     fIntPhness->SetYTitle("Acceptance");
 
+    /*
     fQfac = new TH1D("Qfac", "Naive Quality factor", nbins, 0, 1);
     fQfac->SetXTitle("Hadroness");
     fQfac->SetYTitle("Quality");
+    */
+    fQfac = new TGraph;
+    fQfac->SetTitle(" Naive Quality factor ");
 
     fMinDist = new TH1D("MinDist", "Minimum Dist to (0, 1)", nbins, 0, 1);
@@ -113,5 +117,5 @@
     fMinDist->SetYTitle("Distance");
 
-    fQfac->SetDirectory(NULL);
+    //fQfac->SetDirectory(NULL);
     fGhness->SetDirectory(NULL);
     fPhness->SetDirectory(NULL);
@@ -200,4 +204,5 @@
 
     fGraph->Set(n);
+    fQfac->Set(n);
 
     const Stat_t sumg = fGhness->Integral(1, n+1);
@@ -218,5 +223,7 @@
 
         fMinDist->SetBinContent(i, 1-sqrt(ip*ip + (ig-1)*(ig-1)));
-        fQfac->SetBinContent(i, ig/sqrt(ip));
+        fQfac->SetPoint(i, ig, ig/sqrt(ip));
+        //fQfac->SetBinContent(fQfac->FindBin(ig), ig/sqrt(ip));
+        *fLog << all << i << ": " << ig << " " << ig/sqrt(ip) << endl;
     }
 
@@ -279,9 +286,11 @@
     *fLog << "  Acc Gammas = " << Form("%3.0f", fIntGhness->GetBinContent(h)*100) << "%, ";
     *fLog << "Acc Hadrons = " << Form("%3.0f", fIntPhness->GetBinContent(h)*100) << "%" << endl;
-    const Int_t q = GetQfac()->GetMaximumBin();
-    *fLog << "Maximum Q-Factor: " << GetQfac()->GetMaximum() << " @ H=";
-    *fLog << GetQfac()->GetBinCenter(q) << endl;;
-    *fLog << "  Acc Gammas = " << Form("%3.0f", fIntGhness->GetBinContent(q)*100) << "%, ";
-    *fLog << "Acc Hadrons = " << Form("%3.0f", fIntPhness->GetBinContent(q)*100) << "%" << endl;
+    /*
+     const Int_t q = GetQfac()->GetMaximumBin();
+     *fLog << "Maximum Q-Factor: " << GetQfac()->GetMaximum() << " @ H=";
+     *fLog << GetQfac()->GetBinCenter(q) << endl;;
+     *fLog << "  Acc Gammas = " << Form("%3.0f", fIntGhness->GetBinContent(q)*100) << "%, ";
+     *fLog << "Acc Hadrons = " << Form("%3.0f", fIntPhness->GetBinContent(q)*100) << "%" << endl;
+     */
     *fLog << endl;
 }
@@ -303,26 +312,4 @@
     Getphness()->SetLineColor(kRed);
     Getphness()->DrawCopy("same");
-    c.cd(4);
-    TGraph &g = (TGraph&)*fGraph->DrawClone("AC");
-    g.SetBit(kCanDelete);
-    gPad->Modified();
-    gPad->Update();
-    if (g.GetHistogram())
-    {
-        g.GetXaxis()->SetRangeUser(0, 1);
-        g.GetXaxis()->SetTitle("Acceptance Hadrons");
-        g.GetYaxis()->SetTitle("Acceptance Gammas");
-        g.SetMarkerStyle(kFullDotSmall);
-        g.Draw("P");
-
-        gPad->Modified();
-        gPad->Update();
-    }
-    const Int_t h = fMinDist->GetMaximumBin();
-    TMarker *m = new TMarker(fIntPhness->GetBinContent(h),
-                             fIntGhness->GetBinContent(h), kStar);
-    m->SetMarkerColor(kBlue);
-    m->SetBit(kCanDelete);
-    m->Draw();
     c.cd(2);
     gStyle->SetOptStat(0);
@@ -333,36 +320,35 @@
     fMinDist->DrawCopy("same");
     c.cd(3);
-    GetQfac()->DrawCopy();
-
-    return &c;
-}
-
-// --------------------------------------------------------------------------
-//
-// Draw all histograms. (For the Meaning see class description)
-//
-void MHHadroness::Draw(Option_t *)
-{
-    if (!gPad)
-        MakeDefCanvas("Hadroness", fTitle);
-
-    gPad->Divide(2, 2);
-
-    gPad->cd(1);
-    gStyle->SetOptStat(10);
-    Getghness()->Draw();
-    Getphness()->SetLineColor(kRed);
-    Getphness()->Draw("same");
-    gPad->cd(4);
-    fGraph->Draw("AC");
-    gPad->Modified();
-    gPad->Update();
-    if (fGraph->GetHistogram())
-    {
-        fGraph->GetXaxis()->SetRangeUser(0, 1);
-        fGraph->GetXaxis()->SetTitle("Acceptance Hadrons");
-        fGraph->GetYaxis()->SetTitle("Acceptance Gammas");
-        fGraph->SetMarkerStyle(kFullDotSmall);
-        fGraph->Draw("P");
+    //GetQfac()->DrawCopy();
+    TGraph &g2 = (TGraph&)*fQfac->DrawClone("AC");
+    g2.SetBit(kCanDelete);
+    gPad->Modified();
+    gPad->Update();
+    if (g2.GetHistogram())
+    {
+        g2.GetXaxis()->SetRangeUser(0, 1);
+        g2.GetXaxis()->SetTitle("Acceptance Gammas");
+        g2.GetYaxis()->SetTitle("Quality");
+        g2.SetMarkerStyle(kFullDotSmall);
+        g2.Draw("P");
+
+        gPad->Modified();
+        gPad->Update();
+    }
+    c.cd(4);
+    gPad->Modified();
+    gPad->Update();
+    TGraph &g = (TGraph&)*fGraph->DrawClone("AC");
+    g.SetBit(kCanDelete);
+    gPad->Modified();
+    gPad->Update();
+    if (g.GetHistogram())
+    {
+        g.GetXaxis()->SetRangeUser(0, 1);
+        g.GetXaxis()->SetTitle("Acceptance Hadrons");
+        g.GetYaxis()->SetTitle("Acceptance Gammas");
+        g.SetMarkerStyle(kFullDotSmall);
+        g.Draw("P");
+
         gPad->Modified();
         gPad->Update();
@@ -374,4 +360,23 @@
     m->SetBit(kCanDelete);
     m->Draw();
+    return &c;
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw all histograms. (For the Meaning see class description)
+//
+void MHHadroness::Draw(Option_t *)
+{
+    if (!gPad)
+        MakeDefCanvas("Hadroness", fTitle);
+
+    gPad->Divide(2, 2);
+
+    gPad->cd(1);
+    gStyle->SetOptStat(10);
+    Getghness()->Draw();
+    Getphness()->SetLineColor(kRed);
+    Getphness()->Draw("same");
     gPad->cd(2);
     gStyle->SetOptStat(0);
@@ -382,4 +387,40 @@
     fMinDist->Draw("same");
     gPad->cd(3);
-    GetQfac()->Draw();
-}
+    //GetQfac()->Draw();
+    fQfac->Draw("AC");
+    gPad->Modified();
+    gPad->Update();
+    if (fQfac->GetHistogram())
+    {
+        fQfac->GetXaxis()->SetRangeUser(0, 1);
+        fQfac->GetXaxis()->SetTitle("Acceptance Gammas");
+        fQfac->GetYaxis()->SetTitle("Quality");
+        fQfac->SetMarkerStyle(kFullDotSmall);
+        fQfac->Draw("P");
+
+        gPad->Modified();
+        gPad->Update();
+    }
+    gPad->cd(4);
+    gPad->Modified();
+    gPad->Update();
+    fGraph->Draw("AC");
+    gPad->Modified();
+    gPad->Update();
+    if (fGraph->GetHistogram())
+    {
+        fGraph->GetXaxis()->SetRangeUser(0, 1);
+        fGraph->GetXaxis()->SetTitle("Acceptance Hadrons");
+        fGraph->GetYaxis()->SetTitle("Acceptance Gammas");
+        fGraph->SetMarkerStyle(kFullDotSmall);
+        fGraph->Draw("P");
+        gPad->Modified();
+        gPad->Update();
+    }
+    const Int_t h = fMinDist->GetMaximumBin();
+    TMarker *m = new TMarker(fIntPhness->GetBinContent(h),
+                             fIntGhness->GetBinContent(h), kStar);
+    m->SetMarkerColor(kBlue);
+    m->SetBit(kCanDelete);
+    m->Draw();
+}
