29 |
|
using namespace std; |
30 |
|
|
31 |
|
void check_compatibility_with_zero(Value sigresult, ofstream &file) { |
32 |
< |
cout << "Checking compatibility with zero for f=" << sigresult << endl; |
33 |
< |
cout << " The result is compatible with zero to " << 1-(TMath::Erf((sigresult.getValue()/(TMath::Sqrt(2)*sigresult.getError())))) << endl; |
32 |
> |
dout << "Checking compatibility with zero for f=" << sigresult << endl; |
33 |
> |
dout << " The result is compatible with zero to " << 1-(TMath::Erf((sigresult.getValue()/(TMath::Sqrt(2)*sigresult.getError())))) << endl; |
34 |
|
file << "Checking compatibility with zero for f=" << sigresult << endl; |
35 |
|
file << " The result is compatible with zero to " << 1-(TMath::Erf((sigresult.getValue()/(TMath::Sqrt(2)*sigresult.getError())))) << endl; |
36 |
|
|
165 |
|
c1->SaveAs("Input_for_establish_upper_limits.png"); |
166 |
|
|
167 |
|
TFractionFitter* fit = new TFractionFitter(data, allmc); |
168 |
+ |
|
169 |
+ |
fit->Constrain(1,1.0,1.0); |
170 |
+ |
fit->Constrain(2,0.0,1.1); |
171 |
+ |
//fit->Constrain(1,0.0,10.0); |
172 |
+ |
TFile *rawinput = new TFile("rawtfitterinput.root","RECREATE"); |
173 |
+ |
data->Write(); |
174 |
+ |
signal->Write(); |
175 |
+ |
background->Write(); |
176 |
+ |
rawinput->Close(); |
177 |
|
|
169 |
– |
fit->Constrain(0,0.8,1.2); |
170 |
– |
fit->Constrain(1,0.0,10.0); |
178 |
|
Int_t status = fit->Fit(); |
179 |
|
vector<float> results; |
180 |
|
if(status!=0) return results; |
184 |
|
Value SMresult(mean[0],error[0]); |
185 |
|
fit->GetResult(1,mean[1],error[1]); |
186 |
|
Value sigresult(mean[1],error[1]); |
187 |
< |
cout << "Parameters: " << mean[0] << " , " << mean[1] << endl; |
187 |
> |
dout << "Parameters: " << mean[0] << " , " << mean[1] << endl; |
188 |
|
if(mean[0]<0||mean[1]<0) { |
189 |
< |
cout << "Fitting failed, one of the parameters is negative !!!!" << endl; |
189 |
> |
dout << "Fitting failed, one of the parameters is negative !!!!" << endl; |
190 |
|
return results; |
191 |
|
} |
192 |
|
|
201 |
|
|
202 |
|
Value stretchsm = SMresult/ofacsm; |
203 |
|
Value stretchsig = sigresult/ofac; |
204 |
< |
cout << "Data consists of: " << endl; |
205 |
< |
cout << " SM : " << SMresult << endl; |
206 |
< |
cout << " signal: " << sigresult << endl; |
207 |
< |
cout << "This means that the components have been scaled by: " << endl; |
208 |
< |
cout << " SM: has been stretched by " << (mean[0])/originalfactorSM << " "<< stretchsm<<endl; |
209 |
< |
cout << " Signal: has been stretched by " << (mean[1])/originalfactor << " "<< stretchsig<<endl; |
204 |
> |
dout << "Data consists of: " << endl; |
205 |
> |
dout << " SM : " << SMresult << endl; |
206 |
> |
dout << " signal: " << sigresult << endl; |
207 |
> |
dout << "This means that the components have been scaled by: " << endl; |
208 |
> |
dout << " SM: has been stretched by " << (mean[0])/originalfactorSM << " "<< stretchsm<<endl; |
209 |
> |
dout << " Signal: has been stretched by " << (mean[1])/originalfactor << " "<< stretchsig<<endl; |
210 |
|
|
211 |
|
file << "------------------------------------------"<<endl; |
212 |
|
file << "Now considering: Everything pertaining to " << filename << endl; |
222 |
|
check_compatibility_with_zero(sigresult,file); |
223 |
|
//vector<float> results = compute_sigmas(signal,(mean[1])/originalfactor); |
224 |
|
|
225 |
< |
cout << "\\Chi^2 / ndf = " << fit->GetChisquare() << "/" << fit->GetNDF() << endl; |
225 |
> |
dout << "\\Chi^2 / ndf = " << fit->GetChisquare() << "/" << fit->GetNDF() << endl; |
226 |
|
|
227 |
|
results.push_back(compute_upper_limit_based_on_fit(sigresult,ofac,0)); |
228 |
|
results.push_back(compute_upper_limit_based_on_fit(sigresult,ofac,1)); |
229 |
|
results.push_back(compute_upper_limit_based_on_fit(sigresult,ofac,2)); |
230 |
|
results.push_back(compute_upper_limit_based_on_fit(sigresult,ofac,3)); |
231 |
|
|
232 |
< |
cout << "Limits: (in terms of x prediction) " << endl; |
232 |
> |
dout << "Limits: (in terms of x prediction) " << endl; |
233 |
|
file << "Limits: (in terms of x prediction) " << endl; |
234 |
|
for (int i=0;i<=3;i++) { |
235 |
< |
cout << i << " sigma : " << results[i] << endl; |
235 |
> |
dout << i << " sigma : " << results[i] << endl; |
236 |
|
file << i << " sigma : " << results[i] << endl; |
237 |
|
} |
238 |
|
|
239 |
|
|
240 |
< |
cout << endl << endl; |
240 |
> |
dout << endl << endl; |
241 |
|
file << endl << endl; |
242 |
|
|
243 |
|
if(results[3]<1) { |
244 |
< |
cout << "The point has been excluded, since the upper limit corresponding to 3 sigma, " << results[3] << " is < 1" << endl; |
244 |
> |
dout << "The point has been excluded, since the upper limit corresponding to 3 sigma, " << results[3] << " is < 1" << endl; |
245 |
|
file << "The point has been excluded, since the upper limit corresponding to 3 sigma, " << results[3] << " is < 1" << endl; |
246 |
|
//the ANSII code below will make an X for the excluded point (to celebrate) |
247 |
< |
cout << " __ __" << endl; |
248 |
< |
cout << " \\ \\ / /" << endl; |
249 |
< |
cout << " \\ V / " << endl; |
250 |
< |
cout << " / \\ " << endl; |
251 |
< |
cout << " / /^\\ \\" << endl; |
252 |
< |
cout << " \\/ \\/" << endl; |
247 |
> |
dout << " __ __" << endl; |
248 |
> |
dout << " \\ \\ / /" << endl; |
249 |
> |
dout << " \\ V / " << endl; |
250 |
> |
dout << " / \\ " << endl; |
251 |
> |
dout << " / /^\\ \\" << endl; |
252 |
> |
dout << " \\/ \\/" << endl; |
253 |
|
|
254 |
|
file << " __ __" << endl; |
255 |
|
file << " \\ \\ / /" << endl; |
261 |
|
|
262 |
|
} |
263 |
|
else { |
264 |
< |
cout << "The 3 sigma limit on this point is " << results[3] << " x prediction" << endl; |
264 |
> |
dout << "The 3 sigma limit on this point is " << results[3] << " x prediction" << endl; |
265 |
|
file << "The point has been excluded, since " << results[3] << " x prediction" << endl; |
266 |
|
} |
267 |
|
|