Esempio n. 1
0
static void
dohist1(struct Hist *hp, int *np, int rflg, int hflg)
{
    int print;

    print = (*np) > 0;

    for (; hp != 0; hp = hp->Hnext) {
	(*np)--;
	hp->Href++;
	if (rflg == 0) {
	    dohist1(hp->Hnext, np, rflg, hflg);
	    if (print)
		phist(hp, hflg);
	    return;
	}
	if (*np >= 0)
	    phist(hp, hflg);
    }
}
Esempio n. 2
0
void makeConnectedBinList(string procname, RooRealVar& var, RooWorkspace& ws, TH1F* rhist, vector<pair<RooRealVar*, TH1*> > syst, const RooArgList& srbinlist, RooArgList* crbinlist=NULL) {
    if (crbinlist == NULL) crbinlist = new RooArgList();

    for (int i = 1; i <= rhist->GetNbinsX(); i++) {
        stringstream rbinss;
        rbinss << "r_" << procname << "_bin" << i;
        RooRealVar* rbinvar = new RooRealVar(rbinss.str().c_str(), "", rhist->GetBinContent(i));

        stringstream rerrbinss;
        rerrbinss << procname << "_bin" << i << "_Runc";
        RooRealVar* rerrbinvar = new RooRealVar(rerrbinss.str().c_str(), "", 0., -5., 5.);

        stringstream binss;
        binss << procname << "_bin" << i;

        RooArgList fobinlist;
        fobinlist.add(srbinlist[i-1]);
        fobinlist.add(*rbinvar);
        fobinlist.add(*rerrbinvar);

        stringstream formss;
        formss << "@0/";
        formss << "(";
        formss << "@1";
        formss << "*(1+" << rhist->GetBinError(i)/rhist->GetBinContent(i) << "*@2)";
        for (int j = 0; j < syst.size(); j++) {
            stringstream systbinss;
            if (syst[j].first == NULL) {
                systbinss << procname << "_bin" << i << "_" << syst[j].second->GetName();
                RooRealVar* systbinvar = new RooRealVar(systbinss.str().c_str(), "", 0., -5., 5.);
                fobinlist.add(*systbinvar);
            }
            else {
                fobinlist.add(*syst[j].first);
            }
            formss << "*(1+" << syst[j].second->GetBinContent(i) << "*@" << j+3 << ")";
        }
        formss << ")";

        RooFormulaVar* binvar = new RooFormulaVar(binss.str().c_str(), "", formss.str().c_str(), RooArgList(fobinlist));
        crbinlist->add(*binvar);
    }

    stringstream normss;
    normss << procname << "_norm";

    RooParametricHist phist(procname.c_str(), "", var, *crbinlist, *rhist);
    RooAddition norm(normss.str().c_str(),"", *crbinlist);

    ws.import(phist,RooFit::RecycleConflictNodes());
    ws.import(norm, RooFit::RecycleConflictNodes());
}
Esempio n. 3
0
void makeBinList(string procname, RooRealVar& var, RooWorkspace& ws, TH1F* hist, RooArgList& binlist, bool setConst = false) {
    for (int i = 1; i <= hist->GetNbinsX(); i++) {
        stringstream binss;
        binss << procname << "_bin" << i;
        RooRealVar* binvar;
        if (!setConst) binvar = new RooRealVar(binss.str().c_str(), "", hist->GetBinContent(i), 0., hist->GetBinContent(i)*2.0);
        else           binvar = new RooRealVar(binss.str().c_str(), "", hist->GetBinContent(i));
        binlist.add(*binvar);
    }

    stringstream normss;
    normss << procname << "_norm";

    RooParametricHist phist(procname.c_str(), "", var, binlist, *hist);
    RooAddition norm(normss.str().c_str(), "", binlist);

    ws.import(phist,RooFit::RecycleConflictNodes());
    ws.import(norm, RooFit::RecycleConflictNodes());

}
Esempio n. 4
0
			static libmaus::util::Histogram::unique_ptr_type fillSubHistogram(
				in_iterator in_it,
				uint64_t const in
			)
			{
				libmaus::util::Histogram::unique_ptr_type phist(new libmaus::util::Histogram);
				libmaus::util::Histogram & hist = *phist;

				uint64_t const full = in >> klog;
				uint64_t const rest = in-full*k;
			
				for ( uint64_t i = 0; i < full; ++i )
				{
					uint64_t vmin = *(in_it++);
					for ( unsigned int j = 1; j < k; ++j )
					{
						uint64_t const vj = *(in_it++);
						if ( vj < vmin )
							vmin = vj;
					}
					
					hist(libmaus::math::bitsPerNum(vmin));
				}
				if ( rest )
				{
					uint64_t vmin = *(in_it++);
					for ( unsigned int j = 1; j < rest; ++j )
					{
						uint64_t const vj = *(in_it++);
						if ( vj < vmin )
							vmin = vj;
					}
					
					hist(libmaus::math::bitsPerNum(vmin));
				}
				
				return UNIQUE_PTR_MOVE(phist);
			}