コード例 #1
0
ファイル: MakeTrpRates.py プロジェクト: jiturbep/vertex_lumi
def GetLbStartGraph(run):
    import ROOT
    import CoolHelper    
    lbTimes = CoolHelper.getLbTimes(run)
    lbGraph = ROOT.TGraph(0)
    lbGraph.SetName("LbStarttimesGraph")
    graphCounter = 0
    for lb in lbTimes.keys():
        start = float(lbTimes[lb][0])/1e9
        lbGraph.Set(graphCounter+1)
        lbGraph.SetPoint(graphCounter,lb,start)
        graphCounter += 1
    return lbGraph
コード例 #2
0
refFractions = []
testFractions = []
refRates = []
testRates = []

## read the goodrunslist xml file(s)
reader = Root.TGoodRunsListReader(grlFile)
#reader.AddXMLFile('LumiRangeCollectionB.xml')
reader.Interpret()
grl = reader.GetMergedGoodRunsList()
goodruns = grl.GetGoodRuns()
for rr in goodruns:
    rr.Summary()
    runNum = int(rr.GetRunNumber())
    TAPs = CoolHelper.readLvl1Counters(runNum, itemList, "TAP")
    TAVs = CoolHelper.readLvl1Counters(runNum, itemList, "TAV")
    tapTurns = CoolHelper.readLvl1Turns(runNum, "TAP")
    lbDictRefTAP = TAPs[refItem]
    lbDictRefTAV = TAVs[refItem]
    for testLb in lbDictRefTAP.keys():
        if not grl.HasRunLumiBlock(runNum, testLb): continue
        liveFrac = 100.
        N = lbDictRefTAP[testLb]
        errorDown = float(N) - 0.5 * ROOT.TMath.ChisquareQuantile(
            0.1586555, 2. * float(N))
        errorUp = 0.5 * ROOT.TMath.ChisquareQuantile(
            1. - 0.1586555, 2. * (float(N) + 1.)) - float(N)
        if N: liveFrac = (100. * float(lbDictRefTAV[testLb]) / float(N))
        #        else: print "ZERO!!"
        if N:
コード例 #3
0
if doTrig:
    pr6 = TH1F("TAP0", "TAP0 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr7 = TH1F("TAP1", "TAP1 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr8 = TH1F("TAP2", "TAP2 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr9 = TH1F("TAP3", "TAP3 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr10 = TH1F("TAP4", "TAP4 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr11 = TH1F("TAP5", "TAP5 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr12 = TH1F("TAV0", "TAV0 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr13 = TH1F("TAV1", "TAV1 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr14 = TH1F("TAV2", "TAV2 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr15 = TH1F("TAV3", "TAV3 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr16 = TH1F("TAV4", "TAV4 counts;BCID;# Triggers", 3564, -0.5, 3563.5)
    pr17 = TH1F("TAV5", "TAV5 counts;BCID;# Triggers", 3564, -0.5, 3563.5)

# now get physics bunch group
bgKeys = CoolHelper.readBunchGroupKeys(run)
bgNames, bgItemMap = CoolHelper.readBunchGroupDescription(run)
bgFullContent = CoolHelper.readBunchGroupContent(run)
bcidList = CoolHelper.extractBcids(bgItemMap['L1_EM10'], bgFullContent)
bb = TH1F("PhysicsBunchgroup", "Physics bunch group;BCID;a.u.", 3564, -0.5,
          3563.5)
testLb = 0
for lb in bcidList.keys():
    if lb > testLb:
        testLb = lb
for bcid in bcidList[testLb]:
    bb.Fill(bcid, 1)

lbHistList = []

folder = db.getFolder(foldername)
コード例 #4
0
    usage()
    sys.exit(2)

run = int(-1)
for o, a in opts:
    if o in ('-h', '--help'):
        usage()
        sys.exit(0)
    if o == '--run':
        run = int(a)

if (run == -1):
    usage()
    sys.exit(2)

lbList = CoolHelper.readLumiBCID(run)
fileName = "BcidLumi_Run"
fileName += str(run)
fileName += ".root"
hAll = TH1F("TotalLumi", "Total raw lumi;BCID;Lumi", 3564, -0.5, 3563.5)
histList = []
for lb in lbList.keys():
    hName = "Lumi_lb"
    hName += str(int(lb))
    hTitle = "Raw lumi LB "
    hTitle += str(int(lb))
    hTitle += ";BCID;Lumi"
    h = TH1F(hName, hTitle, 3564, -0.5, 3563.5)
    for bcid in lbList[lb].keys():
        hAll.Fill(bcid, lbList[lb][bcid])
        h.Fill(bcid, lbList[lb][bcid])
コード例 #5
0
import ROOT
ROOT.gSystem.Load('libGoodRunsListsLib')
from ROOT import Root

itemCounts = {}
## read the goodrunslist xml file(s)
reader = Root.TGoodRunsListReader(grlFile)
#reader.AddXMLFile('LumiRangeCollectionB.xml')
reader.Interpret()
grl = reader.GetMergedGoodRunsList()
goodruns = grl.GetGoodRuns()
for rr in goodruns:
    #rr.Summary()
    runNum = int(rr.GetRunNumber())
    TAVs = CoolHelper.readLvl1Counters(runNum, itemList, "TAV")
    for name in itemList:
        lbDictRefTAV = TAVs[name]
        itemCountsPerRun = 0
        for testLb in lbDictRefTAV.keys():
            if not grl.HasRunLumiBlock(runNum, testLb): continue
            try:
                itemCounts[name] += lbDictRefTAV[testLb]
                itemCountsPerRun += lbDictRefTAV[testLb]
            except KeyError:
                itemCounts[name] = int(0)
                itemCounts[name] += lbDictRefTAV[testLb]
                itemCountsPerRun += lbDictRefTAV[testLb]

        if verbose and itemCountsPerRun:
            print "Run", runNum, "triggers", name, itemCountsPerRun