ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 interface to feed data into the TLimit routines
7 */
8 ///////////////////////////////////////////////////////////////////////////
9 
10 #include "TLimitDataSource.h"
11 #include "TH1.h"
12 #include "TVectorD.h"
13 #include "TObjString.h"
14 #include "TRandom3.h"
15 
17 
19 {
20  // Default constructor
21  fDummyTA.SetOwner();
22  fDummyIds.SetOwner();
23 }
24 
26 {
27  // Another constructor, directly adds one channel
28  // with signal, background and data given as input.
31  AddChannel(s, b, d);
32 }
33 
35  TVectorD * es, TVectorD * eb, TObjArray * names)
36 {
37  // Another constructor, directly adds one channel
38  // with signal, background and data given as input.
41  AddChannel(s, b, d, es, eb, names);
42 }
43 
45 {
46  // Adds a channel with signal, background and data given as input.
47 
48  TVectorD *empty;
49  TRandom3 generator;
50  fSignal.AddLast(s);
53  char rndname[20];
54  snprintf(rndname,20, "rndname%f", generator.Rndm());
55  empty = new TVectorD(1);
56  fErrorOnSignal.AddLast(empty);
57  fDummyTA.AddLast(empty);
58  snprintf(rndname,20, "rndname%f", generator.Rndm());
59  empty = new TVectorD(1);
61  fDummyTA.AddLast(empty);
62  TObjArray *dummy = new TObjArray(0);
63  fIds.AddLast(dummy);
64  fDummyIds.AddLast(dummy);
65 }
66 
68  TVectorD * eb, TObjArray * names)
69 {
70  // Adds a channel with signal, background and data given as input.
71  // In addition, error sources are defined.
72  // TH1 are here used for convenience: each bin has to be seen as
73  // an error source (relative).
74  // names is an array of strings containing the names of the sources.
75  // Sources with the same name are correlated.
76 
77  fSignal.AddLast(s);
82  fIds.AddLast(names);
83 }
84 
86 {
87  // Gives to the TLimitDataSource the ownership of the various objects
88  // given as input.
89  // Objects are then deleted by the TLimitDataSource destructor.
90 
91  fSignal.SetOwner(swtch);
92  fBackground.SetOwner(swtch);
93  fCandidates.SetOwner(swtch);
94  fErrorOnSignal.SetOwner(swtch);
96  fIds.SetOwner(swtch);
97  fDummyTA.SetOwner(!swtch);
98  fDummyIds.SetOwner(!swtch);
99 }
100 
An array of TObjects.
Definition: TObjArray.h:39
Random number generator class based on M.
Definition: TRandom3.h:29
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
This class serves as interface to feed data into the TLimit routines.
int d
Definition: tornado.py:11
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
Definition: TRandom3.cxx:94
TVectorT< Double_t > TVectorD
Definition: TVectorDfwd.h:24
virtual void AddChannel(TH1 *, TH1 *, TH1 *)
ClassImp(TLimitDataSource) TLimitDataSource
virtual void SetOwner(bool swtch=kTRUE)
TObjArray fErrorOnSignal
static RooMathCoreReg dummy
The TH1 histogram class.
Definition: TH1.h:80
TObjArray fErrorOnBackground
virtual void AddLast(TObject *obj)
Add object in the next empty slot in the array.
Definition: TObjArray.cxx:169