Ignore:
Timestamp:
08/02/05 10:04:19 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhflux/MHPhi.cc

    r7250 r7251  
    3030// the source position.
    3131//
     32// More detail can be found at:
     33// http://www.astro.uni-wuerzburg.de/results/ringmethod/
     34//
    3235////////////////////////////////////////////////////////////////////////////
    3336#include "MHPhi.h"
     
    6063//
    6164MHPhi::MHPhi(const char *name, const char *title)
    62 : fHillas(0), fSrcPos(0), fDisp(0)
     65: fHillas(0), fSrcPos(0), fDisp(0)//, fOnOffMode(kTRUE), fIsOffLoop(kFALSE)
    6366{
    6467    fName  = name  ? name  : "MHPhi";
     
    6669
    6770    // Init Graphs
    68     fHPhi.SetNameTitle("Phi", "Distribution of \\Delta\\Phi");
     71    fHPhi.SetNameTitle("Phi", "\\Delta\\Phi-Distribution");
    6972
    7073    fHPhi.SetXTitle("\\Delta\\Phi [\\circ]");
     
    7881
    7982    fHPhi.GetYaxis()->SetTitleOffset(1.2);
    80 }
     83
     84    /*
     85    fNameParameter = "Disp";
     86
     87    fHist.SetNameTitle("Phi", "\\Delta\\Phi-Distribution");
     88    fHist.SetZTitle("\\Delta\\Phi [\\circ]");
     89    fHist.SetDirectory(NULL);
     90
     91    // Main histogram
     92    fHistTime.SetName("Phi");
     93    fHistTime.SetXTitle("\\Delta\\Phi [\\circ]");
     94    fHistTime.SetDirectory(NULL);
     95
     96    MBinning binsa, binse, binst;
     97    //binsa.SetEdges(75, 0, 1.5);
     98    //binsa.SetEdges(arr);
     99    binse.SetEdgesLog(15, 10, 100000);
     100    binst.SetEdgesASin(67, -0.005, 0.665);
     101    //binsa.Apply(fHistTime);
     102
     103    MH::SetBinning(&fHist, &binst, &binse, &binsa);
     104     */
     105}
     106
     107/*
     108Double_t MHPhi::GetVal() const
     109{
     110    const Dopuble_t disp = static_cast<const MParameterD*>(fParameter)->GetVal();
     111
     112    const TVector2 pos = fHillas->GetMean()*fConvMm2Deg + fHillas->GetNormAxis()*disp;
     113    const TVector2 src = fSrcPos->GetXY()*fConvMm2Deg;
     114
     115    // Calculate radial distance.
     116    const Double_t d = pos.Mod() - src.Mod();
     117
     118    if (d<-fThetaCut*0.913 || d>fThetaCut)
     119        return kTRUE;
     120
     121    const Double_t delta = src.DeltaPhi(pos)*TMath::RadToDeg();
     122    const Double_t absd  = TMath::Abs(delta)
     123
     124    return fHistOff ? absd : 180-absd;
     125}
     126*/
    81127
    82128// --------------------------------------------------------------------------
     
    118164    fThetaCut      = 0.21/1.2;
    119165    fDistSrc       = 0.4;
     166    //fIsOffLoop = !fIsOffLoop;
    120167
    121168    const Double_t w  = TMath::ATan(fThetaCut/fDistSrc);
     
    124171
    125172    MBinning(n, 0, n*sz).Apply(fHPhi);
    126 
     173    /*
     174
     175    // Get Histogram binnings
     176    MBinning binst, binse;
     177    binst.SetEdges(fHist, 'x');
     178    binse.SetEdges(fHist, 'y');
     179
     180    MBinning binsa(n, 0, n*sz);
     181
     182    // Apply binning
     183    binsa.Apply(fHistTime);
     184    MH::SetBinning(&fHist, &binst, &binse, &binsa);
     185
     186    // Remark: Binnings might be overwritten in MHAlpha::SetupFill
     187    return MHAlpha::SetupFill(pl);
     188     */
    127189    return kTRUE;
    128190}
     
    135197Bool_t MHPhi::Fill(const MParContainer *par, const Stat_t weight)
    136198{
    137     const TVector2 pos = fHillas->GetMean()*fConvMm2Deg - fHillas->GetNormAxis()*fDisp->GetVal();
     199    const TVector2 pos = fHillas->GetMean()*fConvMm2Deg + fHillas->GetNormAxis()*fDisp->GetVal();
    138200    const TVector2 src = fSrcPos->GetXY()*fConvMm2Deg;
    139201
     202    // Calculate radial distance.
    140203    const Double_t d = pos.Mod() - src.Mod();
    141204
     
    146209
    147210    fHPhi.Fill(TMath::Abs(delta), weight);
     211
     212    // const Double_t absd = TMath::Abs(delta)
     213    // fHPhi.Fill(fHistOff ? absd : 180-absd, weight);
    148214
    149215    return kTRUE;
     
    161227    pad->SetBorderMode(0);
    162228
     229    AppendPad("combine");
     230
    163231    fHPhi.Draw();
    164232
    165     AppendPad();
     233    AppendPad(opt);
    166234}
    167235
    168236void MHPhi::Paint(Option_t *o)
    169237{
    170     const Double_t sig = fHPhi.Integral(1, fNumBinsSignal);
    171     const Double_t bg  = fHPhi.Integral(1+fNumBinsSignal, fHPhi.GetNbinsX());
    172 
    173     const Double_t cut = fHPhi.GetBinLowEdge(fNumBinsSignal+1);
    174 
    175     const Double_t f   = cut/(180-cut);
    176 
    177     const Double_t S0  = MMath::SignificanceLiMaSigned(sig, bg*f);
    178     const Double_t S   = MMath::SignificanceLiMaSigned(sig, bg, f);
    179 
    180     const TString  fmt = Form("\\sigma_{L/M}=%.1f (\\sigma_{0}=%.1f)  \\Delta\\Phi<%.1f\\circ  E=%.0f  B=%.0f  f=%.2f",
    181                               S, S0, cut, sig-bg*f, bg*f, f);
     238    //TString opt(o);
     239    //opt.ToLower();
     240
     241    // if (opt=="combine" && fHistOff)
     242    // {
     243    //    fHPhi.Add(fHist, fHistOff);
     244    //    return;
     245    // }
     246
     247    const Bool_t wobble = TString(o).Contains("anticut", TString::kIgnoreCase);
     248
     249    const Double_t cut  = fHPhi.GetBinLowEdge(fNumBinsSignal+1);
     250
     251    const Int_t maxbin  = wobble ? fHPhi.GetXaxis()->FindFixBin(180-cut)-1 : fHPhi.GetNbinsX();
     252    const Double_t cut2 = wobble ? fHPhi.GetBinLowEdge(maxbin+1) : 180;
     253
     254    const Double_t sig  = fHPhi.Integral(1, fNumBinsSignal);
     255    const Double_t bg   = fHPhi.Integral(1+fNumBinsSignal, maxbin);
     256
     257    const Double_t f    = cut/(cut2-cut);
     258
     259    const Double_t S0   = MMath::SignificanceLiMaSigned(sig, bg*f);
     260    const Double_t S    = MMath::SignificanceLiMaSigned(sig, bg, f);
     261
     262    const TString  fmt  = Form("\\sigma_{L/M}=%.1f (\\sigma_{0}=%.1f)  \\Delta\\Phi_{on}<%.1f\\circ  \\Delta\\Phi_{off}<%.1f\\circ  E=%.0f  B=%.0f  f=%.2f",
     263                               S, S0, cut, cut2, sig-bg*f, bg*f, f);
    182264
    183265    const Double_t b = bg             *f/fNumBinsSignal;
    184266    const Double_t e = TMath::Sqrt(bg)*f/fNumBinsSignal;
    185267
    186     TLatex text(0.33, 0.94, fmt);
     268    TLatex text(0.27, 0.94, fmt);
    187269    text.SetBit(TLatex::kTextNDC);
    188270    text.SetTextSize(0.035);
     
    192274    line.SetLineColor(14);
    193275    line.PaintLine(cut, gPad->GetUymin(), cut, gPad->GetUymax());
     276    if (maxbin<fHPhi.GetNbinsX())
     277        line.PaintLine(cut2, gPad->GetUymin(), cut2, gPad->GetUymax());
    194278    line.SetLineColor(kBlue);
    195279    line.PaintLine(0, b, cut, b);
     
    202286    m.SetMarkerStyle(kFullDotMedium);
    203287    m.PaintMarker(cut/2, b);
    204 
    205 }
     288}
Note: See TracChangeset for help on using the changeset viewer.