3 |
|
#include <RooRealVar.h> |
4 |
|
#include <RooArgSet.h> |
5 |
|
#include <RooDataSet.h> |
6 |
< |
#include <RooRealVar.h> |
7 |
< |
#include <RooArgSet.h> |
8 |
< |
#include <RooDataSet.h> |
6 |
> |
#include <RooMCStudy.h> |
7 |
> |
#include <RooCategory.h> |
8 |
> |
|
9 |
> |
#include <RooPlot.h> |
10 |
> |
#include <RooSimultaneous.h> |
11 |
> |
#include <RooAddPdf.h> |
12 |
> |
#include <RooFitResult.h> |
13 |
> |
#include <RooVoigtian.h> |
14 |
> |
#include <RooMsgService.h> |
15 |
> |
|
16 |
|
#include <RooStats/ModelConfig.h> |
17 |
|
#include "RooStats/ProfileLikelihoodCalculator.h" |
18 |
|
#include "RooStats/LikelihoodInterval.h" |
22 |
|
#include "RooStats/HybridCalculatorOriginal.h" |
23 |
|
#include "RooStats/HypoTestInverterOriginal.h" |
24 |
|
|
25 |
+ |
//#include "ParametrizedEdge.C" |
26 |
+ |
#include "/shome/pablom/RooFit/Pdfs/RooSUSYTPdf.cxx" |
27 |
+ |
#include "/shome/pablom/RooFit/Pdfs/RooSUSYBkgPdf.cxx" |
28 |
+ |
|
29 |
|
|
30 |
|
using namespace std; |
31 |
|
using namespace PlottingSetup; |
51 |
|
|
52 |
|
void DoEdgeFit(string mcjzb, string datajzb, float DataPeakError, float MCPeakError, float jzb_cut, int icut, int is_data, TCut cut, TTree*); |
53 |
|
void DoEdgeFit(string mcjzb, string datajzb, float DataPeakError, float MCPeakError, vector<float> jzb_cut, int is_data, TCut cut, TTree*); |
54 |
+ |
void getMedianLimit(RooWorkspace *ws,vector<RooDataSet*> theToys,float &median,float &sigmaDown, float &sigmaUp, float &twoSigmaDown, float &twoSigmaUp); |
55 |
|
void InitializeVariables(float _mllmin, float _mllmax, float _jzbmax, TCut _cut); |
56 |
|
void PrepareDatasets(int); |
57 |
< |
void DoFit(); |
57 |
> |
void DoFit(int is_data, float jzb_cut); |
58 |
|
string RandomStorageFile(); |
59 |
|
Yield Get_Z_estimate(float,int); |
60 |
|
Yield Get_T_estimate(float,int); |
61 |
< |
float SetEdgeLimit(int , RooWorkspace *ws); |
61 |
> |
float calcExclusion(RooWorkspace *ws, RooDataSet *data = NULL); |
62 |
> |
void prepareLimits(RooWorkspace *ws); |
63 |
> |
vector<RooDataSet*> generateToys(RooWorkspace *ws, int nToys); |
64 |
> |
void prepareLimits(RooWorkspace *ws, bool ComputeBands); |
65 |
> |
TGraph* prepareLM(float mass, float nEv); |
66 |
|
|
67 |
|
float jzbmax; |
68 |
|
float mllmin; |
77 |
|
bool MarcoDebug; |
78 |
|
} |
79 |
|
|
80 |
< |
float EdgeFitter::SetEdgeLimit(int is_data, RooWorkspace *ws) { |
80 |
> |
TGraph* EdgeFitter::prepareLM(float mass, float nEv) { |
81 |
> |
float massLM[1]; |
82 |
> |
massLM[0]=mass; |
83 |
> |
float accEffLM[1]; |
84 |
> |
accEffLM[0]=nEv/PlottingSetup::luminosity; |
85 |
> |
TGraph *lm = new TGraph(1, massLM, accEffLM); |
86 |
> |
lm->GetXaxis()->SetNoExponent(true); |
87 |
> |
lm->GetXaxis()->SetTitle("m_{cut} [GeV]"); |
88 |
> |
lm->GetYaxis()->SetTitle("#sigma #times A [pb] 95% CL UL"); |
89 |
> |
lm->GetXaxis()->SetLimits(0.,300.); |
90 |
> |
lm->GetYaxis()->SetRangeUser(0.,0.08); |
91 |
> |
lm->SetMarkerStyle(34); |
92 |
> |
lm->SetMarkerColor(kRed); |
93 |
> |
return lm; |
94 |
> |
} |
95 |
> |
|
96 |
> |
vector<RooDataSet*> EdgeFitter::generateToys(RooWorkspace *ws, int nToys) { |
97 |
> |
ws->var("nSig")->setVal(0.); |
98 |
> |
ws->var("nSig")->setConstant(true); |
99 |
> |
RooFitResult* fit = ws->pdf("combModel")->fitTo(*ws->data("data_obs"),RooFit::Save()); |
100 |
> |
vector<RooDataSet*> theToys; |
101 |
> |
|
102 |
> |
RooMCStudy mcEE(*ws->pdf("combModel"),RooArgSet(*ws->var("inv")),RooFit::Slice(*ws->cat("cat"),"EE")); |
103 |
> |
mcEE.generate(nToys,44,true); |
104 |
> |
RooMCStudy mcMM(*ws->pdf("combModel"),RooArgSet(*ws->var("inv")),RooFit::Slice(*ws->cat("cat"),"MM")); |
105 |
> |
mcMM.generate(nToys,44,true); |
106 |
> |
RooMCStudy mcOSOF(*ws->pdf("combModel"),RooArgSet(*ws->var("inv")),RooFit::Slice(*ws->cat("cat"),"OSOF")); |
107 |
> |
mcOSOF.generate(nToys,44,true); |
108 |
> |
|
109 |
> |
RooRealVar mll("mll","mll",mllmin,mllmax,"GeV/c^{2}"); |
110 |
> |
RooRealVar id1("id1","id1",0,1,"GeV/c^{2}"); |
111 |
> |
RooRealVar id2("id2","id2",0,1,"GeV/c^{2}"); |
112 |
> |
RooRealVar jzb("jzb","jzb",-jzbmax,jzbmax,"GeV/c"); |
113 |
> |
RooRealVar weight("weight","weight",0,1000,""); |
114 |
> |
RooArgSet observables(mll,jzb,id1,id2,weight); |
115 |
> |
|
116 |
> |
for(int i=0;i<nToys;i++) { |
117 |
> |
RooDataSet* toyEE = (RooDataSet*)mcEE.genData(i); |
118 |
> |
RooDataSet* toyMM = (RooDataSet*)mcMM.genData(i); |
119 |
> |
RooDataSet* toyOSOF = (RooDataSet*)mcOSOF.genData(i); |
120 |
> |
stringstream toyname; |
121 |
> |
toyname << "theToy_" << i; |
122 |
> |
write_warning(__FUNCTION__,"Problem while adding toys"); |
123 |
> |
// RooDataSet *toyData = RooDataSet(toyname.str(),toyname.str(),observables,RooFit::Index(ws->cat("cat")),RooFit::Import("OSOF",*toyOSOF),RooFit::Import("EE",*toyEE),RooFit::Import("MM",*toyMM)); |
124 |
> |
// theToys.push_back(toyData); |
125 |
> |
} |
126 |
> |
ws->var("nSig")->setVal(17.0); |
127 |
> |
ws->var("nSig")->setConstant(false); |
128 |
> |
return theToys; |
129 |
> |
} |
130 |
> |
|
131 |
> |
void EdgeFitter::getMedianLimit(RooWorkspace *ws,vector<RooDataSet*> theToys,float &median,float &sigmaDown, float &sigmaUp, float &twoSigmaDown, float &twoSigmaUp) { |
132 |
> |
TH1F *gauLimit = new TH1F("gausLimit","gausLimit",60,0.,80./PlottingSetup::luminosity); |
133 |
> |
vector<float> theLimits; |
134 |
> |
for(int itoy=0;itoy<theToys.size();itoy++) { |
135 |
> |
float theLimit = calcExclusion(ws,theToys[itoy]); |
136 |
> |
if(theLimit > 0 ) gauLimit->Fill(theLimit); |
137 |
> |
} |
138 |
> |
const Int_t nQ = 4; |
139 |
> |
Double_t yQ[nQ] = {0.,0.,0.,0.}; |
140 |
> |
Double_t xQ[nQ] = {0.022750132,0.1586552539,0.84134474609999998,0.977249868}; |
141 |
> |
gauLimit->GetQuantiles(nQ,yQ,xQ); |
142 |
> |
median = gauLimit->GetMean(); |
143 |
> |
// median = median1(gauLimit); |
144 |
> |
twoSigmaDown = abs(yQ[0]-median); |
145 |
> |
sigmaDown = abs(yQ[1]-median); |
146 |
> |
sigmaUp = abs(yQ[2]-median); |
147 |
> |
twoSigmaUp = abs(yQ[3]-median); |
148 |
> |
cout << median * PlottingSetup::luminosity << " " << sigmaUp * PlottingSetup::luminosity << endl; |
149 |
> |
} |
150 |
> |
|
151 |
> |
void EdgeFitter::prepareLimits(RooWorkspace *ws, bool ComputeBands) { |
152 |
> |
if(ComputeBands) { |
153 |
> |
vector<RooDataSet*> theToys = EdgeFitter::generateToys(ws,50); |
154 |
> |
vector<float> medVals; |
155 |
> |
vector<float> medLimits; |
156 |
> |
vector<float> sigmaLimitsDown; |
157 |
> |
vector<float> sigmaLimitsUp; |
158 |
> |
vector<float> twoSigmaLimitsDown; |
159 |
> |
vector<float> twoSigmaLimitsUp; |
160 |
> |
for(int i=20;i<=320;i+=40) { |
161 |
> |
ws->var("nSig")->setVal(10.0); |
162 |
> |
medVals.push_back((float)i); |
163 |
> |
ws->var("m0")->setVal((float)i); |
164 |
> |
ws->var("m0")->setConstant(true); |
165 |
> |
float Smedian,SsigmaDown,SsigmaUp,StwoSigmaDown,StwoSigmaUp; |
166 |
> |
EdgeFitter::getMedianLimit(ws,theToys,Smedian,SsigmaDown,SsigmaUp,StwoSigmaDown,StwoSigmaUp); |
167 |
> |
medLimits.push_back(Smedian); |
168 |
> |
sigmaLimitsDown.push_back(SsigmaDown); |
169 |
> |
sigmaLimitsUp.push_back(SsigmaUp); |
170 |
> |
twoSigmaLimitsDown.push_back(StwoSigmaDown); |
171 |
> |
twoSigmaLimitsUp.push_back(StwoSigmaUp); |
172 |
> |
} |
173 |
> |
write_warning(__FUNCTION__,"Still need to store limits"); |
174 |
> |
} else { |
175 |
> |
vector<float> theVals; |
176 |
> |
vector<float> theLimits; |
177 |
> |
for(int i=20;i<300;i+=5) { |
178 |
> |
ws->var("nSig")->setVal(0.0); |
179 |
> |
theVals.push_back((float)i); |
180 |
> |
ws->var("m0")->setVal((float)i); |
181 |
> |
ws->var("m0")->setConstant(true); |
182 |
> |
theLimits.push_back(calcExclusion(ws)); |
183 |
> |
} |
184 |
> |
|
185 |
> |
for(int i=0;i<theLimits.size();i++) { |
186 |
> |
if((theLimits[i]<2.0/PlottingSetup::luminosity)||(theLimits[i]>40.0/PlottingSetup::luminosity)) { |
187 |
> |
cout << i << " : " << theVals[i] << endl; |
188 |
> |
theLimits[i] = (theLimits[i+2]+theLimits[i-2])/2.0; |
189 |
> |
write_warning(__FUNCTION__,"Need to store limits"); |
190 |
> |
} |
191 |
> |
write_warning(__FUNCTION__,"Need to store limits"); |
192 |
> |
} |
193 |
> |
} |
194 |
> |
} |
195 |
> |
|
196 |
> |
|
197 |
> |
float EdgeFitter::calcExclusion(RooWorkspace *ws, RooDataSet *data) { |
198 |
|
RooRealVar mu("mu","nSig",0,10000,""); |
199 |
|
RooArgSet poi = RooArgSet(mu); |
200 |
|
RooArgSet *nullParams = (RooArgSet*)poi.snapshot(); |
203 |
|
model->SetWorkspace(*ws); |
204 |
|
model->SetPdf("combModel"); |
205 |
|
model->SetParametersOfInterest(poi); |
206 |
< |
RooAbsData* data = ws->data("data_obs"); |
206 |
> |
if(!data) data = (RooDataSet*)ws->data("data_obs"); |
207 |
|
|
208 |
|
RooStats::ProfileLikelihoodCalculator plc(*data, *model); |
209 |
|
plc.SetNullParameters(*nullParams); |
239 |
|
hc.SetTestStatistic(2); |
240 |
|
hc.SetNumberOfToys(50); |
241 |
|
|
109 |
– |
|
242 |
|
RooStats::HypoTestInverterOriginal hcInv = RooStats::HypoTestInverterOriginal(hc,*ws->var("nSig")); |
243 |
|
hcInv.SetTestSize(0.05); |
244 |
|
hcInv.UseCLs(true); |
285 |
|
|
286 |
|
void EdgeFitter::PrepareDatasets(int is_data) { |
287 |
|
TTree *completetree; |
288 |
+ |
write_warning(__FUNCTION__,"Need to make this function ready for scans as well (use signal from scan samples)"); |
289 |
|
bool hashit=0; |
290 |
|
for(int isample=0;isample<allsamples.collection.size();isample++) { |
291 |
|
if(!allsamples.collection[isample].is_active) continue; |
316 |
|
completetree->Write(); |
317 |
|
// delete completetree; |
318 |
|
|
319 |
< |
EdgeFitter::eeSample = (RooDataSet*)LAllData.reduce("id1==id2&&id1==0"); |
320 |
< |
EdgeFitter::mmSample = (RooDataSet*)LAllData.reduce("id1==id2&&id1==1"); |
319 |
> |
EdgeFitter::eeSample = (RooDataSet*)LAllData.reduce("id1==id2"); |
320 |
> |
EdgeFitter::mmSample = (RooDataSet*)LAllData.reduce("id1==id2"); |
321 |
|
EdgeFitter::emSample = (RooDataSet*)LAllData.reduce("id1!=id2"); |
322 |
|
EdgeFitter::AllData = (RooDataSet*)LAllData.reduce("id1!=id2||id1==id2"); |
323 |
|
|
346 |
|
Yield EdgeFitter::Get_Z_estimate(float jzb_cut, int icut) { |
347 |
|
if(MarcoDebug) write_error(__FUNCTION__,"Returning random Z yield"); |
348 |
|
Yield a(123,45,67); return a; |
216 |
– |
|
349 |
|
return PlottingSetup::allresults.predictions[icut].Zbkg; |
350 |
|
} |
351 |
|
|
355 |
|
return PlottingSetup::allresults.predictions[icut].Flavorsym; |
356 |
|
} |
357 |
|
|
358 |
+ |
void EdgeFitter::DoFit(int is_data, float jzb_cut) { |
359 |
+ |
RooRealVar mll("mll","mll",mllmin,mllmax,"GeV/c^{2}"); |
360 |
+ |
RooCategory sample("sample","sample") ; |
361 |
+ |
sample.defineType("ee"); |
362 |
+ |
//sample.defineType("mm"); |
363 |
+ |
sample.defineType("em"); |
364 |
+ |
//RooDataSet combData("combData","combined data",mll,Index(sample),Import("ee",*eeSample),Import("mm",*mmSample),Import("em",*emSample)); |
365 |
+ |
RooDataSet combData("combData","combined data",mll,RooFit::Index(sample),RooFit::Import("ee",*eeSample),RooFit::Import("em",*emSample)); |
366 |
+ |
|
367 |
+ |
|
368 |
+ |
|
369 |
+ |
//First we make a fit to opposite flavor |
370 |
+ |
RooRealVar fttbarem("fttbarem", "fttbarem", 100, 0, 10000); |
371 |
+ |
RooRealVar par1ttbarem("par1ttbarem", "par1ttbarem", 1.6, 0.01, 4.0); |
372 |
+ |
RooRealVar par2ttbarem("par2ttbarem", "par2ttbarem", 1.0); |
373 |
+ |
RooRealVar par3ttbarem("par3ttbarem", "par3ttbarem", 0.028, 0.001, 1.0); |
374 |
+ |
RooRealVar par4ttbarem("par4ttbarem", "par4ttbarem", 2.0); |
375 |
+ |
RooSUSYBkgPdf ttbarem("ttbarem","ttbarem", mll , par1ttbarem, par2ttbarem, par3ttbarem, par4ttbarem); |
376 |
+ |
RooAddPdf model_em("model_em","model_em", ttbarem, fttbarem); |
377 |
+ |
RooSimultaneous simPdfOF("simPdfOF","simultaneous pdf", sample) ; |
378 |
+ |
simPdfOF.addPdf(model_em,"em"); |
379 |
+ |
RooFitResult *resultOF = simPdfOF.fitTo(combData, RooFit::Save()); |
380 |
+ |
resultOF->Print(); |
381 |
+ |
|
382 |
+ |
RooRealVar* resultOFpar1_ = (RooRealVar*) resultOF->floatParsFinal().find("par1ttbarem"); |
383 |
+ |
float resultOFpar1 = resultOFpar1_->getVal(); |
384 |
+ |
//RooRealVar* resultOFpar2_ = (RooRealVar*) resultOF->floatParsFinal().find("par2ttbarem"); |
385 |
+ |
//float resultOFpar2 = resultOFpar2_->getVal(); |
386 |
+ |
//cout << "caca2.txt" << endl; |
387 |
+ |
|
388 |
+ |
RooRealVar* resultOFpar3_ = (RooRealVar*) resultOF->floatParsFinal().find("par3ttbarem"); |
389 |
+ |
float resultOFpar3 = resultOFpar3_->getVal(); |
390 |
+ |
|
391 |
+ |
//RooRealVar* resultOFpar4_ = (RooRealVar*) resultOF->floatParsFinal().find("par4ttbarem"); |
392 |
+ |
//float resultOFpar4 = resultOFpar4_->getVal(); |
393 |
+ |
//cout << "caca4.txt" << endl; |
394 |
+ |
|
395 |
+ |
|
396 |
+ |
// Now same flavor |
397 |
+ |
RooRealVar fzee("fzee", "fzee", 5, 0, 100000); |
398 |
+ |
RooRealVar meanzee("meanzee", "meanzee", 91.1876, 89, 95); |
399 |
+ |
//RooRealVar sigmazee("sigmazee", "sigmazee", 0.5); |
400 |
+ |
RooRealVar sigmazee("sigmazee", "sigmazee", 5, 0, 100); |
401 |
+ |
RooRealVar widthzee("widthzee", "widthzee", 2.94); |
402 |
+ |
|
403 |
+ |
RooRealVar fttbaree("fttbaree", "fttbaree", 100, 0, 100000); |
404 |
+ |
RooRealVar par1ttbaree("par1ttbaree", "par1ttbaree", resultOFpar1, 0, 100); |
405 |
+ |
RooRealVar par2ttbaree("par2ttbaree", "par2ttbaree", 1.0); |
406 |
+ |
RooRealVar par3ttbaree("par3ttbaree", "par3ttbaree", resultOFpar3, 0, 100); |
407 |
+ |
RooRealVar par4ttbaree("par4ttbaree", "par4ttbaree", 2.0); |
408 |
+ |
|
409 |
+ |
RooRealVar fsignalee("fsignalee", "fsignalee", 10, 0, 400); |
410 |
+ |
RooRealVar par1signalee("par1signalee", "par1signalee", 45, 20, 100); |
411 |
+ |
RooRealVar par2signalee("par2signalee", "par2signalee", 2, 1, 10); |
412 |
+ |
RooRealVar par3signalee("par3signalee", "par3signalee", 45, 0, 200); |
413 |
+ |
|
414 |
+ |
RooVoigtian zee("zee", "zee", mll, meanzee, widthzee, sigmazee); |
415 |
+ |
|
416 |
+ |
|
417 |
+ |
RooSUSYBkgPdf ttbaree("ttbaree","ttbaree", mll , par1ttbaree, par2ttbaree, par3ttbaree, par4ttbaree); |
418 |
+ |
//RooSUSYTPdf signalee("signalee","signalee", mll , par1signalee, par2signalee, par3signalee); |
419 |
+ |
RooSUSYTPdf signalee("signalee","signalee", mll , par1signalee, sigmazee, par3signalee); |
420 |
+ |
|
421 |
+ |
//RooAddPdf model_ee("model_ee","model_ee", RooArgList(zee, ttbaree, signalee), RooArgList(fzee, fttbaree, fsignalee)); |
422 |
+ |
RooAddPdf model_ee("model_ee","model_ee", RooArgList(zee, ttbaree, signalee), RooArgList(fzee, fttbaree, fsignalee)); |
423 |
+ |
RooAddPdf model_emu("model_emu","model_emu", RooArgList(ttbaree), RooArgList(fttbaree)); |
424 |
+ |
|
425 |
+ |
|
426 |
+ |
RooSimultaneous simPdf("simPdf","simultaneous pdf",sample) ; |
427 |
+ |
simPdf.addPdf(model_ee,"ee") ; |
428 |
+ |
simPdf.addPdf(model_emu,"em") ; |
429 |
+ |
|
430 |
+ |
RooFitResult *result = simPdf.fitTo(combData, RooFit::Save()); |
431 |
+ |
result->Print(); |
432 |
+ |
|
433 |
+ |
RooPlot* frame1 = mll.frame(RooFit::Bins(25),RooFit::Title("EE sample")) ; |
434 |
+ |
combData.plotOn(frame1,RooFit::Cut("sample==sample::ee")) ; |
435 |
+ |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
436 |
+ |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Components("ttbaree"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
437 |
+ |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Components("zee"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
438 |
+ |
simPdf.plotOn(frame1,RooFit::Slice(sample,"ee"),RooFit::Components("signalee"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
439 |
+ |
|
440 |
+ |
RooPlot* frame2 = mll.frame(RooFit::Bins(25),RooFit::Title("MM sample")) ; |
441 |
+ |
combData.plotOn(frame2,RooFit::Cut("sample==sample::mm")) ; |
442 |
+ |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
443 |
+ |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Components("ttbarmm"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
444 |
+ |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Components("zmm"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); |
445 |
+ |
simPdf.plotOn(frame2,RooFit::Slice(sample,"mm"),RooFit::Components("signalmm"), RooFit::ProjWData(sample, combData), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)); |
446 |
+ |
|
447 |
+ |
|
448 |
+ |
cout << "Result : " << endl; |
449 |
+ |
cout << "f signal : " << fsignalee.getVal() << " +/- " << fsignalee.getError() << endl; |
450 |
+ |
cout << "f ttbar : " << fttbaree.getVal() << " +/- " << fttbaree.getError() << endl; |
451 |
+ |
cout << "f tt em : " << fttbarem.getVal() << " +/- " << fttbarem.getError() << endl; |
452 |
+ |
cout << "f z ee : " << fzee.getVal() << " +/- " << fzee.getError() << endl; |
453 |
+ |
|
454 |
+ |
// The same plot for the cointrol sample slice |
455 |
+ |
RooPlot* frame3 = mll.frame(RooFit::Bins(25),RooFit::Title("EM sample")) ; |
456 |
+ |
combData.plotOn(frame3,RooFit::Cut("sample==sample::em")) ; |
457 |
+ |
simPdfOF.plotOn(frame3,RooFit::Slice(sample,"em"),RooFit::ProjWData(sample,combData), RooFit::LineColor(kBlack)) ; |
458 |
+ |
simPdfOF.plotOn(frame3,RooFit::Slice(sample,"em"),RooFit::Components("ttbarem"),RooFit::ProjWData(sample,combData),RooFit::LineStyle(kDashed)) ; |
459 |
+ |
|
460 |
+ |
stringstream prefix; |
461 |
+ |
if(is_data==data) prefix << "data_"; |
462 |
+ |
if(is_data==mc) prefix << "mc_"; |
463 |
+ |
if(is_data==mcwithsignal) prefix << "mcwithS_"; |
464 |
+ |
|
465 |
+ |
prefix << "JZB_" << jzb_cut; |
466 |
+ |
|
467 |
+ |
/* cout << "fsignalee : " << fsignalee << endl; |
468 |
+ |
cout << "fttbaree : " << fttbaree << endl; |
469 |
+ |
cout << "fzee : " << fzee << endl;*/ |
470 |
+ |
|
471 |
+ |
|
472 |
+ |
TCanvas* c = new TCanvas("rf501_simultaneouspdf","rf403_simultaneouspdf") ; |
473 |
+ |
c->cd() ; |
474 |
+ |
gPad->SetLeftMargin(0.15); |
475 |
+ |
frame1->GetYaxis()->SetTitleOffset(1.4); |
476 |
+ |
frame1->Draw(); |
477 |
+ |
if(is_data==data) DrawPrelim(); |
478 |
+ |
else DrawPrelim(PlottingSetup::luminosity,true); |
479 |
+ |
CompleteSave(c,"Edge/"+prefix.str()+"eemm"); |
480 |
+ |
delete c; |
481 |
+ |
|
482 |
+ |
TCanvas* d = new TCanvas("rf501_simultaneouspdf","rf403_simultaneouspdf") ; |
483 |
+ |
d->cd() ; |
484 |
+ |
gPad->SetLeftMargin(0.15); |
485 |
+ |
frame2->GetYaxis()->SetTitleOffset(1.4); |
486 |
+ |
frame2->Draw(); |
487 |
+ |
if(is_data==data) DrawPrelim(); |
488 |
+ |
else DrawPrelim(PlottingSetup::luminosity,true); |
489 |
+ |
CompleteSave(d,"Edge/"+prefix.str()+"mm"); |
490 |
+ |
delete d; |
491 |
+ |
//c->cd(2) ; gPad->SetLeftMargin(0.15) ; frame2->GetYaxis()->SetTitleOffset(1.4) ; frame2->Draw(); |
492 |
+ |
|
493 |
+ |
TCanvas* e = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
494 |
+ |
e->cd(); |
495 |
+ |
gPad->SetLeftMargin(0.15); |
496 |
+ |
frame3->GetYaxis()->SetTitleOffset(1.4); |
497 |
+ |
frame3->Draw(); |
498 |
+ |
if(is_data==data) DrawPrelim(); |
499 |
+ |
else DrawPrelim(PlottingSetup::luminosity,true); |
500 |
+ |
CompleteSave(e,"Edge/"+prefix.str()+"emu"); |
501 |
+ |
delete e; |
502 |
+ |
|
503 |
+ |
/* TCanvas* f = new TCanvas("rf501_simultaneouspdfem","rf403_simultaneouspdfem") ; |
504 |
+ |
f->cd(); |
505 |
+ |
gPad->SetLeftMargin(0.15); |
506 |
+ |
frame4->GetYaxis()->SetTitleOffset(1.4); |
507 |
+ |
frame4->Draw(); |
508 |
+ |
if(is_data==data) DrawPrelim(); |
509 |
+ |
else DrawPrelim(PlottingSetup::luminosity,true); |
510 |
+ |
CompleteSave(f,"Edge/"+prefix.str()+"eemm"); |
511 |
+ |
delete f;*/ |
512 |
+ |
|
513 |
+ |
} |
514 |
+ |
|
515 |
|
void EdgeFitter::DoEdgeFit(string mcjzb, string datajzb, float DataPeakError, float MCPeakError, float jzb_cut, int icut, int is_data, TCut cut, TTree *signalevents=0) { |
516 |
|
|
517 |
< |
string storagefile=EdgeFitter::RandomStorageFile(); |
518 |
< |
TFile *f = new TFile(storagefile.c_str(),"RECREATE"); |
519 |
< |
EdgeFitter::InitializeVariables(iMllLow,iMllHigh,jzbHigh,cut); |
520 |
< |
|
521 |
< |
Yield Zestimate=EdgeFitter::Get_Z_estimate(jzb_cut,icut); |
233 |
< |
Yield Testimate=EdgeFitter::Get_T_estimate(jzb_cut,icut); |
234 |
< |
cout << "Cut at JZB>" << jzb_cut << "; using estimates: " << endl; |
235 |
< |
cout << " Z : " << Zestimate << endl; |
236 |
< |
cout << " T : " << Testimate << endl; |
517 |
> |
TCut _cut(cut&&PlottingSetup::basiccut&&PlottingSetup::passtrig); |
518 |
> |
|
519 |
> |
TFile *f = new TFile("workingfile.root","RECREATE"); |
520 |
> |
|
521 |
> |
EdgeFitter::InitializeVariables(PlottingSetup::iMllLow,PlottingSetup::iMllHigh,PlottingSetup::jzbHigh,_cut); |
522 |
|
|
523 |
|
EdgeFitter::PrepareDatasets(is_data); |
524 |
+ |
|
525 |
+ |
RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelow(); |
526 |
+ |
RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); |
527 |
+ |
EdgeFitter::DoFit(is_data, jzb_cut); |
528 |
+ |
RooMsgService::instance().setGlobalKillBelow(msglevel); |
529 |
+ |
|
530 |
|
|
240 |
– |
EdgeFitter::eeSample->Write(); |
241 |
– |
EdgeFitter::emSample->Write(); |
242 |
– |
EdgeFitter::mmSample->Write(); |
243 |
– |
EdgeFitter::AllData->Write(); |
531 |
|
f->Close(); |
532 |
|
|
246 |
– |
write_warning(__FUNCTION__,"Work continues here"); |
247 |
– |
|
248 |
– |
if(EdgeFitter::MarcoDebug) write_warning(__FUNCTION__,"Need to uncomment the next line (remove the output file)"); |
249 |
– |
// gSystem->Exec(("rm "+storagefile).c_str()); |
533 |
|
} |
534 |
|
|
535 |
|
void DoEdgeFit(string mcjzb, string datajzb, float DataPeakError, float MCPeakError, vector<float> jzb_cut, int is_data, TCut cut, TTree *signalevents=0) { |
539 |
|
if(is_data!=1) addcut << "(" << mcjzb << ">" << jzb_cut[icut] << ")"; |
540 |
|
TCut jcut(addcut.str().c_str()); |
541 |
|
|
542 |
+ |
|
543 |
|
EdgeFitter::DoEdgeFit(mcjzb, datajzb, DataPeakError, MCPeakError, jzb_cut[icut], icut, is_data, jcut&&cut, signalevents); |
544 |
|
|
545 |
|
} |