test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
listHistos.py
Go to the documentation of this file.
1 
2 #######
3 
4 # automatized plots generator for b-tagging performances
5 # Adrien Caudron, 2013, UCL
6 
7 #######
8 
9 class plotInfo :
10  def __init__ (self, name, title, #mandatory
11  legend="", Xlabel="", Ylabel="", logY=False, grid=False,
12  binning=None, Rebin=None,
13  doNormalization=False,
14  listTagger=None,
15  doPerformance=False, tagFlavor="B", mistagFlavor=["C","DUSG"]):
16  self.name = name #name of the histos without postfix as PT/ETA bin or flavor
17  self.title = title #title of the histograms : better if specific for the histogram
18  self.legend = legend #legend name, if contain 'KEY', it will be replace by the list of keys you provide (as flavor, tagger ...)
19  self.Xlabel = Xlabel #label of the X axis
20  self.Ylabel = Ylabel #label of the Y axis
21  self.logY = logY #if True : Y axis will be in log scale
22  self.grid = grid #if True : a grid will be drawn
23  self.binning = binning #if you want to change the binning put a list with [nBins,xmin,xmax]
24  self.Rebin = Rebin #if you want to rebin the histos
25  self.doNormalization = doNormalization #if you want to normalize to 1 all the histos
26  self.doPerformance = doPerformance #if you want to draw the performance as TGraph
27  if self.doPerformance :
28  #replace TAG by the tag flavor choosen (B, C, UDSG ...)
29  self.title = name.replace("TAG",tagFlavor)
30  self.Xlabel = Xlabel.replace("TAG",tagFlavor)
31  self.Ylabel = Ylabel.replace("TAG",tagFlavor)
32  self.legend = legend.replace("TAG",tagFlavor)
33  self.tagFlavor = tagFlavor
34  self.mistagFlavor = mistagFlavor
35  if listTagger is None :
36  self.listTagger=None #you will take the list of tagger defined centrally
37  else :
38  self.listTagger=listTagger #you take the list passed as argument
39 #define here the histograms you interested by
40 #by jets
41 jetPt = plotInfo(name="jetPt", title="Pt of all jets", legend="isVAL KEY-jets", Xlabel="Pt (GeV/c)", Ylabel="abitrary units",
42  logY=False, grid=False,
43  binning=[300,10.,310.], Rebin=20, doNormalization=True,
44  listTagger=["CSV"]
45  )
46 jetEta = plotInfo(name="jetEta", title="Eta of all jets", legend="isVAL KEY-jets", Xlabel="#eta", Ylabel="abitrary units",
47  logY=False, grid=False,
48  binning=[11,90], Rebin=4, doNormalization=True,
49  listTagger=["CSV"]
50  )
51 discr = plotInfo(name="discr", title="Discriminant of all jets", legend="isVAL KEY-jets", Xlabel="Discriminant", Ylabel="abitrary units",
52  logY=False, grid=False,
53  binning=None, Rebin=None, doNormalization=True
54  )
55 effVsDiscrCut_discr = plotInfo(name="effVsDiscrCut_discr", title="Efficiency versus discriminant cut for all jets", legend="isVAL KEY-jets", Xlabel="Discriminant", Ylabel="efficiency",
56  logY=True, grid=True
57  )
58 #MC only
59 FlavEffVsBEff_discr = plotInfo(name="FlavEffVsBEff_B_discr", title="b-tag efficiency versus non b-tag efficiency",
60  legend="KEY FLAV-jets versus b-jets", Xlabel="b-tag efficiency", Ylabel="non b-tag efficiency",
61  logY=True, grid=True
62  )
63 #MC only
64 performance = plotInfo(name="effVsDiscrCut_discr", title="TAG-tag efficiency versus non TAG-tag efficiency",
65  legend="isVAL KEY-jets versus TAG-jets", Xlabel="TAG-tag efficiency", Ylabel="non TAG-tag efficiency",
66  logY=True, grid=True,
67  doPerformance=True, tagFlavor="B", mistagFlavor=["C","DUSG"]
68  )
69 #MC only, to do C vs B and C vs light
70 performanceC = plotInfo(name="effVsDiscrCut_discr", title="TAG-tag efficiency versus non TAG-tag efficiency",
71  legend="isVAL KEY-jets versus TAG-jets", Xlabel="TAG-tag efficiency", Ylabel="non TAG-tag efficiency",
72  logY=True, grid=True,
73  doPerformance=True, tagFlavor="C", mistagFlavor=["B","DUSG"]
74  )
75 #by tracks
76 IP = plotInfo(name="ip_3D", title="Impact parameter", legend="isVAL KEY-jets", Xlabel="IP [cm]", Ylabel="abitrary units",
77  logY=False, grid=False,
78  binning=None,Rebin=None, doNormalization=True,
79  listTagger=["IPTag"]
80  )
81 IPe = plotInfo(name="ipe_3D", title="Impact parameter error", legend="isVAL KEY-jets", Xlabel="IPE [cm]", Ylabel="abitrary units",
82  logY=False, grid=False,
83  binning=None, Rebin=None, doNormalization=True,
84  listTagger=["IPTag"]
85  )
86 IPs = plotInfo(name="ips_3D", title="Impact parameter significance", legend="isVAL KEY-jets", Xlabel="IPS", Ylabel="abitrary units",
87  logY=False, grid=False,
88  binning=None, Rebin=None, doNormalization=True,
89  listTagger=["IPTag"]
90  )
91 NTracks = plotInfo(name="selTrksNbr_3D", title="number of selected tracks", legend="isVAL KEY-jets", Xlabel="number of selected tracks", Ylabel="abitrary units",
92  logY=False, grid=False,
93  binning=None, Rebin=None, doNormalization=True,
94  listTagger=["IPTag"]
95  )
96 distToJetAxis = plotInfo(name="jetDist_3D", title="track distance to the jet axis", legend="isVAL KEY-jets", Xlabel="distance to the jet axis [cm]", Ylabel="abitrary units",
97  logY=False, grid=False,
98  binning=None, Rebin=None, doNormalization=True,
99  listTagger=["IPTag"]
100  )
101 decayLength = plotInfo(name="decLen_3D", title="track decay length", legend="isVAL KEY-jets", Xlabel="decay length [cm]", Ylabel="abitrary units",
102  logY=False, grid=False,
103  binning=None, Rebin=None, doNormalization=True, listTagger=["IPTag"]
104  )
105 NHits = plotInfo(name="tkNHits_3D", title="Number of Hits / selected tracks", legend="isVAL KEY-jets", Xlabel="Number of Hits", Ylabel="abitrary units",
106  logY=False, grid=False,
107  binning=None, Rebin=None, doNormalization=True,
108  listTagger=["IPTag"]
109  )
110 NPixelHits = plotInfo(name="tkNPixelHits_3D", title="Number of Pixel Hits / selected tracks", legend="isVAL KEY-jets", Xlabel="Number of Pixel Hits", Ylabel="abitrary units",
111  logY=False, grid=False,
112  binning=None, Rebin=None, doNormalization=True,
113  listTagger=["IPTag"]
114  )
115 NormChi2 = plotInfo(name="tkNChiSqr_3D", title="Normalized Chi2", legend="isVAL KEY-jets", Xlabel="Normilized Chi2", Ylabel="abitrary units",
116  logY=False, grid=False,
117  binning=None, Rebin=None, doNormalization=True,
118  listTagger=["IPTag"]
119  )
120 trackPt = plotInfo(name="tkPt_3D", title="track Pt", legend="isVAL KEY-jets", Xlabel="track Pt", Ylabel="abitrary units",
121  logY=False, grid=False,
122  binning=None, Rebin=None, doNormalization=True,
123  listTagger=["IPTag"]
124  )
125 #by SV and for CSV information
126 flightDist3Dval = plotInfo(name="flightDistance3dVal", title="3D flight distance value", legend="isVAL KEY-jets", Xlabel="3D flight distance value [cm]", Ylabel="abitrary units",
127  logY=False, grid=False,
128  binning=None, Rebin=None, doNormalization=True,
129  listTagger=["CSVTag"]
130  )
131 flightDist3Dsig = plotInfo(name="flightDistance3dSig", title="3D flight distance significance", legend="isVAL KEY-jets", Xlabel="3D flight distance significance", Ylabel="abitrary units",
132  logY=False, grid=False,
133  binning=None, Rebin=None, doNormalization=True,
134  listTagger=["CSVTag"]
135  )
136 jetNSecondaryVertices = plotInfo(name="jetNSecondaryVertices", title="Number of SV / jet", legend="isVAL KEY-jets", Xlabel="Number of SV / jet", Ylabel="abitrary units",
137  logY=False, grid=False,
138  binning=None, Rebin=None, doNormalization=True,
139  listTagger=["CSVTag"]
140  )
141 #Reco and pseudo vertex information
142 vertexMass = plotInfo(name="vertexMass", title="vertex mass", legend="isVAL KEY-jets", Xlabel="vertex mass GeV/c^2", Ylabel="abitrary units",
143  logY=False, grid=False,
144  binning=None, Rebin=None, doNormalization=True,
145  listTagger=["CSVTag"]
146  )
147 vertexNTracks = plotInfo(name="vertexNTracks", title="number of tracks at SV", legend="isVAL KEY-jets", Xlabel="number of tracks at SV", Ylabel="abitrary units",
148  logY=False, grid=False,
149  binning=None, Rebin=None, doNormalization=True,
150  listTagger=["CSVTag"]
151  )
152 vertexJetDeltaR = plotInfo(name="vertexJetDeltaR", title="Delta R between the SV and the jet axis", legend="isVAL KEY-jets", Xlabel="Delta R between the SV and the jet axis", Ylabel="abitrary units",
153  logY=False, grid=False,
154  binning=None, Rebin=None, doNormalization=True,
155  listTagger=["CSVTag"]
156  )
157 vertexEnergyRatio = plotInfo(name="vertexEnergyRatio", title="Energy Ratio between SV and the jet", legend="isVAL KEY-jets", Xlabel="Energy Ratio between SV and the jet", Ylabel="abitrary units",
158  logY=False, grid=False,
159  binning=None, Rebin=None, doNormalization=True,
160  listTagger=["CSVTag"]
161  )
162 #Reco, pseudo and no vertex information
163 vertexCategory = plotInfo(name="vertexCategory", title="Reco, Pseudo, No vertex", legend="isVAL KEY-jets", Xlabel="Reco, Pseudo, No vertex", Ylabel="abitrary units",
164  logY=False, grid=False,
165  binning=None, Rebin=None, doNormalization=True,
166  listTagger=["CSVTag"]
167  )
168 trackSip3dVal = plotInfo(name="trackSip3dVal", title="track IP 3D", legend="isVAL KEY-jets", Xlabel="track IP 3D [cm]", Ylabel="abitrary units",
169  logY=False, grid=False,
170  binning=None, Rebin=None, doNormalization=True,
171  listTagger=["CSVTag"]
172  )
173 trackSip3dSig = plotInfo(name="trackSip3dSig", title="track IPS 3D", legend="isVAL KEY-jets", Xlabel="track IPS 3D", Ylabel="abitrary units",
174  logY=False, grid=False,
175  binning=None, Rebin=None, doNormalization=True,
176  listTagger=["CSVTag"]
177  )
178 trackSip3dSigAboveCharm = plotInfo(name="trackSip3dSigAboveCharm", title="first track IPS 3D lifting SV mass above charm", legend="isVAL KEY-jets", Xlabel="first track IPS 3D lifting SV mass above charm", Ylabel="abitrary units",
179  logY=False, grid=False,
180  binning=None, Rebin=None, doNormalization=True,
181  listTagger=["CSVTag"]
182  )
183 trackDeltaR = plotInfo(name="trackDeltaR", title="Delta R between the track and the jet axis", legend="isVAL KEY-jets", Xlabel="DeltaR(track,jet axis)", Ylabel="abitrary units",
184  logY=False, grid=False,
185  binning=None, Rebin=None, doNormalization=True,
186  listTagger=["CSVTag"]
187  )
188 trackEtaRel = plotInfo(name="trackEtaRel", title="track eta relative to the jet axis", legend="isVAL KEY-jets", Xlabel="track eta relative to the jet axis", Ylabel="abitrary units",
189  logY=False, grid=False,
190  binning=None, Rebin=None, doNormalization=True,
191  listTagger=["CSVTag"]
192  )
193 trackDecayLenVal = plotInfo(name="trackDecayLenVal", title="track decay length", legend="isVAL KEY-jets", Xlabel="track decay length", Ylabel="abitrary units",
194  logY=False, grid=False,
195  binning=None, Rebin=None, doNormalization=True,
196  listTagger=["CSVTag"]
197  )
198 trackSumJetDeltaR = plotInfo(name="trackSumJetDeltaR", title="Delta R between track 4-vector sum and jet axis", legend="isVAL KEY-jets", Xlabel="Delta R between track 4-vector sum and jet axis", Ylabel="abitrary units",
199  logY=False, grid=False,
200  binning=None, Rebin=None, doNormalization=True,
201  listTagger=["CSVTag"]
202  )
203 trackJetDist = plotInfo(name="trackJetDist", title="track distance to jet axis", legend="isVAL KEY-jets", Xlabel="track distance to jet axis", Ylabel="abitrary units",
204  logY=False, grid=False,
205  binning=None, Rebin=None, doNormalization=True,
206  listTagger=["CSVTag"]
207  )
208 trackSumJetEtRatio = plotInfo(name="trackSumJetEtRatio", title="track sum Et / jet energy", legend="isVAL KEY-jets", Xlabel="track sum Et / jet energy", Ylabel="abitrary units",
209  logY=False, grid=False,
210  binning=None, Rebin=None, doNormalization=True,
211  listTagger=["CSVTag"]
212  )
213 trackPtRel = plotInfo(name="trackPtRel", title="track Pt relative to jet axis", legend="isVAL KEY-jets", Xlabel="track Pt relative to jet axis", Ylabel="abitrary units",
214  logY=False, grid=False,
215  binning=None, Rebin=None, doNormalization=True,
216  listTagger=["CSVTag"]
217  )
218 trackPtRatio = plotInfo(name="trackPtRatio", title="track Pt relative to jet axis, normalized to its energy", legend="isVAL KEY-jets", Xlabel="track Pt relative to jet axis, normalized to its energy", Ylabel="abitrary units",
219  logY=False, grid=False,
220  binning=None, Rebin=None, doNormalization=True,
221  listTagger=["CSVTag"]
222  )
223 trackMomentum = plotInfo(name="trackMomentum", title="track momentum", legend="isVAL KEY-jets", Xlabel="track momentum [GeV/c]", Ylabel="abitrary units",
224  logY=False, grid=False,
225  binning=None, Rebin=None, doNormalization=True,
226  listTagger=["CSVTag"]
227  )
228 trackPPar = plotInfo(name="trackPPar", title="track parallel momentum along the jet axis", legend="isVAL KEY-jets", Xlabel="track parallel momentum along the jet axis", Ylabel="abitrary units",
229  logY=False, grid=False,
230  binning=None, Rebin=None, doNormalization=True,
231  listTagger=["CSVTag"]
232  )
233 trackPParRatio = plotInfo(name="trackPParRatio", title="track parallel momentum along the jet axis, normalized to its energy", legend="isVAL KEY-jets", Xlabel="track parallel momentum along the jet axis, normalized to its energy", Ylabel="abitrary units",
234  logY=False, grid=False,
235  binning=None, Rebin=None, doNormalization=True,
236  listTagger=["CSVTag"]
237  )