Ignore:
Timestamp:
03/08/03 14:00:30 (22 years ago)
Author:
wittek
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r1668 r1809  
    235235    }
    236236
    237     return val1y - (val2y-val1y)/(val2x-val1x) * (val1x-0.5);
     237    Float_t retValue;
     238    if (val2x-val1x != 0.0)
     239      retValue = val1y - (val2y-val1y)/(val2x-val1x) * (val1x-0.5);
     240    else
     241      retValue = 0.0;
     242
     243    return retValue;
    238244}
    239245
     
    252258    fQfac->Set(n);
    253259
    254     const Stat_t sumg = fGhness->Integral(1, n+1);
    255     const Stat_t sump = fPhness->Integral(1, n+1);
     260    Stat_t sumg;
     261    Stat_t sump;
     262
     263    sumg = fGhness->Integral(1, n);
     264    sump = fPhness->Integral(1, n);
     265
     266    if (sumg == 0.0  ||  sump == 0.0)
     267    {
     268      *fLog << "MHHadronness::Finalize; sumg or sump is zero;   sumg, sump = "
     269            << sumg << ",  " << sump << ".  Cannot calculate hadronness"
     270            << endl;
     271    }
     272
     273
     274    // Normalize photon distribution
     275    Stat_t con;
     276    if (sumg > 0.0)
     277      for (Int_t i=1; i<=n; i++)
     278      {
     279        con = (fGhness->GetBinContent(i)) / sumg;
     280        fGhness->SetBinContent(i, con);       
     281      }
     282
     283    // Normalize hadron distribution
     284    if (sump > 0.0)
     285      for (Int_t i=1; i<=n; i++)
     286      {
     287        con = (fPhness->GetBinContent(i)) / sump;
     288        fPhness->SetBinContent(i, con);       
     289      }
     290
     291    // Calculate acceptances
     292    sumg = fGhness->Integral(1, n);
     293    sump = fPhness->Integral(1, n);
     294
     295    *fLog << "MHHadronness::Finalize; sumg, sump = " << sumg << ",  "
     296          << sump << endl;
    256297
    257298    Float_t max=0;
     
    259300    for (Int_t i=1; i<=n; i++)
    260301    {
    261         const Stat_t ip = fPhness->Integral(1, i)/sump;
    262         const Stat_t ig = fGhness->Integral(1, i)/sumg;
     302        Stat_t ip;
     303        if (sump != 0.0)
     304          ip = fPhness->Integral(1, i)/sump;
     305        else
     306          ip = 0;
     307
     308        Stat_t ig;
     309        if (sumg != 0.0)
     310          ig = fGhness->Integral(1, i)/sumg;
     311        else
     312          ig = 0;
    263313
    264314        fIntPhness->SetBinContent(i, ip);
     
    409459
    410460    c.cd(1);
    411     gStyle->SetOptStat(10);
     461    //gStyle->SetOptStat(10);
    412462    Getghness()->DrawCopy();
    413463    Getphness()->SetLineColor(kRed);
    414464    Getphness()->DrawCopy("same");
    415465    c.cd(2);
    416     gStyle->SetOptStat(0);
     466    //gStyle->SetOptStat(0);
    417467    Getighness()->DrawCopy();
    418468    Getiphness()->SetLineColor(kRed);
     
    483533
    484534    gPad->cd(1);
    485     gStyle->SetOptStat(10);
     535    //gStyle->SetOptStat(10);
    486536    Getghness()->Draw();
    487537    Getphness()->SetLineColor(kRed);
    488538    Getphness()->Draw("same");
    489539    gPad->cd(2);
    490     gStyle->SetOptStat(0);
     540    //gStyle->SetOptStat(0);
    491541    Getighness()->Draw();
    492542    Getiphness()->SetLineColor(kRed);
Note: See TracChangeset for help on using the changeset viewer.