103 Int_t nmc,
bool stat,
116 for (i = 0; i <=
data->GetSignal()->GetLast(); i++) {
117 maxbins = (((
TH1 *) (
data->GetSignal()->At(i)))->GetNbinsX() + 2) > maxbins ?
118 (((
TH1 *) (
data->GetSignal()->At(i)))->GetNbinsX() + 2) : maxbins;
119 nsig += ((
TH1 *) (
data->GetSignal()->At(i)))->Integral();
120 nbg += ((
TH1 *) (
data->GetBackground()->At(i)))->Integral();
121 ncand += (
Int_t) ((
TH1 *) (
data->GetCandidates()->At(i)))->Integral();
128 for (
Int_t channel = 0; channel <=
data->GetSignal()->GetLast(); channel++)
130 bin <= ((
TH1 *) (
data->GetSignal()->At(channel)))->GetNbinsX()+1;
136 if ((
b == 0) && (s > 0)) {
137 std::cout <<
"WARNING: Ignoring bin " << bin <<
" of channel "
138 << channel <<
" which has s=" << s <<
" but b=" <<
b << std::endl;
139 std::cout <<
" Maybe the MC statistic has to be improved..." << std::endl;
141 if ((s > 0) && (
b > 0))
146 if ((s > 0) && (
b > 0))
148 else if ((s > 0) && (
b == 0))
164 for (i = 0; i < nmc; i++) {
176 for (
Int_t channel = 0;
177 channel <= fluctuated->
GetSignal()->GetLast(); channel++) {
179 bin <=((
TH1 *) (fluctuated->
GetSignal()->
At(channel)))->GetNbinsX()+1;
186 tss[i] += rand *
fgTable->
At((channel * maxbins) + bin);
191 if ((s > 0) && (b2 > 0))
193 else if ((s > 0) && (b2 == 0))
194 lrs[i] += 20 * rand - s;
197 rand = myrandom->
Poisson(rate);
198 tsb[i] += rand *
fgTable->
At((channel * maxbins) + bin);
199 if ((s2 > 0) && (
b > 0))
201 else if ((s > 0) && (
b == 0))
202 lrb[i] += 20 * rand - s;
206 lrs[i] =
TMath::Exp(lrs[i] < 710 ? lrs[i] : 710);
207 lrb[i] =
TMath::Exp(lrb[i] < 710 ? lrb[i] : 710);
228 bool init,
TRandom * generator,
bool stat)
233 TIter errornames =
input->GetErrorNames()->MakeIterator();
256 for (
Int_t channel = 0; channel <=
input->GetSignal()->GetLast(); channel++) {
257 TH1 *newsignal = (
TH1*)(
output->GetSignal()->At(channel));
258 TH1 *oldsignal = (
TH1*)(
input->GetSignal()->At(channel));
260 for(
int i=1; i<=newsignal->
GetNbinsX(); i++) {
264 TH1 *newbackground = (
TH1*)(
output->GetBackground()->At(channel));
265 TH1 *oldbackground = (
TH1*)(
input->GetBackground()->At(channel));
267 for(
int i=1; i<=newbackground->
GetNbinsX(); i++)
283 toss[i] = generator->
Gaus(0, 1);
285 for (
Int_t channel = 0;
286 channel <=
input->GetSignal()->GetLast();
291 bin <((
TVectorD *) (
input->GetErrorOnSignal()->At(channel)))->GetNrows();
293 serrf[channel] += ((
TVectorD *) (
input->GetErrorOnSignal()->At(channel)))->operator[](bin) *
295 berrf[channel] += ((
TVectorD *) (
input->GetErrorOnBackground()->At(channel)))->operator[](bin) *
298 if ((serrf[channel] < -1.0) || (berrf[channel] < -0.9)) {
308 for (
Int_t channel = 0; channel <=
input->GetSignal()->GetLast();
310 TH1 *newsignal = (
TH1*)(
output->GetSignal()->At(channel));
311 TH1 *oldsignal = (
TH1*)(
input->GetSignal()->At(channel));
313 for(
int i=1; i<=newsignal->
GetNbinsX(); i++)
316 for(
int i=1; i<=newsignal->
GetNbinsX(); i++)
318 newsignal->
Scale(1 + serrf[channel]);
320 TH1 *newbackground = (
TH1*)(
output->GetBackground()->At(channel));
321 TH1 *oldbackground = (
TH1*)(
input->GetBackground()->At(channel));
323 for(
int i=1; i<=newbackground->
GetNbinsX(); i++)
326 for(
int i=1; i<=newbackground->
GetNbinsX(); i++)
328 newbackground->
Scale(1 + berrf[channel]);
337 Int_t nmc,
bool stat,
350 Int_t nmc,
bool stat,
368 TH1D* sh =
new TH1D(
"__sh",
"__sh",1,0,2);
370 TH1D* bh =
new TH1D(
"__bh",
"__bh",1,0,2);
372 TH1D* dh =
new TH1D(
"__dh",
"__dh",1,0,2);
391 TH1D* sh =
new TH1D(
"__sh",
"__sh",1,0,2);
393 TH1D* bh =
new TH1D(
"__bh",
"__bh",1,0,2);
395 TH1D* dh =
new TH1D(
"__dh",
"__dh",1,0,2);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Array of doubles (64 bits per element).
Double_t At(Int_t i) const
void Set(Int_t n) override
Set size of this array to n doubles.
void AddAt(Double_t c, Int_t i)
Set the double c value at position i in the array.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Class to compute 95% CL limits.
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
virtual Int_t GetNbinsX() const
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
This class serves as input for the TLimit::ComputeLimit method.
virtual TObjArray * GetSignal()
virtual TObjArray * GetBackground()
<div class="legacybox"><h2>Legacy Code</h2> TLimit is a legacy interface: there will be no bug fixes ...
static Double_t LogLikelihood(Double_t s, Double_t b, Double_t b2, Double_t d)
static TOrdCollection * fgSystNames
Collection of systematics names.
static TArrayD * fgTable
A log table... just to speed up calculation.
static bool Fluctuate(TLimitDataSource *input, TLimitDataSource *output, bool init, TRandom *, bool stat=false)
static TConfidenceLevel * ComputeLimit(TLimitDataSource *data, Int_t nmc=50000, bool stat=false, TRandom *generator=nullptr)
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Returns an array iterator.
TObject * At(Int_t idx) const override
Collectable string class.
void AddLast(TObject *obj) override
Add object at the end of the collection.
void Sort()
If objects in collection are sortable (i.e.
Int_t IndexOf(const TObject *obj) const override
Return index of object in collection.
Int_t BinarySearch(TObject *obj)
Find object using a binary search.
Random number generator class based on M.
This is the base class for the ROOT Random number generators.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual ULong64_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Double_t Log(Double_t x)
Returns the natural logarithm of x.