Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:39

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 def memorySavingTracking(process):
0004     toRemove={}
0005     #list of modules in iterative tracking
0006     ## remove rekeying of clusters refs from track producer
0007     trackProducers=['preFilterZeroStepTracks',
0008                     'preFilterStepOneTracks',
0009                     'secWithMaterialTracks',
0010                     'thWithMaterialTracks',
0011                     'fourthWithMaterialTracks',
0012                     'fifthWithMaterialTracks',
0013                     ]
0014 
0015     for tp in trackProducers:
0016         m=getattr(process,tp)
0017         if hasattr(m,"clusterRemovalInfo"):
0018             #print "removing cluter rekeying from",tp
0019             delattr(m,"clusterRemovalInfo")
0020 
0021     measurementTrackers=['MeasurementTracker',
0022                          'newMeasurementTracker',
0023                          'secMeasurementTracker',
0024                          'thMeasurementTracker',
0025                          'fourthMeasurementTracker',
0026                          'fifthMeasurementTracker',
0027                          ]
0028 
0029     # list of measurement tracker, component names
0030     ## create the clusterRef to skip creators (MT+'ToSkip')
0031     for mt in measurementTrackers:
0032         es=getattr(process,mt)
0033         ## modify MT to point to the full cluster list
0034         #if es.pixelClusterProducer.value() == 'siPixelClusters':
0035         #    continue
0036 
0037         #old trackclusterremoval module
0038         removalModule=es.pixelClusterProducer.value()
0039 
0040         if (removalModule != 'siPixelClusters'):
0041             es.skipClusters = cms.InputTag(removalModule)
0042             es.pixelClusterProducer = 'siPixelClusters'
0043             es.stripClusterProducer = 'siStripClusters'
0044             #print mt,es.skipClusters,es.pixelClusterProducer,es.stripClusterProducer
0045             tcremoval = getattr(process,removalModule)
0046             #print removalModule,"turned to using new scheme"
0047             tcremoval.clusterLessSolution= cms.bool(True)
0048             tcremoval.stripClusters = 'siStripClusters'
0049             tcremoval.pixelClusters = 'siPixelClusters'
0050             skipTrackQualityFilter=False
0051             if (skipTrackQualityFilter):
0052                 tcremoval.TrackQuality = cms.string('highPurity')
0053                 #remove the QualityFilter module from the path
0054                 toRemove[tcremoval.trajectories.value()]=True
0055                 qf=getattr(process,tcremoval.trajectories.value())
0056                 tcremoval.trajectories = qf.recTracks
0057         #else:
0058             #print mt,'no cluster to skip',es.pixelClusterProducer,es.stripClusterProducer
0059 
0060     patternRecoModules=[
0061         'fifthTrackCandidates',
0062         'fourthTrackCandidates',
0063         'newTrackCandidateMaker',
0064         'secTrackCandidates',
0065         'stepOneTrackCandidateMaker',
0066         'thTrackCandidates'
0067         ]
0068     
0069     for ckfm in patternRecoModules:
0070         ckf=getattr(process,ckfm)
0071         builder=getattr(process,ckf.TrajectoryBuilder.value())
0072         mtn= builder.MeasurementTrackerName.value()
0073         if mtn!='':
0074             #make it look at the central MT
0075             builder.MeasurementTrackerName=''
0076             mt=getattr(process,mtn)
0077             # transfer the cluster removal from the MT to the builder
0078             builder.clustersToSkip = mt.skipClusters
0079             #print "setting",ckf.TrajectoryBuilder.value(),"via",ckfm,"to look at central MT"
0080             #print "removing MT:",mtn
0081             delattr(process,mtn)
0082         #else:
0083             #print ckfm,"untouched"
0084             
0085     #all seeding layers should point to the same rechits collections
0086     for esp in process.es_producers_().keys():
0087         es = getattr(process,esp)
0088         if es._TypedParameterizable__type != 'SeedingLayersESProducer':
0089             continue
0090         for pm in es.parameters_().keys():
0091             p=getattr(es,pm)
0092             if p.pythonTypeName() == 'cms.PSet':
0093                 if hasattr(p,'HitProducer'):
0094                     #print "pixel",pm,p
0095                     #pixel case
0096                     if p.HitProducer != 'siPixelRecHits':
0097                         toRemove[p.HitProducer.value()]=True
0098                         skip=getattr(process,p.HitProducer.value()).src
0099                         p.HitProducer = 'siPixelRecHits'
0100                         #and set the skipping
0101                         p.skipClusters = cms.InputTag(skip.value())
0102                         #print esp,"modified for new skipping"
0103                         #print esp,pm,p
0104 
0105                 if hasattr(p,'matchedRecHits'):
0106                     #print "strip",pm,p
0107                     #strip case
0108                     ## rename the collection
0109                     if p.matchedRecHits.moduleLabel != 'siStripMatchedRecHits':
0110                         toRemove[p.matchedRecHits.moduleLabel]=True
0111                         skip=getattr(process,p.matchedRecHits.moduleLabel).ClusterProducer
0112                         p.matchedRecHits.setModuleLabel('siStripMatchedRecHits')
0113                         #and set the skipping
0114                         p.skipClusters = cms.InputTag(skip.value())
0115                         #print esp,pm,p
0116 
0117 
0118     for edp in process.producers_():
0119         p=getattr(process,edp)
0120         if hasattr(p,'ClusterCheckPSet'):
0121             #print "resetting cluster check for",edp
0122             p.ClusterCheckPSet.PixelClusterCollectionLabel = 'siPixelClusters'
0123             p.ClusterCheckPSet.ClusterCollectionLabel = 'siStripClusters'
0124 
0125     #force useless module to be removed
0126     toRemove['secStripRecHits']=True
0127     toRemove['fourthPixelRecHits']=True
0128     toRemove['fifthPixelRecHits']=True
0129     
0130     for tr in toRemove:
0131         if hasattr(process,tr):
0132             #print "removing",tr
0133             process.reconstruction_step.remove(getattr(process,tr))
0134 
0135     delattr(process.newCombinedSeeds,'clusterRemovalInfos')
0136         
0137     return (process)
0138 
0139 
0140 def customiseCommon(process):
0141 
0142     process = memorySavingTracking(process)
0143     
0144     return (process)
0145 
0146 
0147 ##############################################################################
0148 def customisePPData(process):
0149     process= customiseCommon(process)
0150 
0151     ## particle flow HF cleaning
0152     process.particleFlowRecHitHCAL.LongShortFibre_Cut = 30.
0153     process.particleFlowRecHitHCAL.ApplyPulseDPG = True
0154 
0155     ## HF cleaning for data only
0156     process.hcalRecAlgos.SeverityLevels[3].RecHitFlags.remove("HFDigiTime")
0157     process.hcalRecAlgos.SeverityLevels[4].RecHitFlags.append("HFDigiTime")
0158 
0159     ##beam-halo-id for data only
0160     process.CSCHaloData.ExpectedBX = cms.int32(3)
0161 
0162     ## hcal hit flagging
0163     process.hfreco.PETstat.flagsToSkip  = 2
0164     process.hfreco.S8S1stat.flagsToSkip = 18
0165     process.hfreco.S9S1stat.flagsToSkip = 26
0166 
0167     return process
0168 
0169 
0170 ##############################################################################
0171 def customisePPMC(process):
0172     process=customiseCommon(process)
0173     
0174     return process
0175 
0176 ##############################################################################
0177 def customiseCosmicData(process):
0178 
0179     return process
0180 
0181 ##############################################################################
0182 def customiseCosmicMC(process):
0183     
0184     return process
0185         
0186 ##############################################################################
0187 def customiseVALSKIM(process):
0188     process= customisePPData(process)
0189     process.reconstruction.remove(process.lumiProducer)
0190     return process
0191                 
0192 ##############################################################################
0193 def customiseExpress(process):
0194     process= customisePPData(process)
0195 
0196     import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi
0197     process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone()
0198     
0199     return process
0200 
0201 ##############################################################################
0202 def customisePrompt(process):
0203     process= customisePPData(process)
0204     return process
0205 
0206 ##############################################################################
0207 ##############################################################################
0208 
0209 def customiseCommonHI(process):
0210     
0211     ###############################################################################################
0212     ####
0213     ####  Top level replaces for handling strange scenarios of early HI collisions
0214     ####
0215 
0216     ## Offline Silicon Tracker Zero Suppression
0217     process.siStripZeroSuppression.Algorithms.CommonModeNoiseSubtractionMode = cms.string("IteratedMedian")
0218     process.siStripZeroSuppression.Algorithms.CutToAvoidSignal = cms.double(2.0)
0219     process.siStripZeroSuppression.Algorithms.Iterations = cms.int32(3)
0220     process.siStripZeroSuppression.storeCM = cms.bool(True)
0221 
0222 
0223     ###
0224     ###  end of top level replacements
0225     ###
0226     ###############################################################################################
0227 
0228     return process
0229 
0230 ##############################################################################
0231 def customiseExpressHI(process):
0232     process= customiseCommonHI(process)
0233 
0234     import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi
0235     process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone()
0236     
0237     return process
0238 
0239 ##############################################################################
0240 def customisePromptHI(process):
0241     process= customiseCommonHI(process)
0242 
0243     import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi
0244     process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone()
0245     
0246     return process
0247 
0248 ##############################################################################