Ignore:
Timestamp:
07/05/06 12:39:47 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r7755 r7778  
    5454#include <TStopwatch.h>
    5555
    56 #include "MGeomCam.h"
    5756#include "MSrcPosCam.h"
    5857#include "MHillasSrc.h"
     
    8281MHAlpha::MHAlpha(const char *name, const char *title)
    8382    : fNameParameter("MHillasSrc"), fParameter(0),
    84     fOffData(0), fResult(0), /*fExcess(0),*/ fEnergy(0),
     83    fOffData(0), fResult(0), fEnergy(0), fBin(0),
    8584    fPointPos(0), fTimeEffOn(0), fTime(0), fNumTimeBins(10),
    8685    fHillas(0), fMatrix(0), fSkipHistTime(kFALSE), fSkipHistTheta(kFALSE),
     
    295294    if (!fSigma)
    296295        return kFALSE;
     296    fBin = (MParameterI*)const_cast<MParList*>(pl)->FindCreateObj("MParameterI", "Bin");
     297    if (!fBin)
     298        return kFALSE;
    297299
    298300    //fExcess = (MParameterD*)const_cast<MParList*>(pl)->FindCreateObj("MParameterD", "MExcess");
     
    440442}
    441443
     444void MHAlpha::SetBin(Int_t ibin)
     445{
     446    // Is this necessary?
     447    // Could be speed up up searching for it only once.
     448    const Float_t max     = fFit.GetSignalIntegralMax();
     449    const Int_t bin0      = fHist.GetZaxis()->FindFixBin(max);
     450
     451    const Int_t nbinsx    = fHist.GetNbinsX();
     452    const Int_t nbinsy    = fHist.GetNbinsY();
     453    const Int_t nxy       = (nbinsx+2)*(nbinsy+2);
     454
     455    const Int_t binz      = ibin/nxy;
     456
     457    const Bool_t issignal = binz>0 && binz<bin0;
     458
     459    fBin->SetVal(issignal ? binz : -binz);
     460}
     461
    442462// --------------------------------------------------------------------------
    443463//
     
    479499
    480500    // Fill histograms
    481     fHist.Fill(theta, energy, TMath::Abs(alpha), w);
     501    const Int_t ibin = fHist.Fill(theta, energy, TMath::Abs(alpha), w);
     502    SetBin(ibin);
    482503
    483504    if (!fSkipHistTime)
     
    769790void MHAlpha::DrawAll(Bool_t newc)
    770791{
    771     if (newc && !fDisplay)
     792    if (!newc && !fDisplay)
    772793        return;
    773794
     
    843864        {
    844865            *fLog << dbg << "Bin " << i << ": sigmaexc=" << fit.GetSignificanceExc() << " omega=" << fit.GetGausSigma() << " events=" << fit.GetEventsExcess() << " scale=" << fit.GetScaleFactor() << endl;
    845             fit.PaintResult();
     866            fit.DrawResult();
    846867        }
    847868        /*
Note: See TracChangeset for help on using the changeset viewer.