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
20
21////////////////////////////////////////////////////////////////////////////////
22/// Default constructor
23
25{
28}
29
30////////////////////////////////////////////////////////////////////////////////
31/// Another constructor, directly adds one channel
32/// with signal, background and data given as input.
33
35{
38 AddChannel(s, b, d);
39}
40
41////////////////////////////////////////////////////////////////////////////////
42/// Another constructor, directly adds one channel
43/// with signal, background and data given as input.
44
46 TVectorD * es, TVectorD * eb, TObjArray * names)
47{
50 AddChannel(s, b, d, es, eb, names);
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Adds a channel with signal, background and data given as input.
55
57{
58 TVectorD *empty;
59 TRandom3 generator;
63 char rndname[20];
64 snprintf(rndname,20, "rndname%f", generator.Rndm());
65 empty = new TVectorD(1);
67 fDummyTA.AddLast(empty);
68 snprintf(rndname,20, "rndname%f", generator.Rndm());
69 empty = new TVectorD(1);
71 fDummyTA.AddLast(empty);
72 TObjArray *dummy = new TObjArray(0);
73 fIds.AddLast(dummy);
74 fDummyIds.AddLast(dummy);
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// Adds a channel with signal, background and data given as input.
79/// In addition, error sources are defined.
80/// TH1 are here used for convenience: each bin has to be seen as
81/// an error source (relative).
82/// names is an array of strings containing the names of the sources.
83/// Sources with the same name are correlated.
84
86 TVectorD * eb, TObjArray * names)
87{
93 fIds.AddLast(names);
94}
95
96////////////////////////////////////////////////////////////////////////////////
97/// Gives to the TLimitDataSource the ownership of the various objects
98/// given as input.
99/// Objects are then deleted by the TLimitDataSource destructor.
100
102{
103 fSignal.SetOwner(swtch);
104 fBackground.SetOwner(swtch);
105 fCandidates.SetOwner(swtch);
108 fIds.SetOwner(swtch);
109 fDummyTA.SetOwner(!swtch);
110 fDummyIds.SetOwner(!swtch);
111}
112
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define ClassImp(name)
Definition Rtypes.h:377
TVectorT< Double_t > TVectorD
Definition TVectorDfwd.h:23
#define snprintf
Definition civetweb.c:1540
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
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.
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
void AddLast(TObject *obj) override
Add object in the next empty slot in the array.
Random number generator class based on M.
Definition TRandom3.h:27
Double_t Rndm() override
Machine independent random number generator.
Definition TRandom3.cxx:99