56 |
|
void getMedianLimit(RooWorkspace *ws,vector<RooDataSet> theToys,float &median,float &sigmaDown, float &sigmaUp, float &twoSigmaDown, float &twoSigmaUp); |
57 |
|
void InitializeVariables(float _mllmin, float _mllmax, float _jzbmax, TCut _cut); |
58 |
|
void PrepareDatasets(int); |
59 |
+ |
void DrawDatasetContent(int); |
60 |
|
void DoFit(int is_data, float jzb_cut); |
61 |
|
string RandomStorageFile(); |
62 |
|
Yield Get_Z_estimate(float,int); |
80 |
|
float FixedMEdge=-1; |
81 |
|
float FixedMEdgeChi2=-1; |
82 |
|
|
83 |
+ |
bool RejectPointIfNoConvergence=false; |
84 |
+ |
|
85 |
+ |
string Mode="UndefinedMode"; |
86 |
+ |
|
87 |
|
} |
88 |
|
|
89 |
|
TGraph* EdgeFitter::prepareLM(float mass, float nEv) { |
266 |
|
} |
267 |
|
|
268 |
|
TTree* SkimTree(int isample) { |
269 |
< |
TTree* newTree = allsamples.collection[isample].events->CloneTree(0); |
269 |
> |
string TreeName = allsamples.collection[isample].filename; |
270 |
> |
TTree* newTree = new TTree("NanoTree",TreeName.c_str()); |
271 |
> |
|
272 |
> |
float mll,edgeWeight; |
273 |
> |
int id1,id2; |
274 |
> |
|
275 |
> |
newTree->Branch("edgeWeight",&edgeWeight,"edgeWeight/F"); |
276 |
> |
newTree->Branch("mll",&mll,"mll/F"); |
277 |
> |
newTree->Branch("id1",&id1,"id1/I"); |
278 |
> |
newTree->Branch("id2",&id2,"id2/I"); |
279 |
> |
|
280 |
|
float xsweight=1.0; |
281 |
|
if(allsamples.collection[isample].is_data==false) xsweight=luminosity*allsamples.collection[isample].weight; |
282 |
|
if(EdgeFitter::MarcoDebug) { |
283 |
|
cout << " Original tree contains " << allsamples.collection[isample].events->GetEntries() << endl; |
284 |
|
cout << " Going to reduce it with cut " << EdgeFitter::cut << endl; |
285 |
|
} |
286 |
< |
float edgeWeight; |
272 |
< |
newTree->Branch("edgeWeight",&edgeWeight,"edgeWeight/F"); |
286 |
> |
|
287 |
|
float tmll; |
288 |
+ |
int tid1,tid2; |
289 |
|
allsamples.collection[isample].events->SetBranchAddress("mll",&tmll); |
290 |
< |
// int id1,id2; |
290 |
> |
allsamples.collection[isample].events->SetBranchAddress("id1",&tid1); |
291 |
> |
allsamples.collection[isample].events->SetBranchAddress("id2",&tid2); |
292 |
|
|
293 |
|
TTreeFormula *select = new TTreeFormula("select", EdgeFitter::cut, allsamples.collection[isample].events); |
294 |
|
TTreeFormula *Weight = new TTreeFormula("Weight", cutWeight, allsamples.collection[isample].events); |
295 |
+ |
|
296 |
|
float wgt=1.0; |
280 |
– |
// allsamples.collection[isample].events->SetBranchAddress(cutWeight,&wgt); |
297 |
|
for (Int_t entry = 0 ; entry < allsamples.collection[isample].events->GetEntries() ; entry++) { |
298 |
|
allsamples.collection[isample].events->LoadTree(entry); |
299 |
|
if (select->EvalInstance()) { |
300 |
|
allsamples.collection[isample].events->GetEntry(entry); |
301 |
+ |
mll=tmll; |
302 |
+ |
id1=tid1; |
303 |
+ |
id2=tid2; |
304 |
|
wgt=Weight->EvalInstance(); |
305 |
|
edgeWeight=wgt*xsweight; |
306 |
|
newTree->Fill(); |
319 |
|
} |
320 |
|
|
321 |
|
TTree* MergeTrees(vector<TTree*> trees) { |
322 |
< |
TTree * newtree = (TTree*)trees[0]->CloneTree(); |
322 |
> |
TTree * newtree = (TTree*)trees[0]->CloneTree(0); |
323 |
|
trees[0]->GetListOfClones()->Remove(newtree); |
324 |
|
trees[0]->ResetBranchAddresses(); |
325 |
|
newtree->ResetBranchAddresses(); |
326 |
|
|
327 |
< |
for(int itree=1;itree<trees.size();itree++) { |
327 |
> |
for(int itree=0;itree<trees.size();itree++) { |
328 |
|
newtree->CopyAddresses(trees[itree]); |
329 |
|
Long64_t nentries = trees[itree]->GetEntries(); |
330 |
|
for (Long64_t iEntry=0;iEntry<nentries;iEntry++) { |
346 |
|
|
347 |
|
void EdgeFitter::PrepareDatasets(int is_data) { |
348 |
|
write_warning(__FUNCTION__,"Need to make this function ready for scans as well (use signal from scan samples)"); |
349 |
< |
// TFile *tempout = new TFile("tempout.root","RECREATE"); |
349 |
> |
TFile *tempout = new TFile("tempout.root","RECREATE"); |
350 |
|
vector<TTree*> SkimmedTrees; |
351 |
|
TTree *SkimmedTree[(int)allsamples.collection.size()]; |
352 |
|
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
356 |
|
if(is_data!=1&&allsamples.collection[isample].is_data==true) continue;//kick all data samples when looking for MC |
357 |
|
if(is_data!=2&&allsamples.collection[isample].is_signal==true) continue;//remove signal sample if we don't want it. |
358 |
|
if(EdgeFitter::MarcoDebug) cout << "Considering : " << allsamples.collection[isample].samplename << endl; |
359 |
< |
SkimmedTrees.push_back(SkimTree(isample)); |
360 |
< |
// SkimmedTree[isample] = SkimTree(isample); |
361 |
< |
// tempout->cd(); |
362 |
< |
// SkimmedTree[isample]->Write(); |
344 |
< |
// treelist->Add(SkimmedTree[isample]); |
345 |
< |
//treelist->Add(SkimTree(isample)); |
346 |
< |
// allsamples.collection[isample].tfile->Close(); |
359 |
> |
SkimmedTree[isample] = SkimTree(isample); |
360 |
> |
tempout->cd(); |
361 |
> |
SkimmedTree[isample]->Write(); |
362 |
> |
SkimmedTrees.push_back(SkimmedTree[isample]); |
363 |
|
} |
364 |
|
|
365 |
|
TTree *completetree = MergeTrees(SkimmedTrees); |
366 |
|
|
351 |
– |
// for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
352 |
– |
// if(SkimmedTree[isample]) SkimmedTree[isample]->Delete(); |
353 |
– |
// } |
354 |
– |
|
367 |
|
if(EdgeFitter::MarcoDebug) cout << "Complete tree now contains " << completetree->GetEntries() << " entries " << endl; |
368 |
|
|
369 |
|
RooRealVar mll("mll","m_{ll}",mllmin,mllmax,"GeV/c^{2}"); |
370 |
|
RooRealVar id1("id1","id1",0,1,"GeV/c^{2}"); |
371 |
|
RooRealVar id2("id2","id2",0,1,"GeV/c^{2}"); |
360 |
– |
//RooRealVar jzb("jzb","jzb",-jzbmax,jzbmax,"GeV/c"); |
372 |
|
RooRealVar edgeWeight("edgeWeight","edgeWeight",0,1000,""); |
373 |
|
RooArgSet observables(mll,id1,id2,edgeWeight); |
374 |
|
|
375 |
|
string title="CMS Data"; |
376 |
|
if(is_data!=1) title="CMS SIMULATION"; |
377 |
|
RooDataSet LAllData("LAllData",title.c_str(),completetree,observables,"","edgeWeight"); |
378 |
+ |
tempout->cd(); |
379 |
|
completetree->Write(); |
380 |
< |
delete completetree; |
381 |
< |
// tempout->Close(); |
380 |
> |
tempout->Close(); |
381 |
> |
|
382 |
|
|
383 |
|
EdgeFitter::SFSample = (RooDataSet*)LAllData.reduce("id1==id2"); |
384 |
|
EdgeFitter::OFSample = (RooDataSet*)LAllData.reduce("id1!=id2"); |
389 |
|
AllData->SetName("AllData"); |
390 |
|
|
391 |
|
if(EdgeFitter::MarcoDebug) { |
392 |
< |
cout << "Number of events in data sample = " << AllData->numEntries() << endl; |
393 |
< |
cout << "Number of events in eemm sample = " << SFSample->numEntries() << endl; |
394 |
< |
cout << "Number of events in em sample = " << OFSample->numEntries() << endl; |
392 |
> |
cout << "Number of events in data sample = " << AllData->sumEntries() << endl; |
393 |
> |
cout << "Number of events in eemm sample = " << SFSample->sumEntries() << endl; |
394 |
> |
cout << "Number of events in em sample = " << OFSample->sumEntries() << endl; |
395 |
|
} |
396 |
|
|
397 |
|
} |
398 |
|
|
399 |
+ |
void EdgeFitter::DrawDatasetContent(int is_data) { |
400 |
+ |
RooRealVar mll("mll","m_{ll}",mllmin,mllmax,"GeV/c^{2}"); |
401 |
+ |
RooPlot* frame1 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("SF sample")) ; |
402 |
+ |
frame1->GetXaxis()->CenterTitle(1); |
403 |
+ |
frame1->GetYaxis()->CenterTitle(1); |
404 |
+ |
SFSample->plotOn(frame1,RooFit::Name("SFdata")) ; |
405 |
+ |
|
406 |
+ |
RooPlot* frame2 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")) ; |
407 |
+ |
frame2->GetXaxis()->CenterTitle(1); |
408 |
+ |
frame2->GetYaxis()->CenterTitle(1); |
409 |
+ |
OFSample->plotOn(frame2,RooFit::Name("OFdata")) ; |
410 |
+ |
|
411 |
+ |
TCanvas* cSFdata = new TCanvas("cSFdata","cSFdata") ; |
412 |
+ |
cSFdata->cd() ; |
413 |
+ |
gPad->SetLeftMargin(0.15); |
414 |
+ |
frame1->GetYaxis()->SetTitleOffset(1.4); |
415 |
+ |
frame1->Draw(); |
416 |
+ |
if(is_data==data) DrawPrelim(); |
417 |
+ |
else DrawPrelim(PlottingSetup::luminosity,true); |
418 |
+ |
CompleteSave(cSFdata,"Edge/SF_NoFit"); |
419 |
+ |
|
420 |
+ |
TCanvas* cOFdata = new TCanvas("cOFdata","cOFdata") ; |
421 |
+ |
cOFdata->cd() ; |
422 |
+ |
gPad->SetLeftMargin(0.15); |
423 |
+ |
frame2->SetMaximum(frame1->GetMaximum()); |
424 |
+ |
frame2->GetYaxis()->SetTitleOffset(1.4); |
425 |
+ |
frame2->Draw(); |
426 |
+ |
if(is_data==data) DrawPrelim(); |
427 |
+ |
else DrawPrelim(PlottingSetup::luminosity,true); |
428 |
+ |
CompleteSave(cOFdata,"Edge/OF_NoFit"); |
429 |
+ |
} |
430 |
+ |
|
431 |
|
string WriteWithError(float central, float error, int digits) { |
432 |
|
float ref=central; |
433 |
|
if(ref<0) ref=-central; |
465 |
|
} |
466 |
|
|
467 |
|
void EdgeFitter::DoFit(int is_data, float jzb_cut) { |
468 |
+ |
|
469 |
+ |
stringstream prefix; |
470 |
+ |
if(is_data==data) prefix << "data_"; |
471 |
+ |
if(is_data==mc) prefix << "mc_"; |
472 |
+ |
if(is_data==mcwithsignal) prefix << "mcwithS_"; |
473 |
+ |
|
474 |
+ |
prefix << EdgeFitter::Mode << "_" << jzb_cut; |
475 |
+ |
|
476 |
+ |
|
477 |
+ |
|
478 |
|
RooRealVar mll("mll","m_{ll}",mllmin,mllmax,"GeV/c^{2}"); |
479 |
|
RooRealVar edgeWeight("edgeWeight","edgeWeight",0,1000,""); |
480 |
|
RooCategory sample("sample","sample") ; |
496 |
|
RooAddPdf model_OF("model_OF","model_OF", ttbarOF, fttbarOF); |
497 |
|
RooSimultaneous simPdfOF("simPdfOF","simultaneous pdf", sample) ; |
498 |
|
simPdfOF.addPdf(model_OF,"OF"); |
499 |
< |
RooFitResult *resultOF = simPdfOF.fitTo(combData, RooFit::Save(),RooFit::Extended()); |
499 |
> |
RooFitResult *resultOF = simPdfOF.fitTo(combData, RooFit::Save(),RooFit::Extended(),RooFit::Minos(true)); |
500 |
> |
cout << "============================= < OF results > =============================" << endl; |
501 |
|
resultOF->Print(); |
502 |
< |
|
503 |
< |
RooRealVar* resultOFpar1_ = (RooRealVar*) resultOF->floatParsFinal().find("par1ttbarOF"); |
504 |
< |
float resultOFpar1 = resultOFpar1_->getVal(); |
505 |
< |
//RooRealVar* resultOFpar2_ = (RooRealVar*) resultOF->floatParsFinal().find("par2ttbarOF"); |
506 |
< |
//float resultOFpar2 = resultOFpar2_->getVal(); |
507 |
< |
//cout << "caca2.txt" << endl; |
508 |
< |
|
509 |
< |
RooRealVar* resultOFpar3_ = (RooRealVar*) resultOF->floatParsFinal().find("par3ttbarOF"); |
510 |
< |
float resultOFpar3 = resultOFpar3_->getVal(); |
511 |
< |
|
512 |
< |
//RooRealVar* resultOFpar4_ = (RooRealVar*) resultOF->floatParsFinal().find("par4ttbarOF"); |
513 |
< |
//float resultOFpar4 = resultOFpar4_->getVal(); |
514 |
< |
//cout << "caca4.txt" << endl; |
502 |
> |
cout << "============================= < /OF results > =============================" << endl; |
503 |
> |
|
504 |
> |
|
505 |
> |
RooPlot* frameO = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")); |
506 |
> |
frameO->GetXaxis()->CenterTitle(1); |
507 |
> |
frameO->GetYaxis()->CenterTitle(1); |
508 |
> |
combData.plotOn(frameO,RooFit::Name("OFdata"),RooFit::Cut("sample==sample::OF")) ; |
509 |
> |
simPdfOF.plotOn(frameO,RooFit::Slice(sample,"OF"),RooFit::Name("FullFit"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
510 |
> |
simPdfOF.plotOn(frameO,RooFit::Slice(sample,"OF"),RooFit::Name("TTbarOFonly"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
511 |
> |
|
512 |
> |
TCanvas* pof = new TCanvas("pof","pof") ; |
513 |
> |
pof->cd() ; |
514 |
> |
gPad->SetLeftMargin(0.15); |
515 |
> |
frameO->GetYaxis()->SetTitleOffset(1.4); |
516 |
> |
frameO->Draw(); |
517 |
> |
if(is_data==data) DrawPrelim(); |
518 |
> |
else DrawPrelim(PlottingSetup::luminosity,true); |
519 |
> |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(pof,"Edge/OF__OFFitonly_"+prefix.str()+"__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
520 |
> |
else CompleteSave(pof,"Edge/OF__OFFitonly_"+prefix.str(),false,false); |
521 |
> |
delete pof; |
522 |
> |
|
523 |
> |
if(resultOF->covQual()!=3) { |
524 |
> |
write_error(__FUNCTION__,"OF fit did not converge!!! Cannot continue!"); |
525 |
> |
cout << "covQual is " << resultOF->covQual() << endl; |
526 |
> |
EdgeFitter::FixedMEdgeChi2=-1; |
527 |
> |
if(EdgeFitter::RejectPointIfNoConvergence) return; |
528 |
> |
} else { |
529 |
> |
write_info(__FUNCTION__,"OF fit converged"); |
530 |
> |
} |
531 |
|
|
532 |
|
float StartingMedge=70; |
533 |
|
if(EdgeFitter::FixedMEdge>0) StartingMedge=EdgeFitter::FixedMEdge; |
534 |
|
|
535 |
|
|
536 |
+ |
RooDataSet *ZDataSet = new RooDataSet("ZDataSet","ZDataSet",SFSample,RooArgSet(mll),"abs(mll-91.2)<20"); |
537 |
+ |
float maxZ = ZDataSet->sumEntries(); |
538 |
+ |
cout << "maxZ was set to " << maxZ << endl; |
539 |
+ |
delete ZDataSet; |
540 |
+ |
|
541 |
+ |
|
542 |
+ |
|
543 |
|
// Now same flavor |
544 |
< |
RooRealVar fzSF("fzSF", "fzSF", 5, 0, 100000); |
544 |
> |
RooRealVar fzSF("fzSF", "fzSF", 39, 39, maxZ); |
545 |
|
RooRealVar meanzSF("meanzSF", "meanzSF", 91.1876, 89, 95); |
546 |
|
//RooRealVar sigmazSF("sigmazSF", "sigmazSF", 0.5); |
547 |
|
RooRealVar sigmazSF("sigmazSF", "sigmazSF", 5, 0.5, 5); |
548 |
|
RooRealVar widthzSF("widthzSF", "widthzSF", 2.94); |
549 |
+ |
widthzSF.setConstant(); |
550 |
|
|
551 |
|
RooRealVar fttbarSF("fttbarSF", "fttbarSF", 100, 0, 100000); |
552 |
< |
RooRealVar par1ttbarSF("par1ttbarSF", "par1ttbarSF", resultOFpar1, 0, 100); |
474 |
< |
RooRealVar par2ttbarSF("par2ttbarSF", "par2ttbarSF", 1.0); |
475 |
< |
RooRealVar par3ttbarSF("par3ttbarSF", "par3ttbarSF", resultOFpar3, 0, 100); |
476 |
< |
RooRealVar par4ttbarSF("par4ttbarSF", "par4ttbarSF", 2.0); |
552 |
> |
RooRealVar par1ttbarSF("par1ttbarSF", "par1ttbarSF", 1.02*par1ttbarOF.getVal(), (1.02-0.07)*par1ttbarOF.getVal(), (1.02+0.07)*par1ttbarOF.getVal()); |
553 |
|
|
554 |
|
RooRealVar fsignalSF("fsignalSF", "fsignalSF", 10, 0, 300); |
555 |
|
RooRealVar par1signalSF("par1signalSF", "par1signalSF", 45, 20, 100); |
560 |
|
|
561 |
|
if(EdgeFitter::FixedMEdge>0) par3signalSF.setConstant(); |
562 |
|
|
563 |
< |
RooSUSYBkgPdf ttbarSF("ttbarSF","ttbarSF", mll , par1ttbarSF, par2ttbarSF, par3ttbarSF, par4ttbarSF); |
488 |
< |
//RooSUSYTPdf signalSF("signalSF","signalSF", mll , par1signalSF, par2signalSF, par3signalSF); |
563 |
> |
RooSUSYBkgPdf ttbarSF("ttbarSF","ttbarSF", mll , par1ttbarSF, par2ttbarOF, par3ttbarOF, par4ttbarOF); |
564 |
|
RooSUSYTPdf signalSF("signalSF","signalSF", mll , par1signalSF, sigmazSF, par3signalSF); |
565 |
|
|
491 |
– |
/* par1ttbarSF.setConstant(true); |
492 |
– |
par2ttbarSF.setConstant(true); |
493 |
– |
par3ttbarSF.setConstant(true); |
494 |
– |
par4ttbarSF.setConstant(true);*/ |
495 |
– |
|
496 |
– |
|
497 |
– |
//RooAddPdf model_SF("model_SF","model_SF", RooArgList(zSF, ttbarSF, signalSF), RooArgList(fzSF, fttbarSF, fsignalSF)); |
566 |
|
RooAddPdf model_SF("model_SF","model_SF", RooArgList(zSF, ttbarSF, signalSF), RooArgList(fzSF, fttbarSF, fsignalSF)); |
499 |
– |
RooAddPdf model_em("model_em","model_em", RooArgList(ttbarSF), RooArgList(fttbarSF)); |
500 |
– |
|
567 |
|
|
568 |
|
RooSimultaneous simPdf("simPdf","simultaneous pdf",sample) ; |
569 |
|
simPdf.addPdf(model_SF,"SF") ; |
570 |
< |
simPdf.addPdf(model_em,"em") ; |
570 |
> |
simPdf.addPdf(model_OF,"OF") ; |
571 |
|
|
572 |
< |
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save(), RooFit::Extended()); |
572 |
> |
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save(), RooFit::Extended(),RooFit::Minos(true)); |
573 |
> |
|
574 |
> |
if(result->covQual()!=3) { |
575 |
> |
write_error(__FUNCTION__,"Full fit did not converge!!! Cannot continue!"); |
576 |
> |
cout << "covQual is " << result->covQual() << endl; |
577 |
> |
EdgeFitter::FixedMEdgeChi2=-1; |
578 |
> |
if(EdgeFitter::RejectPointIfNoConvergence) return; |
579 |
> |
} else { |
580 |
> |
write_info(__FUNCTION__,"Full fit converged"); |
581 |
> |
} |
582 |
> |
|
583 |
> |
cout << "============================= < OF results > =============================" << endl; |
584 |
|
result->Print(); |
585 |
+ |
cout << "============================= < /OF results > =============================" << endl; |
586 |
+ |
|
587 |
|
|
588 |
|
RooPlot* frame1 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("EE sample")) ; |
589 |
|
frame1->GetXaxis()->CenterTitle(1); |
590 |
+ |
frame1->GetYaxis()->CenterTitle(1); |
591 |
|
combData.plotOn(frame1,RooFit::Name("SFdata"),RooFit::Cut("sample==sample::SF")) ; |
592 |
|
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("FullFit"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
593 |
|
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("TTbarSFonly"),RooFit::Components("ttbarSF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
607 |
|
// The same plot for the cointrol sample slice |
608 |
|
RooPlot* frame3 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")) ; |
609 |
|
frame3->GetXaxis()->CenterTitle(1); |
610 |
+ |
frame3->GetYaxis()->CenterTitle(1); |
611 |
|
frame3->SetMaximum(frame1->GetMaximum()); |
612 |
|
combData.plotOn(frame3,RooFit::Cut("sample==sample::OF")) ; |
613 |
< |
simPdfOF.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
614 |
< |
simPdfOF.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
534 |
< |
|
535 |
< |
|
536 |
< |
stringstream prefix; |
537 |
< |
if(is_data==data) prefix << "data_"; |
538 |
< |
if(is_data==mc) prefix << "mc_"; |
539 |
< |
if(is_data==mcwithsignal) prefix << "mcwithS_"; |
540 |
< |
|
541 |
< |
prefix << "JZB_" << jzb_cut; |
542 |
< |
|
613 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
614 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
615 |
|
|
616 |
|
|
617 |
|
TCanvas* c = new TCanvas("rf501_simultaneouspdf","rf403_simultaneouspdf") ; |
622 |
|
if(is_data==data) DrawPrelim(); |
623 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
624 |
|
stringstream infotext; |
625 |
< |
infotext << "#splitline{Fit results (JZB>" << jzb_cut << "): }{#splitline{"; |
626 |
< |
infotext << "N(Data) = " << EdgeFitter::SFSample->numEntries() << "}{#splitline{"; |
625 |
> |
infotext << "#splitline{Fit results (" << EdgeFitter::Mode << ">" << jzb_cut << "): }{#splitline{"; |
626 |
> |
infotext << "N(Data) = " << EdgeFitter::SFSample->sumEntries() << "}{#splitline{"; |
627 |
|
infotext << "N(Z+Jets) = " << WriteWithError(fzSF.getVal(),fzSF.getError(),3) << "}{#splitline{"; |
628 |
|
infotext << "N(t#bar{t}) = " << WriteWithError(fttbarSF.getVal(),fttbarSF.getError(),3) << "}{#splitline{"; |
629 |
|
infotext << "N(signal) = " << WriteWithError(fsignalSF.getVal(),fsignalSF.getError(),3) << "}{"; |
633 |
|
infobox->SetNDC(); |
634 |
|
infobox->SetTextSize(0.03); |
635 |
|
infobox->Draw(); |
636 |
< |
CompleteSave(c,"Edge/"+prefix.str()+"_SF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
636 |
> |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(c,"Edge/"+prefix.str()+"_SF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
637 |
> |
else CompleteSave(c,"Edge/"+prefix.str()+"_SF",false,false); |
638 |
|
delete c; |
639 |
|
|
640 |
|
TCanvas* e = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
644 |
|
frame3->Draw(); |
645 |
|
if(is_data==data) DrawPrelim(); |
646 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
647 |
< |
CompleteSave(e,"Edge/"+prefix.str()+"_OF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
647 |
> |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(e,"Edge/"+prefix.str()+"_OF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
648 |
> |
else CompleteSave(e,"Edge/"+prefix.str()+"_OF",false,false); |
649 |
|
delete e; |
650 |
|
|
651 |
|
|
690 |
|
|
691 |
|
EdgeFitter::PrepareDatasets(is_data); |
692 |
|
|
693 |
+ |
EdgeFitter::DrawDatasetContent(is_data); |
694 |
+ |
|
695 |
|
RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelow(); |
696 |
|
RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); |
621 |
– |
write_warning(__FUNCTION__,"Deactivated actual fitting procedure ATM"); |
697 |
|
|
698 |
|
|
699 |
|
bool ScanMassRange=true; |
700 |
+ |
float ScanSteps=5.0;//GeV |
701 |
|
|
702 |
|
|
703 |
|
|
705 |
|
TFile *fscan = new TFile("fscan.root","UPDATE"); |
706 |
|
TGraph *gr = new TGraph(); |
707 |
|
stringstream GrName; |
708 |
< |
GrName << "ScanGraphFor_JZB_" << jzb_cut; |
708 |
> |
GrName << "ScanGraphFor_" << EdgeFitter::Mode << "_" << jzb_cut; |
709 |
|
gr->SetName(GrName.str().c_str()); |
710 |
|
|
711 |
|
int i=0; |
712 |
< |
for(float tempMedge=10;tempMedge<=300;tempMedge+=5.0) { |
713 |
< |
write_info(__FUNCTION__,"Now testing Medge="+any2string(tempMedge)+" for JZB>"+any2string(jzb_cut)); |
712 |
> |
for(float tempMedge=10;tempMedge<=300;tempMedge+=ScanSteps) { |
713 |
> |
write_info(__FUNCTION__,"Now testing Medge="+any2string(tempMedge)+" for "+EdgeFitter::Mode+">"+any2string(jzb_cut)); |
714 |
|
EdgeFitter::FixedMEdge=tempMedge; |
715 |
|
EdgeFitter::DoFit(is_data, jzb_cut); |
716 |
+ |
if(EdgeFitter::FixedMEdgeChi2<0) continue; |
717 |
|
gr->SetPoint(i,tempMedge,EdgeFitter::FixedMEdgeChi2); |
718 |
|
i++; |
719 |
|
} |
729 |
|
gr->SetTitle(""); |
730 |
|
gr->Draw("AL"); |
731 |
|
stringstream ScanCanSave; |
732 |
< |
ScanCanSave << "Edge/MEdgeScan_JZB_" << jzb_cut; |
732 |
> |
ScanCanSave << "Edge/MEdgeScan_"+EdgeFitter::Mode+"_" << jzb_cut; |
733 |
|
if(is_data) DrawPrelim(); |
734 |
|
else DrawMCPrelim(); |
735 |
|
CompleteSave(ScanCan,ScanCanSave.str()); |
753 |
|
} |
754 |
|
|
755 |
|
void DoEdgeFit(string mcjzb, string datajzb, float DataPeakError, float MCPeakError, vector<float> jzb_cut, int is_data, TCut cut, TTree *signalevents=0) { |
756 |
+ |
|
757 |
+ |
EdgeFitter::Mode="JZB"; |
758 |
+ |
if(mcjzb=="met[4]") EdgeFitter::Mode="MET"; |
759 |
+ |
|
760 |
|
for(int icut=0;icut<(int)jzb_cut.size();icut++) { |
761 |
|
stringstream addcut; |
762 |
|
if(is_data==1) addcut << "(" << datajzb << ">" << jzb_cut[icut] << ")"; |