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()); |
500 |
< |
resultOF->Print(); |
499 |
> |
RooFitResult *resultOF = simPdfOF.fitTo(combData, RooFit::Save(),RooFit::Extended(),RooFit::Minos(true)); |
500 |
> |
//resultOF->Print(); |
501 |
> |
|
502 |
> |
|
503 |
> |
RooPlot* frameO = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")); |
504 |
> |
frameO->GetXaxis()->CenterTitle(1); |
505 |
> |
frameO->GetYaxis()->CenterTitle(1); |
506 |
> |
combData.plotOn(frameO,RooFit::Name("OFdata"),RooFit::Cut("sample==sample::OF")) ; |
507 |
> |
simPdfOF.plotOn(frameO,RooFit::Slice(sample,"OF"),RooFit::Name("FullFit"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
508 |
> |
simPdfOF.plotOn(frameO,RooFit::Slice(sample,"OF"),RooFit::Name("TTbarOFonly"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
509 |
> |
|
510 |
> |
TCanvas* pof = new TCanvas("pof","pof") ; |
511 |
> |
pof->cd() ; |
512 |
> |
gPad->SetLeftMargin(0.15); |
513 |
> |
frameO->GetYaxis()->SetTitleOffset(1.4); |
514 |
> |
frameO->Draw(); |
515 |
> |
if(is_data==data) DrawPrelim(); |
516 |
> |
else DrawPrelim(PlottingSetup::luminosity,true); |
517 |
> |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(pof,"Edge/"+prefix.str()+"_OF__OFFitonly_"+any2string(EdgeFitter::FixedMEdge),false,false); |
518 |
> |
else CompleteSave(pof,"Edge/"+prefix.str()+"_OF__OFFitonly",false,false); |
519 |
> |
delete pof; |
520 |
> |
|
521 |
> |
|
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 |
|
RooRealVar* resultOFpar1_ = (RooRealVar*) resultOF->floatParsFinal().find("par1ttbarOF"); |
533 |
|
float resultOFpar1 = resultOFpar1_->getVal(); |
554 |
|
RooRealVar widthzSF("widthzSF", "widthzSF", 2.94); |
555 |
|
|
556 |
|
RooRealVar fttbarSF("fttbarSF", "fttbarSF", 100, 0, 100000); |
557 |
< |
RooRealVar par1ttbarSF("par1ttbarSF", "par1ttbarSF", resultOFpar1, 0, 100); |
557 |
> |
RooRealVar par1ttbarSF("par1ttbarSF", "par1ttbarSF", 1.02*resultOFpar1, 0, 100); |
558 |
|
RooRealVar par2ttbarSF("par2ttbarSF", "par2ttbarSF", 1.0); |
559 |
|
RooRealVar par3ttbarSF("par3ttbarSF", "par3ttbarSF", resultOFpar3, 0, 100); |
560 |
|
RooRealVar par4ttbarSF("par4ttbarSF", "par4ttbarSF", 2.0); |
568 |
|
|
569 |
|
if(EdgeFitter::FixedMEdge>0) par3signalSF.setConstant(); |
570 |
|
|
571 |
+ |
/* par1ttbarOF.setConstant(1); |
572 |
+ |
par2ttbarOF.setConstant(1); |
573 |
+ |
par3ttbarOF.setConstant(1); |
574 |
+ |
par4ttbarOF.setConstant(1); |
575 |
+ |
fttbarOF.setConstant(1);*/ |
576 |
+ |
|
577 |
|
RooSUSYBkgPdf ttbarSF("ttbarSF","ttbarSF", mll , par1ttbarSF, par2ttbarSF, par3ttbarSF, par4ttbarSF); |
578 |
|
//RooSUSYTPdf signalSF("signalSF","signalSF", mll , par1signalSF, par2signalSF, par3signalSF); |
579 |
|
RooSUSYTPdf signalSF("signalSF","signalSF", mll , par1signalSF, sigmazSF, par3signalSF); |
586 |
|
|
587 |
|
//RooAddPdf model_SF("model_SF","model_SF", RooArgList(zSF, ttbarSF, signalSF), RooArgList(fzSF, fttbarSF, fsignalSF)); |
588 |
|
RooAddPdf model_SF("model_SF","model_SF", RooArgList(zSF, ttbarSF, signalSF), RooArgList(fzSF, fttbarSF, fsignalSF)); |
589 |
< |
RooAddPdf model_em("model_em","model_em", RooArgList(ttbarSF), RooArgList(fttbarSF)); |
589 |
> |
// RooAddPdf model_OF("model_OF","model_OF", RooArgList(ttbarSF), RooArgList(fttbarSF)); |
590 |
|
|
591 |
|
|
592 |
|
RooSimultaneous simPdf("simPdf","simultaneous pdf",sample) ; |
593 |
|
simPdf.addPdf(model_SF,"SF") ; |
594 |
< |
simPdf.addPdf(model_em,"em") ; |
594 |
> |
simPdf.addPdf(model_OF,"OF") ; |
595 |
|
|
596 |
< |
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save(), RooFit::Extended()); |
597 |
< |
result->Print(); |
596 |
> |
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save(), RooFit::Extended(),RooFit::Minos(true)); |
597 |
> |
|
598 |
> |
if(result->covQual()!=3) { |
599 |
> |
write_error(__FUNCTION__,"Full fit did not converge!!! Cannot continue!"); |
600 |
> |
cout << "covQual is " << result->covQual() << endl; |
601 |
> |
EdgeFitter::FixedMEdgeChi2=-1; |
602 |
> |
if(EdgeFitter::RejectPointIfNoConvergence) return; |
603 |
> |
} else { |
604 |
> |
write_info(__FUNCTION__,"Full fit converged"); |
605 |
> |
} |
606 |
> |
|
607 |
> |
// result->Print(); |
608 |
|
|
609 |
|
RooPlot* frame1 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("EE sample")) ; |
610 |
|
frame1->GetXaxis()->CenterTitle(1); |
611 |
+ |
frame1->GetYaxis()->CenterTitle(1); |
612 |
|
combData.plotOn(frame1,RooFit::Name("SFdata"),RooFit::Cut("sample==sample::SF")) ; |
613 |
|
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("FullFit"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
614 |
|
simPdf.plotOn(frame1,RooFit::Slice(sample,"SF"),RooFit::Name("TTbarSFonly"),RooFit::Components("ttbarSF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
628 |
|
// The same plot for the cointrol sample slice |
629 |
|
RooPlot* frame3 = mll.frame(RooFit::Bins(int((mllmax-mllmin)/5.0)),RooFit::Title("OF sample")) ; |
630 |
|
frame3->GetXaxis()->CenterTitle(1); |
631 |
+ |
frame3->GetYaxis()->CenterTitle(1); |
632 |
|
frame3->SetMaximum(frame1->GetMaximum()); |
633 |
|
combData.plotOn(frame3,RooFit::Cut("sample==sample::OF")) ; |
634 |
< |
simPdfOF.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
635 |
< |
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 |
< |
|
634 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
635 |
> |
simPdf.plotOn(frame3,RooFit::Slice(sample,"OF"),RooFit::Components("ttbarOF"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
636 |
|
|
637 |
|
|
638 |
|
TCanvas* c = new TCanvas("rf501_simultaneouspdf","rf403_simultaneouspdf") ; |
643 |
|
if(is_data==data) DrawPrelim(); |
644 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
645 |
|
stringstream infotext; |
646 |
< |
infotext << "#splitline{Fit results (JZB>" << jzb_cut << "): }{#splitline{"; |
647 |
< |
infotext << "N(Data) = " << EdgeFitter::SFSample->numEntries() << "}{#splitline{"; |
646 |
> |
infotext << "#splitline{Fit results (" << EdgeFitter::Mode << ">" << jzb_cut << "): }{#splitline{"; |
647 |
> |
infotext << "N(Data) = " << EdgeFitter::SFSample->sumEntries() << "}{#splitline{"; |
648 |
|
infotext << "N(Z+Jets) = " << WriteWithError(fzSF.getVal(),fzSF.getError(),3) << "}{#splitline{"; |
649 |
|
infotext << "N(t#bar{t}) = " << WriteWithError(fttbarSF.getVal(),fttbarSF.getError(),3) << "}{#splitline{"; |
650 |
|
infotext << "N(signal) = " << WriteWithError(fsignalSF.getVal(),fsignalSF.getError(),3) << "}{"; |
654 |
|
infobox->SetNDC(); |
655 |
|
infobox->SetTextSize(0.03); |
656 |
|
infobox->Draw(); |
657 |
< |
CompleteSave(c,"Edge/"+prefix.str()+"_SF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
657 |
> |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(c,"Edge/"+prefix.str()+"_SF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
658 |
> |
else CompleteSave(c,"Edge/"+prefix.str()+"_SF",false,false); |
659 |
|
delete c; |
660 |
|
|
661 |
|
TCanvas* e = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
665 |
|
frame3->Draw(); |
666 |
|
if(is_data==data) DrawPrelim(); |
667 |
|
else DrawPrelim(PlottingSetup::luminosity,true); |
668 |
< |
CompleteSave(e,"Edge/"+prefix.str()+"_OF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
668 |
> |
if(EdgeFitter::FixedMEdge>=0) CompleteSave(e,"Edge/"+prefix.str()+"_OF__MEdgeFix_"+any2string(EdgeFitter::FixedMEdge),false,false); |
669 |
> |
else CompleteSave(e,"Edge/"+prefix.str()+"_OF",false,false); |
670 |
|
delete e; |
671 |
|
|
672 |
|
|
711 |
|
|
712 |
|
EdgeFitter::PrepareDatasets(is_data); |
713 |
|
|
714 |
+ |
EdgeFitter::DrawDatasetContent(is_data); |
715 |
+ |
|
716 |
|
RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelow(); |
717 |
|
RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); |
621 |
– |
write_warning(__FUNCTION__,"Deactivated actual fitting procedure ATM"); |
718 |
|
|
719 |
|
|
720 |
< |
bool ScanMassRange=true; |
720 |
> |
bool ScanMassRange=false; |
721 |
|
|
722 |
|
|
723 |
|
|
725 |
|
TFile *fscan = new TFile("fscan.root","UPDATE"); |
726 |
|
TGraph *gr = new TGraph(); |
727 |
|
stringstream GrName; |
728 |
< |
GrName << "ScanGraphFor_JZB_" << jzb_cut; |
728 |
> |
GrName << "ScanGraphFor_" << EdgeFitter::Mode << "_" << jzb_cut; |
729 |
|
gr->SetName(GrName.str().c_str()); |
730 |
|
|
731 |
|
int i=0; |
732 |
|
for(float tempMedge=10;tempMedge<=300;tempMedge+=5.0) { |
733 |
< |
write_info(__FUNCTION__,"Now testing Medge="+any2string(tempMedge)+" for JZB>"+any2string(jzb_cut)); |
733 |
> |
write_info(__FUNCTION__,"Now testing Medge="+any2string(tempMedge)+" for "+EdgeFitter::Mode+">"+any2string(jzb_cut)); |
734 |
|
EdgeFitter::FixedMEdge=tempMedge; |
735 |
|
EdgeFitter::DoFit(is_data, jzb_cut); |
736 |
+ |
if(EdgeFitter::FixedMEdgeChi2<0) continue; |
737 |
|
gr->SetPoint(i,tempMedge,EdgeFitter::FixedMEdgeChi2); |
738 |
|
i++; |
739 |
|
} |
749 |
|
gr->SetTitle(""); |
750 |
|
gr->Draw("AL"); |
751 |
|
stringstream ScanCanSave; |
752 |
< |
ScanCanSave << "Edge/MEdgeScan_JZB_" << jzb_cut; |
752 |
> |
ScanCanSave << "Edge/MEdgeScan_"+EdgeFitter::Mode+"_" << jzb_cut; |
753 |
|
if(is_data) DrawPrelim(); |
754 |
|
else DrawMCPrelim(); |
755 |
|
CompleteSave(ScanCan,ScanCanSave.str()); |
773 |
|
} |
774 |
|
|
775 |
|
void DoEdgeFit(string mcjzb, string datajzb, float DataPeakError, float MCPeakError, vector<float> jzb_cut, int is_data, TCut cut, TTree *signalevents=0) { |
776 |
+ |
|
777 |
+ |
EdgeFitter::Mode="JZB"; |
778 |
+ |
if(mcjzb=="met[4]") EdgeFitter::Mode="MET"; |
779 |
+ |
|
780 |
|
for(int icut=0;icut<(int)jzb_cut.size();icut++) { |
781 |
|
stringstream addcut; |
782 |
|
if(is_data==1) addcut << "(" << datajzb << ">" << jzb_cut[icut] << ")"; |