diff --git a/src/RooHybridBDTAutoPdf.cc b/src/RooHybridBDTAutoPdf.cc index 94662bd..ed32fcb 100644 --- a/src/RooHybridBDTAutoPdf.cc +++ b/src/RooHybridBDTAutoPdf.cc @@ -153,6 +153,15 @@ RooDataSet *RooTreeConvert::CreateDataSet(std::string name, TTree *tree, RooArgL RooDataSet *dset = new RooDataSet(name.c_str(),"",roovars,RooFit::WeightVar(weight)); + const int nvars = vars.getSize(); + std::vector varsv(vars.getSize()); + for (int ivar=0; ivar(vars.at(ivar)); + } + + RooArgSet varss(vars); + + int currenttree = -1; for (Long64_t iev=0; ievGetEntries(); ++iev) { if (iev%100000==0) printf("%i\n",int(iev)); @@ -163,27 +172,41 @@ RooDataSet *RooTreeConvert::CreateDataSet(std::string name, TTree *tree, RooArgL if (newtree) { cutform.Notify(); - for (int ivar=0; ivarNotify(); } } - double weight = cutform.EvalInstance(); - - if (weight==0.) continue; //skip events with 0 weight + int multmax = cutform.GetNdata(); +// for (int ivar=0; ivarGetNdata(); +// if (mult>multmax) multmax = mult; +// } - bool valid = true; - for (int ivar=0; ivarEvalInstance(); - RooRealVar *var = static_cast(vars.at(ivar)); - if (valgetMin() || val>var->getMax()) { - valid = false; + for (int imult=0; imultGetNdata()==multmax); + RooRealVar *var = varsv[ivar]; + if (inputforms[ivar]->GetNdata()!=multmax) { + printf("multmax = %i, ivar = %i, ndata = %i\n",multmax,ivar,inputforms[ivar]->GetNdata()); + assert(0); + } + double val = inputforms[ivar]->EvalInstance(imult); + if (valgetMin() || val>var->getMax()) { + valid = false; + } + var->setVal(val); } - var->setVal(val); + if (!valid && limitvals) continue; + + //dset->add(vars,weight); + dset->addFast(varss,weight); } - if (!valid && limitvals) continue; - - dset->add(vars,weight); } @@ -719,8 +742,9 @@ void RooGBRTargetFlex::ClearFuncServers() { double RooGBRTargetFlex::EvalFunc() const { + RooFIter iter = _funcvars.fwdIterator(); for (int ivar=0; ivar<_funcvars.getSize(); ++ivar) { - _eval[ivar] = static_cast(_funcvars.at(ivar))->getVal(); + _eval[ivar] = static_cast(iter.next())->getVal(); //printf("ivar = %i, var = %5f\n",ivar,_eval[ivar]); } return static_cast(_func.absArg())->Forest()->GetResponse(&_eval[0]); @@ -2590,7 +2614,7 @@ double RooHybridBDTAutoPdf::EvalLoss(double lambda, const TVectorD &dL, int itre //fExtVars = extbak; for (int ivar=0; ivar(fExtVars.at(ivar))->setVal(extvals[ivar]); + static_cast(fExtVars.at(ivar))->setVal(extvals[ivar]); } for (int ithread=0; ithreadsetError(static_cast(fExtVars.at(ivar))->getError()); } } + +// for (unsigned int itgt=0; itgtgetVal(), fStaticTgtsClones[0][itgt]->getError(),int(fStaticTgtsClones[0][itgt]->getAttribute("Constant"))); +// } //printf("finalval = %5f\n",static_cast(fExtVars.at(1))->getVal()); @@ -3249,6 +3277,7 @@ void RooHybridBDTAutoPdf::FitResponses(int selvar = -1) { double stepm = 0; double stepg = 0; + //solved = false; if (solved) { for (int i=0; i