** Warning **

Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=lxr at /lxr/lib/LXR/Common.pm line 1103.

Last-Modified: Fri, 30 Jun 2022 01:52:46 GMT Content-Type: text/html; charset=utf-8 /CMSSW_12_5_X_2022-06-29-2300/Validation/RecoTrack/test/trackingPerformanceValidation.py
Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:34:06

0001 #! /usr/bin/env python3
0002 
0003 from Validation.RecoTrack.plotting.validation import Sample, Validation
0004 import Validation.RecoTrack.plotting.validation as validation
0005 import Validation.RecoTrack.plotting.trackingPlots as trackingPlots
0006 import Validation.RecoVertex.plotting.vertexPlots as vertexPlots
0007 
0008 #########################################################
0009 ########### User Defined Variables (BEGIN) ##############
0010 
0011 ### Reference release
0012 RefRelease='CMSSW_10_0_0_pre2_2018'
0013 
0014 ### Relval release (set if different from $CMSSW_VERSION)
0015 NewRelease='CMSSW_10_0_0_pre3_2018'
0016 
0017 ### This is the list of IDEAL-conditions relvals 
0018 startupsamples_run1 = [
0019     Sample('RelValMinBias'),
0020     Sample('RelValTTbar', version="v2"),
0021     Sample('RelValQCD_Pt_600_800'),
0022     Sample('RelValQCD_Pt_3000_3500'),
0023     Sample('RelValQCD_FlatPt_15_3000', append="HS"),
0024     Sample('RelValZMM'),
0025     Sample('RelValWjet_Pt_3000_3500'),
0026     Sample('RelValH130GGgluonfusion'),
0027     Sample('RelValSingleElectronPt35'),
0028     Sample('RelValSingleElectronPt10'),
0029     Sample('RelValSingleMuPt10'),
0030     Sample('RelValSingleMuPt100')
0031 ]
0032 
0033 common = [
0034     Sample('RelValMinBias', midfix="13"),
0035     Sample('RelValTTbar', midfix="13"),
0036     Sample('RelValQCD_Pt_600_800', midfix="13"),
0037     Sample('RelValQCD_Pt_3000_3500', midfix="13"),
0038     Sample('RelValQCD_FlatPt_15_3000', append="HS", midfix="13"),
0039     Sample('RelValZMM', midfix="13"),
0040     Sample('RelValWjet_Pt_3000_3500', midfix="13"),
0041     Sample('RelValH125GGgluonfusion', midfix="13"),
0042 ]
0043 
0044 startupsamples = common + [
0045     Sample('RelValSingleElectronPt35', midfix="UP15"),
0046     Sample('RelValSingleElectronPt10', midfix="UP15"),
0047     Sample('RelValSingleMuPt10', midfix="UP15"),
0048     Sample('RelValSingleMuPt100', midfix="UP15")
0049 ]
0050 hasPhase0FullSim = False
0051 if not hasPhase0FullSim:
0052     startupsamples = [] # no phase0 in 91X
0053 #startupsamples = []
0054 #startupsamples = startupsamples_run1
0055 
0056 
0057 def putype(t):
0058     if "_pmx" in NewRelease:
0059         if "_pmx" in RefRelease:
0060             return {"default": "pmx"+t}
0061         return {"default": t, NewRelease: "pmx"+t}
0062     return t
0063 
0064 pileupstartupsamples = [
0065     Sample('RelValTTbar', putype=putype("25ns"), punum=35, midfix="13"),
0066 #    Sample('RelValTTbar', putype=putype("50ns"), punum=35, midfix="13"),
0067     Sample('RelValZMM', putype=putype("25ns"), punum=35, midfix="13"),
0068 #    Sample('RelValZMM', putype=putype("50ns"), punum=35, midfix="13")
0069 ]
0070 #pileupstartupsamples = []
0071 def _isPhase1(release):
0072     return "phase1" in release or "2017" in release or "2018" in release
0073 if not _isPhase1(NewRelease) and not hasPhase0FullSim:
0074     pileupstartupsamples = []
0075 
0076 phase1samples = common + [
0077     Sample('RelValSingleElectronPt35'),
0078     Sample('RelValSingleElectronPt10'),
0079     Sample("RelValSingleMuPt1"),
0080     Sample("RelValSingleMuPt10"),
0081     Sample("RelValSingleMuPt100"),
0082 ]
0083 phase1samples_design = [
0084     # Design
0085     Sample('RelValMinBias', midfix="13", scenario="Design"),
0086     Sample("RelValTTbar", midfix="13", scenario="Design"),
0087 ]
0088 if "phase1" in NewRelease or "2017" in NewRelease:
0089     phase1samples.extend(pileupstartupsamples)
0090     phase1samples_design.extend([
0091             Sample("RelValSingleMuPt1", scenario="Design"),
0092             Sample("RelValSingleMuPt10", scenario="Design"),
0093             Sample("RelValSingleMuPt100", scenario="Design"),
0094             Sample("RelValTTbar", midfix="13", scenario="Design", putype=putype("25ns"), punum=35),
0095     ])
0096 phase1samples.extend([
0097     Sample('RelValTTbar', putype=putype("25ns"), punum=50, midfix="13"),
0098 ])
0099 if "2018" in NewRelease:
0100     phase1samples.extend([
0101             Sample('RelValZMM', putype=putype("25ns"), punum=50, midfix="13"),
0102     ])
0103     phase1samples_design.extend([
0104             Sample("RelValTTbar", midfix="13", scenario="Design", putype=putype("25ns"), punum=50),
0105     ])
0106 if _isPhase1(NewRelease):
0107     phase1samples.extend(phase1samples_design)
0108 
0109 phase2samples = [
0110     Sample("RelValMinBias", midfix="TuneZ2star_14TeV", scenario="2023GReco"),
0111     Sample("RelValMinBias", midfix="TuneZ2star_14TeV", scenario="2023tilted"),
0112     Sample("RelValTTbar", midfix="14TeV", scenario="2023GReco"),
0113     Sample("RelValTTbar", midfix="14TeV", scenario="2023GRecoPU35", putype=putype("25ns"), punum=35),
0114     Sample("RelValTTbar", midfix="14TeV", scenario="2023GRecoPU140", putype=putype("25ns"), punum=140),
0115     Sample("RelValTTbar", midfix="14TeV", scenario="2023GRecoPU200", putype=putype("25ns"), punum=200),
0116     Sample("RelValTTbar", midfix="14TeV", scenario="2023tilted"),
0117     Sample("RelValTTbar", midfix="14TeV", scenario="2023tiltedPU35", putype=putype("25ns"), punum=35),
0118     Sample("RelValTTbar", midfix="14TeV", scenario="2023tiltedPU140", putype=putype("25ns"), punum=140),
0119     Sample("RelValTTbar", midfix="14TeV", scenario="2023tiltedPU200", putype=putype("25ns"), punum=200),
0120     Sample("RelValZMM", midfix="13", scenario="2023GReco"),
0121     Sample("RelValZMM", midfix="13", scenario="2023GRecoPU140", putype=putype("25ns"), punum=140),
0122     Sample("RelValZMM", midfix="13", scenario="2023GRecoPU200", putype=putype("25ns"), punum=200),
0123     Sample("RelValZMM", midfix="13", scenario="2023tilted"),
0124     Sample("RelValZMM", midfix="13", scenario="2023tiltedPU140", putype=putype("25ns"), punum=140),
0125     Sample("RelValZMM", midfix="13", scenario="2023tiltedPU200", putype=putype("25ns"), punum=200),
0126     Sample("RelValSingleElectronPt35Extended", scenario="2023GReco"),
0127     Sample("RelValSingleElectronPt35Extended", scenario="2023tilted"),
0128     Sample("RelValSingleMuPt10Extended", scenario="2023GReco"),
0129     Sample("RelValSingleMuPt10Extended", scenario="2023tilted"),
0130     Sample("RelValSingleMuPt100", scenario="2023GReco"),
0131     Sample("RelValSingleMuPt100", scenario="2023tilted"),
0132 ]
0133 
0134 fastsimstartupsamples = [
0135     Sample('RelValTTbar', midfix="13", fastsim=True),
0136     Sample('RelValQCD_FlatPt_15_3000', midfix="13", fastsim=True),
0137     Sample('RelValSingleMuPt10', midfix="UP15", fastsim=True),
0138     Sample('RelValSingleMuPt100', midfix="UP15", fastsim=True)
0139 ]
0140 
0141 pileupfastsimstartupsamples = [
0142     Sample('RelValTTbar', putype=putype("25ns"), punum=35, midfix="13", fastsim=True)
0143 ]
0144 
0145 doFastVsFull = True
0146 doPhase2PU = False
0147 if "_pmx" in NewRelease:
0148     startupsamples = []
0149     fastsimstartupsamples = []
0150     phase1samples = pileupstartupsamples
0151     doFastVsFull = False
0152     if not NewRelease in validation._globalTags:
0153         validation._globalTags[NewRelease] = validation._globalTags[NewRelease.replace("_pmx", "")]
0154 if RefRelease is not None and "_pmx" in RefRelease:
0155     if not RefRelease in validation._globalTags:
0156         validation._globalTags[RefRelease] = validation._globalTags[RefRelease.replace("_pmx", "")]
0157 if "_extended" in NewRelease:
0158     startupsamples = [
0159         Sample('RelValTTbar', midfix="13_HS"),
0160         Sample('RelValZMM', midfix="13_HS"),
0161     ]
0162     pileupstartupsamples = [
0163         Sample('RelValTTbar', putype=putype("25ns"), midfix="13_HS"),
0164         Sample('RelValZMM', putype=putype("25ns"), midfix="13_HS"),
0165     ]
0166     fastsimstartupsamples = []
0167     pileupfastsimstartupsamples = []
0168     doFastVsFull = False
0169     if not NewRelease in validation._globalTags:
0170         validation._globalTags[NewRelease] = validation._globalTags[NewRelease.replace("_extended", "")]
0171 if _isPhase1(NewRelease):
0172     startupsamples = phase1samples
0173     pileupstartupsamples = []
0174     fastsimstartupsamples = []
0175     pileupfastsimstartupsamples = []
0176     doFastVsFull = False
0177 if "_phase2" in NewRelease:
0178     startupsamples = phase2samples
0179     pileupstartupsamples = []
0180     fastsimstartupsamples = []
0181     pileupfastsimstartupsamples = []
0182     doFastVsFull = False
0183     doPhase2PU = True
0184 
0185 ### Track algorithm name and quality. Can be a list.
0186 Algos= ['ootb', 'initialStep', 'lowPtTripletStep','pixelPairStep','detachedTripletStep','mixedTripletStep','pixelLessStep','tobTecStep','displacedGeneralStep','jetCoreRegionalStep','muonSeededStepInOut','muonSeededStepOutIn',
0187         'ak4PFJets','btvLike'
0188 ]
0189 #Algos= ['ootb']
0190 #Algos= ['ootb','initialStep','lowPtTripletStep','pixelPairStep','mixedTripletStep','muonSeededStepInOut','muonSeededStepOutIn'] # phase1
0191 Qualities=['', 'highPurity']
0192 VertexCollections=["offlinePrimaryVertices", "selectedOfflinePrimaryVertices"]
0193 
0194 def limitProcessing(algo, quality):
0195     return algo in Algos and quality in Qualities
0196 
0197 def limitRelVal(algo, quality):
0198     qual = quality.replace("ByOriginalAlgo", "") # include ByOriginalAlgo
0199     return qual in ["", "highPurity"]
0200 
0201 def ignore(a, q):
0202     return False
0203 
0204 kwargs_tracking = {
0205     "limitSubFoldersOnlyTo": {
0206         # filter out the pT>0.9 GeV track selection
0207         "": limitRelVal,
0208         "tpPtLess09": limitRelVal,
0209         "tpEtaGreater2p7": limitRelVal,
0210         "displaced": limitRelVal,
0211         "allTPEffic": limitRelVal,
0212         "fromPV": limitRelVal,
0213         "fromPVAllTP": limitRelVal,
0214     }
0215 }
0216 # Temporary until we have limited the set of histograms for phase2
0217 if "_phase2" in NewRelease or "SLHC" in NewRelease:
0218     kwargs_tracking["limitSubFoldersOnlyTo"].update({
0219         "allTPEffic": ignore, "fromPV": ignore, "fromPVAllTP": ignore, # ignore for now to save disk space
0220         "seeding": ignore, "building": ignore # temporary until we have limited the set of histograms for phase2
0221     })
0222 
0223 
0224 
0225 ### Reference and new repository
0226 RefRepository = '/eos/project/c/cmsweb/www/tracking/validation/MC'
0227 NewRepository = 'new' # copy output into a local folder
0228 
0229 # Tracking validation plots
0230 val = Validation(
0231     fullsimSamples = startupsamples + pileupstartupsamples,
0232     fastsimSamples = fastsimstartupsamples + pileupfastsimstartupsamples,
0233     refRelease=RefRelease, refRepository=RefRepository,
0234     newRelease=NewRelease, newRepository=NewRepository
0235 )
0236 htmlReport = val.createHtmlReport()
0237 val.download()
0238 val.doPlots(plotter=trackingPlots.plotter,
0239             htmlReport=htmlReport, doFastVsFull=doFastVsFull, doPhase2PU=doPhase2PU,
0240             **kwargs_tracking
0241 )
0242 #val.doPlots(plotter=trackingPlots.plotterExt,
0243 #            htmlReport=htmlReport, doFastVsFull=doFastVsFull, doPhase2PU=doPhase2PU,
0244 #            **kwargs_tracking
0245 #)
0246 
0247 val.doPlots(plotter=vertexPlots.plotter,
0248             limitSubFoldersOnlyTo={"": VertexCollections},
0249             htmlReport=htmlReport, doFastVsFull=doFastVsFull, doPhase2PU=doPhase2PU,
0250 )
0251 #val.doPlots(plotter=vertexPlots.plotterExt,
0252 #            limitSubFoldersOnlyTo={"": VertexCollections},
0253 #            htmlReport=htmlReport, doFastVsFull=doFastVsFull, doPhase2PU=doPhase2PU,
0254 #)
0255 htmlReport.write()
0256 
0257 
0258 # Timing plots
0259 #val2 = validation.Validation(
0260 #    fullsimSamples = startupsamples, fastsimSamples=[],
0261 #    newRelease=NewRelease)
0262 #val2.doPlots(refRelease=RefRelease,
0263 #             refRepository=RefRepository, newRepository=NewRepository, plotter=trackingPlots.timePlotter,
0264 #             algos=None, qualities=None)
0265 
0266 # TrackingParticle plots
0267 #val3 = validation.Validation(
0268 #    fullsimSamples = startupsamples + pileupstartupsamples + upgradesamples,
0269 #    fastsimSamples=[], newRelease=NewRelease,
0270 #    selectionName="_tp")
0271 #val3.download()
0272 #val3.doPlots(algos=None, qualities=None, refRelease=RefRelease,
0273 #             refRepository=RefRepository, newRepository=NewRepository, plotter=trackingPlots.tpPlotter)
0274