Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:02

0001 from PhysicsTools.PatAlgos.tools.ConfigToolBase import *
0002 from PhysicsTools.PatAlgos.tools.helpers import *
0003 
0004 
0005 class ConfigureHeavyIons(ConfigToolBase):
0006 
0007     """ Configure all defaults for heavy ions
0008     """
0009     _label='configureHeavyIons'
0010     _defaultParameters=dicttypes.SortedKeysDict()
0011     
0012     def __init__(self):
0013         ConfigToolBase.__init__(self)        
0014         self._parameters=copy.deepcopy(self._defaultParameters)
0015         self._comment = ""
0016 
0017     def getDefaultParameters(self):
0018         return self._defaultParameters
0019 
0020     def __call__(self,process):
0021                 
0022         self.apply(process) 
0023         
0024     def toolCode(self, process):        
0025         productionDefaults(process)
0026         selectionDefaults(process)
0027            
0028 configureHeavyIons=ConfigureHeavyIons()
0029 
0030 
0031 class ProductionDefaults(ConfigToolBase):
0032 
0033     """ Configure all relevant layer1 candidates for heavy ions
0034     """
0035     _label='productionDefaults'
0036     _defaultParameters=dicttypes.SortedKeysDict()
0037     
0038     def __init__(self):
0039         ConfigToolBase.__init__(self)        
0040         self._parameters=copy.deepcopy(self._defaultParameters)
0041         self._comment = ""
0042 
0043     def getDefaultParameters(self):
0044         return self._defaultParameters
0045     
0046     def __call__(self,process):
0047                 
0048         self.apply(process) 
0049         
0050     def toolCode(self, process):        
0051         ## adapt jet defaults
0052         patJets = getattr(process, jetCollectionString())
0053         patJets.jetSource  = cms.InputTag("iterativeConePu5CaloJets")
0054 
0055         jetCors  = getattr(process, 'patJetCorrFactors')
0056         jetCors.jetSource = cms.InputTag("iterativeConePu5CaloJets")
0057         jetCors.corrLevels = cms.PSet(L2Relative = cms.string("L2Relative_IC5Calo"),
0058                                       L3Absolute = cms.string("L3Absolute_IC5Calo"),
0059                                       L1Offset   = cms.string('none'),
0060                                       L4EMF      = cms.string('none'),
0061                                       L5Flavor   = cms.string('none'),
0062                                       L6UE       = cms.string('none'),
0063                                       L7Parton   = cms.string('none') 
0064                                       )
0065 
0066         partonMatch = getattr(process, 'patJetPartonMatch')
0067         partonMatch.src = cms.InputTag("iterativeConePu5CaloJets")
0068         partonMatch.matched = cms.InputTag("hiPartons")
0069 
0070         jetMatch = getattr(process, 'patJetGenJetMatch')
0071         jetMatch.src     = cms.InputTag("iterativeConePu5CaloJets")
0072         jetMatch.matched = cms.InputTag("heavyIonCleanedGenJets")
0073         
0074         patJets.addBTagInfo         = False
0075         patJets.addTagInfos         = False
0076         patJets.addDiscriminators   = False
0077         patJets.addAssociatedTracks = False
0078         patJets.addJetCharge        = False
0079         patJets.addJetID            = False
0080         patJets.getJetMCFlavour     = False
0081         patJets.addGenPartonMatch   = True
0082         patJets.addGenJetMatch      = True
0083         patJets.embedGenJetMatch    = True
0084         patJets.embedGenPartonMatch   = True
0085 
0086         ## adapt muon defaults
0087         muonMatch = getattr(process, 'muonMatch')
0088         muonMatch.matched = cms.InputTag("hiGenParticles")
0089         patMuons  = getattr(process, 'patMuons')
0090         patMuons.embedGenMatch = cms.bool(True)
0091         process.patMuons.embedCaloMETMuonCorrs = cms.bool(False)
0092         process.patMuons.embedTcMETMuonCorrs   = cms.bool(False)
0093         process.patMuons.embedPFCandidate   = cms.bool(False)
0094         process.patMuons.useParticleFlow    = cms.bool(False)
0095         process.patMuons.addEfficiencies    = cms.bool(False)
0096         process.patMuons.addResolutions     = cms.bool(False)
0097         process.patMuons.pvSrc = cms.InputTag("hiSelectedVertex")
0098         
0099         ## adapt photon defaults
0100         photonMatch = getattr(process, 'photonMatch')
0101         photonMatch.matched = cms.InputTag("hiGenParticles")
0102         patPhotons  = getattr(process, 'patPhotons')
0103         patPhotons.addPhotonID   = cms.bool(True)
0104         patPhotons.addGenMatch   = cms.bool(True)
0105         patPhotons.embedGenMatch = cms.bool(True)
0106         patPhotons.userData.userFloats.src  = cms.VInputTag(
0107             cms.InputTag( "isoCC1"),cms.InputTag( "isoCC2"),cms.InputTag( "isoCC3"),cms.InputTag( "isoCC4"),cms.InputTag("isoCC5"),
0108             cms.InputTag( "isoCR1"),cms.InputTag( "isoCR2"),cms.InputTag( "isoCR3"),cms.InputTag( "isoCR4"),cms.InputTag("isoCR5"),
0109             cms.InputTag( "isoT11"),cms.InputTag( "isoT12"),cms.InputTag( "isoT13"),cms.InputTag( "isoT14"),  
0110             cms.InputTag( "isoT21"),cms.InputTag( "isoT22"),cms.InputTag( "isoT23"),cms.InputTag( "isoT24"),  
0111             cms.InputTag( "isoT31"),cms.InputTag( "isoT32"),cms.InputTag( "isoT33"),cms.InputTag( "isoT34"),  
0112             cms.InputTag( "isoT41"),cms.InputTag( "isoT42"),cms.InputTag( "isoT43"),cms.InputTag( "isoT44"),  
0113             cms.InputTag("isoDR11"),cms.InputTag("isoDR12"),cms.InputTag("isoDR13"),cms.InputTag("isoDR14"),  
0114             cms.InputTag("isoDR21"),cms.InputTag("isoDR22"),cms.InputTag("isoDR23"),cms.InputTag("isoDR24"),  
0115             cms.InputTag("isoDR31"),cms.InputTag("isoDR32"),cms.InputTag("isoDR33"),cms.InputTag("isoDR34"),  
0116             cms.InputTag("isoDR41"),cms.InputTag("isoDR42"),cms.InputTag("isoDR43"),cms.InputTag("isoDR44")
0117             )
0118         patPhotons.photonIDSource = cms.InputTag("PhotonIDProd","PhotonCutBasedIDLoose")
0119         del patPhotons.photonIDSources
0120         
0121 productionDefaults=ProductionDefaults()
0122 
0123 
0124 class SelectionDefaults(ConfigToolBase):
0125 
0126     """ Configure all relevant selected layer1 candidates for heavy ions
0127     """
0128     _label='selectionDefaults'
0129     _defaultParameters=dicttypes.SortedKeysDict()
0130     
0131     def __init__(self):
0132         ConfigToolBase.__init__(self)        
0133         self._parameters=copy.deepcopy(self._defaultParameters)
0134         self._comment = ""
0135 
0136     def getDefaultParameters(self):
0137         return self._defaultParameters
0138 
0139     def __call__(self,process):
0140                 
0141         self.apply(process) 
0142         
0143     def toolCode(self, process):        
0144         selectedJets = getattr(process, jetCollectionString('selected'))
0145         selectedJets.cut = cms.string('pt > 20.')
0146         selectedMuons = getattr(process, 'selectedPatMuons')
0147         selectedMuons.cut = cms.string('pt > 0. & abs(eta) < 12.')
0148         selectedPhotons = getattr(process, 'selectedPatPhotons')
0149         selectedPhotons.cut = cms.string('pt > 0. & abs(eta) < 12.')
0150         
0151 selectionDefaults=SelectionDefaults()
0152 
0153 
0154 class DisbaleMonteCarloDeps(ConfigToolBase):
0155 
0156     """ Cut off all MC dependencies
0157     """
0158     _label='disableMonteCarloDeps'
0159     _defaultParameters=dicttypes.SortedKeysDict()
0160     
0161     def __init__(self):
0162         ConfigToolBase.__init__(self)        
0163         self._parameters=copy.deepcopy(self._defaultParameters)
0164         self._comment = ""
0165 
0166     def getDefaultParameters(self):
0167         return self._defaultParameters
0168 
0169     def __call__(self,process):
0170                 
0171         self.apply(process) 
0172         
0173     def toolCode(self, process):
0174         ## switch MC to false in heavyIon Producer
0175         process.heavyIon.doMC = False
0176         
0177         ## remove MC matching from heavyIonJets
0178         process.makeHeavyIonJets.remove(process.genPartons)
0179         process.makeHeavyIonJets.remove(process.heavyIonCleanedGenJets)
0180         process.makeHeavyIonJets.remove(process.hiPartons)
0181         process.makeHeavyIonJets.remove(process.patJetGenJetMatch)
0182         process.makeHeavyIonJets.remove(process.patJetPartonMatch)
0183         
0184         process.patJets.addGenPartonMatch   = False
0185         process.patJets.embedGenPartonMatch = False
0186         process.patJets.genPartonMatch      = ''
0187         process.patJets.addGenJetMatch      = False
0188         process.patJets.genJetMatch       = ''
0189         process.patJets.getJetMCFlavour     = False
0190         process.patJets.JetPartonMapSource  = ''
0191 
0192         ## remove MC matching from heavyIonMuons        
0193         process.makeHeavyIonMuons.remove(process.muonMatch)
0194         
0195         process.patMuons.addGenMatch        = False
0196         process.patMuons.embedGenMatch      = False
0197         
0198 disableMonteCarloDeps=DisbaleMonteCarloDeps()