Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:57

0001 
0002 ####### 
0003 
0004 #  automatized plots generator for b-tagging performances
0005 #  Adrien Caudron, 2013, UCL
0006 
0007 #######
0008 
0009 class plotInfo :
0010     def __init__ (self, name, title, #mandatory
0011                   legend="", Xlabel="", Ylabel="", logY=False, grid=False,
0012                   binning=None, Rebin=None,
0013                   doNormalization=False,
0014                   listTagger=None,
0015                   doPerformance=False, tagFlavor="B", mistagFlavor=["C","DUSG"]):
0016         self.name = name #name of the histos without postfix as PT/ETA bin or flavor
0017         self.title = title #title of the histograms : better if specific for the histogram
0018         self.legend = legend #legend name, if contain 'KEY', it will be replace by the list of keys you provide (as flavor, tagger ...)
0019         self.Xlabel = Xlabel #label of the X axis
0020         self.Ylabel = Ylabel #label of the Y axis
0021         self.logY = logY #if True : Y axis will be in log scale
0022         self.grid = grid #if True : a grid will be drawn
0023         self.binning = binning #if you want to change the binning put a list with [nBins,xmin,xmax]
0024         self.Rebin = Rebin #if you want to rebin the histos
0025         self.doNormalization = doNormalization #if you want to normalize to 1 all the histos 
0026         self.doPerformance = doPerformance #if you want to draw the performance as TGraph
0027         if self.doPerformance : 
0028             #replace TAG by the tag flavor choosen (B, C, UDSG ...)
0029             self.title = name.replace("TAG",tagFlavor)
0030             self.Xlabel = Xlabel.replace("TAG",tagFlavor)
0031             self.Ylabel = Ylabel.replace("TAG",tagFlavor)
0032             self.legend = legend.replace("TAG",tagFlavor)
0033             self.tagFlavor = tagFlavor
0034             self.mistagFlavor = mistagFlavor
0035         if listTagger is None :
0036             self.listTagger=None #you will take the list of tagger defined centrally
0037         else :
0038             self.listTagger=listTagger #you take the list passed as argument
0039 #define here the histograms you interested by
0040 #by jets
0041 jetPt = plotInfo(name="jetPt", title="Pt of all jets", legend="isVAL KEY-jets", Xlabel="Pt (GeV/c)", Ylabel="abitrary units",
0042                  logY=False, grid=False,
0043                  binning=[300,10.,310.], Rebin=20, doNormalization=True,
0044                  listTagger=["CSV"]
0045                  )
0046 jetEta = plotInfo(name="jetEta", title="Eta of all jets", legend="isVAL KEY-jets", Xlabel="#eta", Ylabel="abitrary units",
0047                   logY=False, grid=False,
0048                   binning=[11,90], Rebin=4, doNormalization=True,
0049                   listTagger=["CSV"]
0050                   )
0051 discr = plotInfo(name="discr", title="Discriminant of all jets", legend="isVAL KEY-jets", Xlabel="Discriminant", Ylabel="abitrary units",
0052                  logY=False, grid=False,
0053                  binning=None, Rebin=None, doNormalization=True
0054                  )
0055 effVsDiscrCut_discr = plotInfo(name="effVsDiscrCut_discr", title="Efficiency versus discriminant cut for all jets", legend="isVAL KEY-jets", Xlabel="Discriminant", Ylabel="efficiency",
0056                                logY=True, grid=True
0057                                )
0058 #MC only
0059 FlavEffVsBEff_discr = plotInfo(name="FlavEffVsBEff_B_discr", title="b-tag efficiency versus non b-tag efficiency", 
0060                                legend="KEY FLAV-jets versus b-jets", Xlabel="b-tag efficiency", Ylabel="non b-tag efficiency",
0061                                logY=True, grid=True
0062                                )
0063 #MC only
0064 performance = plotInfo(name="effVsDiscrCut_discr", title="TAG-tag efficiency versus non TAG-tag efficiency", 
0065                        legend="isVAL KEY-jets versus TAG-jets", Xlabel="TAG-tag efficiency", Ylabel="non TAG-tag efficiency",
0066                        logY=True, grid=True, 
0067                        doPerformance=True, tagFlavor="B", mistagFlavor=["C","DUSG"]
0068                        )
0069 #MC only, to do C vs B and C vs light
0070 performanceC = plotInfo(name="effVsDiscrCut_discr", title="TAG-tag efficiency versus non TAG-tag efficiency", 
0071                        legend="isVAL KEY-jets versus TAG-jets", Xlabel="TAG-tag efficiency", Ylabel="non TAG-tag efficiency",
0072                        logY=True, grid=True, 
0073                        doPerformance=True, tagFlavor="C", mistagFlavor=["B","DUSG"]
0074                        )
0075 #by tracks
0076 IP = plotInfo(name="ip_3D", title="Impact parameter", legend="isVAL KEY-jets", Xlabel="IP [cm]", Ylabel="abitrary units",
0077               logY=False, grid=False,
0078               binning=None,Rebin=None, doNormalization=True,
0079               listTagger=["IPTag"]
0080               )
0081 IPe = plotInfo(name="ipe_3D", title="Impact parameter error", legend="isVAL KEY-jets", Xlabel="IPE [cm]", Ylabel="abitrary units",
0082                logY=False, grid=False, 
0083                binning=None, Rebin=None, doNormalization=True,
0084                listTagger=["IPTag"]
0085                )
0086 IPs = plotInfo(name="ips_3D", title="Impact parameter significance", legend="isVAL KEY-jets", Xlabel="IPS", Ylabel="abitrary units", 
0087                logY=False, grid=False, 
0088                binning=None, Rebin=None, doNormalization=True,
0089                listTagger=["IPTag"]
0090                )
0091 NTracks = plotInfo(name="selTrksNbr_3D", title="number of selected tracks", legend="isVAL KEY-jets", Xlabel="number of selected tracks", Ylabel="abitrary units",
0092                    logY=False, grid=False,
0093                    binning=None, Rebin=None, doNormalization=True,
0094                    listTagger=["IPTag"]
0095                    )
0096 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",
0097                          logY=False, grid=False,
0098                          binning=None, Rebin=None, doNormalization=True, 
0099                          listTagger=["IPTag"]
0100                          )
0101 decayLength = plotInfo(name="decLen_3D", title="track decay length", legend="isVAL KEY-jets", Xlabel="decay length [cm]", Ylabel="abitrary units",
0102                        logY=False, grid=False,
0103                        binning=None, Rebin=None, doNormalization=True, listTagger=["IPTag"]
0104                        )
0105 NHits = plotInfo(name="tkNHits_3D", title="Number of Hits / selected tracks", legend="isVAL KEY-jets", Xlabel="Number of Hits", Ylabel="abitrary units",
0106                  logY=False, grid=False,
0107                  binning=None, Rebin=None, doNormalization=True,
0108                  listTagger=["IPTag"]
0109                  )
0110 NPixelHits = plotInfo(name="tkNPixelHits_3D", title="Number of Pixel Hits / selected tracks", legend="isVAL KEY-jets", Xlabel="Number of Pixel Hits", Ylabel="abitrary units",
0111                       logY=False, grid=False, 
0112                       binning=None, Rebin=None, doNormalization=True,
0113                       listTagger=["IPTag"]
0114                       )
0115 NormChi2 = plotInfo(name="tkNChiSqr_3D", title="Normalized Chi2", legend="isVAL KEY-jets", Xlabel="Normilized Chi2", Ylabel="abitrary units",
0116                     logY=False, grid=False,
0117                     binning=None, Rebin=None, doNormalization=True,
0118                     listTagger=["IPTag"]
0119                     )
0120 trackPt = plotInfo(name="tkPt_3D", title="track Pt", legend="isVAL KEY-jets", Xlabel="track Pt", Ylabel="abitrary units",
0121                    logY=False, grid=False,
0122                    binning=None, Rebin=None, doNormalization=True,
0123                    listTagger=["IPTag"]
0124                    )
0125 #by SV and for CSV information
0126 flightDist3Dval = plotInfo(name="flightDistance3dVal", title="3D flight distance value", legend="isVAL KEY-jets", Xlabel="3D flight distance value [cm]", Ylabel="abitrary units",
0127                            logY=False, grid=False,
0128                            binning=None, Rebin=None, doNormalization=True,
0129                            listTagger=["CSVTag"]
0130                            )
0131 flightDist3Dsig = plotInfo(name="flightDistance3dSig", title="3D flight distance significance", legend="isVAL KEY-jets", Xlabel="3D flight distance significance", Ylabel="abitrary units",
0132                            logY=False, grid=False,
0133                            binning=None, Rebin=None, doNormalization=True,
0134                            listTagger=["CSVTag"]
0135                            )
0136 jetNSecondaryVertices = plotInfo(name="jetNSecondaryVertices", title="Number of SV / jet", legend="isVAL KEY-jets", Xlabel="Number of SV / jet", Ylabel="abitrary units",
0137                            logY=False, grid=False,
0138                            binning=None, Rebin=None, doNormalization=True,
0139                            listTagger=["CSVTag"]
0140                            )
0141 #Reco and pseudo vertex information
0142 vertexMass = plotInfo(name="vertexMass", title="vertex mass", legend="isVAL KEY-jets", Xlabel="vertex mass GeV/c^2", Ylabel="abitrary units",
0143                       logY=False, grid=False,
0144                       binning=None, Rebin=None, doNormalization=True,
0145                       listTagger=["CSVTag"]
0146                       )
0147 vertexNTracks = plotInfo(name="vertexNTracks", title="number of tracks at SV", legend="isVAL KEY-jets", Xlabel="number of tracks at SV", Ylabel="abitrary units",
0148                       logY=False, grid=False,
0149                       binning=None, Rebin=None, doNormalization=True,
0150                       listTagger=["CSVTag"]
0151                       )
0152 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",
0153                       logY=False, grid=False,
0154                       binning=None, Rebin=None, doNormalization=True,
0155                       listTagger=["CSVTag"]
0156                       )
0157 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",
0158                       logY=False, grid=False,
0159                       binning=None, Rebin=None, doNormalization=True,
0160                       listTagger=["CSVTag"]
0161                       )
0162 #Reco, pseudo and no vertex information
0163 vertexCategory = plotInfo(name="vertexCategory", title="Reco, Pseudo, No vertex", legend="isVAL KEY-jets", Xlabel="Reco, Pseudo, No vertex", Ylabel="abitrary units",
0164                           logY=False, grid=False,
0165                           binning=None, Rebin=None, doNormalization=True,
0166                           listTagger=["CSVTag"]
0167                           )
0168 trackSip3dVal = plotInfo(name="trackSip3dVal", title="track IP 3D", legend="isVAL KEY-jets", Xlabel="track IP 3D [cm]", Ylabel="abitrary units",
0169                          logY=False, grid=False,
0170                          binning=None, Rebin=None, doNormalization=True,
0171                          listTagger=["CSVTag"]
0172                          )
0173 trackSip3dSig = plotInfo(name="trackSip3dSig", title="track IPS 3D", legend="isVAL KEY-jets", Xlabel="track IPS 3D", Ylabel="abitrary units",
0174                          logY=False, grid=False,
0175                          binning=None, Rebin=None, doNormalization=True,
0176                          listTagger=["CSVTag"]
0177                          )
0178 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",
0179                                    logY=False, grid=False,
0180                                    binning=None, Rebin=None, doNormalization=True,
0181                                    listTagger=["CSVTag"]
0182                                    )
0183 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",
0184                        logY=False, grid=False,
0185                        binning=None, Rebin=None, doNormalization=True,
0186                        listTagger=["CSVTag"]
0187                        )
0188 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",
0189                        logY=False, grid=False,
0190                        binning=None, Rebin=None, doNormalization=True,
0191                        listTagger=["CSVTag"]
0192                        )
0193 trackDecayLenVal = plotInfo(name="trackDecayLenVal", title="track decay length", legend="isVAL KEY-jets", Xlabel="track decay length", Ylabel="abitrary units",
0194                             logY=False, grid=False,
0195                             binning=None, Rebin=None, doNormalization=True,
0196                             listTagger=["CSVTag"]
0197                             )
0198 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",
0199                              logY=False, grid=False,
0200                              binning=None, Rebin=None, doNormalization=True,
0201                              listTagger=["CSVTag"]
0202                              )
0203 trackJetDist = plotInfo(name="trackJetDist", title="track distance to jet axis", legend="isVAL KEY-jets", Xlabel="track distance to jet axis", Ylabel="abitrary units",
0204                         logY=False, grid=False,
0205                         binning=None, Rebin=None, doNormalization=True,
0206                         listTagger=["CSVTag"]
0207                         )
0208 trackSumJetEtRatio = plotInfo(name="trackSumJetEtRatio", title="track sum Et / jet energy", legend="isVAL KEY-jets", Xlabel="track sum Et / jet energy", Ylabel="abitrary units",
0209                               logY=False, grid=False,
0210                               binning=None, Rebin=None, doNormalization=True,
0211                               listTagger=["CSVTag"]
0212                               )
0213 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",
0214                       logY=False, grid=False,
0215                       binning=None, Rebin=None, doNormalization=True,
0216                       listTagger=["CSVTag"]
0217                       )
0218 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",
0219                         logY=False, grid=False,
0220                         binning=None, Rebin=None, doNormalization=True,
0221                         listTagger=["CSVTag"]
0222                         )
0223 trackMomentum = plotInfo(name="trackMomentum", title="track momentum", legend="isVAL KEY-jets", Xlabel="track momentum [GeV/c]", Ylabel="abitrary units",
0224                          logY=False, grid=False,
0225                          binning=None, Rebin=None, doNormalization=True,
0226                          listTagger=["CSVTag"]
0227                          )
0228 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",
0229                      logY=False, grid=False,
0230                      binning=None, Rebin=None, doNormalization=True,
0231                      listTagger=["CSVTag"]
0232                      )
0233 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",
0234                           logY=False, grid=False,
0235                           binning=None, Rebin=None, doNormalization=True,
0236                           listTagger=["CSVTag"]
0237                           )