Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TLimitDataSource.cxx
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Christophe.Delaere@cern.ch 21/08/2002
3
4
5/** \class TLimitDataSource
6 This class serves as input for the TLimit::ComputeLimit method.
7 It takes the signal, background and data histograms to form a channel.
8 More channels can be added using AddChannel(), as well as different
9 systematics sources.
10*/
11
12
13#include "TLimitDataSource.h"
14#include "TH1.h"
15#include "TVectorD.h"
16#include "TRandom3.h"
17#include "snprintf.h"
18
19
20////////////////////////////////////////////////////////////////////////////////
21/// Default constructor
22
24{
25 fDummyTA.SetOwner();
26 fDummyIds.SetOwner();
27}
28
29////////////////////////////////////////////////////////////////////////////////
30/// Another constructor, directly adds one channel
31/// with signal, background and data given as input.
32
34{
35 fDummyTA.SetOwner();
36 fDummyIds.SetOwner();
37 AddChannel(s, b, d);
38}
39
40////////////////////////////////////////////////////////////////////////////////
41/// Another constructor, directly adds one channel
42/// with signal, background and data given as input.
43
45 TVectorD * es, TVectorD * eb, TObjArray * names)
46{
47 fDummyTA.SetOwner();
48 fDummyIds.SetOwner();
49 AddChannel(s, b, d, es, eb, names);
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Adds a channel with signal, background and data given as input.
54
56{
57 TVectorD *empty;
58 TRandom3 generator;
59 fSignal.AddLast(s);
60 fBackground.AddLast(b);
61 fCandidates.AddLast(d);
62 char rndname[20];
63 snprintf(rndname,20, "rndname%f", generator.Rndm());
64 empty = new TVectorD(1);
65 fErrorOnSignal.AddLast(empty);
66 fDummyTA.AddLast(empty);
67 snprintf(rndname,20, "rndname%f", generator.Rndm());
68 empty = new TVectorD(1);
69 fErrorOnBackground.AddLast(empty);
70 fDummyTA.AddLast(empty);
71 TObjArray *dummy = new TObjArray(0);
72 fIds.AddLast(dummy);
73 fDummyIds.AddLast(dummy);
74}
75
76////////////////////////////////////////////////////////////////////////////////
77/// Adds a channel with signal, background and data given as input.
78/// In addition, error sources are defined.
79/// TH1 are here used for convenience: each bin has to be seen as
80/// an error source (relative).
81/// names is an array of strings containing the names of the sources.
82/// Sources with the same name are correlated.
83
85 TVectorD * eb, TObjArray * names)
86{
87 fSignal.AddLast(s);
88 fBackground.AddLast(b);
89 fCandidates.AddLast(d);
90 fErrorOnSignal.AddLast(es);
91 fErrorOnBackground.AddLast(eb);
92 fIds.AddLast(names);
93}
94
95////////////////////////////////////////////////////////////////////////////////
96/// Gives to the TLimitDataSource the ownership of the various objects
97/// given as input.
98/// Objects are then deleted by the TLimitDataSource destructor.
99
101{
102 fSignal.SetOwner(swtch);
103 fBackground.SetOwner(swtch);
104 fCandidates.SetOwner(swtch);
105 fErrorOnSignal.SetOwner(swtch);
106 fErrorOnBackground.SetOwner(swtch);
107 fIds.SetOwner(swtch);
108 fDummyTA.SetOwner(!swtch);
109 fDummyIds.SetOwner(!swtch);
110}
111
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
TVectorT< Double_t > TVectorD
Definition TVectorDfwd.h:23
#define snprintf
Definition civetweb.c:1579
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
virtual void SetOwner(bool swtch=kTRUE)
Gives to the TLimitDataSource the ownership of the various objects given as input.
TObjArray fErrorOnBackground
Packed error sources for background.
TObjArray fErrorOnSignal
Packed error sources for signal.
virtual void AddChannel(TH1 *, TH1 *, TH1 *)
Adds a channel with signal, background and data given as input.
TLimitDataSource()
Default constructor.
TObjArray fIds
Packed IDs for the different error sources.
TObjArray fDummyTA
Dummy objects the class will use and delete.
TObjArray fSignal
Packed input signal.
TObjArray fCandidates
Packed input candidates (data).
TObjArray fBackground
Packed input background.
TObjArray fDummyIds
Array of dummy object (used for bookeeping).
An array of TObjects.
Definition TObjArray.h:31
Random number generator class based on M.
Definition TRandom3.h:27
Double_t Rndm() override
Machine independent random number generator.
Definition TRandom3.cxx:107