29 |
|
#include "RooStats/HypoTestInverterOriginal.h" |
30 |
|
|
31 |
|
//#include "ParametrizedEdge.C" |
32 |
+ |
#include "ExtendedMath.C" |
33 |
|
#include "EdgeModules/RooSUSYTPdf.cxx" |
34 |
|
#include "EdgeModules/RooSUSYBkgPdf.cxx" |
35 |
+ |
#include "EdgeModules/RooSUSYCompleteBkgPdf.cxx" |
36 |
+ |
|
37 |
|
|
38 |
|
#include "md5/md5.h" |
39 |
|
#include "md5/md5.C" |
83 |
|
RooDataSet* AllData; |
84 |
|
RooDataSet* eeSample; |
85 |
|
RooDataSet* mmSample; |
86 |
< |
RooDataSet* OFSample; |
86 |
> |
RooDataSet* OFSample; |
87 |
> |
RooDataSet* SFSample; |
88 |
|
|
89 |
|
bool MarcoDebug=true; |
90 |
|
|
374 |
|
stringstream FileName; |
375 |
|
FileName << PlottingSetup::cbafbasedir << "/EdgeCache/" << md5((const char*)cut) << ".root"; |
376 |
|
|
377 |
< |
TFile *fEdgeCache = new TFile(FileName.str().c_str(),"UPDATE"); |
377 |
> |
|
378 |
> |
TFile *fEdgeCache; |
379 |
> |
if(PlottingSetup::do_CleanCache) fEdgeCache = new TFile(FileName.str().c_str(),"RECREATE"); |
380 |
> |
else fEdgeCache = new TFile(FileName.str().c_str(),"UPDATE"); |
381 |
> |
|
382 |
|
if(fEdgeCache->GetNkeys()==0) { |
383 |
|
ofstream CacheOverview; |
384 |
|
CacheOverview.open((PlottingSetup::cbafbasedir+"/EdgeCache/CacheOverview").c_str(),ios::app); |
429 |
|
EdgeFitter::eeSample = (RooDataSet*)LAllData.reduce("id1==id2&&id1==0"); |
430 |
|
EdgeFitter::mmSample = (RooDataSet*)LAllData.reduce("id1==id2&&id1==1"); |
431 |
|
EdgeFitter::OFSample = (RooDataSet*)LAllData.reduce("id1!=id2"); |
432 |
+ |
EdgeFitter::SFSample = (RooDataSet*)LAllData.reduce("id1==id2"); |
433 |
|
EdgeFitter::AllData = (RooDataSet*)LAllData.reduce("id1!=id2||id1==id2"); |
434 |
|
|
435 |
+ |
|
436 |
|
eeSample->SetName("eeSample"); |
437 |
|
mmSample->SetName("mmSample"); |
438 |
|
OFSample->SetName("OFSample"); |
439 |
+ |
SFSample->SetName("SFSample"); |
440 |
|
AllData->SetName("AllData"); |
441 |
|
|
442 |
+ |
eeSample->SetTitle("eeSample"); |
443 |
+ |
mmSample->SetTitle("mmSample"); |
444 |
+ |
OFSample->SetTitle("OFSample"); |
445 |
+ |
SFSample->SetTitle("SFSample"); |
446 |
+ |
AllData->SetTitle("AllData"); |
447 |
+ |
|
448 |
|
if(EdgeFitter::MarcoDebug) { |
449 |
|
dout << "Number of (weighted) events in full sample = " << AllData->sumEntries() << " (raw events : " << AllData->numEntries() << ")" << endl; |
450 |
|
dout << "Number of (weighted) events in ee sample = " << eeSample->sumEntries() << " (raw events : " << eeSample->numEntries() << ")" << endl; |
451 |
|
dout << "Number of (weighted) events in mm sample = " << mmSample->sumEntries() << " (raw events : " << mmSample->numEntries() << ")" << endl; |
452 |
+ |
dout << "Number of (weighted) events in SF sample = " << SFSample->sumEntries() << " (raw events : " << SFSample->numEntries() << ")" << endl; |
453 |
|
dout << "Number of (weighted) events in em sample = " << OFSample->sumEntries() << " (raw events : " << OFSample->numEntries() << ")" << endl; |
454 |
|
} |
455 |
|
|
459 |
|
TCanvas* ceedata = new TCanvas("ceedata","ceedata") ; |
460 |
|
|
461 |
|
RooRealVar mll("mll","m_{ll}",mllmin,mllmax,"GeV/c^{2}"); |
462 |
< |
RooPlot* frame1 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("EE sample")) ; |
462 |
> |
RooPlot* frame1 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("ee sample")) ; |
463 |
|
frame1->GetXaxis()->CenterTitle(1); |
464 |
|
frame1->GetYaxis()->CenterTitle(1); |
465 |
< |
eeSample->plotOn(frame1,RooFit::Name("eedata")) ; |
465 |
> |
eeSample->plotOn(frame1,RooFit::Name("eedata")); |
466 |
|
|
467 |
< |
RooPlot* frame2 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")) ; |
467 |
> |
RooPlot* frame2 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("mm sample")) ; |
468 |
|
frame2->GetXaxis()->CenterTitle(1); |
469 |
|
frame2->GetYaxis()->CenterTitle(1); |
470 |
< |
OFSample->plotOn(frame2,RooFit::Name("OFdata")) ; |
470 |
> |
mmSample->plotOn(frame2,RooFit::Name("mmdata")); |
471 |
> |
|
472 |
> |
RooPlot* frame3 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")) ; |
473 |
> |
frame3->GetXaxis()->CenterTitle(1); |
474 |
> |
frame3->GetYaxis()->CenterTitle(1); |
475 |
> |
OFSample->plotOn(frame3,RooFit::Name("OFdata")); |
476 |
|
|
477 |
|
TH1F *ee_ref = allsamples.Draw("ee_ref","mll",int((mllmax-mllmin)/5.0),mllmin,mllmax, "m_{ll} [GeV]", "events", cut&&TCut("id1==id2&&id1==0"),is_data, luminosity); |
478 |
|
TH1F *mm_ref = allsamples.Draw("mm_ref","mll",int((mllmax-mllmin)/5.0),mllmin,mllmax, "m_{ll} [GeV]", "events", cut&&TCut("id1==id2&&id1==1"),is_data, luminosity); |
479 |
|
TH1F *of_ref = allsamples.Draw("of_ref","mll",int((mllmax-mllmin)/5.0),mllmin,mllmax, "m_{ll} [GeV]", "events", cut&&TCut("id1!=id2"),is_data, luminosity); |
480 |
|
|
481 |
+ |
ee_ref->SetFillColor(TColor::GetColor("#3ADF00")); |
482 |
+ |
mm_ref->SetFillColor(TColor::GetColor("#3ADF00")); |
483 |
+ |
of_ref->SetFillColor(TColor::GetColor("#3ADF00")); |
484 |
+ |
|
485 |
|
TH1F *ee_fit = (TH1F*)eeSample->createHistogram("ee_fit",mll,RooFit::Binning(int((mllmax-mllmin)/5)),RooFit::SumW2Error(true)); |
486 |
< |
TH1F *mm_fit = (TH1F*)eeSample->createHistogram("mm_fit",mll,RooFit::Binning(int((mllmax-mllmin)/5)),RooFit::SumW2Error(true)); |
486 |
> |
TH1F *mm_fit = (TH1F*)mmSample->createHistogram("mm_fit",mll,RooFit::Binning(int((mllmax-mllmin)/5)),RooFit::SumW2Error(true)); |
487 |
|
TH1F *of_fit = (TH1F*)OFSample->createHistogram("of_fit",mll,RooFit::Binning(int((mllmax-mllmin)/5)),RooFit::SumW2Error(true)); |
488 |
|
|
489 |
< |
TLegend *leg = allsamples.allbglegend(); |
489 |
> |
TLegend *leg = make_legend(); |
490 |
|
leg->AddEntry(ee_fit,"RooDataSet content","p"); |
491 |
< |
leg->SetX1(0.58); |
491 |
> |
leg->AddEntry(ee_ref,"CBAF cross-check","f"); |
492 |
> |
leg->SetX1(0.5); |
493 |
> |
leg->SetY1(0.75); |
494 |
|
|
495 |
|
ceedata->cd() ; |
496 |
|
gPad->SetLeftMargin(0.15); |
497 |
+ |
frame1->SetMaximum(1.2*frame1->GetMaximum()); |
498 |
|
frame1->GetYaxis()->SetTitleOffset(1.4); |
499 |
|
frame1->Draw(); |
500 |
|
ee_ref->Draw("histo,same"); |
502 |
|
leg->Draw("same"); |
503 |
|
if(is_data==data) DrawPrelim(); |
504 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
505 |
< |
CompleteSave(ceedata,"Edge/ee_NoFit"); |
505 |
> |
CompleteSave(ceedata,"Edge/PreFit_ee"); |
506 |
|
|
507 |
|
ceedata->cd() ; |
508 |
|
gPad->SetLeftMargin(0.15); |
509 |
< |
frame1->GetYaxis()->SetTitleOffset(1.4); |
510 |
< |
frame1->Draw(); |
509 |
> |
frame2->SetMaximum(1.2*frame2->GetMaximum()); |
510 |
> |
frame2->GetYaxis()->SetTitleOffset(1.4); |
511 |
> |
frame2->Draw(); |
512 |
|
mm_ref->Draw("histo,same"); |
513 |
|
mm_fit->Draw("e1,same"); |
514 |
|
leg->Draw("same"); |
515 |
|
if(is_data==data) DrawPrelim(); |
516 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
517 |
< |
CompleteSave(ceedata,"Edge/mm_NoFit"); |
517 |
> |
CompleteSave(ceedata,"Edge/PreFit_mm"); |
518 |
|
|
519 |
|
TCanvas* cOFdata = new TCanvas("cOFdata","cOFdata") ; |
520 |
|
cOFdata->cd() ; |
521 |
|
gPad->SetLeftMargin(0.15); |
522 |
< |
frame2->SetMaximum(frame1->GetMaximum()); |
523 |
< |
frame2->GetYaxis()->SetTitleOffset(1.4); |
524 |
< |
frame2->Draw(); |
522 |
> |
frame3->SetMaximum(1.2*frame3->GetMaximum()); |
523 |
> |
frame3->GetYaxis()->SetTitleOffset(1.4); |
524 |
> |
frame3->Draw(); |
525 |
|
of_ref->Draw("histo,same"); |
526 |
|
of_fit->Draw("e1,same"); |
527 |
|
leg->Draw("same"); |
528 |
|
if(is_data==data) DrawPrelim(); |
529 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
530 |
< |
CompleteSave(cOFdata,"Edge/OF_NoFit"); |
530 |
> |
CompleteSave(cOFdata,"Edge/PreFit_OF"); |
531 |
|
|
532 |
|
delete ee_fit; |
533 |
|
delete mm_fit; |
536 |
|
delete ee_ref; |
537 |
|
delete mm_ref; |
538 |
|
delete of_ref; |
508 |
– |
|
539 |
|
} |
540 |
|
|
541 |
|
string WriteWithError(float central, float error, int digits) { |
583 |
|
|
584 |
|
prefix << EdgeFitter::Mode << "_" << jzb_cut; |
585 |
|
|
586 |
+ |
if(!EdgeFitter::AllowTriangle && EdgeFitter::FixedMEdge>=0) prefix << "__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge); |
587 |
+ |
|
588 |
|
if(EdgeFitter::AllowTriangle) prefix << "__H1"; |
589 |
|
else prefix << "__H0"; |
590 |
|
|
594 |
|
sample.defineType("ee"); |
595 |
|
sample.defineType("mm"); |
596 |
|
sample.defineType("OF"); |
597 |
+ |
sample.defineType("SF"); |
598 |
+ |
|
599 |
+ |
RooDataSet combData("combData","combined data",RooArgSet(mll,edgeWeight),RooFit::Index(sample),RooFit::Import("ee",*eeSample),RooFit::Import("mm",*mmSample),RooFit::Import("OF",*OFSample),RooFit::Import("SF",*SFSample),RooFit::WeightVar(edgeWeight)); |
600 |
+ |
|
601 |
+ |
//------------------------------------------------------------------------------------------------------------------------------------ |
602 |
+ |
// _____ _ __ |
603 |
+ |
// / ____| | /_ | |
604 |
+ |
// | (___ | |_ ___ _ __ | | |
605 |
+ |
// \___ \| __/ _ \ '_ \ | | |
606 |
+ |
// ____) | || __/ |_) | | | |
607 |
+ |
// |_____/ \__\___| .__/ |_| |
608 |
+ |
// | | |
609 |
+ |
// |_| |
610 |
+ |
// |
611 |
+ |
// Fit OF to get good initial values for flavor-symmetric background |
612 |
|
|
566 |
– |
RooDataSet combData("combData","combined data",RooArgSet(mll,edgeWeight),RooFit::Index(sample),RooFit::Import("ee",*eeSample),RooFit::Import("mm",*mmSample),RooFit::Import("OF",*OFSample),RooFit::WeightVar(edgeWeight)); |
613 |
|
|
614 |
|
|
615 |
|
//First we make a fit to opposite flavor |
616 |
< |
RooRealVar fttbarOF("fttbarOF", "fttbarOF", 100, 0, 1.5*combData.sumEntries()); |
617 |
< |
RooRealVar par1ttbarOF("par1ttbarOF", "par1ttbarOF", 1.6, 0.01, 4.0); |
616 |
> |
RooRealVar fttbarOF("fttbarOF", "fttbarOF", OFSample->sumEntries(), 0, combData.sumEntries()); |
617 |
> |
RooRealVar par1ttbarOF("par1ttbarOF", "par1ttbarOF", 1.77, 0.01, 4.0); |
618 |
|
RooRealVar par2ttbarOF("par2ttbarOF", "par2ttbarOF", 1.0); |
619 |
< |
RooRealVar par3ttbarOF("par3ttbarOF", "par3ttbarOF", 0.028, 0.001, 1.0); |
619 |
> |
RooRealVar par3ttbarOF("par3ttbarOF", "par3ttbarOF", 0.0272, 0.001, 1.0); |
620 |
|
RooRealVar par4ttbarOF("par4ttbarOF", "par4ttbarOF", 2.0); |
621 |
|
RooSUSYBkgPdf ttbarOF("ttbarOF","ttbarOF", mll , par1ttbarOF, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
622 |
|
RooAddPdf model_OF("model_OF","model_OF", ttbarOF, fttbarOF); |
642 |
|
frameO->Draw(); |
643 |
|
if(is_data==data) DrawPrelim(); |
644 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
645 |
< |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(pof,"Edge/OF__OFFitonly_"+prefix.str()+"__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
600 |
< |
else CompleteSave(pof,"Edge/OF__OFFitonly_"+prefix.str(),false,false); |
645 |
> |
CompleteSave(pof,"Edge/OF__OFFitonly_"+prefix.str(),false,false); |
646 |
|
delete pof; |
647 |
+ |
|
648 |
+ |
TCanvas* pof2 = new TCanvas("pof2","pof2") ; |
649 |
+ |
pof2->cd(); |
650 |
+ |
gPad->SetLeftMargin(0.15); |
651 |
+ |
frameO->GetYaxis()->SetTitleOffset(1.4); |
652 |
+ |
frameO->Draw(); |
653 |
+ |
if(is_data==data) DrawPrelim(); |
654 |
+ |
else DrawPrelim(PlottingSetup::luminosity,true); |
655 |
+ |
stringstream OFFitParameterSummary; |
656 |
+ |
OFFitParameterSummary << "#splitline{ftbbarOF = " << WriteWithError(fttbarOF.getVal(),fttbarOF.getError(),3) << "}{"; |
657 |
+ |
OFFitParameterSummary << "#splitline{par1ttbarOF = " << WriteWithError(par1ttbarOF.getVal(),par1ttbarOF.getError(),3) << "}{"; |
658 |
+ |
OFFitParameterSummary << "#splitline{par2ttbarOF = " << WriteWithError(par2ttbarOF.getVal(),par2ttbarOF.getError(),3) << "}{"; |
659 |
+ |
OFFitParameterSummary << "#splitline{par3ttbarOF = " << WriteWithError(par3ttbarOF.getVal(),par3ttbarOF.getError(),3) << "}{"; |
660 |
+ |
OFFitParameterSummary << "par4ttbarOF = " << WriteWithError(par4ttbarOF.getVal(),par4ttbarOF.getError(),3); |
661 |
+ |
OFFitParameterSummary << "}}}}"; |
662 |
+ |
TLatex *OFFitinfobox = new TLatex(0.57,0.75,OFFitParameterSummary.str().c_str()); |
663 |
+ |
OFFitinfobox->SetNDC(); |
664 |
+ |
OFFitinfobox->SetTextSize(0.03); |
665 |
+ |
OFFitinfobox->Draw(); |
666 |
+ |
|
667 |
+ |
|
668 |
+ |
CompleteSave(pof2,"Edge/OF__OFFitonly_"+prefix.str()+"__INFO",false,false); |
669 |
+ |
|
670 |
+ |
delete pof2; |
671 |
|
|
672 |
|
if(resultOF->covQual()!=3) { |
673 |
|
write_error(__FUNCTION__,"OF fit did not converge!!! Cannot continue!"); |
679 |
|
write_info(__FUNCTION__,"OF fit converged"); |
680 |
|
} |
681 |
|
|
682 |
+ |
|
683 |
+ |
// _____ _ ___ |
684 |
+ |
// / ____| | |__ \ |
685 |
+ |
// | (___ | |_ ___ _ __ ) | |
686 |
+ |
// \___ \| __/ _ \ '_ \ / / |
687 |
+ |
// ____) | || __/ |_) | / /_ |
688 |
+ |
// |_____/ \__\___| .__/ |____| |
689 |
+ |
// | | |
690 |
+ |
// |_| |
691 |
+ |
// |
692 |
+ |
// Set up all the models |
693 |
+ |
|
694 |
+ |
|
695 |
+ |
// Step 2a: set up edge position (if fixed), and maximum Z yield |
696 |
|
float StartingMedge=70; |
697 |
|
if(EdgeFitter::FixedMEdge>0) StartingMedge=EdgeFitter::FixedMEdge; |
615 |
– |
|
698 |
|
|
699 |
|
RooDataSet *ZDataSet = (RooDataSet*)EdgeFitter::AllData->reduce("id1==id2 && abs(mll-91.2)<20"); |
700 |
|
|
702 |
|
dout << "maxZ was set to " << maxZ << endl; |
703 |
|
delete ZDataSet; |
704 |
|
|
705 |
+ |
RooRealVar JustOne("JustOne","Just One",1) ; |
706 |
+ |
|
707 |
|
|
708 |
< |
// Now same flavor |
709 |
< |
RooRealVar fzee("fzee", "fzee", 39, 39, maxZ); |
710 |
< |
RooRealVar meanzee("meanzee", "meanzee", 91.1876, 89, 95); |
708 |
> |
// Step 2b: set up the models! |
709 |
> |
write_info(__FUNCTION__,"ee & mm fractions fixed"); |
710 |
> |
/* RooRealVar eefrac("eefrac","eefrac",eeSample->sumEntries()/(eeSample->sumEntries()+mmSample->sumEntries()),0.1,1.0); |
711 |
> |
RooFormulaVar mmfrac("mmfrac","1-eefrac",RooArgSet(eefrac));*/ |
712 |
> |
RooRealVar eefrac("eefrac","eefrac",eeSample->sumEntries()/(eeSample->sumEntries()+mmSample->sumEntries())); |
713 |
> |
RooFormulaVar mmfrac("mmfrac","1-eefrac",RooArgSet(eefrac)); |
714 |
> |
|
715 |
> |
RooRealVar rOneOverEMFrac("rOneOverEMFrac","rOneOverEMFrac",1.02,1.02-0.07,1.02+0.07); |
716 |
> |
RooRealVar rmean("rmean","rmean",1.02); |
717 |
> |
RooRealVar rwidth("rwidth","rwidth",0.07); |
718 |
> |
RooGaussian OneOverEMFrac("OneOverEMFrac","OneOverEMFrac",rOneOverEMFrac,rmean,rwidth); |
719 |
> |
|
720 |
> |
|
721 |
> |
// FIRST: Drell-Yan: different parameters for resolution of DY (and of course yield), but same mean and so on |
722 |
> |
RooRealVar widthz("widthz", "widthz", 2.94); |
723 |
> |
widthz.setConstant(1); |
724 |
> |
RooRealVar meanz("meanz", "meanz", 91.1876, 89, 93); |
725 |
> |
RooRealVar fzSF("fzSF","fzSF",39,0,maxZ); |
726 |
> |
RooFormulaVar fzee("fzee","eefrac*fzSF",RooArgSet(eefrac,fzSF)); |
727 |
> |
RooFormulaVar fzmm("fzmm","mmfrac*fzSF",RooArgSet(mmfrac,fzSF)); |
728 |
|
RooRealVar sigmazee("sigmazee", "sigmazee", 5, 0.5, 5); |
628 |
– |
RooRealVar widthzee("widthzee", "widthzee", 2.94); |
629 |
– |
widthzee.setConstant(1); |
630 |
– |
|
631 |
– |
RooRealVar fzmm("fzmm", "fzmm", 39, 39, maxZ); |
632 |
– |
RooRealVar meanzmm("meanzmm", "meanzmm", 91.1876, 89, 95); |
729 |
|
RooRealVar sigmazmm("sigmazmm", "sigmazmm", 5, 0.5, 5); |
634 |
– |
RooRealVar widthzmm("widthzmm", "widthzmm", 2.94); |
635 |
– |
widthzmm.setConstant(1); |
730 |
|
|
731 |
< |
//for ttbar only the relative fraction are different - all other parameters are the same. |
732 |
< |
RooRealVar fttbaree("fttbaree", "fttbaree", fttbarOF.getVal(), 0.2*fttbarOF.getVal(), 1.5*fttbarOF.getVal()); |
733 |
< |
RooRealVar fttbarmm("fttbarmm", "fttbarmm", fttbarOF.getVal(), 0.2*fttbarOF.getVal(), 1.5*fttbarOF.getVal()); |
731 |
> |
RooVoigtian zee("zee", "zee", mll, meanz, widthz, sigmazee); |
732 |
> |
RooVoigtian zmm("zmm", "zmm", mll, meanz, widthz, sigmazmm); |
733 |
> |
RooAddPdf zSF("zSF","zSF",RooArgList(zee,zmm),RooArgList(fzee,fzmm)); |
734 |
> |
|
735 |
> |
|
736 |
> |
//SECOND: Flavor-Symmetry contribution. Only relative fraction is different, all other parameters are the same; |
737 |
> |
RooFormulaVar fttbaree("fttbaree","eefrac*fttbarOF*OneOverEMFrac",RooArgSet(eefrac,fttbarOF,OneOverEMFrac)); |
738 |
> |
RooFormulaVar fttbarmm("fttbarmm","mmfrac*fttbarOF*OneOverEMFrac",RooArgSet(mmfrac,fttbarOF,OneOverEMFrac)); |
739 |
> |
|
740 |
> |
RooSUSYBkgPdf ttbaree("ttbaree","ttbaree", mll , par1ttbarOF, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
741 |
> |
RooSUSYBkgPdf ttbarmm("ttbarmm","ttbarmm", mll , par1ttbarOF, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
742 |
> |
RooAddPdf ttbarSF("ttbarSF","ttbarSF", RooArgList(ttbaree,ttbarmm), RooArgList(fttbaree,fttbarmm)); |
743 |
> |
RooAddPdf ttbarSFOne("ttbarSF","ttbarSF", RooArgList(ttbaree,ttbarmm), RooArgList(JustOne,JustOne)); |
744 |
> |
|
745 |
|
|
641 |
– |
RooRealVar par1ttbaree("par1ttbaree", "par1ttbaree", 1.02*par1ttbarOF.getVal(), (1.02-0.07)*par1ttbarOF.getVal(), (1.02+0.07)*par1ttbarOF.getVal()); |
642 |
– |
RooRealVar par1ttbarmm("par1ttbarmm", "par1ttbarmm", 1.02*par1ttbarOF.getVal(), (1.02-0.07)*par1ttbarOF.getVal(), (1.02+0.07)*par1ttbarOF.getVal()); |
643 |
– |
|
746 |
|
//for signal only the resolution and absolute fraction are different for ee / mm |
747 |
< |
RooRealVar fsignalee("fsignalee", "fsignalee", 0, 0, 300); |
748 |
< |
RooRealVar fsignalmm("fsignalmm", "fsignalmm", 0, 0, 300); |
747 |
> |
RooRealVar fsignal("fsignal", "fsignal", 0, 0, 300); |
748 |
> |
RooFormulaVar fsignalee("fsignalee","eefrac*fsignal",RooArgSet(eefrac,fsignal)); |
749 |
> |
RooFormulaVar fsignalmm("fsignalmm","mmfrac*fsignal",RooArgSet(mmfrac,fsignal)); |
750 |
> |
|
751 |
> |
RooRealVar par1signal("par1signal", "par1signal", 45, 20, 100); |
752 |
> |
RooRealVar par3signal("par3signal", "par3signal", StartingMedge, 0, 300); |
753 |
> |
if(EdgeFitter::FixedMEdge>0) par3signal.setConstant(); |
754 |
> |
|
755 |
> |
RooSUSYTPdf signalee("signalee","signalee", mll , par1signal, sigmazee, par3signal); |
756 |
> |
RooSUSYTPdf signalmm("signalmm","signalmm", mll , par1signal, sigmazmm, par3signal); |
757 |
> |
RooAddPdf signalSF("signalSF","signalSF",RooArgList(signalee,signalmm),RooArgList(fsignalee,fsignalmm)); |
758 |
> |
|
759 |
> |
if(!EdgeFitter::AllowTriangle) { |
760 |
> |
fsignal.setVal(0.0); // kill off the signal if we don't want the triangle |
761 |
> |
fsignal.setConstant(1); |
762 |
> |
par1signal.setConstant(1); |
763 |
> |
par3signal.setConstant(1); |
764 |
> |
} |
765 |
|
|
648 |
– |
RooRealVar par1signalSF("par1signalSF", "par1signalSF", 45, 20, 100); |
649 |
– |
RooRealVar par2signalSF("par2signalSF", "par2signalSF", 2, 1, 10); |
650 |
– |
RooRealVar par3signalSF("par3signalSF", "par3signalSF", StartingMedge, 0, 300); |
651 |
– |
|
652 |
– |
RooVoigtian zee("zee", "zee", mll, meanzee, widthzee, sigmazee); |
653 |
– |
RooVoigtian zmm("zmm", "zmm", mll, meanzmm, widthzmm, sigmazmm); |
654 |
– |
|
655 |
– |
if(EdgeFitter::FixedMEdge>0) par3signalSF.setConstant(); |
766 |
|
|
767 |
< |
RooSUSYBkgPdf ttbaree("ttbaree","ttbaree", mll , par1ttbaree, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
768 |
< |
RooSUSYTPdf signalee("signalee","signalee", mll , par1signalSF, sigmazee, par3signalSF); |
767 |
> |
write_error(__FUNCTION__,"RnD version: fixing most parameters so the fit works very quickly (only one parameters instead of eight) !"); |
768 |
> |
// fttbarOF.setConstant(1); |
769 |
> |
fzSF.setConstant(1); |
770 |
> |
meanz.setConstant(1); |
771 |
> |
par1ttbarOF.setConstant(1); |
772 |
> |
par3ttbarOF.setConstant(1); |
773 |
> |
sigmazee.setConstant(1); |
774 |
> |
sigmazmm.setConstant(1); |
775 |
|
|
776 |
< |
RooSUSYBkgPdf ttbarmm("ttbarmm","ttbarmm", mll , par1ttbarmm, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
777 |
< |
RooSUSYTPdf signalmm("signalmm","signalmm", mll , par1signalSF, sigmazmm, par3signalSF); |
776 |
> |
|
777 |
> |
//COMPLETE MODEL: |
778 |
|
|
779 |
|
RooAddPdf model_ee("model_ee","model_ee", RooArgList(zee, ttbaree, signalee), RooArgList(fzee, fttbaree, fsignalee)); |
780 |
|
RooAddPdf model_mm("model_mm","model_mm", RooArgList(zmm, ttbarmm, signalmm), RooArgList(fzmm, fttbarmm, fsignalmm)); |
781 |
+ |
// RooAddPdf model_SF("model_SF","model_SF", RooArgList(zSF, ttbarSF, signalSF), RooArgList(fzSF, fttbarSF, fsignalSF)); |
782 |
+ |
RooAddPdf model_SF("model_SF","model_SF",RooArgList(model_ee,model_mm),RooArgList(JustOne,JustOne)); |
783 |
|
|
784 |
|
|
785 |
< |
if(!EdgeFitter::AllowTriangle) { |
786 |
< |
fsignalee.setVal(0.0); // kill off the signal if we don't want the triangle |
787 |
< |
fsignalee.setConstant(1); |
788 |
< |
fsignalmm.setVal(0.0); // kill off the signal if we don't want the triangle |
789 |
< |
fsignalmm.setConstant(1); |
790 |
< |
par1signalSF.setConstant(1); |
791 |
< |
par2signalSF.setConstant(1); |
792 |
< |
par3signalSF.setConstant(1); |
793 |
< |
} |
785 |
> |
// _____ _ ____ |
786 |
> |
// / ____| | |___ \ |
787 |
> |
// | (___ | |_ ___ _ __ __) | |
788 |
> |
// \___ \| __/ _ \ '_ \ |__ < |
789 |
> |
// ____) | || __/ |_) | ___) | |
790 |
> |
// |_____/ \__\___| .__/ |____/ |
791 |
> |
// | | |
792 |
> |
// |_| |
793 |
> |
// |
794 |
> |
// Fitting |
795 |
|
|
796 |
|
RooSimultaneous simPdf("simPdf","simultaneous pdf",sample) ; |
797 |
|
simPdf.addPdf(model_ee,"ee") ; |
798 |
|
simPdf.addPdf(model_mm,"mm") ; |
799 |
|
simPdf.addPdf(model_OF,"OF") ; |
800 |
|
|
682 |
– |
|
801 |
|
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save(), RooFit::Extended(),RooFit::Minos(true)); |
802 |
|
|
803 |
|
if(result->covQual()!=3) { |
814 |
|
result->Print(); |
815 |
|
dout << "============================= < /Full results > =============================" << endl; |
816 |
|
|
817 |
+ |
// _____ _ _ _ |
818 |
+ |
// / ____| | | || | |
819 |
+ |
// | (___ | |_ ___ _ __ | || |_ |
820 |
+ |
// \___ \| __/ _ \ '_ \ |__ _| |
821 |
+ |
// ____) | || __/ |_) | | | |
822 |
+ |
// |_____/ \__\___| .__/ |_| |
823 |
+ |
// | | |
824 |
+ |
// |_| |
825 |
+ |
// |
826 |
+ |
// Present results |
827 |
|
|
828 |
|
RooPlot* frame1 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("EE sample")) ; |
829 |
|
frame1->GetXaxis()->CenterTitle(1); |
830 |
|
frame1->GetYaxis()->CenterTitle(1); |
831 |
|
combData.plotOn(frame1,RooFit::Name("eedata"),RooFit::Cut("sample==sample::ee")) ; |
832 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("FullFit"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
833 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("TTbarSFonly"),RooFit::Components("ttbaree"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
834 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("DYSFonly"),RooFit::Components("zee"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
832 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("FullFitEE"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
833 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("TTbarEEonly"),RooFit::Components("ttbaree"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
834 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("DYEEonly"),RooFit::Components("zee"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
835 |
|
if(EdgeFitter::AllowTriangle) simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("SignalEEonly"),RooFit::Components("signalee"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
836 |
|
|
709 |
– |
if(EdgeFitter::AllowTriangle) EdgeFitter::FixedMEdgeChi2_H1=frame1->chiSquare("FullFit", "SFdata", 3); |
710 |
– |
else EdgeFitter::FixedMEdgeChi2_H0=frame1->chiSquare("FullFit", "SFdata", 3); |
711 |
– |
|
712 |
– |
dout << "Result : " << endl; |
713 |
– |
if(EdgeFitter::AllowTriangle) dout << "f signal : " << fsignalee.getVal() << " +/- " << fsignalee.getError() << endl; |
714 |
– |
if(EdgeFitter::AllowTriangle) dout << "f signal : " << fsignalmm.getVal() << " +/- " << fsignalmm.getError() << endl; |
715 |
– |
// dout << "f ttbar : " << fttbaree.getVal() << " +/- " << fttbaree.getError() << endl; |
716 |
– |
// dout << "f ttbar : " << fttbarmm.getVal() << " +/- " << fttbarmm.getError() << endl; |
717 |
– |
dout << "f ttbaree: " << fttbaree.getVal() << " +/- NO ERROR CUZ ITS A PDF "<< endl; |
718 |
– |
dout << "f ttbarmm: " << fttbarmm.getVal() << " +/- NO ERROR CUZ ITS A PDF "<< endl; |
719 |
– |
dout << "f tt OF : " << fttbarOF.getVal() << " +/- " << fttbarOF.getError() << endl; |
720 |
– |
dout << "f z ee : " << fzee.getVal() << " +/- " << fzee.getError() << endl; |
721 |
– |
dout << "f z mm : " << fzmm.getVal() << " +/- " << fzmm.getError() << endl; |
722 |
– |
if(EdgeFitter::AllowTriangle) dout << "#Chi^{2}/NDF : " << EdgeFitter::FixedMEdgeChi2_H1 << endl; |
723 |
– |
else dout << "#Chi^{2}/NDF : " << EdgeFitter::FixedMEdgeChi2_H0 << endl; |
837 |
|
|
838 |
< |
// The same plot for the cointrol sample slice |
838 |
> |
RooPlot* frame2 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("mm sample")) ; |
839 |
> |
frame2->GetXaxis()->CenterTitle(1); |
840 |
> |
frame2->GetYaxis()->CenterTitle(1); |
841 |
> |
combData.plotOn(frame2,RooFit::Name("mmdata"),RooFit::Cut("sample==sample::mm")) ; |
842 |
> |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Name("FullFitMM"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
843 |
> |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Name("TTbarMMonly"),RooFit::Components("ttbarmm"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
844 |
> |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Name("DYMMonly"),RooFit::Components("zmm"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
845 |
> |
if(EdgeFitter::AllowTriangle) simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Name("SignalMMonly"),RooFit::Components("signalmm"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
846 |
> |
|
847 |
> |
|
848 |
|
RooPlot* frame3 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")) ; |
849 |
|
frame3->GetXaxis()->CenterTitle(1); |
850 |
|
frame3->GetYaxis()->CenterTitle(1); |
851 |
< |
frame3->SetMaximum(frame1->GetMaximum()); |
852 |
< |
combData.plotOn(frame3,RooFit::Cut("sample==sample::OF")) ; |
853 |
< |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
854 |
< |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
855 |
< |
|
851 |
> |
combData.plotOn(frame3,RooFit::Name("OFdata"),RooFit::Cut("sample==sample::OF")) ; |
852 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Name("FullFitOF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
853 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Name("TTbarOFonly"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
854 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Name("DYOFonly"),RooFit::Components("zOF"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
855 |
> |
|
856 |
> |
RooAbsPdf *ee_result = simPdf.getPdf("ee"); |
857 |
> |
RooAbsPdf *mm_result = simPdf.getPdf("mm"); |
858 |
> |
RooAddPdf SF_result("SF_result","SF_result",RooArgList(*ee_result,*mm_result)); |
859 |
> |
|
860 |
> |
|
861 |
> |
TCanvas* g = new TCanvas("g","g") ; |
862 |
> |
|
863 |
> |
RooPlot* frame4 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("SF sample")) ; |
864 |
> |
frame4->GetXaxis()->CenterTitle(1); |
865 |
> |
frame4->GetYaxis()->CenterTitle(1); |
866 |
> |
EdgeFitter::SFSample->plotOn(frame4,RooFit::Name("SFdata")) ; |
867 |
> |
SF_result.plotOn(frame4,RooFit::Name("FullFitSF"),RooFit::ProjWData(*EdgeFitter::SFSample),RooFit::LineColor(kBlack)); |
868 |
> |
SF_result.plotOn(frame4,RooFit::Name("TTbarSFonly"),RooFit::ProjWData(*EdgeFitter::SFSample),RooFit::Components("ttbaree,ttbarmm"),RooFit::LineColor(kBlue),RooFit::LineStyle(kDashed)); |
869 |
> |
SF_result.plotOn(frame4,RooFit::Name("DYSFonly"),RooFit::ProjWData(*EdgeFitter::SFSample),RooFit::Components("zmm,zee"), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
870 |
> |
if(EdgeFitter::AllowTriangle) SF_result.plotOn(frame4,RooFit::Name("SignalSFonly"),RooFit::Components("signalSF"), RooFit::ProjWData(*EdgeFitter::SFSample), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
871 |
|
|
872 |
+ |
/// ******************************************************************************************************************************** |
873 |
|
TCanvas* c = new TCanvas("rf501_simultaneouspdf","rf403_simultaneouspdf") ; |
874 |
|
c->cd() ; |
875 |
|
gPad->SetLeftMargin(0.15); |
877 |
|
frame1->Draw(); |
878 |
|
if(is_data==data) DrawPrelim(); |
879 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
880 |
< |
stringstream infotext; |
743 |
< |
infotext << "#splitline{Fit results (" << EdgeFitter::Mode << ">" << jzb_cut << "): }{#splitline{"; |
744 |
< |
infotext << "N(Data) = " << EdgeFitter::eeSample->sumEntries()+EdgeFitter::mmSample->sumEntries() << "}{#splitline{"; |
745 |
< |
infotext << "N(Z+Jets) = " << WriteWithError(fzee.getVal()+fzmm.getVal(),sqrt(pow(fzee.getError(),2)+pow(fzmm.getError(),2)),3) << "}{#splitline{"; |
746 |
< |
//infotext << "N(t#bar{t}) = " << WriteWithError(fttbarSF.getVal(),fttbarSF.getError(),3) << "}{#splitline{"; |
747 |
< |
infotext << "N(t#bar{t}) = " << WriteWithError(fttbaree.getVal()+fttbarmm.getVal(),0,3) << "}{#splitline{"; |
748 |
< |
write_warning(any2string(__LINE__),"Don't have the error yet, need to complete this"); |
749 |
< |
if(EdgeFitter::AllowTriangle) { |
750 |
< |
infotext << "N(signal) = " << WriteWithError(fsignalee.getVal()+fsignalmm.getVal(),sqrt(pow(fsignalee.getError(),2)+pow(fsignalmm.getError(),2)),3) << "}{"; |
751 |
< |
infotext << "m_{edge} = " << WriteWithError(par3signalSF.getVal(),par3signalSF.getError(),3) << "}}}}}"; |
752 |
< |
} else infotext << "}{}}}}}"; |
753 |
< |
|
754 |
< |
TLatex *infobox = new TLatex(0.57,0.75,infotext.str().c_str()); |
755 |
< |
infobox->SetNDC(); |
756 |
< |
infobox->SetTextSize(0.03); |
757 |
< |
infobox->Draw(); |
758 |
< |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(c,"Edge/"+prefix.str()+"_SF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
759 |
< |
else CompleteSave(c,"Edge/"+prefix.str()+"_SF",false,false); |
760 |
< |
delete c; |
880 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_ee",false,false); |
881 |
|
|
882 |
< |
TCanvas* e = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
883 |
< |
e->cd(); |
882 |
> |
c->cd() ; |
883 |
> |
gPad->SetLeftMargin(0.15); |
884 |
> |
frame2->GetYaxis()->SetTitleOffset(1.4); |
885 |
> |
frame2->Draw(); |
886 |
> |
if(is_data==data) DrawPrelim(); |
887 |
> |
else DrawPrelim(PlottingSetup::luminosity,true); |
888 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_mm",false,false); |
889 |
> |
|
890 |
> |
c->cd() ; |
891 |
|
gPad->SetLeftMargin(0.15); |
892 |
|
frame3->GetYaxis()->SetTitleOffset(1.4); |
893 |
|
frame3->Draw(); |
894 |
|
if(is_data==data) DrawPrelim(); |
895 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
896 |
< |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(e,"Edge/"+prefix.str()+"_OF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
897 |
< |
else CompleteSave(e,"Edge/"+prefix.str()+"_OF",false,false); |
898 |
< |
delete e; |
772 |
< |
|
773 |
< |
|
774 |
< |
|
775 |
< |
|
776 |
< |
/* TCanvas* f = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
777 |
< |
f->cd(); |
896 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_OF",false,false); |
897 |
> |
|
898 |
> |
c->cd() ; |
899 |
|
gPad->SetLeftMargin(0.15); |
900 |
|
frame4->GetYaxis()->SetTitleOffset(1.4); |
901 |
|
frame4->Draw(); |
902 |
|
if(is_data==data) DrawPrelim(); |
903 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
904 |
< |
CompleteSave(f,"Edge/"+prefix.str()+"_SF"); |
784 |
< |
delete f;*/ |
785 |
< |
|
904 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_SF",false,false); |
905 |
|
|
906 |
< |
/* |
907 |
< |
float maxZ=200; |
789 |
< |
RooWorkspace* wspace = new RooWorkspace(); |
790 |
< |
stringstream mllvar; |
791 |
< |
mllvar << "mll[" << (mllmax-mllmin)/2 << "," << mllmin << "," << mllmax << "]"; |
792 |
< |
wspace->factory(mllvar.str().c_str()); |
793 |
< |
wspace->var("mll")->setBins(30); |
794 |
< |
wspace->factory("nSig[1.,0.,100.]"); |
795 |
< |
wspace->factory(("nZ[0.04.,0.,"+any2string(maxZ)+"]").c_str()); |
796 |
< |
wspace->factory("rME[1.12,1.05,1.19]"); |
797 |
< |
wspace->factory("effUncert[1.]"); |
798 |
< |
EdgeFitter::prepareLimits(wspace, true); |
799 |
< |
*/ |
906 |
> |
delete c; |
907 |
> |
/// ******************************************************************************************************************************** |
908 |
|
|
909 |
< |
write_warning(__FUNCTION__," A lot missing here to calculate limits"); |
909 |
> |
|
910 |
> |
// if(EdgeFitter::AllowTriangle) EdgeFitter::FixedMEdgeChi2_H1=frame2->chiSquare("FullFit", "EEdata", 3); |
911 |
> |
// else EdgeFitter::FixedMEdgeChi2_H0=frame2->chiSquare("FullFit", "EEdata", 3); |
912 |
> |
|
913 |
> |
|
914 |
|
|
915 |
|
} |
916 |
|
|
933 |
|
EdgeFitter::AllowTriangle=false; |
934 |
|
EdgeFitter::DoFit(is_data, jzb_cut); |
935 |
|
|
824 |
– |
write_info(__FUNCTION__,"TAKING SHORTCUT");return; |
825 |
– |
|
936 |
|
EdgeFitter::AllowTriangle=true; |
937 |
|
|
938 |
|
bool ScanMassRange=false; |