def _get_crossings_for_limits(self, list_of_segments, cl=0.68): """Internal function for getting the Y values from given TGraph objets. It is used to get POI limits for particular confidence level. """ assert belongsTo( float(cl), 0, 1), "Confidence level has to be given in interval [0,1]" quantileExpected = 1 - cl values = [] for seg in list_of_segments: #ll_seg is a TGraph xmin = TMath.MinElement(seg.GetN(), seg.GetX()) xmax = TMath.MaxElement(seg.GetN(), seg.GetX()) if belongsTo(quantileExpected, xmin, xmax): values.append(seg.Eval(quantileExpected)) return values
def is_set_ul(self, POI, cl=0.68): assert belongsTo( float(cl), 0, 1), "Confidence level has to be given in interval [0,1]" cl_name = "{1}_CL@{0:.2f}".format(cl, POI) try: self.ul_values_dict[cl_name] except KeyError: raise KeyError, 'The POI name \"{0}\" is invalid.'.format(POI) else: return (len(self.ul_values_dict[cl_name]) > 0)
def ll_values(self, POI, cl=0.68): """returns a list of lower limits for a given level for a given POI """ if not self._has_parsed_combine_result_already: self._parse_combine_result() assert belongsTo( float(cl), 0, 1), "Confidence level has to be given in interval [0,1]" cl_name = "{1}_CL@{0:.2f}".format(cl, POI) try: self.ll_values_dict[cl_name] except KeyError: self.ll_values_dict[cl_name] = self._get_crossings_for_limits( self.raising_segments[POI], float(cl)) self.log.debug('Creating limit for C.L.@{0}'.format(cl)) else: self.log.debug('Returning existing limit for C.L.@{0}'.format(cl)) return self.ll_values_dict[cl_name]