ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/claudioc/ScansICHEP2012/code/Functions.cc
(Generate patch)

Comparing UserCode/claudioc/ScansICHEP2012/code/Functions.cc (file contents):
Revision 1.1 by claudioc, Sat Jun 16 01:51:53 2012 UTC vs.
Revision 1.2 by claudioc, Mon Jul 2 04:42:05 2012 UTC

# Line 5 | Line 5 | double observedLimitOnNumberOfEvents( in
5      
6      
7      int SR ;
8 <    float err,obs,exp, myUL, myMinErr = 9999;
8 >    float err,obs,exp, exp_PlusSigma, exp_MinusSigma, myUL,  myMinErr = 9999;
9      TString MyFile = "empty";
10      
11      
# Line 21 | Line 21 | double observedLimitOnNumberOfEvents( in
21          return 1;
22      }
23      
24 <    while( fLimits >> SR >> err >> exp >> obs ){
24 >    while( fLimits >> SR >> err >> exp >> obs >> exp_PlusSigma >> exp_MinusSigma ){
25          
26          if( SR == mySR ){
27              
# Line 43 | Line 43 | double expectedLimitOnNumberOfEvents( in
43      
44      
45      int SR ;
46 <    float err,obs,exp, myUL, myMinErr = 9999;
46 >    float err,obs,exp, exp_PlusSigma, exp_MinusSigma, myUL,  myMinErr = 9999;
47      TString MyFile = "empty";
48      
49      
# Line 59 | Line 59 | double expectedLimitOnNumberOfEvents( in
59          return 1;
60      }
61      
62 <    while( fLimits >> SR >> err >> exp >> obs ){
62 >    while( fLimits >> SR >> err >> exp >> obs >> exp_PlusSigma >> exp_MinusSigma ){
63          
64          if( SR == mySR ){
65              
# Line 71 | Line 71 | double expectedLimitOnNumberOfEvents( in
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines