Exemplo n.º 1
0
def recordedInvMicrobarns(json) :
    pars = lumiQueryAPI.ParametersObject()
    pars.noWarnings  = True
    pars.norm        = 1.0
    pars.lumiversion = '0001'
    pars.beammode    = 'STABLE BEAMS'

    session,svc =  lumiQueryAPI.setupSession( connectString = 'frontier://LumiCalc/CMS_LUMI_PROD',
                                              parameters = pars, siteconfpath = None, debug = False)
    lumidata =  lumiQueryAPI.recordedLumiForRange (session, pars, jsonToIFP(json))    
    return sum(lumiQueryAPI.calculateTotalRecorded(dataperRun[2]) for dataperRun in lumidata if dataperRun[1])
Exemplo n.º 2
0
    if options.runnumber:
        inputRange = options.runnumber
    else:
        basename, extension = os.path.splitext(options.inputfile)
        if extension == ".csv":  # if file ends with .csv, use csv
            # parser, else parse as json file
            fileparsingResult = csvSelectionParser.csvSelectionParser(options.inputfile)
        else:
            f = open(options.inputfile, "r")
            inputfilecontent = f.read()
            inputRange = selectionParser.selectionParser(inputfilecontent)
        if not inputRange:
            print "failed to parse the input file", options.inputfile
            raise

    recordedData = LumiQueryAPI.recordedLumiForRange(session, parameters, inputRange)
    ## pprint (recordedData)
    for runDTarray in recordedData:
        runNumber = runDTarray[0]
        deadTable = runDTarray[2]
        if options.saveRuns:
            hist = fillPileupHistogram(deadTable, parameters, runNumber=runNumber, debug=options.debugLumi)
            pileupHist.Add(hist)
            histList.append(hist)
        else:
            fillPileupHistogram(deadTable, parameters, hist=pileupHist, debug=options.debugLumi)
    histFile = ROOT.TFile.Open(output, "recreate")
    if not histFile:
        raise RuntimeError, "Could not open '%s' as an output root file" % output
    pileupHist.Write()
    for hist in histList:
Exemplo n.º 3
0
    if options.runnumber:
        inputRange = options.runnumber
    else:
        basename, extension = os.path.splitext (options.inputfile)
        if extension == '.csv': # if file ends with .csv, use csv
                                # parser, else parse as json file
            fileparsingResult = csvSelectionParser.csvSelectionParser (options.inputfile)
        else:
            f = open (options.inputfile, 'r')
            inputfilecontent = f.read()
            inputRange =  selectionParser.selectionParser (inputfilecontent)
        if not inputRange:
            print('failed to parse the input file', options.inputfile)
            raise 

    recordedData  = LumiQueryAPI.recordedLumiForRange  (session, parameters, inputRange)
    ## pprint (recordedData)
    for runDTarray in recordedData:
        runNumber = runDTarray[0]
        deadTable = runDTarray[2]
        if options.saveRuns:
            hist = fillPileupHistogram (deadTable, parameters,
                                        runNumber = runNumber,
                                        debug = options.debugLumi)
            pileupHist.Add (hist)
            histList.append (hist)
        else:
            fillPileupHistogram (deadTable, parameters,
                                 hist = pileupHist,
                                 debug = options.debugLumi)
    histFile = ROOT.TFile.Open (output, 'recreate')