Changeset 7667


Ignore:
Timestamp:
04/30/06 16:53:27 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.cc

    r7666 r7667  
    113113            const Float_t s = gx->Integral(1, y+1);
    114114            const Float_t b = hx->Integral(1, y+1);
    115             const Float_t sig1 = MMath::SignificanceLiMaSigned(s+b, b);
    116             const Float_t sig2 = s<1 ? 0 : MMath::SignificanceLiMaSigned(s+b, b)*TMath::Log10(s);
     115            const Float_t sig1 = MMath::SignificanceLiMa(s+b, b);
     116            const Float_t sig2 = s<1 ? 0 : MMath::SignificanceLiMa(s+b, b)*TMath::Log10(s);
    117117            if (sig1>max1)
    118118            {
     
    137137    }
    138138
     139    TGraph gr3;
     140    TGraph gr4;
     141
     142    TH1 *hx = h.ProjectionY("H_py");
     143    TH1 *gx = g.ProjectionY("G_py");
     144    for (int y=0; y<ny; y++)
     145    {
     146        const Float_t s = gx->Integral(1, y+1);
     147        const Float_t b = hx->Integral(1, y+1);
     148        const Float_t sig1 = MMath::SignificanceLiMa(s+b, b);
     149        const Float_t sig2 = s<1 ? 0 : MMath::SignificanceLiMa(s+b, b)*TMath::Log10(s);
     150
     151        gr3.SetPoint(y, h.GetYaxis()->GetBinLowEdge(y+2), sig1);
     152        gr4.SetPoint(y, h.GetYaxis()->GetBinLowEdge(y+2), sig2);
     153    }
     154    delete hx;
     155    delete gx;
     156
    139157    TCanvas &c = fDisplay->AddTab("OptCut");
     158    c.SetBorderMode(0);
    140159    c.Divide(2,2);
    141160
     
    152171    gr2.DrawClone("LP")->SetBit(kCanDelete);
    153172
     173    c.cd(3);
     174    gPad->SetBorderMode(0);
     175    gPad->SetFrameBorderMode(0);
     176    gr4.SetMarkerStyle(kFullDotMedium);
     177    gr4.DrawClone("ALP")->SetBit(kCanDelete);
     178    gr3.SetLineColor(kBlue);
     179    gr3.SetMarkerStyle(kFullDotMedium);
     180    gr3.DrawClone("LP")->SetBit(kCanDelete);
     181
    154182    c.cd(2);
    155183    gPad->SetBorderMode(0);
     
    304332    }
    305333
    306     *fLog << inf << "Found " << num << " background events in " << ontime << "s" << endl;
    307 
    308334    return num/ontime;
    309335}
     
    382408    if (data<n)
    383409    {
    384         on  = TMath::Nint(nummc*data/n); //(UInt_t)-1;
     410        on  = TMath::Nint(nummc*data/n);
    385411        off = TMath::Nint(data);
    386412        *fLog << "Not enough data events available... scaling by " << data/n << endl;
     
    405431    *fLog << "Target number of MC events:   " << fNumTrainOn << endl;
    406432    *fLog << "Target number of data events: " << fNumTrainOff << endl;
     433
     434    fNumTestOn  = fNumTrainOn;
     435    fNumTestOff = fNumTrainOff;
    407436
    408437    /*
     
    548577    *fLog << " * Gammas:     " << numgammas   << endl;
    549578    *fLog << " * Background: " << numbackgrnd << endl;
     579    *fLog << endl;
     580    *fLog << "Gamma/Background ratio:" << endl;
     581    *fLog << " * Requested:  " << (float)fNumTrainOn/fNumTrainOff << endl;
     582    *fLog << " * Result:     " << (float)numgammas/numbackgrnd << endl;
    550583
    551584    if (!fDataSetTest.IsValid())
     
    565598    // ----- Setup histograms -----
    566599    MBinning binsy(100, 0 , 1,      "BinningMH3Y", "lin");
    567     MBinning binsx( 50, 10, 100000, "BinningMH3X", "log");
     600    MBinning binsx( 40, 10, 100000, "BinningMH3X", "log");
    568601
    569602    plist.AddToList(&binsx);
     
    599632
    600633    MFEventSelector sel;
    601     sel.SetNumSelectEvts(fNumTestOn);
     634    sel.SetNumSelectEvts(fNumTestOff);
    602635
    603636    MContinue c1(&sel);
     
    622655
    623656    // ----- Setup and run eventloop on background -----
    624     sel.SetNumSelectEvts(fNumTestOff);
     657    sel.SetNumSelectEvts(fNumTestOn);
    625658    fillh0.ResetBit(MFillH::kDoNotDisplay);
    626659
Note: See TracChangeset for help on using the changeset viewer.