Exemplo n.º 1
0
def openEB(numofFiles, filename, fileList, entries, histList1, histList2):
    for k in range(0, numofFiles):
        if filename in fileList[k]:
            rootFile = rt.TFile.Open(fileList[k])
            rTree = rootFile.Get("Tree_Optim")
            print "successfully cut branch from " + fileList[k]
            #rootFile.Print("v")
            #fills the histogram with data
            if isinstance(histList1[0],list) == True: #Individual barrel crystals
                if histList2 !=0:
                    histList1,histList2 = snf.stackTime(rTree, entries, histList1, histList2, 1, 0)
                else:
                    histList = snf.stackTime(rTree, entries, histList, 0, 0, 0)
        
            else: #eta baby eta
                if histList2!=0:
                    histList1, histList2 = snf.stackTimeEta(rTree, entries, histList1,histList2)
                else:
                    histList1 = snf.stackTimeEta(rTree,entries,histList1,0)
            rootFile.Close()
Exemplo n.º 2
0
def openEB(filename, fileList, runinfo, startfilepos, endfilepos, entries, histList1, histList2, transList1, transList2):
    rTree = rt.TChain("Tree_Optim")
    for k in range(startfilepos, endfilepos):
        if filename in fileList[k]:
            rTree.Add(fileList[k])
            print "successfully cut branch from " + fileList[k]
            #Saving run info in tuple list
            runinfo = np.vstack((runinfo, [fileList[k]]))

    #fills the histogram with data
    if isinstance(histList1[0],list) == True: #Individual barrel crystals
        if histList2 !=0:
            histList1, histList2, transList1, transList2 = snf.stackTime(rTree, entries, histList1, histList2, 1, 0, transList1,transList2, 0, 0)
        else:
            histList1, transList1 = snf.stackTime(rTree, entries, histList1, 0, 0, 0, transList1, 0, 0, 0)
        
    else: #eta baby eta
        if histList2!=0:
            histList1, histList2, transList1, transList2 = snf.stackTimeEta(rTree, entries, histList1, histList2, transList1, transList2)
        else:
            histList1, transList1 = snf.stackTimeEta(rTree, entries, histList1, 0, transList1, 0)
    return runinfo
Exemplo n.º 3
0
def openEE(filename, fileList, runinfo, startfilepos, endfilepos, entries, histListp1, histListm1, histListp2, histListm2, transListp1, transListm1, transListp2, transListm2):
    rTree = rt.TChain("Tree_Optim")
    for k in range(startfilepos, endfilepos):
        if filename in fileList[k]:
            rTree.Add(fileList[k])
            print "successfully cut branch from " + fileList[k]
            #Saving run info in tuple list
            runinfo = np.vstack((runinfo, [fileList[k]]))

    #fills the histogram with data
    if histListm2 != 0: #Differentiating photon 1 and 2
        histListp1, histListm1, histListp2, histListm2, transListp1, transListm1, transListp2, transListm2 = snf.stackTime(rTree, entries, histListp1, histListm1, histListp2, histListm2, transListp1, transListm1, transListp2, transListm2)
    else:   #Combine photon 1 and 2
        histListp1, histListm1, transListp1, transListm1 = snf.stackTime(rTree, entries, histListp1, histListm1, 0, 0, transListp1, transListm1, 0, 0)
    return runinfo
Exemplo n.º 4
0
                histname = "time on sc (%i,%i)" %(eta-85,phi)
                histtitle = "time response (ns) for crystal (%i,%i)" %(eta-85,phi)
                histList[eta][phi] = rt.TH1F(histname,histtitle,1000,-30,30)

        a.openEB(nof,rootfilename,fileList, p.numberofEntries, histList, 0)

    for k in range(0,len(fileList)):
        if "2015A_EcalNtp_" in fileList[k]:
            rootFile = rt.TFile.Open(fileList[k])
            rTree = rootFile.Get("Tree_Optim")
            print "successfully cut branch from " + fileList[k]
            #rootFile.Print("v")
                   
            #fills the histogram with data
#            histList = snf.stackTime(rTree,histList, 0, 0, 0)
            histList1,histList2 = snf.stackTime(rTree,histList1, histList2, 1, 0)
            rootFile.Close()


    #fits the histograms
#    htime = snf.fitTime(histList,htime)
    htime1 = snf.fitTime(histList1,htime1)
    htime2 = snf.fitTime(histList2,htime2)

## Getting back to program file
##
    # Check current working directory.
    retdir = os.getcwd()
    print "Current working directory %s" % retdir
    
    # Now change the directory
Exemplo n.º 5
0
    print "Directory changed successfully %s" % retdir


    # Get list of root files in directory
    fileList = os.listdir(retdir)
    
    for k in range(0,len(fileList)):
        if "2015A_EcalNtp_" in fileList[k]:
            rootFile = rt.TFile.Open(fileList[k])
            rTree = rootFile.Get("Tree_Optim")
            print "successfully cut branch from " + fileList[k]
            #rootFile.Print("v")
            
            #fills the histogram with data
#            histListp, histListm = snf.stackTime(rTree,histListp, histListm, 0, 0)
            histListp1, histListm1, histListp2, histListm2 = snf.stackTime(rTree,histListp1, histListm1, histListp2, histListm2)
            rootFile.Close()

    #fits the histograms
#    htimep = snf.fitTime(histListp,htimep)
#    htimem = snf.fitTime(histListm,htimem)

    htimep1 = snf.fitTime(histListp1,htimep1)
    htimem1 = snf.fitTime(histListm1,htimem1)
    htimep2 = snf.fitTime(histListp2,htimep2)
    htimem2 = snf.fitTime(histListm2,htimem2)

## Getting back to program file
##
    # Check current working directory.
    retdir = os.getcwd()
Exemplo n.º 6
0
    retdir = os.getcwd()
    print "Directory changed successfully %s" % retdir


    # Get list of root files in directory
    fileList = os.listdir(retdir)
    
    for k in range(0,5):#len(fileList)): ###CHANGED###
        if "2015A_EcalNtp_" in fileList[k]:
            rootFile = rt.TFile.Open(fileList[k])
            rTree = rootFile.Get("Tree_Optim")
            print "successfully cut branch from " + fileList[k]
            #rootFile.Print("v")
            
            #fills the histogram with data
            histListp, histListm = snf.stackTime(rTree,histListp, histListm, 0, 0)
            rootFile.Close()

    #fits the histograms
    htimep = snf.fitTime(histListp,htimep)
    htimem = snf.fitTime(histListm,htimem)

## Getting back to program file
##
    # Check current working directory.
    retdir = os.getcwd()
    print "Current working directory %s" % retdir
    
    # Now change the directory
    os.chdir( startdir + '/result/')