当前位置: 首页>>代码示例>>Python>>正文


Python LumiList.LumiList类代码示例

本文整理汇总了Python中FWCore.PythonUtilities.LumiList.LumiList的典型用法代码示例。如果您正苦于以下问题:Python LumiList类的具体用法?Python LumiList怎么用?Python LumiList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LumiList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createDataDatasets

 def createDataDatasets(self):
   self.dataDatasets = {}
   for d in self.datasets:
     dsLumiList = None
     if not os.path.isfile(d['json']):
       oldSsArgv = sys.argv; sys.argv=[] # sys argv fix
       dasC = dasTools.myDasClient();dasC.limit=0
       dsLumiList = dasC.getJsonOfDataset(d["dataset"])
       dsLumiList.writeJSON(d['json'])
       sys.argv = oldSsArgv
     else:
       dsLumiList = LumiList(compactList=json.load(open(d['json'])))
     dsRuns = dsLumiList.getRuns()
     self.dataDatasets[d['label']] = ('{ \n '
       '\t"xSec":None\n'
       '\t,"localFile":None\n'
       '\t,"datasetName":"'+d["dataset"]+'"\n'
       '\t,"label":"Data_'+d['label']+'"\n'
       '\t,"datasetJSON":"'+d['json']+'"\n'
       '\t,"crabConfig":{\n'
         '\t\t"CMSSW":{"lumis_per_job":5\n'
           '\t\t\t,"lumi_mask": os.getenv("CMSSW_BASE") + '+'"/'+d['goldenJson'].lstrip('/')+'"\n'
           '\t\t\t,"total_number_of_lumis" : -1}\n'
         '\t\t}\n'
       '\t,"color":0\n'
       '\t,"runRange":"'+str(dsRuns[0])+"-"+str(dsRuns[-1])+'"\n'
     '\t}\n');
开发者ID:fhoehle,项目名称:MyCMSSWAnalysisTools,代码行数:27,代码来源:datasetTools.py

示例2: getStrangeRuns

 def getStrangeRuns(self):
   hltInfoByLs =self.analysisOutput()
   strangeRunsLumis = LumiList( lumis = [[int(hltInf[0]),int(hltInf[1])] for hltInf in hltInfoByLs if not int(hltInf[2][1]) >= 1] )
   if self.jsonOutput:
     strangeRunsLumis.writeJSON(jsonOutput+"_strange")
   else:
     return strangeRunsLumis
开发者ID:fhoehle,项目名称:MyCMSSWAnalysisTools,代码行数:7,代码来源:lumiTools.py

示例3: getPrescaledRuns

 def getPrescaledRuns(self):
   hltInfoByLs =self.analysisOutput()
   prescaledRunsAndLumis = LumiList( lumis = [[int(hltInf[0]),int(hltInf[1])] for hltInf in hltInfoByLs if int(hltInf[2][1]) >= 1] )
   if self.jsonOutput:
     prescaledRunsAndLumis.writeJSON(jsonOutput+"_prescaled")
     return jsonOutput+"_prescaled"
   else:
     return prescaledRunsAndLumis
开发者ID:fhoehle,项目名称:MyCMSSWAnalysisTools,代码行数:8,代码来源:lumiTools.py

示例4: getGoodRuns

 def getGoodRuns(self):
   hltInfoByLs =self.analysisOutput()
   goodRunsAndLumis = LumiList(lumis = [[int(hltInf[0]),int(hltInf[1])] for hltInf in hltInfoByLs if int(hltInf[2][1]) == 1] )
   if self.jsonOutput:
     goodRunsAndLumis.writeJSON(jsonOutput+"_good")
     return jsonOutput+"_good"
   else:
     return goodRunsAndLumis
开发者ID:fhoehle,项目名称:MyCMSSWAnalysisTools,代码行数:8,代码来源:lumiTools.py

示例5: getRuns

def getRuns(name=None,bfield=None,bunchSpacing=None):
	ll = LumiList()
	for rp in runPeriods:
		if name is None or rp.name == name:
			if bfield is None or rp.bfield == bfield:
				if bunchSpacing is None or rp.bunchSpacing == bunchSpacing:
					newll = LumiListForRunPeriod(rp)
					ll += LumiListForRunPeriod(rp)
	return ll.getRuns()
开发者ID:previsualconsent,项目名称:EcalTiming,代码行数:9,代码来源:runInfo.py

示例6: createDataPileUpFile

def createDataPileUpFile(jsonFile, pileUpReweightingType):
    jsonList = LumiList(jsonFile)
    lumiString = jsonList.getCMSSWString()
    thisHash = hashlib.md5(lumiString)
    #print 'Require pileup file with hash ', thisHash.hexdigest()
    dataPileUpFilename = '/data/DataPileUp_'+thisHash.hexdigest()+'_'+pileUpReweightingType+'.root'
    if not os.path.exists(baseDir+dataPileUpFilename):
        print 'Creating new "', pileUpReweightingType, '" data pileup file for json file "',jsonFile,'"'
        subprocess.call(['pileupCalc.py', '-i', jsonFile, '--inputLumiJSON', '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/PileUp/pileup_JSON_2011_4_2_validation.txt', '--calcMode', pileUpReweightingType, '--maxPileupBin', '50', baseDir+dataPileUpFilename], shell=False)
    return dataPileUpFilename
开发者ID:CMSAachen3B,项目名称:RWTH3b,代码行数:10,代码来源:PileUpReweighting.py

示例7: mergeLumis

 def mergeLumis(inputdata, lumimask):
     """
     Computes the processed lumis, merges if needed and returns the compacted list.
     """
     mergedlumis = LumiList()
     doublelumis = LumiList()
     for report in inputdata:
         doublelumis = mergedlumis & LumiList(runsAndLumis=report)
         mergedlumis = mergedlumis | LumiList(runsAndLumis=report)
     return mergedlumis.getCompactList(), (LumiList(compactList=lumimask) - mergedlumis).getCompactList(), doublelumis.getCompactList()
开发者ID:qunox,项目名称:CRABClient,代码行数:10,代码来源:BasicJobType.py

示例8: LumiListForRunPeriod

def LumiListForRunPeriod(rp, MIN_LUMIS=0):
	ll = LumiList(filename = rp.json)
	runs = [ run for run in map(int,ll.getRuns()) if run >= rp.firstRun and run <= rp.lastRun]

	lumis = ll.getLumis()
	nlumis = defaultdict(int)
	for r,l in lumis:
		nlumis[r]+=1
	select_runs = [run for run in runs if nlumis[run] > MIN_LUMIS]
	ll.selectRuns(select_runs)
	return ll
开发者ID:previsualconsent,项目名称:EcalTiming,代码行数:11,代码来源:runInfo.py

示例9: mergeLumis

 def mergeLumis(inputdata, lumimask):
     """
     Computes the processed lumis, merges if needed and returns the compacted list.
     """
     mergedlumis = LumiList()
     doublelumis = LumiList()
     for report in inputdata:
         doublelumis = mergedlumis & LumiList(runsAndLumis=report)
         mergedlumis = mergedlumis | LumiList(runsAndLumis=report)
         if doublelumis:
             self.logger.info("Warning: double run-lumis processed %s" % doublelumis)
     return mergedlumis.getCompactList(), (LumiList(compactList=lumimask) - mergedlumis).getCompactList()
开发者ID:HassenRiahi,项目名称:CRABClient,代码行数:12,代码来源:BasicJobType.py

示例10: getInputRunLumi

    def getInputRunLumi(self, file):
        import xml.dom.minidom

        dom = xml.dom.minidom.parse(file)
        ll=[]

        for elem in dom.getElementsByTagName("Job"):
            nJob = int(elem.getAttribute("JobID"))
            lumis = elem.getAttribute('Lumis')
            #lumis = '193752:1'
            #lumis = '193752:1-193752:5,193774:1-193774:5,193775:1'
            if lumis:
                tmp=str.split(str(lumis), ",")
                #print "tmp = ", tmp
            else:
                msg = "The summary file inputLumiSummaryOfTask.json about input run and lumi isn't created"
                common.logger.info(msg)
                return
                

            #tmp = [193752:1-193752:5] [193774:1-193774:5]
            for entry in tmp:
                run_lumi=str.split(entry, "-")
                # run_lumi = [193752:1] [193752:5] 
                if len(run_lumi) == 0: pass
                if len(run_lumi) == 1:
                    lumi = str.split(run_lumi[0],":")[1]
                    run = str.split(run_lumi[0],":")[0]
                    ll.append((run,int(lumi)))
    
                if len(run_lumi) == 2:
                    lumi_max = str.split(run_lumi[1],":")[1]
                    lumi_min = str.split(run_lumi[0],":")[1]
                    run = str.split(run_lumi[1],":")[0]
                    for count in range(int(lumi_min),int(lumi_max) + 1): 
                        ll.append((run,count))
        if len(ll):
            lumiList = LumiList(lumis = ll)
            compactList = lumiList.getCompactList()

            totalLumiFilename = self.fjrDirectory + 'inputLumiSummaryOfTask.json'
            totalLumiSummary = open(totalLumiFilename, 'w')
            json.dump(compactList, totalLumiSummary)
            totalLumiSummary.write('\n')
            totalLumiSummary.close()
            msg = "Summary file of input run and lumi to be analize with this task: %s\n" %totalLumiFilename
            common.logger.info(msg)
        else:    
            msg = "The summary file inputLumiSummaryOfTask.json about input run and lumi isn't created"
            common.logger.info(msg)
        return totalLumiFilename 
开发者ID:bbockelm,项目名称:CRAB,代码行数:51,代码来源:Reporter.py

示例11: files_for_events

def files_for_events(run_events, dataset, instance='global'):
    wanted_run_lumis = []
    for x in run_events: # list of runs, or list of (run, event), or list of (run, lumi, event)
        if type(x) == int:
            wanted_run_lumis.append((x, None))
        elif len(x) == 2:
            wanted_run_lumis.append((x[0], None))
        else:
            wanted_run_lumis.append(x[:2])

    files = set()
    for file, run_lumis in file_details_run_lumis(dataset, instance).iteritems():
        ll = LumiList(runsAndLumis=run_lumis)
        for x in wanted_run_lumis:
            if ll.contains(*x):
                files.add(file)
    return sorted(files)
开发者ID:jordantucker,项目名称:cmssw-usercode,代码行数:17,代码来源:DBS.py

示例12: __init__

    def __init__(self, cfg_ana, cfg_comp, looperName):
        super(JSONAnalyzer, self).__init__(cfg_ana, cfg_comp, looperName)
        if not cfg_comp.isMC:
            self.lumiList = LumiList(self.cfg_comp.json)
        else:
            self.lumiList = None
        

        self.rltInfo = RLTInfo()
开发者ID:mariadalfonso,项目名称:cmg-wmass-44X,代码行数:9,代码来源:JSONAnalyzer.py

示例13: __init__

    def __init__(self, cfg_ana, cfg_comp, looperName):
        super(JSONAnalyzer, self).__init__(cfg_ana, cfg_comp, looperName)
        if not cfg_comp.isMC:
            if self.cfg_comp.json is None:
                raise ValueError('component {cname} is not MC, and contains no JSON file. Either remove the JSONAnalyzer for your path or set the "json" attribute of this component'.format(cname=cfg_comp.name))
            self.lumiList = LumiList(os.path.expandvars(self.cfg_comp.json))
        else:
            self.lumiList = None
        
        if hasattr(self.cfg_comp, 'additionaljson'):
            self.additionalLumiList = LumiList(os.path.expandvars(self.cfg_comp.additionaljson))
            self.twojson = True
        else: 
            self.twojson = False
        
        self.useLumiBlocks = self.cfg_ana.useLumiBlocks if (hasattr(self.cfg_ana,'useLumiBlocks')) else False

        self.rltInfo = RLTInfo()
开发者ID:,项目名称:,代码行数:18,代码来源:

示例14: customise

def customise(process):

    lumiFile = 'Cert_246908-260627_13TeV_PromptReco_Collisions15_25ns_JSON.txt'

    runOnMC = True
    for i in process.source.fileNames:
        if 'Run2015' in i:
            runOnMC=False
   
    isTTbar=False
    for i in process.source.fileNames:
        if '/TT' in i or '/tt' in i:
            isTTbar=True
   
    if not runOnMC:
        from FWCore.PythonUtilities.LumiList import LumiList
        lumiList = LumiList(os.environ["CMSSW_BASE"]+'/src/CATTools/CatProducer/prod/LumiMask/'+lumiFile)    
        #lumiList = LumiList(os.environ["CMSSW_BASE"]+'/src/CATTools/CommonTools/test/ttbb/'+lumiFile)    
        process.source.lumisToProcess = lumiList.getVLuminosityBlockRange()  
开发者ID:YoungKwonJo,项目名称:Analysis2,代码行数:19,代码来源:customise_cff.py

示例15: __init__

    def __init__(self, cfg_ana, cfg_comp, looperName):
        super(JSONAnalyzer, self).__init__(cfg_ana, cfg_comp, looperName)
        if not cfg_comp.isMC:
            if self.cfg_comp.json is None:
                raise ValueError('component {cname} is not MC, and contains no JSON file. Either remove the JSONAnalyzer for your path or set the "json" attribute of this component'.format(cname=cfg_comp.name))
            self.lumiList = LumiList(os.path.expandvars(self.cfg_comp.json))
        else:
            self.lumiList = None
        

        self.rltInfo = RLTInfo()
开发者ID:DesyTau,项目名称:cmssw,代码行数:11,代码来源:JSONAnalyzer.py


注:本文中的FWCore.PythonUtilities.LumiList.LumiList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。