ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/claudioc/ScansICHEP2012/code/Functions.cc
Revision: 1.1
Committed: Sat Jun 16 01:51:53 2012 UTC (12 years, 10 months ago) by claudioc
Content type: text/plain
Branch: MAIN
CVS Tags: CommonAN1stRelease
Log Message:
from Nik

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, 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 ){
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, 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 ){
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