ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/nowaf/RootFilesInUse/DrawMiscPlots.py
Revision: 1.1.1.1 (vendor branch)
Committed: Tue Mar 20 13:12:08 2012 UTC (13 years, 1 month ago) by nowak
Content type: text/x-python
Branch: rootFilesInUse, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
t files in use

File Contents

# User Rev Content
1 nowak 1.1 import ROOT, sys
2     sys.path.append("/afs/naf.desy.de/user/n/nowaf/UserCode/nowaf/PythonScripts/")
3     import definitions as Def
4     import styles as Style
5    
6     if __name__ == "__main__":
7    
8     Def.SetGlobalStyles()
9    
10     saveName = "./plots/HPSVeryLoose_Misc_EffOnly"
11    
12     dir_ = "MuonAnalyzerPre"
13     dirEff_ = "EffRatePre"
14    
15     rootfile = ROOT.TFile.Open( "./WJets_muonAcc.root" )
16     hist1 = rootfile.Get( dir_ + "/MuonPtPrompt" )
17     hist1.SetDirectory( 0 )
18     hist1.SetName( "MuonPtPrompt" )
19     hist2 = rootfile.Get( dir_ + "/GenMuonPtMatched" )
20     hist2.SetDirectory( 0 )
21     hist2.SetName( "MuonPtReco" )
22     hist3 = rootfile.Get( dir_ + "/MuonPtPromptNotFromTau" )
23     hist3.SetDirectory( 0 )
24     hist3.SetName( "MuonPtNoTau" )
25     hist4 = rootfile.Get( dir_ + "/MuonDRPromptNotFromTau" )
26     hist4.SetDirectory( 0 )
27     hist4.SetName( "MuonDRNoTau" )
28     hist5 = rootfile.Get( dir_ + "/GenMuonDRMatched" )
29     hist5.SetDirectory( 0 )
30     hist5.SetName( "MuonDRReco" )
31     hist7 = rootfile.Get( dir_ + "/GenMuonPtMatchedDR01to03" )
32     hist7.SetDirectory( 0 )
33     hist7.SetName( "GenMuonPtMatchedDR01to03" )
34     hist8 = rootfile.Get( dir_ + "/GenMuonPtMatchedDR03to05" )
35     hist8.SetDirectory( 0 )
36     hist8.SetName( "GenMuonPtMatchedDR03to05" )
37     hist9 = rootfile.Get( dir_ + "/GenMuonPtMatchedDR05toInf" )
38     hist9.SetDirectory( 0 )
39     hist9.SetName( "GenMuonPtMatchedDR05toInf" )
40     rootfile.Close()
41    
42     rootfile = ROOT.TFile.Open( "./WJets_HPS_eff.root" )
43     hist6 = rootfile.Get( dirEff_ + "/TauPt" )
44     hist6.SetDirectory( 0 )
45     hist6.SetName( "TauEff" )
46     hist6U = rootfile.Get( dirEff_ + "/TauPtErrUp" )
47     hist6U.SetDirectory( 0 )
48     hist6U.SetName( "TauEffErrUp" )
49     hist6D = rootfile.Get( dirEff_ + "/TauPtErrDwn" )
50     hist6D.SetDirectory( 0 )
51     hist6D.SetName( "TauEffErrDwn" )
52     rootfile.Close()
53    
54    
55    
56     histList = []
57     #histList.append( hist1 )
58     #histList.append( hist2 )
59     #histList.append( hist3 )
60     #histList.append( hist4 )
61     #histList.append( hist5 )
62     ##histList.append( hist6 )
63     ##histList.append( hist6U )
64     ##histList.append( hist6D )
65     #histList.append( hist7 )
66     #histList.append( hist8 )
67     #histList.append( hist9 )
68    
69     errHistList = []
70     errHistList.append( hist6 )
71     errHistList.append( hist6U )
72     errHistList.append( hist6D )
73    
74     fakeList = []
75     fakeDir = "FakeRateDiJetsLoose3Jet/"
76     #fakeList.append( "JetTauPtJPT" )
77     #fakeList.append( "JetTauEtaJPT" )
78     #fakeList.append( "JetTauEtaJPTPt20" )
79     #fakeList.append( "JetTauEtaJPTPt40" )
80     #fakeList.append( "JetTauEtaJPTPt60" )
81     #fakeList.append( "JetTauEtaJPTPt80" )
82     #fakeList.append( "JetTauEtaJPTPt100" )
83     #fakeList.append( "JetTauEtaJPTPt200" )
84     #fakeList.append( "JetTauEtaJPTPt500" )
85     #fakeList.append( "JetTauEtaJPTPtInf" )
86     rootfile = ROOT.TFile.Open( "./Data_fakes.root" )
87     for fh in fakeList:
88     h = rootfile.Get( fakeDir + fh )
89     h.SetDirectory( 0 )
90     hU = rootfile.Get( fakeDir + fh + "ErrUp" )
91     hU.SetDirectory( 0 )
92     hD = rootfile.Get( fakeDir + fh + "ErrDwn" )
93     hD.SetDirectory( 0 )
94     errHistList.append( h )
95     errHistList.append( hU )
96     errHistList.append( hD )
97    
98     rootfile.Close()
99    
100    
101     cDict = {}
102     for hist in histList:
103     #if not hist.GetName() in [ "TauEff", "TauEffErrUp", "TauEffErrDwn" ]:
104     cDict[ hist.GetName() ] = ROOT.TCanvas( hist.GetName(), hist.GetName() )
105     cDict[ hist.GetName() ].cd()
106     hist.Draw()
107     pass
108     #for hist in errHistList :
109     for i in range( 0, len( errHistList ) ):
110     print i
111     if not i%3:
112     #print "selected: ", i
113     #cDict[ errHistList[ i + 1 ].GetName() ] = ROOT.TCanvas( errHistList[ i + 1 ].GetName(),
114     # errHistList[ i + 1 ].GetName() )
115     #cDict[ errHistList[ i + 1 ].GetName() ].cd()
116     #errHistList[ i + 1 ].Draw()
117     #errHistList[ i ].Draw( "same" )
118     #errHistList[ i + 2 ].Draw( "same" )
119     cDict[ errHistList[ i ].GetName() ] = ROOT.TCanvas( errHistList[ i ].GetName(),
120     errHistList[ i ].GetName() )
121     errHistList[ i ].GetXaxis().SetRangeUser( 0,155 )
122    
123     errHistList[ i ].Draw()
124     pass
125     pass
126    
127    
128    
129     Style.saveToEPS( saveName, cDict )
130    
131     Def.DontQuit()