102 Int_t nmc,
bool stat,
115 for (i = 0; i <=
data->GetSignal()->GetLast(); i++) {
116 maxbins = (((
TH1 *) (
data->GetSignal()->At(i)))->GetNbinsX() + 2) > maxbins ?
117 (((
TH1 *) (
data->GetSignal()->At(i)))->GetNbinsX() + 2) : maxbins;
118 nsig += ((
TH1 *) (
data->GetSignal()->At(i)))->Integral();
119 nbg += ((
TH1 *) (
data->GetBackground()->At(i)))->Integral();
120 ncand += (
Int_t) ((
TH1 *) (
data->GetCandidates()->At(i)))->Integral();
126 fgTable->Set(maxbins * (
data->GetSignal()->GetLast() + 1));
127 for (
Int_t channel = 0; channel <=
data->GetSignal()->GetLast(); channel++)
129 bin <= ((
TH1 *) (
data->GetSignal()->At(channel)))->GetNbinsX()+1;
135 if ((
b == 0) && (s > 0)) {
136 std::cout <<
"WARNING: Ignoring bin " << bin <<
" of channel "
137 << channel <<
" which has s=" << s <<
" but b=" <<
b << std::endl;
138 std::cout <<
" Maybe the MC statistic has to be improved..." << std::endl;
140 if ((s > 0) && (
b > 0))
145 if ((s > 0) && (
b > 0))
147 else if ((s > 0) && (
b == 0))
148 fgTable->AddAt(20, (channel * maxbins) + bin);
163 for (i = 0; i < nmc; i++) {
175 for (
Int_t channel = 0;
176 channel <= fluctuated->
GetSignal()->GetLast(); channel++) {
178 bin <=((
TH1 *) (fluctuated->
GetSignal()->
At(channel)))->GetNbinsX()+1;
185 tss[i] += rand *
fgTable->At((channel * maxbins) + bin);
190 if ((s > 0) && (b2 > 0))
192 else if ((s > 0) && (b2 == 0))
193 lrs[i] += 20 * rand - s;
196 rand = myrandom->
Poisson(rate);
197 tsb[i] += rand *
fgTable->At((channel * maxbins) + bin);
198 if ((s2 > 0) && (
b > 0))
200 else if ((s > 0) && (
b == 0))
201 lrb[i] += 20 * rand - s;
205 lrs[i] =
TMath::Exp(lrs[i] < 710 ? lrs[i] : 710);
206 lrb[i] =
TMath::Exp(lrb[i] < 710 ? lrb[i] : 710);
227 bool init,
TRandom * generator,
bool stat)
232 TIter errornames =
input->GetErrorNames()->MakeIterator();
255 for (
Int_t channel = 0; channel <=
input->GetSignal()->GetLast(); channel++) {
257 TH1 *oldsignal = (
TH1*)(
input->GetSignal()->At(channel));
259 for(
int i=1; i<=newsignal->
GetNbinsX(); i++) {
264 TH1 *oldbackground = (
TH1*)(
input->GetBackground()->At(channel));
266 for(
int i=1; i<=newbackground->
GetNbinsX(); i++)
282 toss[i] = generator->
Gaus(0, 1);
284 for (
Int_t channel = 0;
285 channel <=
input->GetSignal()->GetLast();
290 bin <((
TVectorD *) (
input->GetErrorOnSignal()->At(channel)))->GetNrows();
292 serrf[channel] += ((
TVectorD *) (
input->GetErrorOnSignal()->At(channel)))->operator[](bin) *
294 berrf[channel] += ((
TVectorD *) (
input->GetErrorOnBackground()->At(channel)))->operator[](bin) *
297 if ((serrf[channel] < -1.0) || (berrf[channel] < -0.9)) {
307 for (
Int_t channel = 0; channel <=
input->GetSignal()->GetLast();
310 TH1 *oldsignal = (
TH1*)(
input->GetSignal()->At(channel));
312 for(
int i=1; i<=newsignal->
GetNbinsX(); i++)
315 for(
int i=1; i<=newsignal->
GetNbinsX(); i++)
317 newsignal->
Scale(1 + serrf[channel]);
320 TH1 *oldbackground = (
TH1*)(
input->GetBackground()->At(channel));
322 for(
int i=1; i<=newbackground->
GetNbinsX(); i++)
325 for(
int i=1; i<=newbackground->
GetNbinsX(); i++)
327 newbackground->
Scale(1 + berrf[channel]);
336 Int_t nmc,
bool stat,
349 Int_t nmc,
bool stat,
367 TH1D* sh =
new TH1D(
"__sh",
"__sh",1,0,2);
369 TH1D* bh =
new TH1D(
"__bh",
"__bh",1,0,2);
371 TH1D* dh =
new TH1D(
"__dh",
"__dh",1,0,2);
390 TH1D* sh =
new TH1D(
"__sh",
"__sh",1,0,2);
392 TH1D* bh =
new TH1D(
"__bh",
"__bh",1,0,2);
394 TH1D* dh =
new TH1D(
"__dh",
"__dh",1,0,2);
bool Bool_t
Boolean (0=false, 1=true) (bool).
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
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
TVectorT< Double_t > TVectorD
Array of doubles (64 bits per element).
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 Scale(Double_t c1=1, Option_t *option="")
virtual Int_t GetNbinsX() const
virtual void SetDirectory(TDirectory *dir)
virtual Int_t Fill(Double_t x)
virtual Double_t GetBinError(Int_t bin) const
virtual Double_t GetBinContent(Int_t bin) const
virtual void SetBinContent(Int_t bin, Double_t content)
This class serves as input for the TLimit::ComputeLimit method.
virtual void SetOwner(bool swtch=kTRUE)
Gives to the TLimitDataSource the ownership of the various objects given as input.
virtual TObjArray * GetSignal()
virtual TObjArray * GetBackground()
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.
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.