ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/claudioc/ScansICHEP2012/code/Functions.cc
Revision: 1.2
Committed: Mon Jul 2 04:42:05 2012 UTC (12 years, 10 months ago) by claudioc
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +82 -4 lines
Log Message:
lipstick

File Contents

# Content
1
2
3
4 double observedLimitOnNumberOfEvents( int mySR, float accUncertainty, bool Posteriori ){
5
6
7 int SR ;
8 float err,obs,exp, exp_PlusSigma, exp_MinusSigma, myUL, myMinErr = 9999;
9 TString MyFile = "empty";
10
11
12 //input files:
13 if( Posteriori )
14 MyFile = "LandsOutput_Posterior.txt";
15 else
16 MyFile = "LandsOutput_Apriori.txt";
17
18 ifstream fLimits(""+MyFile+"", ifstream::in);
19 if( !fLimits.is_open() ){
20 cerr << "[ERROR] Limit file is null " << endl;
21 return 1;
22 }
23
24 while( fLimits >> SR >> err >> exp >> obs >> exp_PlusSigma >> exp_MinusSigma ){
25
26 if( SR == mySR ){
27
28 // To Find the UL for a given accUncert!!
29 float dAncc = TMath::Abs( err - accUncertainty );
30 if( dAncc < myMinErr ){
31 myMinErr = dAncc ;
32 myUL = obs;
33 }
34 }
35 }
36
37 return myUL;
38 }
39
40
41
42 double expectedLimitOnNumberOfEvents( int mySR, float accUncertainty, bool Posteriori ){
43
44
45 int SR ;
46 float err,obs,exp, exp_PlusSigma, exp_MinusSigma, myUL, myMinErr = 9999;
47 TString MyFile = "empty";
48
49
50 //input files:
51 if( Posteriori )
52 MyFile = "LandsOutput_Posterior.txt";
53 else
54 MyFile = "LandsOutput_Apriori.txt";
55
56 ifstream fLimits(""+MyFile+"", ifstream::in);
57 if( !fLimits.is_open() ){
58 cerr << "[ERROR] Limit file is null " << endl;
59 return 1;
60 }
61
62 while( fLimits >> SR >> err >> exp >> obs >> exp_PlusSigma >> exp_MinusSigma ){
63
64 if( SR == mySR ){
65
66 // To Find the UL for a given accUncert!!
67 float dAncc = TMath::Abs( err - accUncertainty );
68 if( dAncc < myMinErr ){
69 myMinErr = dAncc ;
70 myUL = exp;
71 }
72 }
73 }
74
75 return myUL;
76 }
77
78
79
80 double expectedMinusOneSigmaLimitOnNumberOfEvents( int mySR, float accUncertainty, bool Posteriori ){
81
82
83 int SR ;
84 float err,obs,exp, exp_PlusSigma, exp_MinusSigma, myUL, myMinErr = 9999;
85 TString MyFile = "empty";
86
87
88 //input files:
89 if( Posteriori )
90 MyFile = "LandsOutput_Posterior.txt";
91 else
92 MyFile = "LandsOutput_Apriori.txt";
93
94 ifstream fLimits(""+MyFile+"", ifstream::in);
95 if( !fLimits.is_open() ){
96 cerr << "[ERROR] Limit file is null " << endl;
97 return 1;
98 }
99
100 while( fLimits >> SR >> err >> exp >> obs >> exp_PlusSigma >> exp_MinusSigma ){
101
102 if( SR == mySR ){
103
104 // To Find the UL for a given accUncert!!
105 float dAncc = TMath::Abs( err - accUncertainty );
106 if( dAncc < myMinErr ){
107 myMinErr = dAncc ;
108 myUL = exp_MinusSigma ;
109 }
110 }
111 }
112
113 return myUL;
114 }
115
116
117
118
119
120 double expectedPlusOneSigmaLimitOnNumberOfEvents( int mySR, float accUncertainty, bool Posteriori ){
121
122
123 int SR ;
124 float err,obs,exp, exp_PlusSigma, exp_MinusSigma, myUL, myMinErr = 9999;
125 TString MyFile = "empty";
126
127
128 //input files:
129 if( Posteriori )
130 MyFile = "LandsOutput_Posterior.txt";
131 else
132 MyFile = "LandsOutput_Apriori.txt";
133
134 ifstream fLimits(""+MyFile+"", ifstream::in);
135 if( !fLimits.is_open() ){
136 cerr << "[ERROR] Limit file is null " << endl;
137 return 1;
138 }
139
140 while( fLimits >> SR >> err >> exp >> obs >> exp_PlusSigma >> exp_MinusSigma ){
141
142 if( SR == mySR ){
143
144 // To Find the UL for a given accUncert!!
145 float dAncc = TMath::Abs( err - accUncertainty );
146 if( dAncc < myMinErr ){
147 myMinErr = dAncc ;
148 myUL = exp_PlusSigma ;
149 }
150 }
151 }
152
153 return myUL;
154 }
155