Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-25 06:38:48

0001 # This file is the authoritative source of the order of tracking
0002 # iterations. It is used in RECO, DQM, and VALIDATION. Note that here
0003 # InitialStepPreSplitting is not counted as an iteration.
0004 import FWCore.ParameterSet.Config as cms
0005 
0006 _defaultEraName = ""
0007 _nonDefaultEraNames = ["trackingLowPU", "trackingPhase1", "trackingPhase2PU140"]
0008 
0009 # name, postfix, era
0010 _defaultEra = (_defaultEraName, "", None)
0011 _nonDefaultEras = [
0012     (_name, "_"+_name, getattr(__import__('Configuration.Eras.Modifier_'+_name+'_cff',globals(),locals(),[_name],0),_name)) \
0013     for _name in _nonDefaultEraNames
0014 ]
0015 
0016 _allEras = [_defaultEra] + _nonDefaultEras
0017 
0018 
0019 _iterations = [
0020     "InitialStep",
0021     "DetachedTripletStep",
0022     "LowPtTripletStep",
0023     "PixelPairStep",
0024     "MixedTripletStep",
0025     "PixelLessStep",
0026     "TobTecStep",
0027     "JetCoreRegionalStep",
0028 ]
0029 _iterations_trackingLowPU = [
0030     "InitialStep",
0031     "LowPtTripletStep",
0032     "PixelPairStep",
0033     "DetachedTripletStep",
0034     "MixedTripletStep",
0035     "PixelLessStep",
0036     "TobTecStep",
0037 ]
0038 _iterations_trackingPhase1 = [
0039     "InitialStep",
0040     "LowPtQuadStep",
0041     "HighPtTripletStep",
0042     "LowPtTripletStep",
0043     "DetachedQuadStep",
0044     "DetachedTripletStep",
0045     "PixelPairStep",
0046     "MixedTripletStep",
0047     "PixelLessStep",
0048     "TobTecStep",
0049 ]
0050 
0051 from Configuration.ProcessModifiers.displacedTracking_cff import displacedTracking
0052 displacedTracking.toModify(_iterations_trackingPhase1, func=lambda x: x.append('DisplacedGeneralStep'))
0053 
0054 _iterations_trackingPhase1.append('JetCoreRegionalStep')
0055 
0056 _iterations_trackingPhase2PU140 = [
0057     "InitialStep",
0058     "HighPtTripletStep",
0059     "LowPtQuadStep",
0060     "LowPtTripletStep",
0061     "DetachedQuadStep",
0062     "PixelPairStep",
0063 ]
0064 from Configuration.ProcessModifiers.vectorHits_cff import vectorHits
0065 vectorHits.toModify(_iterations_trackingPhase2PU140, func=lambda x: x.append('PixelLessStep'))
0066 _iterations_muonSeeded = [
0067     "MuonSeededStepInOut",
0068     "MuonSeededStepOutIn",
0069 ]
0070 #Phase2
0071 _iterations_muonSeeded_trackingPhase2PU140 = [
0072     "MuonSeededStepInOut",
0073     "MuonSeededStepOutIn",
0074 ]
0075 _multipleSeedProducers = {
0076     "MixedTripletStep": ["A", "B"],
0077     "TobTecStep": ["Pair", "Tripl"],
0078 }
0079 _multipleSeedProducers_trackingLowPU = {
0080     "MixedTripletStep": ["A", "B"],
0081 }
0082 _multipleSeedProducers_trackingPhase1 = {
0083     "PixelPairStep": ["A", "B"],
0084     "MixedTripletStep": ["A", "B"],
0085     "TobTecStep": ["Pair", "Tripl"],
0086 }
0087 from Configuration.ProcessModifiers.seedingDeepCore_cff import seedingDeepCore
0088 seedingDeepCore.toModify(_multipleSeedProducers_trackingPhase1, func=lambda x: x.update({"JetCoreRegionalStep": ["Barrel","Endcap"]}))
0089 
0090 
0091 _multipleSeedProducers_trackingPhase2PU140 = {}
0092 _oldStyleHasSelector = set([
0093     "InitialStep",
0094     "HighPtTripletStep",
0095     "LowPtQuadStep",
0096     "LowPtTripletStep",
0097     "PixelPairStep",
0098     "PixelLessStep",
0099     "TobTecStep",
0100 ])
0101 
0102 from RecoLocalTracker.SubCollectionProducers.trackClusterRemover_cfi import trackClusterRemover as _trackClusterRemover
0103 _trackClusterRemoverBase = _trackClusterRemover.clone(
0104     maxChi2                                  = 9.0,
0105     pixelClusters                            = "siPixelClusters",
0106     stripClusters                            = "siStripClusters",
0107     TrackQuality                             = 'highPurity',
0108     minNumberOfLayersWithMeasBeforeFiltering = 0,
0109 )
0110 
0111 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
0112 pp_on_AA.toModify(_trackClusterRemoverBase, TrackQuality = 'tight')
0113 
0114 #Phase2 : configuring the phase2 track Cluster Remover
0115 from RecoLocalTracker.SubCollectionProducers.phase2trackClusterRemover_cfi import phase2trackClusterRemover as _phase2trackClusterRemover
0116 _trackClusterRemoverBase_trackingPhase2PU140 = _phase2trackClusterRemover.clone(
0117     maxChi2                                  = 9.0,
0118     phase2pixelClusters                      = "siPixelClusters",
0119     phase2OTClusters                         = "siPhase2Clusters",
0120     TrackQuality                             = 'highPurity',
0121     minNumberOfLayersWithMeasBeforeFiltering = 0,
0122 )
0123 
0124 def _modulePrefix(iteration):
0125     return iteration[0].lower()+iteration[1:]
0126 
0127 def _clusterRemover(iteration):
0128     return _modulePrefix(iteration)+"Clusters"
0129 
0130 def _tracks(iteration):
0131     return _modulePrefix(iteration)+"Tracks"
0132 
0133 def _classifier(iteration, oldStyle=False, oldStyleQualityMasks=False):
0134     pre = _modulePrefix(iteration)
0135     if oldStyle:
0136         if iteration in _oldStyleHasSelector:
0137             return pre+"Selector:" + ("QualityMasks" if oldStyleQualityMasks else pre)
0138         else:
0139             return pre
0140     else:
0141         return pre+":QualityMasks"
0142 
0143 def allEras():
0144     return _allEras
0145 
0146 def nonDefaultEras():
0147     return _nonDefaultEras
0148 
0149 def createEarlyTask(eraName, postfix, modDict):
0150     task = cms.Task()
0151     for it in globals()["_iterations"+postfix]:
0152         task.add(modDict[it+'Task'])
0153     return task
0154 
0155 def iterationAlgos(postfix, includeSequenceName=False):
0156     muonVariable = "_iterations_muonSeeded"+postfix
0157     iterations = globals()["_iterations"+postfix] + globals().get(muonVariable, _iterations_muonSeeded)
0158 
0159     if includeSequenceName:
0160         return [(_modulePrefix(i), i) for i in iterations]
0161     else:
0162         return [_modulePrefix(i) for i in iterations]
0163 
0164 def _seedOrTrackProducers(postfix, typ):
0165     ret = []
0166     iters = globals()["_iterations"+postfix]
0167     if typ == "Seeds":
0168         multipleSeedProducers = globals()["_multipleSeedProducers"+postfix]
0169     else:
0170         multipleSeedProducers = None
0171     for i in iters:
0172         seeder = _modulePrefix(i)+typ
0173         if multipleSeedProducers is not None and i in multipleSeedProducers:
0174             ret.extend([seeder+m for m in multipleSeedProducers[i]])
0175         else:
0176             ret.append(seeder)
0177 
0178     for i in globals().get("_iterations_muonSeeded"+postfix, _iterations_muonSeeded):
0179         ret.append(_modulePrefix(i).replace("Step", typ))
0180 
0181     return ret
0182 
0183 def seedProducers(postfix):
0184     return _seedOrTrackProducers(postfix, "Seeds")
0185 
0186 def trackProducers(postfix):
0187     return _seedOrTrackProducers(postfix, "Tracks")
0188 
0189 def clusterRemoverForIter(iteration, eraName="", postfix="", module=None):
0190     if module is None:
0191         module = _trackClusterRemoverBase.clone()
0192     if eraName == "trackingPhase2PU140":
0193         module = globals().get("_trackClusterRemoverBase"+postfix, _trackClusterRemoverBase)
0194 
0195     iters = globals()["_iterations"+postfix]
0196     try:
0197         ind = iters.index(iteration)
0198     except ValueError:
0199         # if the iteration is not active in era, just return the same
0200         return module
0201 
0202     if ind == 0:
0203         raise Exception("Iteration %s is the first iteration in era %s, asking cluster remover configuration does not make sense" % (iteration, eraName))
0204     prevIter = iters[ind-1]
0205 
0206     customize = dict(
0207         trajectories          = _tracks(prevIter),
0208         oldClusterRemovalInfo = _clusterRemover(prevIter) if ind >= 2 else "", # 1st iteration does not have cluster remover
0209     )
0210     if eraName in ["trackingPhase2PU140"]:
0211         customize["overrideTrkQuals"] = _classifier(prevIter, oldStyle=True) # old-style selector
0212     elif eraName == "trackingLowPU":
0213         customize["overrideTrkQuals"] = _classifier(prevIter, oldStyle=True, oldStyleQualityMasks=True) # old-style selector with 'QualityMasks' instance label
0214     else:
0215         customize["trackClassifier"] = _classifier(prevIter)
0216 
0217     return module.clone(**customize)