75 |
|
RooDataSet* OFSample; |
76 |
|
|
77 |
|
bool MarcoDebug=true; |
78 |
+ |
|
79 |
+ |
float FixedMEdge=-1; |
80 |
+ |
float FixedMEdgeChi2=-1; |
81 |
+ |
|
82 |
|
} |
83 |
|
|
84 |
|
TGraph* EdgeFitter::prepareLM(float mass, float nEv) { |
442 |
|
RooAddPdf model_OF("model_OF","model_OF", ttbarOF, fttbarOF); |
443 |
|
RooSimultaneous simPdfOF("simPdfOF","simultaneous pdf", sample) ; |
444 |
|
simPdfOF.addPdf(model_OF,"OF"); |
445 |
< |
RooFitResult *resultOF = simPdfOF.fitTo(combData, RooFit::Save()); |
445 |
> |
RooFitResult *resultOF = simPdfOF.fitTo(combData, RooFit::Save(),RooFit::Extended()); |
446 |
|
resultOF->Print(); |
447 |
|
|
448 |
|
RooRealVar* resultOFpar1_ = (RooRealVar*) resultOF->floatParsFinal().find("par1ttbarOF"); |
457 |
|
//RooRealVar* resultOFpar4_ = (RooRealVar*) resultOF->floatParsFinal().find("par4ttbarOF"); |
458 |
|
//float resultOFpar4 = resultOFpar4_->getVal(); |
459 |
|
//cout << "caca4.txt" << endl; |
460 |
+ |
|
461 |
+ |
float StartingMedge=70; |
462 |
+ |
if(EdgeFitter::FixedMEdge>0) StartingMedge=EdgeFitter::FixedMEdge; |
463 |
|
|
464 |
|
|
465 |
|
// Now same flavor |
478 |
|
RooRealVar fsignalSF("fsignalSF", "fsignalSF", 10, 0, 300); |
479 |
|
RooRealVar par1signalSF("par1signalSF", "par1signalSF", 45, 20, 100); |
480 |
|
RooRealVar par2signalSF("par2signalSF", "par2signalSF", 2, 1, 10); |
481 |
< |
RooRealVar par3signalSF("par3signalSF", "par3signalSF", 70, 0, 300); |
481 |
> |
RooRealVar par3signalSF("par3signalSF", "par3signalSF", StartingMedge, 0, 300); |
482 |
|
|
483 |
|
RooVoigtian zSF("zSF", "zSF", mll, meanzSF, widthzSF, sigmazSF); |
484 |
|
|
485 |
+ |
if(EdgeFitter::FixedMEdge>0) par3signalSF.setConstant(); |
486 |
|
|
487 |
|
RooSUSYBkgPdf ttbarSF("ttbarSF","ttbarSF", mll , par1ttbarSF, par2ttbarSF, par3ttbarSF, par4ttbarSF); |
488 |
|
//RooSUSYTPdf signalSF("signalSF","signalSF", mll , par1signalSF, par2signalSF, par3signalSF); |
503 |
|
simPdf.addPdf(model_SF,"SF") ; |
504 |
|
simPdf.addPdf(model_em,"em") ; |
505 |
|
|
506 |
< |
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save()); |
506 |
> |
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save(), RooFit::Extended()); |
507 |
|
result->Print(); |
508 |
|
|
509 |
|
RooPlot* frame1 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("EE sample")) ; |
510 |
|
frame1->GetXaxis()->CenterTitle(1); |
511 |
< |
combData.plotOn(frame1,RooFit::Cut("sample==sample::SF")) ; |
512 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
513 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Components("ttbarSF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
514 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Components("zSF"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
515 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Components("signalSF"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
516 |
< |
|
517 |
< |
|
511 |
> |
combData.plotOn(frame1,RooFit::Name("SFdata"),RooFit::Cut("sample==sample::SF")) ; |
512 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("FullFit"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
513 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("TTbarSFonly"),RooFit::Components("ttbarSF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
514 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("DYSFonly"),RooFit::Components("zSF"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
515 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("SignalSFonly"),RooFit::Components("signalSF"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
516 |
> |
|
517 |
> |
EdgeFitter::FixedMEdgeChi2 = frame1->chiSquare("FullFit", "SFdata", 3); |
518 |
> |
|
519 |
|
|
520 |
|
cout << "Result : " << endl; |
521 |
|
cout << "f signal : " << fsignalSF.getVal() << " +/- " << fsignalSF.getError() << endl; |
522 |
|
cout << "f ttbar : " << fttbarSF.getVal() << " +/- " << fttbarSF.getError() << endl; |
523 |
|
cout << "f tt OF : " << fttbarOF.getVal() << " +/- " << fttbarOF.getError() << endl; |
524 |
|
cout << "f z SF : " << fzSF.getVal() << " +/- " << fzSF.getError() << endl; |
525 |
+ |
cout << "#Chi^{2}/NDF : " << EdgeFitter::FixedMEdgeChi2 << endl; |
526 |
|
|
527 |
|
// The same plot for the cointrol sample slice |
528 |
|
RooPlot* frame3 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")) ; |
551 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
552 |
|
stringstream infotext; |
553 |
|
infotext << "#splitline{Fit results (JZB>" << jzb_cut << "): }{#splitline{"; |
554 |
< |
infotext << "N(Data) = " << combData.sumEntries() << "}{#splitline{"; |
554 |
> |
infotext << "N(Data) = " << EdgeFitter::SFSample->numEntries() << "}{#splitline{"; |
555 |
|
infotext << "N(Z+Jets) = " << WriteWithError(fzSF.getVal(),fzSF.getError(),3) << "}{#splitline{"; |
556 |
|
infotext << "N(t#bar{t}) = " << WriteWithError(fttbarSF.getVal(),fttbarSF.getError(),3) << "}{#splitline{"; |
557 |
|
infotext << "N(signal) = " << WriteWithError(fsignalSF.getVal(),fsignalSF.getError(),3) << "}{"; |
561 |
|
infobox->SetNDC(); |
562 |
|
infobox->SetTextSize(0.03); |
563 |
|
infobox->Draw(); |
564 |
< |
CompleteSave(c,"Edge/"+prefix.str()+"_SF"); |
564 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_SF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
565 |
|
delete c; |
566 |
|
|
567 |
|
TCanvas* e = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
571 |
|
frame3->Draw(); |
572 |
|
if(is_data==data) DrawPrelim(); |
573 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
574 |
< |
CompleteSave(e,"Edge/"+prefix.str()+"_OF"); |
574 |
> |
CompleteSave(e,"Edge/"+prefix.str()+"_OF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
575 |
|
delete e; |
576 |
|
|
577 |
|
|
619 |
|
RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelow(); |
620 |
|
RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); |
621 |
|
write_warning(__FUNCTION__,"Deactivated actual fitting procedure ATM"); |
622 |
+ |
|
623 |
+ |
|
624 |
+ |
bool ScanMassRange=true; |
625 |
+ |
|
626 |
+ |
|
627 |
+ |
|
628 |
+ |
if(ScanMassRange) { |
629 |
+ |
TFile *fscan = new TFile("fscan.root","UPDATE"); |
630 |
+ |
TGraph *gr = new TGraph(); |
631 |
+ |
stringstream GrName; |
632 |
+ |
GrName << "ScanGraphFor_JZB_" << jzb_cut; |
633 |
+ |
gr->SetName(GrName.str().c_str()); |
634 |
+ |
|
635 |
+ |
int i=0; |
636 |
+ |
for(float tempMedge=10;tempMedge<=300;tempMedge+=5.0) { |
637 |
+ |
write_info(__FUNCTION__,"Now testing Medge="+any2string(tempMedge)+" for JZB>"+any2string(jzb_cut)); |
638 |
+ |
EdgeFitter::FixedMEdge=tempMedge; |
639 |
+ |
EdgeFitter::DoFit(is_data, jzb_cut); |
640 |
+ |
gr->SetPoint(i,tempMedge,EdgeFitter::FixedMEdgeChi2); |
641 |
+ |
i++; |
642 |
+ |
} |
643 |
+ |
|
644 |
+ |
TCanvas *ScanCan = new TCanvas("ScanCan","ScanCan",500,500); |
645 |
+ |
gr->GetXaxis()->SetTitle("m_{edge}"); |
646 |
+ |
gr->GetXaxis()->CenterTitle(); |
647 |
+ |
gr->GetYaxis()->SetTitle("#Chi^{2} / NDF"); |
648 |
+ |
gr->GetYaxis()->CenterTitle(); |
649 |
+ |
gr->GetYaxis()->SetTitleOffset(0.95); |
650 |
+ |
gr->GetXaxis()->SetTitleOffset(0.9); |
651 |
+ |
gr->SetLineColor(kBlue); |
652 |
+ |
gr->SetTitle(""); |
653 |
+ |
gr->Draw("AL"); |
654 |
+ |
stringstream ScanCanSave; |
655 |
+ |
ScanCanSave << "Edge/MEdgeScan_JZB_" << jzb_cut; |
656 |
+ |
if(is_data) DrawPrelim(); |
657 |
+ |
else DrawMCPrelim(); |
658 |
+ |
CompleteSave(ScanCan,ScanCanSave.str()); |
659 |
+ |
fscan->cd(); |
660 |
+ |
gr->Write(); |
661 |
+ |
delete ScanCan; |
662 |
+ |
fscan->Close(); |
663 |
+ |
} else { |
664 |
+ |
EdgeFitter::DoFit(is_data, jzb_cut); |
665 |
+ |
} |
666 |
+ |
|
667 |
+ |
|
668 |
+ |
|
669 |
+ |
|
670 |
|
EdgeFitter::DoFit(is_data, jzb_cut); |
671 |
|
RooMsgService::instance().setGlobalKillBelow(msglevel); |
672 |
|
|