CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/Validation/RecoB/scripts/listHistos.py

Go to the documentation of this file.
00001 
00002 ####### 
00003 
00004 #  automatized plots generator for b-tagging performances
00005 #  Adrien Caudron, 2013, UCL
00006 
00007 #######
00008 
00009 class plotInfo :
00010     def __init__ (self, name, title, #mandatory
00011                   legend="", Xlabel="", Ylabel="", logY=False, grid=False,
00012                   binning=None, Rebin=None,
00013                   doNormalization=False,
00014                   listTagger=None,
00015                   doPerformance=False, tagFlavor="B", mistagFlavor=["C","DUSG"]):
00016         self.name = name #name of the histos without postfix as PT/ETA bin or flavor
00017         self.title = title #title of the histograms : better if specific for the histogram
00018         self.legend = legend #legend name, if contain 'KEY', it will be replace by the list of keys you provide (as flavor, tagger ...)
00019         self.Xlabel = Xlabel #label of the X axis
00020         self.Ylabel = Ylabel #label of the Y axis
00021         self.logY = logY #if True : Y axis will be in log scale
00022         self.grid = grid #if True : a grid will be drawn
00023         self.binning = binning #if you want to change the binning put a list with [nBins,xmin,xmax]
00024         self.Rebin = Rebin #if you want to rebin the histos
00025         self.doNormalization = doNormalization #if you want to normalize to 1 all the histos 
00026         self.doPerformance = doPerformance #if you want to draw the performance as TGraph
00027         if self.doPerformance : 
00028             #replace TAG by the tag flavor choosen (B, C, UDSG ...)
00029             self.title = name.replace("TAG",tagFlavor)
00030             self.Xlabel = Xlabel.replace("TAG",tagFlavor)
00031             self.Ylabel = Ylabel.replace("TAG",tagFlavor)
00032             self.legend = legend.replace("TAG",tagFlavor)
00033             self.tagFlavor = tagFlavor
00034             self.mistagFlavor = mistagFlavor
00035         if listTagger is None :
00036             self.listTagger=None #you will take the list of tagger defined centrally
00037         else :
00038             self.listTagger=listTagger #you take the list passed as argument
00039 #define here the histograms you interested by
00040 #by jets
00041 jetPt = plotInfo(name="jetPt", title="Pt of all jets", legend="isVAL KEY-jets", Xlabel="Pt (GeV/c)", Ylabel="abitrary units",
00042                  logY=False, grid=False,
00043                  binning=[300,10.,310.], Rebin=20, doNormalization=True,
00044                  listTagger=["CSV"]
00045                  )
00046 jetEta = plotInfo(name="jetEta", title="Eta of all jets", legend="isVAL KEY-jets", Xlabel="#eta", Ylabel="abitrary units",
00047                   logY=False, grid=False,
00048                   binning=[11,90], Rebin=4, doNormalization=True,
00049                   listTagger=["CSV"]
00050                   )
00051 discr = plotInfo(name="discr", title="Discriminant of all jets", legend="isVAL KEY-jets", Xlabel="Discriminant", Ylabel="abitrary units",
00052                  logY=False, grid=False,
00053                  binning=None, Rebin=None, doNormalization=True
00054                  )
00055 effVsDiscrCut_discr = plotInfo(name="effVsDiscrCut_discr", title="Efficiency versus discriminant cut for all jets", legend="isVAL KEY-jets", Xlabel="Discriminant", Ylabel="efficiency",
00056                                logY=True, grid=True
00057                                )
00058 #MC only
00059 FlavEffVsBEff_discr = plotInfo(name="FlavEffVsBEff_B_discr", title="b-tag efficiency versus non b-tag efficiency", 
00060                                legend="KEY FLAV-jets versus b-jets", Xlabel="b-tag efficiency", Ylabel="non b-tag efficiency",
00061                                logY=True, grid=True
00062                                )
00063 #MC only
00064 performance = plotInfo(name="effVsDiscrCut_discr", title="TAG-tag efficiency versus non TAG-tag efficiency", 
00065                        legend="isVAL KEY-jets versus TAG-jets", Xlabel="TAG-tag efficiency", Ylabel="non TAG-tag efficiency",
00066                        logY=True, grid=True, 
00067                        doPerformance=True, tagFlavor="B", mistagFlavor=["C","DUSG"]
00068                        )
00069 #MC only, to do C vs B and C vs light
00070 performanceC = plotInfo(name="effVsDiscrCut_discr", title="TAG-tag efficiency versus non TAG-tag efficiency", 
00071                        legend="isVAL KEY-jets versus TAG-jets", Xlabel="TAG-tag efficiency", Ylabel="non TAG-tag efficiency",
00072                        logY=True, grid=True, 
00073                        doPerformance=True, tagFlavor="C", mistagFlavor=["B","DUSG"]
00074                        )
00075 #by tracks
00076 IP = plotInfo(name="ip_3D", title="Impact parameter", legend="isVAL KEY-jets", Xlabel="IP [cm]", Ylabel="abitrary units",
00077               logY=False, grid=False,
00078               binning=None,Rebin=None, doNormalization=True,
00079               listTagger=["IPTag"]
00080               )
00081 IPe = plotInfo(name="ipe_3D", title="Impact parameter error", legend="isVAL KEY-jets", Xlabel="IPE [cm]", Ylabel="abitrary units",
00082                logY=False, grid=False, 
00083                binning=None, Rebin=None, doNormalization=True,
00084                listTagger=["IPTag"]
00085                )
00086 IPs = plotInfo(name="ips_3D", title="Impact parameter significance", legend="isVAL KEY-jets", Xlabel="IPS", Ylabel="abitrary units", 
00087                logY=False, grid=False, 
00088                binning=None, Rebin=None, doNormalization=True,
00089                listTagger=["IPTag"]
00090                )
00091 NTracks = plotInfo(name="selTrksNbr_3D", title="number of selected tracks", legend="isVAL KEY-jets", Xlabel="number of selected tracks", Ylabel="abitrary units",
00092                    logY=False, grid=False,
00093                    binning=None, Rebin=None, doNormalization=True,
00094                    listTagger=["IPTag"]
00095                    )
00096 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",
00097                          logY=False, grid=False,
00098                          binning=None, Rebin=None, doNormalization=True, 
00099                          listTagger=["IPTag"]
00100                          )
00101 decayLength = plotInfo(name="decLen_3D", title="track decay length", legend="isVAL KEY-jets", Xlabel="decay length [cm]", Ylabel="abitrary units",
00102                        logY=False, grid=False,
00103                        binning=None, Rebin=None, doNormalization=True, listTagger=["IPTag"]
00104                        )
00105 NHits = plotInfo(name="tkNHits_3D", title="Number of Hits / selected tracks", legend="isVAL KEY-jets", Xlabel="Number of Hits", Ylabel="abitrary units",
00106                  logY=False, grid=False,
00107                  binning=None, Rebin=None, doNormalization=True,
00108                  listTagger=["IPTag"]
00109                  )
00110 NPixelHits = plotInfo(name="tkNPixelHits_3D", title="Number of Pixel Hits / selected tracks", legend="isVAL KEY-jets", Xlabel="Number of Pixel Hits", Ylabel="abitrary units",
00111                       logY=False, grid=False, 
00112                       binning=None, Rebin=None, doNormalization=True,
00113                       listTagger=["IPTag"]
00114                       )
00115 NormChi2 = plotInfo(name="tkNChiSqr_3D", title="Normalized Chi2", legend="isVAL KEY-jets", Xlabel="Normilized Chi2", Ylabel="abitrary units",
00116                     logY=False, grid=False,
00117                     binning=None, Rebin=None, doNormalization=True,
00118                     listTagger=["IPTag"]
00119                     )
00120 trackPt = plotInfo(name="tkPt_3D", title="track Pt", legend="isVAL KEY-jets", Xlabel="track Pt", Ylabel="abitrary units",
00121                    logY=False, grid=False,
00122                    binning=None, Rebin=None, doNormalization=True,
00123                    listTagger=["IPTag"]
00124                    )
00125 #by SV and for CSV information
00126 flightDist3Dval = plotInfo(name="flightDistance3dVal", title="3D flight distance value", legend="isVAL KEY-jets", Xlabel="3D flight distance value [cm]", Ylabel="abitrary units",
00127                            logY=False, grid=False,
00128                            binning=None, Rebin=None, doNormalization=True,
00129                            listTagger=["CSVTag"]
00130                            )
00131 flightDist3Dsig = plotInfo(name="flightDistance3dSig", title="3D flight distance significance", legend="isVAL KEY-jets", Xlabel="3D flight distance significance", Ylabel="abitrary units",
00132                            logY=False, grid=False,
00133                            binning=None, Rebin=None, doNormalization=True,
00134                            listTagger=["CSVTag"]
00135                            )
00136 jetNSecondaryVertices = plotInfo(name="jetNSecondaryVertices", title="Number of SV / jet", legend="isVAL KEY-jets", Xlabel="Number of SV / jet", Ylabel="abitrary units",
00137                            logY=False, grid=False,
00138                            binning=None, Rebin=None, doNormalization=True,
00139                            listTagger=["CSVTag"]
00140                            )
00141 #Reco and pseudo vertex information
00142 vertexMass = plotInfo(name="vertexMass", title="vertex mass", legend="isVAL KEY-jets", Xlabel="vertex mass GeV/c^2", Ylabel="abitrary units",
00143                       logY=False, grid=False,
00144                       binning=None, Rebin=None, doNormalization=True,
00145                       listTagger=["CSVTag"]
00146                       )
00147 vertexNTracks = plotInfo(name="vertexNTracks", title="number of tracks at SV", legend="isVAL KEY-jets", Xlabel="number of tracks at SV", Ylabel="abitrary units",
00148                       logY=False, grid=False,
00149                       binning=None, Rebin=None, doNormalization=True,
00150                       listTagger=["CSVTag"]
00151                       )
00152 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",
00153                       logY=False, grid=False,
00154                       binning=None, Rebin=None, doNormalization=True,
00155                       listTagger=["CSVTag"]
00156                       )
00157 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",
00158                       logY=False, grid=False,
00159                       binning=None, Rebin=None, doNormalization=True,
00160                       listTagger=["CSVTag"]
00161                       )
00162 #Reco, pseudo and no vertex information
00163 vertexCategory = plotInfo(name="vertexCategory", title="Reco, Pseudo, No vertex", legend="isVAL KEY-jets", Xlabel="Reco, Pseudo, No vertex", Ylabel="abitrary units",
00164                           logY=False, grid=False,
00165                           binning=None, Rebin=None, doNormalization=True,
00166                           listTagger=["CSVTag"]
00167                           )
00168 trackSip3dVal = plotInfo(name="trackSip3dVal", title="track IP 3D", legend="isVAL KEY-jets", Xlabel="track IP 3D [cm]", Ylabel="abitrary units",
00169                          logY=False, grid=False,
00170                          binning=None, Rebin=None, doNormalization=True,
00171                          listTagger=["CSVTag"]
00172                          )
00173 trackSip3dSig = plotInfo(name="trackSip3dSig", title="track IPS 3D", legend="isVAL KEY-jets", Xlabel="track IPS 3D", Ylabel="abitrary units",
00174                          logY=False, grid=False,
00175                          binning=None, Rebin=None, doNormalization=True,
00176                          listTagger=["CSVTag"]
00177                          )
00178 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",
00179                                    logY=False, grid=False,
00180                                    binning=None, Rebin=None, doNormalization=True,
00181                                    listTagger=["CSVTag"]
00182                                    )
00183 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",
00184                        logY=False, grid=False,
00185                        binning=None, Rebin=None, doNormalization=True,
00186                        listTagger=["CSVTag"]
00187                        )
00188 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",
00189                        logY=False, grid=False,
00190                        binning=None, Rebin=None, doNormalization=True,
00191                        listTagger=["CSVTag"]
00192                        )
00193 trackDecayLenVal = plotInfo(name="trackDecayLenVal", title="track decay length", legend="isVAL KEY-jets", Xlabel="track decay length", Ylabel="abitrary units",
00194                             logY=False, grid=False,
00195                             binning=None, Rebin=None, doNormalization=True,
00196                             listTagger=["CSVTag"]
00197                             )
00198 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",
00199                              logY=False, grid=False,
00200                              binning=None, Rebin=None, doNormalization=True,
00201                              listTagger=["CSVTag"]
00202                              )
00203 trackJetDist = plotInfo(name="trackJetDist", title="track distance to jet axis", legend="isVAL KEY-jets", Xlabel="track distance to jet axis", Ylabel="abitrary units",
00204                         logY=False, grid=False,
00205                         binning=None, Rebin=None, doNormalization=True,
00206                         listTagger=["CSVTag"]
00207                         )
00208 trackSumJetEtRatio = plotInfo(name="trackSumJetEtRatio", title="track sum Et / jet energy", legend="isVAL KEY-jets", Xlabel="track sum Et / jet energy", Ylabel="abitrary units",
00209                               logY=False, grid=False,
00210                               binning=None, Rebin=None, doNormalization=True,
00211                               listTagger=["CSVTag"]
00212                               )
00213 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",
00214                       logY=False, grid=False,
00215                       binning=None, Rebin=None, doNormalization=True,
00216                       listTagger=["CSVTag"]
00217                       )
00218 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",
00219                         logY=False, grid=False,
00220                         binning=None, Rebin=None, doNormalization=True,
00221                         listTagger=["CSVTag"]
00222                         )
00223 trackMomentum = plotInfo(name="trackMomentum", title="track momentum", legend="isVAL KEY-jets", Xlabel="track momentum [GeV/c]", Ylabel="abitrary units",
00224                          logY=False, grid=False,
00225                          binning=None, Rebin=None, doNormalization=True,
00226                          listTagger=["CSVTag"]
00227                          )
00228 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",
00229                      logY=False, grid=False,
00230                      binning=None, Rebin=None, doNormalization=True,
00231                      listTagger=["CSVTag"]
00232                      )
00233 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",
00234                           logY=False, grid=False,
00235                           binning=None, Rebin=None, doNormalization=True,
00236                           listTagger=["CSVTag"]
00237                           )