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" |
40 |
+ |
|
41 |
|
using namespace std; |
42 |
|
using namespace PlottingSetup; |
43 |
|
|
81 |
|
TCut cut; |
82 |
|
|
83 |
|
RooDataSet* AllData; |
84 |
< |
RooDataSet* SFSample; |
85 |
< |
RooDataSet* OFSample; |
84 |
> |
RooDataSet* eeSample; |
85 |
> |
RooDataSet* mmSample; |
86 |
> |
RooDataSet* OFSample; |
87 |
> |
RooDataSet* SFSample; |
88 |
|
|
89 |
|
bool MarcoDebug=true; |
90 |
|
|
99 |
|
bool AllowTriangle=true; |
100 |
|
} |
101 |
|
|
95 |
– |
TLatex* WriteAppleStudel() { |
96 |
– |
string sel="Apple Strudel Preliminary"; |
97 |
– |
TLatex *sele = new TLatex(0.97,0.135,sel.c_str()); |
98 |
– |
sele->SetNDC(true); |
99 |
– |
sele->SetTextColor(TColor::GetColor("#848484")); |
100 |
– |
sele->SetTextFont(42); |
101 |
– |
sele->SetTextAlign(32); |
102 |
– |
sele->SetTextSize(0.03); |
103 |
– |
sele->SetTextAngle(270); |
104 |
– |
return sele; |
105 |
– |
} |
106 |
– |
|
102 |
|
TGraph* EdgeFitter::prepareLM(float mass, float nEv) { |
103 |
|
float massLM[1]; |
104 |
|
massLM[0]=mass; |
278 |
|
|
279 |
|
} |
280 |
|
|
281 |
+ |
string GetSkimName(int isample) { |
282 |
+ |
return removefunnystring(allsamples.collection[isample].filename); |
283 |
+ |
} |
284 |
+ |
|
285 |
|
TTree* SkimTree(int isample) { |
286 |
< |
string TreeName = removefunnystring(allsamples.collection[isample].filename); |
286 |
> |
string TreeName = GetSkimName(isample); |
287 |
|
cout << "About to skim " << TreeName << " for sample id " << isample << endl; |
288 |
< |
TTree* newTree = new TTree("NanoTree",TreeName.c_str()); |
288 |
> |
TTree* newTree = new TTree(TreeName.c_str(),TreeName.c_str()); |
289 |
|
|
290 |
|
float mll,edgeWeight; |
291 |
|
int id1,id2; |
338 |
|
} |
339 |
|
|
340 |
|
TTree* MergeTrees(vector<TTree*> trees) { |
341 |
+ |
assert(trees.size()>0); |
342 |
|
TTree * newtree = (TTree*)trees[0]->CloneTree(0); |
343 |
|
newtree->SetTitle("FullTree"); |
344 |
|
newtree->SetName("FullTree"); |
368 |
|
|
369 |
|
void EdgeFitter::PrepareDatasets(int is_data) { |
370 |
|
write_warning(__FUNCTION__,"Need to make this function ready for scans as well (use signal from scan samples)"); |
371 |
< |
TFile *tempout = new TFile("tempout.root","RECREATE"); |
371 |
> |
|
372 |
> |
ensure_directory_exists(PlottingSetup::cbafbasedir+"/EdgeCache/"); |
373 |
> |
|
374 |
> |
stringstream FileName; |
375 |
> |
FileName << PlottingSetup::cbafbasedir << "/EdgeCache/" << md5((const char*)cut) << ".root"; |
376 |
> |
|
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); |
385 |
> |
CacheOverview << md5((const char*)cut) << ";" << (const char*) cut << endl; |
386 |
> |
CacheOverview.close(); |
387 |
> |
} |
388 |
> |
|
389 |
|
vector<TTree*> SkimmedTrees; |
390 |
|
TTree *SkimmedTree[(int)allsamples.collection.size()]; |
391 |
|
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
395 |
|
if(is_data!=1&&allsamples.collection[isample].is_data==true) continue;//kick all data samples when looking for MC |
396 |
|
if(is_data!=2&&allsamples.collection[isample].is_signal==true) continue;//remove signal sample if we don't want it. |
397 |
|
if(EdgeFitter::MarcoDebug) dout << "Considering : " << allsamples.collection[isample].samplename << endl; |
398 |
< |
SkimmedTree[isample] = SkimTree(isample); |
399 |
< |
tempout->cd(); |
400 |
< |
SkimmedTree[isample]->Write(); |
398 |
> |
|
399 |
> |
string SkimName = GetSkimName(isample); |
400 |
> |
SkimmedTree[isample] = (TTree*)fEdgeCache->Get(SkimName.c_str()); |
401 |
> |
if(!SkimmedTree[isample]) { |
402 |
> |
dout << "Need to generate tree for " << allsamples.collection[isample].filename << endl; |
403 |
> |
SkimmedTree[isample] = SkimTree(isample); |
404 |
> |
fEdgeCache->cd(); |
405 |
> |
SkimmedTree[isample]->Write(); |
406 |
> |
} else { |
407 |
> |
dout << "Loaded tree for " << allsamples.collection[isample].filename << " from cache file " << endl; |
408 |
> |
} |
409 |
> |
|
410 |
|
SkimmedTrees.push_back(SkimmedTree[isample]); |
411 |
|
} |
412 |
|
|
423 |
|
string title="CMS Data"; |
424 |
|
if(is_data!=1) title="CMS SIMULATION"; |
425 |
|
RooDataSet LAllData("LAllData",title.c_str(),completetree,observables,"","edgeWeight"); |
426 |
< |
tempout->cd(); |
427 |
< |
completetree->Write(); |
428 |
< |
tempout->Close(); |
429 |
< |
|
430 |
< |
EdgeFitter::SFSample = (RooDataSet*)LAllData.reduce("id1==id2"); |
426 |
> |
fEdgeCache->Close(); |
427 |
> |
dout << "Edge cache closed." << endl; |
428 |
> |
|
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 |
< |
SFSample->SetName("SFSample"); |
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 eemm sample = " << SFSample->sumEntries() << " (raw events : " << SFSample->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 |
|
|
456 |
|
} |
457 |
|
|
458 |
|
void EdgeFitter::DrawDatasetContent(int is_data) { |
459 |
< |
TCanvas* cSFdata = new TCanvas("cSFdata","cSFdata") ; |
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("SF 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 |
< |
SFSample->plotOn(frame1,RooFit::Name("SFdata")) ; |
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 |
< |
// THStack sf_ref = allsamples.DrawStack("sf_ref","mll",int((mllmax-mllmin)/5.0),mllmin,mllmax, "m_{ll} [GeV]", "events", cut&&TCut("id1==id2"),is_data, luminosity); |
473 |
< |
// THStack of_ref = allsamples.DrawStack("of_ref","mll",int((mllmax-mllmin)/5.0),mllmin,mllmax, "m_{ll} [GeV]", "events", cut&&TCut("id1!=id2"),is_data, luminosity); |
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 *sf_ref = allsamples.Draw("sf_ref","mll",int((mllmax-mllmin)/5.0),mllmin,mllmax, "m_{ll} [GeV]", "events", cut&&TCut("id1==id2"),is_data, luminosity); |
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 |
< |
TH1F *sf_fit = (TH1F*)SFSample->createHistogram("sf_fit",mll,RooFit::Binning(int((mllmax-mllmin)/5)),RooFit::SumW2Error(true)); |
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*)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(); |
490 |
< |
leg->AddEntry(sf_fit,"RooDataSet content","p"); |
491 |
< |
leg->SetX1(0.58); |
489 |
> |
TLegend *leg = make_legend(); |
490 |
> |
leg->AddEntry(ee_fit,"RooDataSet content","p"); |
491 |
> |
leg->AddEntry(ee_ref,"CBAF cross-check","f"); |
492 |
> |
leg->SetX1(0.5); |
493 |
> |
leg->SetY1(0.75); |
494 |
|
|
495 |
< |
cSFdata->cd() ; |
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 |
< |
sf_ref->Draw("histo,same"); |
501 |
< |
sf_fit->Draw("e1,same"); |
500 |
> |
ee_ref->Draw("histo,same"); |
501 |
> |
ee_fit->Draw("e1,same"); |
502 |
|
leg->Draw("same"); |
503 |
|
if(is_data==data) DrawPrelim(); |
504 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
505 |
< |
CompleteSave(cSFdata,"Edge/SF_NoFit"); |
505 |
> |
CompleteSave(ceedata,"Edge/PreFit_ee"); |
506 |
|
|
507 |
< |
TCanvas* cOFdata = new TCanvas("cOFdata","cOFdata") ; |
459 |
< |
cOFdata->cd() ; |
507 |
> |
ceedata->cd() ; |
508 |
|
gPad->SetLeftMargin(0.15); |
509 |
< |
frame2->SetMaximum(frame1->GetMaximum()); |
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/PreFit_mm"); |
518 |
+ |
|
519 |
+ |
TCanvas* cOFdata = new TCanvas("cOFdata","cOFdata") ; |
520 |
+ |
cOFdata->cd() ; |
521 |
+ |
gPad->SetLeftMargin(0.15); |
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 sf_fit; |
532 |
> |
delete ee_fit; |
533 |
> |
delete mm_fit; |
534 |
|
delete of_fit; |
535 |
|
|
536 |
< |
delete sf_ref; |
536 |
> |
delete ee_ref; |
537 |
> |
delete mm_ref; |
538 |
|
delete of_ref; |
476 |
– |
|
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 |
|
|
591 |
|
RooRealVar mll("mll","m_{ll}",mllmin,mllmax,"GeV/c^{2}"); |
592 |
|
RooRealVar edgeWeight("edgeWeight","edgeWeight",0,1000,""); |
593 |
|
RooCategory sample("sample","sample") ; |
594 |
< |
sample.defineType("SF"); |
595 |
< |
//sample.defineType("mm"); |
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 |
|
|
534 |
– |
//RooDataSet combData("combData","combined data",mll,Index(sample),Import("SF",*SFSample),Import("mm",*mmSample),Import("OF",*OFSample)); |
535 |
– |
RooDataSet combData("combData","combined data",RooArgSet(mll,edgeWeight),RooFit::Index(sample),RooFit::Import("SF",*SFSample),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", 0.8*OFSample->sumEntries(), 0, 1.2*OFSample->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); |
569 |
< |
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; |
584 |
– |
|
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 fzSF("fzSF", "fzSF", 39, 39, maxZ); |
710 |
< |
RooRealVar meanzSF("meanzSF", "meanzSF", 91.1876, 89, 95); |
596 |
< |
//RooRealVar sigmazSF("sigmazSF", "sigmazSF", 0.5); |
597 |
< |
RooRealVar sigmazSF("sigmazSF", "sigmazSF", 5, 0.5, 5); |
598 |
< |
RooRealVar widthzSF("widthzSF", "widthzSF", 2.94); |
599 |
< |
widthzSF.setConstant(1); |
600 |
< |
|
601 |
< |
/*RooRealVar fttbarSFx("fttbarSFx","fttbarSFx",0.2,1.8); |
602 |
< |
RooRealVar mRsfof("mRsfof","mRsfof",1.02); |
603 |
< |
RooRealVar wRsfof("wRsfof","wRsfof",0.07); |
604 |
< |
|
605 |
< |
RooGaussian RSFOF("RSFOF","RSFOF",fttbarSFx,mRsfof,wRsfof); |
606 |
< |
RooProdPdf fttbarSF("fttbarSF","fttbarOF*RSFOF",RooArgList(RSFOF,fttbarOF));*/ |
607 |
< |
RooRealVar fttbarSF("fttbarSF", "fttbarSF", fttbarOF.getVal(), 0.2*fttbarOF.getVal(), 1.5*fttbarOF.getVal()); |
708 |
> |
// Step 2b: set up the models! |
709 |
> |
RooRealVar eefrac("eefrac","eefrac",eeSample->sumEntries()/(eeSample->sumEntries()+mmSample->sumEntries())); |
710 |
> |
RooFormulaVar mmfrac("mmfrac","1-eefrac",RooArgSet(eefrac)); |
711 |
|
|
712 |
< |
RooRealVar par1ttbarSF("par1ttbarSF", "par1ttbarSF", 1.02*par1ttbarOF.getVal(), (1.02-0.07)*par1ttbarOF.getVal(), (1.02+0.07)*par1ttbarOF.getVal()); |
713 |
< |
|
714 |
< |
RooRealVar fsignalSF("fsignalSF", "fsignalSF", 0, 0, 300); |
715 |
< |
RooRealVar par1signalSF("par1signalSF", "par1signalSF", 45, 20, 100); |
613 |
< |
RooRealVar par2signalSF("par2signalSF", "par2signalSF", 2, 1, 10); |
614 |
< |
RooRealVar par3signalSF("par3signalSF", "par3signalSF", StartingMedge, 0, 300); |
615 |
< |
|
616 |
< |
RooVoigtian zSF("zSF", "zSF", mll, meanzSF, widthzSF, sigmazSF); |
617 |
< |
|
618 |
< |
if(EdgeFitter::FixedMEdge>0) par3signalSF.setConstant(); |
712 |
> |
RooRealVar rOneOverEMFrac("rOneOverEMFrac","rOneOverEMFrac",1.02,1.02-0.07,1.02+0.07); |
713 |
> |
RooRealVar rmean("rmean","rmean",1.02); |
714 |
> |
RooRealVar rwidth("rwidth","rwidth",0.07); |
715 |
> |
RooGaussian OneOverEMFrac("OneOverEMFrac","OneOverEMFrac",rOneOverEMFrac,rmean,rwidth); |
716 |
|
|
717 |
< |
RooSUSYBkgPdf ttbarSF("ttbarSF","ttbarSF", mll , par1ttbarSF, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
718 |
< |
RooSUSYTPdf signalSF("signalSF","signalSF", mll , par1signalSF, sigmazSF, par3signalSF); |
719 |
< |
|
720 |
< |
RooAddPdf model_SF("model_SF","model_SF", RooArgList(zSF, ttbarSF, signalSF), RooArgList(fzSF, fttbarSF, fsignalSF)); |
717 |
> |
|
718 |
> |
// FIRST: Drell-Yan: different parameters for resolution of DY (and of course yield), but same mean and so on |
719 |
> |
RooRealVar widthz("widthz", "widthz", 2.94); |
720 |
> |
widthz.setConstant(1); |
721 |
> |
RooRealVar meanz("meanz", "meanz", 91.1876, 89, 93); |
722 |
> |
RooRealVar fzSF("fzSF","fzSF",39,0,maxZ); |
723 |
> |
RooFormulaVar fzee("fzee","eefrac*fzSF",RooArgSet(eefrac,fzSF)); |
724 |
> |
RooFormulaVar fzmm("fzmm","mmfrac*fzSF",RooArgSet(mmfrac,fzSF)); |
725 |
> |
RooRealVar sigmazee("sigmazee", "sigmazee", 5, 0.5, 5); |
726 |
> |
RooRealVar sigmazmm("sigmazmm", "sigmazmm", 5, 0.5, 5); |
727 |
> |
|
728 |
> |
RooVoigtian zee("zee", "zee", mll, meanz, widthz, sigmazee); |
729 |
> |
RooVoigtian zmm("zmm", "zmm", mll, meanz, widthz, sigmazmm); |
730 |
|
|
731 |
|
|
732 |
+ |
|
733 |
+ |
//SECOND: Flavor-Symmetry contribution. Only relative fraction is different, all other parameters are the same; |
734 |
+ |
RooFormulaVar fttbaree("fttbaree","eefrac*fttbarOF*OneOverEMFrac",RooArgSet(eefrac,fttbarOF,OneOverEMFrac)); |
735 |
+ |
RooFormulaVar fttbarmm("fttbarmm","mmfrac*fttbarOF*OneOverEMFrac",RooArgSet(mmfrac,fttbarOF,OneOverEMFrac)); |
736 |
+ |
|
737 |
+ |
RooSUSYBkgPdf ttbaree("ttbaree","ttbaree", mll , par1ttbarOF, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
738 |
+ |
RooSUSYBkgPdf ttbarmm("ttbarmm","ttbarmm", mll , par1ttbarOF, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
739 |
+ |
RooAddPdf ttbarSF("ttbarSF","ttbarSF", RooArgList(ttbaree,ttbarmm), RooArgList(fttbaree,fttbarmm)); |
740 |
+ |
|
741 |
+ |
|
742 |
+ |
//for signal only the resolution and absolute fraction are different for ee / mm |
743 |
+ |
RooRealVar fsignal("fsignal", "fsignal", 0, 0, (eeSample->sumEntries()+mmSample->sumEntries()-OFSample->sumEntries())); |
744 |
+ |
RooFormulaVar fsignalee("fsignalee","eefrac*fsignal",RooArgSet(eefrac,fsignal)); |
745 |
+ |
RooFormulaVar fsignalmm("fsignalmm","mmfrac*fsignal",RooArgSet(mmfrac,fsignal)); |
746 |
+ |
|
747 |
+ |
RooRealVar par1signal("par1signal", "par1signal", 45, 20, 100); |
748 |
+ |
par1signal.setConstant(1); // doesn't have any effect. |
749 |
+ |
RooRealVar par3signal("par3signal", "par3signal", StartingMedge, 0, 300); // this is the edge position |
750 |
+ |
if(EdgeFitter::FixedMEdge>0) par3signal.setConstant(); |
751 |
+ |
|
752 |
+ |
RooSUSYTPdf signalee("signalee","signalee", mll , par1signal, sigmazee, par3signal); |
753 |
+ |
RooSUSYTPdf signalmm("signalmm","signalmm", mll , par1signal, sigmazmm, par3signal); |
754 |
+ |
RooAddPdf signalSF("signalSF","signalSF",RooArgList(signalee,signalmm),RooArgList(fsignalee,fsignalmm)); |
755 |
+ |
|
756 |
|
if(!EdgeFitter::AllowTriangle) { |
757 |
< |
fsignalSF.setVal(0.0); // kill off the signal if we don't want the triangle |
758 |
< |
fsignalSF.setConstant(1); |
759 |
< |
par1signalSF.setConstant(1); |
760 |
< |
par2signalSF.setConstant(1); |
631 |
< |
par3signalSF.setConstant(1); |
757 |
> |
fsignal.setVal(0.0); // kill off the signal if we don't want the triangle |
758 |
> |
fsignal.setConstant(1); |
759 |
> |
par1signal.setConstant(1); |
760 |
> |
par3signal.setConstant(1); |
761 |
|
} |
762 |
|
|
763 |
+ |
|
764 |
+ |
|
765 |
+ |
//COMPLETE MODEL: |
766 |
+ |
RooAddPdf model_ee("model_ee","model_ee", RooArgList(zee, ttbaree, signalee), RooArgList(fzee, fttbaree, fsignalee)); |
767 |
+ |
RooAddPdf model_mm("model_mm","model_mm", RooArgList(zmm, ttbarmm, signalmm), RooArgList(fzmm, fttbarmm, fsignalmm)); |
768 |
+ |
RooAddPdf model_SF("model_SF","model_SF",RooArgList(model_ee,model_mm),RooArgList(JustOne,JustOne)); |
769 |
+ |
|
770 |
+ |
|
771 |
+ |
// _____ _ ____ |
772 |
+ |
// / ____| | |___ \ |
773 |
+ |
// | (___ | |_ ___ _ __ __) | |
774 |
+ |
// \___ \| __/ _ \ '_ \ |__ < |
775 |
+ |
// ____) | || __/ |_) | ___) | |
776 |
+ |
// |_____/ \__\___| .__/ |____/ |
777 |
+ |
// | | |
778 |
+ |
// |_| |
779 |
+ |
// |
780 |
+ |
// Fitting |
781 |
+ |
|
782 |
|
RooSimultaneous simPdf("simPdf","simultaneous pdf",sample) ; |
783 |
< |
simPdf.addPdf(model_SF,"SF") ; |
783 |
> |
simPdf.addPdf(model_ee,"ee") ; |
784 |
> |
simPdf.addPdf(model_mm,"mm") ; |
785 |
|
simPdf.addPdf(model_OF,"OF") ; |
786 |
|
|
787 |
< |
|
787 |
> |
//RooFitResult *result = simPdf.fitTo(combData, RooFit::Save(), RooFit::Extended(),RooFit::Minos(true),RooFit::ExternalConstraints(OneOverEMFrac)); |
788 |
|
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save(), RooFit::Extended(),RooFit::Minos(true)); |
789 |
|
|
790 |
|
if(result->covQual()!=3) { |
801 |
|
result->Print(); |
802 |
|
dout << "============================= < /Full results > =============================" << endl; |
803 |
|
|
804 |
+ |
// _____ _ _ _ |
805 |
+ |
// / ____| | | || | |
806 |
+ |
// | (___ | |_ ___ _ __ | || |_ |
807 |
+ |
// \___ \| __/ _ \ '_ \ |__ _| |
808 |
+ |
// ____) | || __/ |_) | | | |
809 |
+ |
// |_____/ \__\___| .__/ |_| |
810 |
+ |
// | | |
811 |
+ |
// |_| |
812 |
+ |
// |
813 |
+ |
// Present results |
814 |
|
|
815 |
|
RooPlot* frame1 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("EE sample")) ; |
816 |
|
frame1->GetXaxis()->CenterTitle(1); |
817 |
|
frame1->GetYaxis()->CenterTitle(1); |
818 |
< |
combData.plotOn(frame1,RooFit::Name("SFdata"),RooFit::Cut("sample==sample::SF")) ; |
819 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("FullFit"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
820 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("TTbarSFonly"),RooFit::Components("ttbarSF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
821 |
< |
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("DYSFonly"),RooFit::Components("zSF"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
822 |
< |
if(EdgeFitter::AllowTriangle) simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("SignalSFonly"),RooFit::Components("signalSF"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
823 |
< |
|
824 |
< |
if(EdgeFitter::AllowTriangle) EdgeFitter::FixedMEdgeChi2_H1=frame1->chiSquare("FullFit", "SFdata", 3); |
825 |
< |
else EdgeFitter::FixedMEdgeChi2_H0=frame1->chiSquare("FullFit", "SFdata", 3); |
826 |
< |
|
827 |
< |
dout << "Result : " << endl; |
828 |
< |
if(EdgeFitter::AllowTriangle) dout << "f signal : " << fsignalSF.getVal() << " +/- " << fsignalSF.getError() << endl; |
829 |
< |
// dout << "f ttbar : " << fttbarSF.getVal() << " +/- " << fttbarSF.getError() << endl; |
830 |
< |
dout << "f ttbar : " << fttbarSF.getVal() << " +/- NO ERROR CUZ ITS A PDF "<< endl; |
831 |
< |
dout << "f tt OF : " << fttbarOF.getVal() << " +/- " << fttbarOF.getError() << endl; |
832 |
< |
dout << "f z SF : " << fzSF.getVal() << " +/- " << fzSF.getError() << endl; |
833 |
< |
if(EdgeFitter::AllowTriangle) dout << "#Chi^{2}/NDF : " << EdgeFitter::FixedMEdgeChi2_H1 << endl; |
675 |
< |
else dout << "#Chi^{2}/NDF : " << EdgeFitter::FixedMEdgeChi2_H0 << endl; |
818 |
> |
combData.plotOn(frame1,RooFit::Name("eedata"),RooFit::Cut("sample==sample::ee")) ; |
819 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("FullFitEE"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
820 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("TTbarEEonly"),RooFit::Components("ttbaree"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
821 |
> |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Name("DYEEonly"),RooFit::Components("zee"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
822 |
> |
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)); |
823 |
> |
|
824 |
> |
|
825 |
> |
RooPlot* frame2 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("mm sample")) ; |
826 |
> |
frame2->GetXaxis()->CenterTitle(1); |
827 |
> |
frame2->GetYaxis()->CenterTitle(1); |
828 |
> |
combData.plotOn(frame2,RooFit::Name("mmdata"),RooFit::Cut("sample==sample::mm")) ; |
829 |
> |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Name("FullFitMM"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
830 |
> |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Name("TTbarMMonly"),RooFit::Components("ttbarmm"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
831 |
> |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Name("DYMMonly"),RooFit::Components("zmm"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
832 |
> |
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)); |
833 |
> |
|
834 |
|
|
677 |
– |
// The same plot for the cointrol sample slice |
835 |
|
RooPlot* frame3 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")) ; |
836 |
|
frame3->GetXaxis()->CenterTitle(1); |
837 |
|
frame3->GetYaxis()->CenterTitle(1); |
838 |
< |
frame3->SetMaximum(frame1->GetMaximum()); |
839 |
< |
combData.plotOn(frame3,RooFit::Cut("sample==sample::OF")) ; |
840 |
< |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
841 |
< |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
842 |
< |
|
838 |
> |
combData.plotOn(frame3,RooFit::Name("OFdata"),RooFit::Cut("sample==sample::OF")) ; |
839 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Name("FullFitOF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
840 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Name("TTbarOFonly"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
841 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Name("DYOFonly"),RooFit::Components("zOF"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
842 |
> |
|
843 |
> |
RooAbsPdf *ee_result = simPdf.getPdf("ee"); |
844 |
> |
RooAbsPdf *mm_result = simPdf.getPdf("mm"); |
845 |
> |
RooAddPdf SF_result("SF_result","SF_result",RooArgList(*ee_result,*mm_result)); |
846 |
> |
|
847 |
> |
|
848 |
> |
TCanvas* g = new TCanvas("g","g") ; |
849 |
> |
|
850 |
> |
RooPlot* frame4 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("SF sample")) ; |
851 |
> |
frame4->GetXaxis()->CenterTitle(1); |
852 |
> |
frame4->GetYaxis()->CenterTitle(1); |
853 |
> |
EdgeFitter::SFSample->plotOn(frame4,RooFit::Name("SFdata")) ; |
854 |
> |
SF_result.plotOn(frame4,RooFit::Name("FullFitSF"),RooFit::ProjWData(*EdgeFitter::SFSample),RooFit::LineColor(kBlack)); |
855 |
> |
SF_result.plotOn(frame4,RooFit::Name("TTbarSFonly"),RooFit::ProjWData(*EdgeFitter::SFSample),RooFit::Components("ttbaree,ttbarmm"),RooFit::LineColor(kBlue),RooFit::LineStyle(kDashed)); |
856 |
> |
SF_result.plotOn(frame4,RooFit::Name("DYSFonly"),RooFit::ProjWData(*EdgeFitter::SFSample),RooFit::Components("zmm,zee"), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
857 |
> |
if(EdgeFitter::AllowTriangle) SF_result.plotOn(frame4,RooFit::Name("SignalSFonly"),RooFit::Components("signalee,signalmm"), RooFit::ProjWData(*EdgeFitter::SFSample), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
858 |
|
|
859 |
+ |
/// ******************************************************************************************************************************** |
860 |
|
TCanvas* c = new TCanvas("rf501_simultaneouspdf","rf403_simultaneouspdf") ; |
861 |
|
c->cd() ; |
862 |
|
gPad->SetLeftMargin(0.15); |
864 |
|
frame1->Draw(); |
865 |
|
if(is_data==data) DrawPrelim(); |
866 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
867 |
< |
stringstream infotext; |
868 |
< |
infotext << "#splitline{Fit results (" << EdgeFitter::Mode << ">" << jzb_cut << "): }{#splitline{"; |
869 |
< |
infotext << "N(Data) = " << EdgeFitter::SFSample->sumEntries() << "}{#splitline{"; |
870 |
< |
infotext << "N(Z+Jets) = " << WriteWithError(fzSF.getVal(),fzSF.getError(),3) << "}{#splitline{"; |
871 |
< |
//infotext << "N(t#bar{t}) = " << WriteWithError(fttbarSF.getVal(),fttbarSF.getError(),3) << "}{#splitline{"; |
872 |
< |
infotext << "N(t#bar{t}) = " << WriteWithError(fttbarSF.getVal(),0,3) << "}{#splitline{"; |
873 |
< |
write_warning(any2string(__LINE__),"Don't have the error yet, need to complete this"); |
874 |
< |
if(EdgeFitter::AllowTriangle) { |
875 |
< |
infotext << "N(signal) = " << WriteWithError(fsignalSF.getVal(),fsignalSF.getError(),3) << "}{"; |
876 |
< |
infotext << "m_{edge} = " << WriteWithError(par3signalSF.getVal(),par3signalSF.getError(),3) << "}}}}}"; |
877 |
< |
} else infotext << "}{}}}}}"; |
705 |
< |
|
706 |
< |
TLatex *infobox = new TLatex(0.57,0.75,infotext.str().c_str()); |
707 |
< |
infobox->SetNDC(); |
708 |
< |
infobox->SetTextSize(0.03); |
709 |
< |
infobox->Draw(); |
710 |
< |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(c,"Edge/"+prefix.str()+"_SF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
711 |
< |
else CompleteSave(c,"Edge/"+prefix.str()+"_SF",false,false); |
712 |
< |
delete c; |
867 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_ee",false,false); |
868 |
> |
stringstream eeFitParameterSummary; |
869 |
> |
eeFitParameterSummary << "#splitline{t#bar{t} : " << WriteWithError((OneOverEMFrac.getVal()*fttbarOF.getVal()*eefrac.getVal()),(OneOverEMFrac.getVal()*fttbarOF.getVal()*eefrac.getVal())*sqrt(pow(fttbarOF.getError()/fttbarOF.getVal(),2)+pow(eefrac.getError()/eefrac.getVal(),2)),3) << "}{";//no taking uncertainty on R(SF/OF) into consideration! |
870 |
> |
eeFitParameterSummary << "#splitline{DY : " << WriteWithError((fzSF.getVal()*eefrac.getVal()),(fzSF.getVal()*eefrac.getVal())*sqrt(pow(fzSF.getError()/fzSF.getVal(),2)+pow(eefrac.getError()/eefrac.getVal(),2)),3) << "}{"; |
871 |
> |
eeFitParameterSummary << "#splitline{signal : " << WriteWithError((fsignal.getVal()*eefrac.getVal()),(fsignal.getVal()*eefrac.getVal())*sqrt(pow(fsignal.getError()/fsignal.getVal(),2)+pow(eefrac.getError()/eefrac.getVal(),2)),3) << "}{"; |
872 |
> |
eeFitParameterSummary << "}}}"; |
873 |
> |
TLatex *eeFitinfobox = new TLatex(0.57,0.75,eeFitParameterSummary.str().c_str()); |
874 |
> |
eeFitinfobox->SetNDC(); |
875 |
> |
eeFitinfobox->SetTextSize(0.03); |
876 |
> |
eeFitinfobox->Draw(); |
877 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_ee__INFO",false,false); |
878 |
|
|
879 |
< |
TCanvas* e = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
880 |
< |
e->cd(); |
879 |
> |
c->cd() ; |
880 |
> |
gPad->SetLeftMargin(0.15); |
881 |
> |
frame2->GetYaxis()->SetTitleOffset(1.4); |
882 |
> |
frame2->Draw(); |
883 |
> |
if(is_data==data) DrawPrelim(); |
884 |
> |
else DrawPrelim(PlottingSetup::luminosity,true); |
885 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_mm",false,false); |
886 |
> |
stringstream mmFitParameterSummary; |
887 |
> |
mmFitParameterSummary << "#splitline{t#bar{t} : " << WriteWithError((OneOverEMFrac.getVal()*fttbarOF.getVal()*(1-eefrac.getVal())),(OneOverEMFrac.getVal()*fttbarOF.getVal()*(1-eefrac.getVal()))*sqrt(pow(fttbarOF.getError()/fttbarOF.getVal(),2)+pow(eefrac.getError()/(1-eefrac.getVal()),2)),3) << "}{";//no taking uncertainty on R(SF/OF) into consideration! |
888 |
> |
mmFitParameterSummary << "#splitline{DY : " << WriteWithError((fzSF.getVal()*(1-eefrac.getVal())),(fzSF.getVal()*(1-eefrac.getVal()))*sqrt(pow(fzSF.getError()/fzSF.getVal(),2)+pow(eefrac.getError()/(1-eefrac.getVal()),2)),3) << "}{"; |
889 |
> |
mmFitParameterSummary << "#splitline{signal : " << WriteWithError((fsignal.getVal()*(1-eefrac.getVal())),(fsignal.getVal()*(1-eefrac.getVal()))*sqrt(pow(fsignal.getError()/fsignal.getVal(),2)+pow(eefrac.getError()/(1-eefrac.getVal()),2)),3) << "}{"; |
890 |
> |
mmFitParameterSummary << "}}}"; |
891 |
> |
TLatex *mmFitinfobox = new TLatex(0.57,0.75,mmFitParameterSummary.str().c_str()); |
892 |
> |
mmFitinfobox->SetNDC(); |
893 |
> |
mmFitinfobox->SetTextSize(0.03); |
894 |
> |
mmFitinfobox->Draw(); |
895 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_mm__INFO",false,false); |
896 |
> |
|
897 |
> |
c->cd() ; |
898 |
|
gPad->SetLeftMargin(0.15); |
899 |
|
frame3->GetYaxis()->SetTitleOffset(1.4); |
900 |
|
frame3->Draw(); |
901 |
|
if(is_data==data) DrawPrelim(); |
902 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
903 |
< |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(e,"Edge/"+prefix.str()+"_OF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
904 |
< |
else CompleteSave(e,"Edge/"+prefix.str()+"_OF",false,false); |
905 |
< |
delete e; |
724 |
< |
|
725 |
< |
|
726 |
< |
|
727 |
< |
|
728 |
< |
/* TCanvas* f = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
729 |
< |
f->cd(); |
903 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_OF",false,false); |
904 |
> |
|
905 |
> |
c->cd() ; |
906 |
|
gPad->SetLeftMargin(0.15); |
907 |
|
frame4->GetYaxis()->SetTitleOffset(1.4); |
908 |
|
frame4->Draw(); |
909 |
|
if(is_data==data) DrawPrelim(); |
910 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
911 |
< |
CompleteSave(f,"Edge/"+prefix.str()+"_SF"); |
912 |
< |
delete f;*/ |
913 |
< |
|
911 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_SF",false,false); |
912 |
> |
stringstream SFFitParameterSummary; |
913 |
> |
SFFitParameterSummary << "#splitline{t#bar{t} : " << WriteWithError((OneOverEMFrac.getVal()*fttbarOF.getVal()),(OneOverEMFrac.getVal()*fttbarOF.getVal())*sqrt(pow(fttbarOF.getError()/fttbarOF.getVal(),2)),3) << "}{";//no taking uncertainty on R(SF/OF) into consideration! |
914 |
> |
SFFitParameterSummary << "#splitline{DY : " << WriteWithError((fzSF.getVal()),(fzSF.getVal())*sqrt(pow(fzSF.getError()/fzSF.getVal(),2)),3) << "}{"; |
915 |
> |
SFFitParameterSummary << "#splitline{signal : " << WriteWithError(fsignal.getVal(),(fsignal.getVal())*sqrt(pow(fsignal.getError()/fsignal.getVal(),2)),3) << "}{"; |
916 |
> |
SFFitParameterSummary << "}}}"; |
917 |
> |
TLatex *SFFitinfobox = new TLatex(0.57,0.75,SFFitParameterSummary.str().c_str()); |
918 |
> |
SFFitinfobox->SetNDC(); |
919 |
> |
SFFitinfobox->SetTextSize(0.03); |
920 |
> |
SFFitinfobox->Draw(); |
921 |
> |
CompleteSave(c,"Edge/"+prefix.str()+"_SF__INFO",false,false); |
922 |
|
|
923 |
< |
/* |
924 |
< |
float maxZ=200; |
741 |
< |
RooWorkspace* wspace = new RooWorkspace(); |
742 |
< |
stringstream mllvar; |
743 |
< |
mllvar << "mll[" << (mllmax-mllmin)/2 << "," << mllmin << "," << mllmax << "]"; |
744 |
< |
wspace->factory(mllvar.str().c_str()); |
745 |
< |
wspace->var("mll")->setBins(30); |
746 |
< |
wspace->factory("nSig[1.,0.,100.]"); |
747 |
< |
wspace->factory(("nZ[0.04.,0.,"+any2string(maxZ)+"]").c_str()); |
748 |
< |
wspace->factory("rME[1.12,1.05,1.19]"); |
749 |
< |
wspace->factory("effUncert[1.]"); |
750 |
< |
EdgeFitter::prepareLimits(wspace, true); |
751 |
< |
*/ |
923 |
> |
delete c; |
924 |
> |
/// ******************************************************************************************************************************** |
925 |
|
|
926 |
< |
write_warning(__FUNCTION__," A lot missing here to calculate limits"); |
926 |
> |
if(result->covQual()==3) { |
927 |
> |
if(EdgeFitter::AllowTriangle) EdgeFitter::FixedMEdgeChi2_H1=frame4->chiSquare("FullFitSF", "SFdata", 3); |
928 |
> |
else EdgeFitter::FixedMEdgeChi2_H0=frame4->chiSquare("FullFitSF", "SFdata", 3); |
929 |
> |
} |
930 |
|
|
931 |
|
} |
932 |
|
|
946 |
|
RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); |
947 |
|
|
948 |
|
|
773 |
– |
|
949 |
|
EdgeFitter::AllowTriangle=false; |
950 |
|
EdgeFitter::DoFit(is_data, jzb_cut); |
951 |
|
|
777 |
– |
write_info(__FUNCTION__,"TAKING SHORTCUT");return; |
778 |
– |
|
952 |
|
EdgeFitter::AllowTriangle=true; |
953 |
|
|
954 |
< |
bool ScanMassRange=false; |
954 |
> |
bool ScanMassRange=true; |
955 |
|
float ScanSteps=5.0;//GeV |
956 |
|
|
957 |
|
|