Newer
Older
TB_Chris / Kepler / Scripts / .svn / text-base / spatialEfficiency.py.svn-base
@iaro iaro on 9 May 2016 909 bytes first attempt of automated anal
  1. from ROOT import *
  2.  
  3. #gROOT.ProcessLine(".x lhcbStyle.C")
  4. gStyle.SetPalette(1)
  5.  
  6. infile = TFile("Kepler-histos.root")
  7. infile.cd("Tb/TbClusterPlots")
  8.  
  9. nPlanes = 8
  10. efficiencies = []
  11. for i in range(nPlanes):
  12. histoname = "Plane" + repr(i)
  13. hTotal = gDirectory.Get("Positions/" + histoname)
  14. hPassed = gDirectory.Get("PositionsAssociated/" + histoname)
  15. eff = TEfficiency(hPassed, hTotal)
  16. eff.SetDirectory(0)
  17. efficiencies.append(eff)
  18. infile.Close()
  19.  
  20. gStyle.SetPaintTextFormat("3.2g")
  21. c = TCanvas("c", "c", 1200, 600)
  22. c.Divide(4, 2, 0, 0)
  23. for i in range(nPlanes):
  24. c.cd(i + 1)
  25. efficiencies[i].Draw("col")
  26. #efficiencies[i].Draw("textsame")
  27. efficiencies[i].Paint("col")
  28. efficiencies[i].GetPaintedHistogram().GetXaxis().SetTitle("#font[12]{x} [mm]")
  29. efficiencies[i].GetPaintedHistogram().GetYaxis().SetTitle("#font[12]{y} [mm]")
  30. efficiencies[i].GetPaintedHistogram().SetMaximum(1.0)
  31. c.Update()