Ignore:
Timestamp:
12/03/07 17:44:59 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhflux
Files:
4 edited

Legend:

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

    r8767 r8775  
    630630}
    631631*/
     632
    632633Bool_t MAlphaFitter::FitAlpha(const TH3D &hon, const TH3D &hof, Bool_t paint)
    633634{
     
    646647
    647648    return rc;
     649}
     650
     651Bool_t MAlphaFitter::ApplyScaling(const TH3D &hon, TH3D &hof, UInt_t bin) const
     652{
     653    const TString name1(Form("TempAlpha%06d_on",  gRandom->Integer(1000000)));
     654    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
     655
     656    TH1D *h1 = hon.ProjectionZ(name1, -1, -1, bin, bin, "E");
     657    TH1D *h0 = hof.ProjectionZ(name0, -1, -1, bin, bin, "E");
     658    h1->SetDirectory(0);
     659    h0->SetDirectory(0);
     660
     661    const Double_t scale = Scale(*h0, *h1);
     662
     663    delete h0;
     664    delete h1;
     665
     666    for (int x=0; x<=hof.GetNbinsX()+1; x++)
     667        for (int z=0; z<=hof.GetNbinsZ()+1; z++)
     668        {
     669            hof.SetBinContent(x, bin, z, hof.GetBinContent(x, bin, z)*scale);
     670            hof.SetBinError(  x, bin, z, hof.GetBinError(  x, bin, z)*scale);
     671        }
     672
     673    return scale>0;
     674}
     675
     676Bool_t MAlphaFitter::ApplyScaling(const TH3D &hon, TH3D &hof) const
     677{
     678    for (int y=0; y<=hof.GetNbinsY()+1; y++)
     679        ApplyScaling(hon, hof, y);
     680
     681    return kTRUE;
    648682}
    649683
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h

    r8767 r8775  
    237237    Double_t Scale(TH1D &off, const TH1D &on) const;
    238238
     239    Bool_t ApplyScaling(const TH3D &hon, TH3D &hof, UInt_t bin) const;
     240    Bool_t ApplyScaling(const TH3D &hon, TH3D &hof) const;
     241
    239242    // Interface to result
    240243    void PaintResult(Float_t x=0.04, Float_t y=0.94, Float_t size=0.035, Bool_t draw=kFALSE) const;
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.cc

    r8695 r8775  
    10101010Bool_t MHAlpha::Finalize()
    10111011{
    1012     //TH1D *h = fHist.ProjectionZ("AlphaExc_px", -1, 9999, -1, 9999, "E");
    1013     //h->SetDirectory(0);
    1014     //Bool_t rc = fFit.Fit(*h);
    1015     //delete h;
    1016 
    1017     if (!fFit.FitAlpha(fHist, fOffData))
     1012    if (!FitAlpha())
    10181013    {
    10191014        *fLog << warn << "MAlphaFitter - Fit failed..." << endl;
     
    10991094}
    11001095
     1096void MHAlpha::ApplyScaling()
     1097{
     1098    if (!fOffData)
     1099        return;
     1100
     1101    fFit.ApplyScaling(fHist, *const_cast<TH3D*>(fOffData));
     1102}
     1103
    11011104Int_t MHAlpha::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    11021105{
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.h

    r8636 r8775  
    104104    const TH1D &GetHEnergy() const { return fHEnergy; }
    105105
     106    const TH3D *GetOffData() const { return fOffData; }
     107
    106108    // Setter
    107109    void SetNameParameter(const char *name) { fNameParameter=name; }
     
    132134    void ForceUsingSize(Bool_t b=kTRUE) { fForceUsingSize=b; }
    133135
     136    Bool_t FitAlpha()
     137    {
     138        return fFit.FitAlpha(fHist, fOffData);
     139    }
     140
    134141    void DrawNicePlot(const char *title="MAGIC Telescope observation", const char *watermark="preliminary") { DrawNicePlot(kTRUE, title, watermark); } //*MENU*
    135142    void DrawNicePlot(Bool_t newc, const char *title=0, const char *watermark=0);
     
    139146    virtual void InitMapping(MHMatrix *mat, Int_t type=0);
    140147    void StopMapping();
     148
     149    void ApplyScaling();
    141150
    142151    // TObject
Note: See TracChangeset for help on using the changeset viewer.