Esempio n. 1
0
 def validateIOVIntervals(self, iovn):
     iov = lastIOVSince.LastIOVSince(dbName = self.dbName)        
     for el in iov.iovSequence(tag = self.tag).elements:
         n = int(iovn)
         if n >= el.since() and n <= el.till():
             return el.since()
     return 1
Esempio n. 2
0
def validateIOV(dbName, tag, iovn):
    iov = lastIOVSince.LastIOVSince(dbName=dbName)
    elems = iov.iovSequence(tag=tag).elements
    for el in elems:
        n = int(iovn)
        if n >= el.since() and n <= el.till():
            return el.since()
    return el.since()
 def buildLastIOVTable(self, dbName='', acc=''):
     self.check_dbName_acc(dbName, acc, '1')
     #db = self.masker.unmask_dbname(db = dbName)
     #db = av.get_validated_dbname(value = db, acc = self.masker.unmask_schema(db, acc))
     c = readXML()
     db = str(c.dbMap_reverse[dbName] + "/CMS_COND_" + acc)
     lastIOV = lastIOVSince.LastIOVSince(dbName=db)
     lastIOV.writeTable()
     return "done"
 def get_timetype(self, dbName='', acc='', tag=''):
     self.check_dbName_acc(dbName, acc, '1')
     try:
         c = readXML()
         db = str(c.dbMap_reverse[dbName] + "/CMS_COND_" + acc)
         vtag = str(tag)
         iov = lastIOVSince.LastIOVSince(dbName=db)
         return str(iov.iovSequence(tag=vtag).timetype())
     except:
         return ''
Esempio n. 5
0
def validateTag(self, dbName, tag):
    if type(tag) != type(''):
        raise TypeError('tag has to be string')
    if type(dbName) != type(''):
        raise TypeError('dbName has to be string')
    if len(tag.strip()) == 0:
        raise ValueError('tag value can not be empty.')
    iov = lastIOVSince.LastIOVSince(dbName=dbName)
    tags = iov.getTags()
    rez = False
    for t in tags:
        if tag == t:
            rez = True
            break
    if not rez:
        raise ValueError('no such tag exist for given DB.')
Esempio n. 6
0
def generateData(dbName, dir):
    try:
        iov = lastIOVSince.LastIOVSince(dbName = dbName)  
        tags = iov.getTags()
        #cdb = CondDBPayloadInspector_backend.CondDBPayloadInspector()
        for tag in tags:
            #try:
            #print 'analyzing tag %s' % tag
            #if you want to generate the plots for a specific tag
            if tag != 'SiStripPedestals_GR10_v2_hlt':
                print "\n\nTAG:",tag
                continue
            iovs = iov.iovSequence(tag = tag).elements
            for i in iovs:
                #try:
                print 'generating data for: db=%s, tag=%s, since=%s' % (dbName, tag, str(i.since()))
                pnggen.generateData(dbName = dbName, tag = tag, since = str(i.since()), plots = dir)
                #except:
                #    pass
            #except:
            #    pass

    except RuntimeError, e:
        print 'Error making connecting to DB. %s' % str(e)
Esempio n. 7
0
def get_validated_tag(dbName, value):
    val = str(value)
    iov = lastIOVSince.LastIOVSince(dbName=dbName)
    if value in iov.getTags():
        return val
    raise ValueError("Parameter \"tag\" doesn't have valid value")
Esempio n. 8
0
    if type(value) == type(''):
        #print "%s is a string" %(value,)
        sinces = value.strip().split(';')
    elif type(value) == type(u''):
        #print "value is unicode"
        valStr = str(value)
        sinces = valStr.strip().split(';')
    elif type(value) in (type(1), type(1l)):
        #print "value is an integer or a long"
        sinces = [
            str(value),
        ]
    else:
        print "type(value): ", type(value)
    rez = []
    iov = lastIOVSince.LastIOVSince(dbName=db)
    for i in sinces:
        if not validateSince(i, onlyone=True):
            continue
        #for el in iov.iovSequence(tag = tag).elements:
        #    n = int(i)
        #    if n >= el.since() and n <= el.till():
        #        rez.append(str(el.since()))
        #        break
        rez.append(str(validateIOV(dbName=db, tag=tag, iovn=i)))
        if onlyone:
            break
    return ';'.join(rez)


def validateTag(self, dbName, tag):
Esempio n. 9
0
def getPlots(connStr='frontier://PromptProd/CMS_COND_31X_STRIP',
             tagStr='SiStripLorentzAngle_GR10_v1_express',
             since=""):
    tagName = tagStr.split("_", 1)[0]
    messageLogger = ""
    messageSelect = [
        """
process.MessageLogger = cms.Service("MessageLogger",
    debugModules = cms.untracked.vstring(''),
    Reader = cms.untracked.PSet(
        threshold = cms.untracked.string('INFO')
    ),
    destinations = cms.untracked.vstring('Reader') #Reader, cout
)
""",
    ]
    messageLoggerMap = {
        "SiStripBad":
        messageSelect[0],
        "SiStripDetVOff":
        messageSelect[0],
        "SiStripFedCabling":
        messageSelect[0],
        "default":
        """
process.MessageLogger = cms.Service("MessageLogger",
    debugModules = cms.untracked.vstring(''),
    cout = cms.untracked.PSet(
        threshold = cms.untracked.string('INFO')
    ),
    destinations = cms.untracked.vstring('cout') #Reader, cout
)
"""
    }
    if tagName in messageLoggerMap:
        messageLogger = messageLoggerMap[tagName]
    elif tagName[0:10] == "SiStripBad":
        messageLogger = messageLoggerMap[tagName[0:10]]
    else:
        messageLogger = messageLoggerMap["default"]

    iov = lastIOVSince.LastIOVSince(dbName=connStr)
    runnmbr = str(iov.iovSequence(tag=tagStr).timetype())

    return """
import FWCore.ParameterSet.Config as cms

process = cms.Process("Reader")

%s

process.maxEvents = cms.untracked.PSet(
    input = cms.untracked.int32(-1)
)

process.source = cms.Source("EmptyIOVSource",
    firstValue = cms.uint64(%s),
    lastValue = cms.uint64(%s),
    timetype = cms.string('%s'),
    interval = cms.uint64(1)
)

process.poolDBESSource = cms.ESSource("PoolDBESSource",
   BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'),
   DBParameters = cms.PSet(
        messageLevel = cms.untracked.int32(2),
        authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb')
    ),
    timetype = cms.untracked.string('%s'),
    connect = cms.string('%s'),
    toGet = cms.VPSet(cms.PSet(
        record = cms.string('%s'),
        tag = cms.string('%s')
    ))
)

process.DQMStore = cms.Service("DQMStore",
    referenceFileName = cms.untracked.string(''),
    verbose = cms.untracked.int32(1)
)

process.load("DQM.SiStripMonitorSummary.SiStripMonitorCondData_cfi")

%s

process.CondDataMonitoring.SiStripPedestalsDQM_PSet.FillSummaryAtLayerLevel     = True
process.CondDataMonitoring.SiStripNoisesDQM_PSet.FillSummaryAtLayerLevel        = True
process.CondDataMonitoring.SiStripQualityDQM_PSet.FillSummaryAtLayerLevel       = True
process.CondDataMonitoring.SiStripApvGainsDQM_PSet.FillSummaryAtLayerLevel      = True
process.CondDataMonitoring.SiStripLowThresholdDQM_PSet.FillSummaryAtLayerLevel  = True
process.CondDataMonitoring.SiStripHighThresholdDQM_PSet.FillSummaryAtLayerLevel = True

process.CondDataMonitoring.SiStripCablingDQM_PSet.CondObj_fillId       = 'ProfileAndCumul'
process.CondDataMonitoring.SiStripPedestalsDQM_PSet.CondObj_fillId     = 'onlyProfile'
process.CondDataMonitoring.SiStripNoisesDQM_PSet.CondObj_fillId        = 'onlyCumul'
process.CondDataMonitoring.SiStripQualityDQM_PSet.CondObj_fillId       = 'onlyProfile'
process.CondDataMonitoring.SiStripApvGainsDQM_PSet.CondObj_fillId      = 'ProfileAndCumul'
process.CondDataMonitoring.SiStripLorentzAngleDQM_PSet.CondObj_fillId  = 'ProfileAndCumul'
process.CondDataMonitoring.SiStripLowThresholdDQM_PSet.CondObj_fillId  = 'onlyProfile'
process.CondDataMonitoring.SiStripHighThresholdDQM_PSet.CondObj_fillId = 'onlyProfile'

## --- TkMap specific Configurable options:

process.CondDataMonitoring.SiStripCablingDQM_PSet.TkMap_On     = True
process.CondDataMonitoring.SiStripCablingDQM_PSet.TkMapName    = '%sFedCablingTkMap.png'
process.CondDataMonitoring.SiStripCablingDQM_PSet.minValue     = 0.
process.CondDataMonitoring.SiStripCablingDQM_PSet.maxValue     = 6.

process.CondDataMonitoring.SiStripPedestalsDQM_PSet.TkMap_On     = True
process.CondDataMonitoring.SiStripPedestalsDQM_PSet.TkMapName    = '%sPedestalTkMap.png'
process.CondDataMonitoring.SiStripPedestalsDQM_PSet.minValue     = 0.
process.CondDataMonitoring.SiStripPedestalsDQM_PSet.maxValue     = 400.

process.CondDataMonitoring.SiStripNoisesDQM_PSet.TkMap_On     = True
process.CondDataMonitoring.SiStripNoisesDQM_PSet.TkMapName    = '%sNoiseTkMap.png'
process.CondDataMonitoring.SiStripNoisesDQM_PSet.minValue     = 3.
process.CondDataMonitoring.SiStripNoisesDQM_PSet.maxValue     = 9.

process.CondDataMonitoring.SiStripApvGainsDQM_PSet.TkMap_On     = True
process.CondDataMonitoring.SiStripApvGainsDQM_PSet.TkMapName    = '%sApvGainTkMap.png'
process.CondDataMonitoring.SiStripApvGainsDQM_PSet.minValue     = 0.
process.CondDataMonitoring.SiStripApvGainsDQM_PSet.maxValue     = 1.5

process.CondDataMonitoring.SiStripLorentzAngleDQM_PSet.TkMap_On     = True
process.CondDataMonitoring.SiStripLorentzAngleDQM_PSet.TkMapName    = '%sLorentzAngleTkMap.png'
process.CondDataMonitoring.SiStripLorentzAngleDQM_PSet.minValue     = 0.01
process.CondDataMonitoring.SiStripLorentzAngleDQM_PSet.maxValue     = 0.03

process.CondDataMonitoring.SiStripLowThresholdDQM_PSet.TkMap_On     = True
process.CondDataMonitoring.SiStripLowThresholdDQM_PSet.TkMapName     = '%sLowThresholdTkMap.png'
process.CondDataMonitoring.SiStripLowThresholdDQM_PSet.minValue     = 0.
process.CondDataMonitoring.SiStripLowThresholdDQM_PSet.maxValue     = 10.

process.CondDataMonitoring.SiStripHighThresholdDQM_PSet.TkMap_On     = True
process.CondDataMonitoring.SiStripHighThresholdDQM_PSet.TkMapName     = '%sHighThresholdTkMap.png'
process.CondDataMonitoring.SiStripHighThresholdDQM_PSet.minValue     = 0.
process.CondDataMonitoring.SiStripHighThresholdDQM_PSet.maxValue     = 10.

process.CondDataMonitoring.SiStripQualityDQM_PSet.TkMapName='%sQualityTkMap.png'

process.p1 = cms.Path(process.CondDataMonitoring)
""" % (
        messageLogger,
        since,
        since,
        runnmbr,
        runnmbr,
        connStr,
        getRecord(tagStr),
        tagStr,
        fillValues(tagStr=tagStr, since=since),
        tagStr + "_",
        tagStr + "_",
        tagStr + "_",
        tagStr + "_",
        tagStr + "_",
        tagStr + "_",
        tagStr + "_",
        tagStr + "_",
    )