Changeset 3590


Ignore:
Timestamp:
03/23/04 16:26:06 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHFalseSource.cc

    r3588 r3590  
    148148    fHist.SetName("Alpha");
    149149    fHist.SetTitle("3D-plot of Alpha vs x, y");
    150     fHist.SetXTitle("x [\\circ]");
    151     fHist.SetYTitle("y [\\circ]");
     150    fHist.SetXTitle("y [\\circ]");
     151    fHist.SetYTitle("x [\\circ]");
    152152    fHist.SetZTitle("\\alpha [\\circ]");
    153153}
     
    223223    if (fUseMmScale)
    224224    {
    225         fHist.SetXTitle("x [mm]");
    226         fHist.SetYTitle("y [mm]");
     225        fHist.SetXTitle("y [mm]");
     226        fHist.SetYTitle("x [mm]");
    227227
    228228        fHist.Scale(1./fMm2Deg);
     
    230230    else
    231231    {
    232         fHist.SetXTitle("x [\\circ]");
    233         fHist.SetYTitle("y [\\circ]");
     232        fHist.SetXTitle("y [\\circ]");
     233        fHist.SetYTitle("x [\\circ]");
    234234
    235235        fHist.Scale(1./fMm2Deg);
     
    281281        fUseMmScale = kFALSE;
    282282
    283         fHist.SetXTitle("x [\\circ]");
    284         fHist.SetYTitle("y [\\circ]");
     283        fHist.SetXTitle("y [\\circ]");
     284        fHist.SetYTitle("x [\\circ]");
    285285    }
    286286
     
    340340    hsrc.SetSrcPos(&src);
    341341
    342     const Int_t nx = fHist.GetNbinsX();
    343     const Int_t ny = fHist.GetNbinsY();
    344 
     342    // This is because a 3D histogram x and y are exchanged...
     343    const Int_t nx = fHist.GetNbinsY();
     344    const Int_t ny = fHist.GetNbinsX();
    345345    Axis_t cx[nx];
    346346    Axis_t cy[ny];
    347     fHist.GetXaxis()->GetCenter(cx);
    348     fHist.GetYaxis()->GetCenter(cy);
     347    fHist.GetYaxis()->GetCenter(cx);
     348    fHist.GetXaxis()->GetCenter(cy);
    349349
    350350    for (int ix=0; ix<nx; ix++)
     
    371371
    372372            const Double_t alpha = hsrc.GetAlpha();
    373             fHist.Fill(cx[ix], cy[iy], TMath::Abs(alpha), w);
     373
     374            // This is because a 3D histogram x and y are exchanged...
     375            fHist.Fill(cy[iy], cx[ix], TMath::Abs(alpha), w);
    374376        }
    375377    }
     
    502504        if ((h1 = (TH1D*)gPad->FindObject("Alpha")))
    503505        {
    504             //h1->Reset();
    505 
    506             const Double_t x = fHist.GetXaxis()->GetBinCenter(maxx);
    507             const Double_t y = fHist.GetYaxis()->GetBinCenter(maxy);
     506            const Double_t x = h4->GetXaxis()->GetBinCenter(maxx);
     507            const Double_t y = h4->GetYaxis()->GetBinCenter(maxy);
    508508            const Double_t s = h4->GetBinContent(max);
    509509
    510             TH1 *h = fHist.ProjectionZ("Alpha", maxx, maxx, maxy, maxy);
     510            // This is because a 3D histogram x and y are vice versa
     511            // Than for their projections
     512            TH1 *h = fHist.ProjectionZ("Alpha", maxy, maxy, maxx, maxx);
    511513            h->SetTitle(Form("Distribution of \\alpha for x=%.2f y=%.2f (\\sigma_{max}=%.1f)", x, y, s));
    512514        }
     
    545547    TH1 *h2 = fHist.Project3D("xy_off");
    546548    h2->SetDirectory(NULL);
    547     h2->SetXTitle(fHist.GetXaxis()->GetTitle());
    548     h2->SetYTitle(fHist.GetYaxis()->GetTitle());
     549    h2->SetXTitle(fHist.GetYaxis()->GetTitle());
     550    h2->SetYTitle(fHist.GetXaxis()->GetTitle());
    549551    h2->Draw("colz");
    550552    h2->SetBit(kCanDelete);
     
    556558    fHist.GetZaxis()->SetRange(0,9999);
    557559    h3->SetDirectory(NULL);
    558     h3->SetXTitle(fHist.GetXaxis()->GetTitle());
    559     h3->SetYTitle(fHist.GetYaxis()->GetTitle());
     560    h3->SetXTitle(fHist.GetYaxis()->GetTitle());
     561    h3->SetYTitle(fHist.GetXaxis()->GetTitle());
    560562    h3->Draw("colz");
    561563    h3->SetBit(kCanDelete);
     
    568570    h4->SetTitle("Significance");
    569571    h4->SetDirectory(NULL);
    570     h4->SetXTitle(fHist.GetXaxis()->GetTitle());
    571     h4->SetYTitle(fHist.GetYaxis()->GetTitle());
     572    h4->SetXTitle(fHist.GetYaxis()->GetTitle());
     573    h4->SetYTitle(fHist.GetXaxis()->GetTitle());
    572574    h4->Draw("colz");
    573575    h4->SetBit(kCanDelete);
     
    671673    hists->SetNameTitle("Excess",     Form("Number of excess events for \\alpha<%.0f\\circ", sigint));
    672674    histb->SetNameTitle("Background", Form("Number of background events for \\alpha<%.0f\\circ", sigint));
    673     hist->SetXTitle(fHist.GetXaxis()->GetTitle());
    674     hists->SetXTitle(fHist.GetXaxis()->GetTitle());
    675     histb->SetXTitle(fHist.GetXaxis()->GetTitle());
     675    hist->SetXTitle(fHist.GetYaxis()->GetTitle());
     676    hists->SetXTitle(fHist.GetYaxis()->GetTitle());
     677    histb->SetXTitle(fHist.GetYaxis()->GetTitle());
    676678    hist->SetYTitle(fHist.GetXaxis()->GetTitle());
    677679    hists->SetYTitle(fHist.GetXaxis()->GetTitle());
     
    700702    func.SetParLimits(3, -1, 1);
    701703
    702     const Int_t nx = fHist.GetXaxis()->GetNbins();
    703     const Int_t ny = fHist.GetYaxis()->GetNbins();
     704    const Int_t nx = hist->GetXaxis()->GetNbins();
     705    const Int_t ny = hist->GetYaxis()->GetNbins();
    704706    const Int_t nr = nx*nx+ny*ny;
    705707
     
    724726        for (int iy=1; iy<=ny; iy++)
    725727        {
    726             h = fHist.ProjectionZ("AlphaFit", ix, ix, iy, iy);
     728            // This is because a 3D histogram x and y are vice versa
     729            // Than for their projections
     730            h = fHist.ProjectionZ("AlphaFit", iy, iy, ix, ix);
    727731
    728732            const Double_t alpha0 = h->GetBinContent(1);
     
    808812            const Double_t sig = Significance(s, b);
    809813
     814            // This is because a 3D histogram x and y are exchanged...
    810815            const Int_t n = hist->GetBin(ix, iy);
    811816            hists->SetBinContent(n, s-b);
     
    886891    {
    887892        const char *title = Form(" \\alpha for x=%.2f y=%.2f (\\sigma_{max}=%.1f) ",
    888                                  fHist.GetXaxis()->GetBinCenter(maxx),
    889                                  fHist.GetYaxis()->GetBinCenter(maxy), maxs);
    890 
    891         TH1 *result = fHist.ProjectionZ("AlphaFit", maxx, maxx, maxy, maxy);
     893                                 hist->GetXaxis()->GetBinCenter(maxx),
     894                                 hist->GetYaxis()->GetBinCenter(maxy), maxs);
     895
     896        TH1 *result = fHist.ProjectionZ("AlphaFit", maxy, maxy, maxx, maxx);
    892897        result->SetDirectory(NULL);
    893898        result->SetNameTitle("Result \\alpha", title);
Note: See TracChangeset for help on using the changeset viewer.