Example #1
0
def getComment(analysis, path=None):
    """
    Get the comment of an analysis.
    
    """
    logger.warning("getComment is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "comment", path)
Example #2
0
def isPrivate(analysis, path=None):
    """
    Check if analysis is flagged as private.
    """
    field = smsHelpers.getMetaInfoField(analysis, "private", path)
    if field == None: return False
    return bool(int(field))
Example #3
0
def getPAS(analysis, path=None):
    """
    Get the PAS of an analysis.
    
    """
    logger.warning("getPAS is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "pas", path)
Example #4
0
def getJournal(analysis, path=None):
    """
    Get the journal of an analysis.
    
    """
    logger.warning("getJournal is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "journal", path)
Example #5
0
def getJournal(analysis, path=None):
    """
    Get the journal of an analysis.
    
    """
    logger.warning ("getJournal is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "journal", path)
Example #6
0
def getPAS(analysis, path=None):
    """
    Get the PAS of an analysis.
    
    """
    logger.warning("getPAS is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "pas", path)
Example #7
0
def isPrivate(analysis, path=None):
    """
    Check if analysis is flagged as private.
    """
    field=smsHelpers.getMetaInfoField(analysis, "private", path)
    if field==None: return False
    return bool(int(field))
Example #8
0
def getURL(analysis, path=None):
    """
    Get the URL of an analysis.
    
    """
    logger.warning("getURL is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "url", path)
Example #9
0
def getURL(analysis, path=None):
    """
    Get the URL of an analysis.
    
    """
    logger.warning ("getURL is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "url", path)
Example #10
0
def getComment(analysis, path=None):
    """
    Get the comment of an analysis.
    
    """
    logger.warning ("getComment is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "comment", path)
Example #11
0
def getSqrts(analysis, path=None):
    """ get the center-of-mass energy of the analysis.
    """
    sqrts = smsHelpers.getMetaInfoField(analysis, "sqrts", path)
    try:
        return float(sqrts) * TeV

    except ValueError:
        try:
            return eval(sqrts)
        except:
            pass
    return sqrts
Example #12
0
def getSqrts(analysis, path=None):
    """ get the center-of-mass energy of the analysis.
    """
    sqrts = smsHelpers.getMetaInfoField(analysis, "sqrts", path)
    try:
        return float(sqrts) * TeV

    except ValueError:
        try:
            return eval(sqrts)
        except:
            pass
    return sqrts
Example #13
0
def getLumi(analysis, path=None):
    """
    Get the integrated luminosity for an analysis.
    
    """
    lumifb = smsHelpers.getMetaInfoField(analysis, "lumi", path)
    try:
        return float(lumifb) / fb
    except ValueError:
        try:
            return eval(lumifb)
        except:
            pass
    return lumifb
Example #14
0
def getLumi(analysis, path=None):
    """
    Get the integrated luminosity for an analysis.
    
    """
    lumifb = smsHelpers.getMetaInfoField(analysis, "lumi", path)
    try:
        return float(lumifb) / fb
    except ValueError:
        try:
            return eval(lumifb)
        except:
            pass
    return lumifb
Example #15
0
def getaxes(analysis, topology=None, path=None):
    """Get information about the histogram axes for an analysis.

    For each topology list of dictionary, each dictionary corresponds to one
    histogram. The key axes gives string (mx-my), the key mz gives information
    on other masses, if you supply a topology, returns list for this topology
    only.

    """
    if not _exists(analysis, topology=None):
        return None
    try:
        st = smsHelpers.getMetaInfoField(analysis, "axes", path)
    except MetaInfoError:
        logger.error("Meta info field 'axes' does not exist in %s.", analysis)
        st = None
    if not st:
        if not topology:
            # Cannot return default without info on topology
            return None
        # If there is no information about the axes, return the default
        return [{'axes': 'M1-M0', 'mz': None}]
    st = st.split(',')
    d = {}
    for i in range(len(st)):
        l = st[i].split(':')
        nm = l[0].replace(" ", "")
        d[nm] = []
        m = l[1].split('-')
        for j in range(len(m)):
            n = m[j].split()
            if len(n) == 2:
                d[nm].append({'axes': n[0] + '-' + n[1], 'mz': None})
            else:
                d[nm].append({'axes': n.pop(0) + '-' + n.pop(0), 'mz': n})

    if topology:
        topology = topology.replace(" ", "")
        if not d or not topology in d:
            # Return None, if topology does not exist
            return None
        else:
            return d[topology]

    return d
Example #16
0
def getaxes(analysis, topology=None, path=None):
    """Get information about the histogram axes for an analysis.

    For each topology list of dictionary, each dictionary corresponds to one
    histogram. The key axes gives string (mx-my), the key mz gives information
    on other masses, if you supply a topology, returns list for this topology
    only.

    """
    if not _exists(analysis, topology=None):
        return None
    try:
        st = smsHelpers.getMetaInfoField(analysis, "axes", path)
    except MetaInfoError:
        logger.error("Meta info field 'axes' does not exist in %s.", analysis)
        st = None
    if not st:
        if not topology:
            # Cannot return default without info on topology
            return None
        # If there is no information about the axes, return the default
        return [{'axes': 'M1-M0', 'mz': None}]
    st = st.split(',')
    d = {}
    for i in range(len(st)):
        l = st[i].split(':')
        nm = l[0].replace(" ", "")
        d[nm] = []
        m = l[1].split('-')
        for j in range(len(m)):
            n = m[j].split()
            if len(n) == 2:
                d[nm].append({'axes': n[0] + '-' + n[1], 'mz': None})
            else:
                d[nm].append({'axes': n.pop(0) + '-' + n.pop(0), 'mz': n})

    if topology:
        topology = topology.replace(" ", "")
        if not d or not topology in d:
            # Return None, if topology does not exist
            return None
        else:
            return d[topology]

    return d
Example #17
0
def isSuperseded (analysis, path=None):
    """
    check if analysis is superseded, if yes,
    return analysis name of newer analysis
    """
    return smsHelpers.getMetaInfoField (analysis, "superseded_by", path)
Example #18
0
def hasURL(analysis, path=None):
    """
    Check if URL of an analysis exists."""
    logger.warning("hasURL is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "url", path)
Example #19
0
def isSuperseded(analysis, path=None):
    """
    check if analysis is superseded, if yes,
    return analysis name of newer analysis
    """
    return smsHelpers.getMetaInfoField(analysis, "superseded_by", path)
Example #20
0
def hasURL(analysis, path=None):
    """
    Check if URL of an analysis exists."""
    logger.warning("hasURL is deprecated")
    return smsHelpers.getMetaInfoField(analysis, "url", path)