def openMass(filename, fileList, runinfo, startfilepos, endfilepos, entries, histList, histRun): 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]])) #makes the histogram for pi0 mass histname = "Average Pi0 mass in Barrel for time instance (%s)" %(fileList[k]) histtitle = "Pi0 mass (GeV) for ROOT file cluster (%s)" %(fileList[k]) histmass = rt.TH1F(histname,histtitle,1000,0,1) #fills the mass histogram list with ROOT files oriented folder histmass = snf.stackMass(rTree,histmass) histList.append(copy.copy(histmass)) #Fills large histogram for the entire run's dataset histRun = snf.stackMass(rTree,histRun) return runinfo, histList, histrun
for k in range(0,len(fileList)): if "2015A_EcalNtp_" in fileList[k]: roofiles.append(fileList[k]) rootFile = rt.TFile.Open(fileList[k]) rTree = rootFile.Get("Tree_Optim") print "successfully cut branch from " + fileList[k] #rootFile.Print("v") #makes the histogram for pi0 mass histname = "Average Pi0 mass in Barrel for time instance (%s)" %(fileList[k]) histtitle = "Pi0 mass (GeV) for ROOT file cluster (%s)" %(fileList[k]) histmass = rt.TH1F(histname,histtitle,1000,0,1) #fills the mass histogram list with ROOT files oriented folder histmass = snf.stackMass(rTree,histmass) histList.append(copy.copy(histmass)) #print histmass #print histList[0] #Fills large histogram for the entire run's dataset histRun = snf.stackMass(rTree,histRun) rootFile.Close() #fits the histograms and saves 1D in tree massvalues = snf.fitMassROOT(histList) avemass = snf.fitMass(histRun) # Same procedure, going back to original working directory. retdir = os.getcwd()