ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/auterman/SusyScan/Limits/TLimitDataSource.cc
Revision: 1.1.1.1 (vendor branch)
Committed: Wed Jan 26 14:37:51 2011 UTC (14 years, 3 months ago) by auterman
Content type: text/plain
Branch: Limits, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Error occurred while calculating annotation data.
Log Message:
Limt calculation code

File Contents

# Content
1 // @(#)root/hist:$Name: $:$Id: TLimitDataSource.cc,v 1.2 2010/05/03 16:51:17 auterman Exp $
2 // Author: Christophe.Delaere@cern.ch 21/08/2002
3
4 ///////////////////////////////////////////////////////////////////////////
5 //
6 // TLimitDataSource
7 //
8 // This class serves as interface to feed data into the TLimit routines
9 //
10 ///////////////////////////////////////////////////////////////////////////
11
12 #include "TLimitDataSource.h"
13 #include "TH1.h"
14 #include "TObjString.h"
15 #include "TRandom3.h"
16
17
18 #include <iostream>
19
20 ClassImp(TLimitDataSource)
21
22 TLimitDataSource::TLimitDataSource()
23 {
24 // Default constructor
25 fDummyTH1D.SetOwner();
26 fDummyIds.SetOwner();
27 }
28
29 TLimitDataSource::TLimitDataSource(TH1D * s, TH1D * b, TH1D * d)
30 {
31 // Another constructor, directly adds one channel
32 // with signal, background and data given as input.
33 fDummyTH1D.SetOwner();
34 fDummyIds.SetOwner();
35 AddChannel(s, b, d);
36 }
37
38 void TLimitDataSource::AddChannel(TH1D * s, TH1D * b, TH1D * d)
39 {
40 // Adds a channel with signal, background and data given as input.
41
42 TH1D *empty;
43 TRandom3 generator;
44 fSignal.AddLast(s);
45 fBackground.AddLast(b);
46 fCandidates.AddLast(d);
47 char rndname[20];
48 sprintf(rndname, "rndname%f", generator.Rndm());
49 empty = new TH1D(rndname, "", 1, 0, 1);
50 empty->SetDirectory(0);
51 fErrorOnSignal.AddLast(empty);
52 fDummyTH1D.AddLast(empty);
53
54 sprintf(rndname, "rndname%f", generator.Rndm());
55 empty = new TH1D(rndname, "", 1, 0, 1);
56 empty->SetDirectory(0);
57 fErrorOnBackground.AddLast(empty);
58 fDummyTH1D.AddLast(empty);
59 TObjArray *dummy = new TObjArray(0);
60 fIds.AddLast(dummy);
61 fDummyIds.AddLast(dummy);
62 }
63
64 void TLimitDataSource::AddChannel(TH1D * s, TH1D * b, TH1D * d, TH1D * es,
65 TH1D * eb, TObjArray * names)
66 {
67 // Adds a channel with signal, background and data given as input.
68 // In addition, error sources are defined.
69 // TH1D are here used for convenience: each bin has to be seen as
70 // an error source (relative).
71 // names is an array of strings containing the names of the sources.
72 // Sources with the same name are correlated.
73
74 fSignal.AddLast(s);
75 fBackground.AddLast(b);
76 fCandidates.AddLast(d);
77 fErrorOnSignal.AddLast(es);
78 fErrorOnBackground.AddLast(eb);
79 fIds.AddLast(names);
80 }
81
82 void TLimitDataSource::AddChannel(TH1D * s, TH1D * b, TH1D * d,
83 TH1D * espos, TH1D * esneg,
84 TH1D * ebpos, TH1D * ebneg, TObjArray * names)
85 {
86 // Adds a channel with signal, background and data given as input.
87 // In addition, error sources with asymmetric errors are defined.
88 // TH1D are here used for convenience: each bin has to be seen as
89 // an error source (relative).
90 // names is an array of strings containing the names of the sources.
91 // Sources with the same name are correlated.
92
93 fErrorOnSignalNeg.AddLast(esneg);
94 fErrorOnBackgroundNeg.AddLast(ebneg);
95 AddChannel(s,b,d,espos,ebpos,names);
96 }
97
98 void TLimitDataSource::SetOwner(bool swtch)
99 {
100 // Gives to the TLimitDataSource the ownership of the various objects
101 // given as input.
102 // Objects are then deleted by the TLimitDataSource destructor.
103
104 fSignal.SetOwner(swtch);
105 fBackground.SetOwner(swtch);
106 fCandidates.SetOwner(swtch);
107 fErrorOnSignal.SetOwner(swtch);
108 fErrorOnSignalNeg.SetOwner(swtch);
109 fErrorOnBackground.SetOwner(swtch);
110 fErrorOnBackgroundNeg.SetOwner(swtch);
111 fIds.SetOwner(swtch);
112 fDummyTH1D.SetOwner(!swtch);
113 fDummyIds.SetOwner(!swtch);
114 }
115