How to get optimal cut from TMVA Rectangular Cuts method?

I am using TMVA Rectangular Cuts method.
Using TMVA::GUI I can see the optimal cut corresponding to maximal significance: S/sqrt(S + B).
But there it is supposed that there are 1000 signal events and 1000 background events which is not the case. How to get optimal cut according to my numbers of events. I can do it by hand but I want to do it from code.


By the way, why significance (the green line) is displayed as zero constant?
Another question is what weight per tree exactly means:

    Double_t sigWeight = 1.0;
    Double_t bkgWeight = 1.0;//bkgChain->GetEntries() / sigTree->GetEntries();
    //And then
    dataloader->AddSignalTree( sigTree, sigWeight );
    dataloader->AddBackgroundTree( bkgChain, bkgWeight );

Will it solve my problem somehow?

Hi,

@moneta, @sergei , could you comment on the number of sig. vs. bkg. events?

The tree weights are weights that are applied uniformly across all events of that tree. E.g. setting the signal tree weight to 0 would exclude these events from efficiency calculations. Setting the signal tree weight to 0.5 and the background tree weight to 1 would make sig. half as important as bkg.

This is a multiplicative factor in addition to individual event weights.

Cheers,
Kim