CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/PhysicsTools/PatAlgos/python/tools/heavyIonTools.py

Go to the documentation of this file.
00001 from FWCore.GuiBrowsers.ConfigToolBase import *
00002 from PhysicsTools.PatAlgos.tools.helpers import *
00003 
00004 
00005 class ConfigureHeavyIons(ConfigToolBase):
00006 
00007     """ Configure all defaults for heavy ions
00008     """
00009     _label='configureHeavyIons'
00010     _defaultParameters=dicttypes.SortedKeysDict()
00011     
00012     def __init__(self):
00013         ConfigToolBase.__init__(self)        
00014         self._parameters=copy.deepcopy(self._defaultParameters)
00015         self._comment = ""
00016 
00017     def getDefaultParameters(self):
00018         return self._defaultParameters
00019 
00020     def __call__(self,process):
00021                 
00022         self.apply(process) 
00023         
00024     def toolCode(self, process):        
00025         productionDefaults(process)
00026         selectionDefaults(process)
00027            
00028 configureHeavyIons=ConfigureHeavyIons()
00029 
00030 
00031 class ProductionDefaults(ConfigToolBase):
00032 
00033     """ Configure all relevant layer1 candidates for heavy ions
00034     """
00035     _label='productionDefaults'
00036     _defaultParameters=dicttypes.SortedKeysDict()
00037     
00038     def __init__(self):
00039         ConfigToolBase.__init__(self)        
00040         self._parameters=copy.deepcopy(self._defaultParameters)
00041         self._comment = ""
00042 
00043     def getDefaultParameters(self):
00044         return self._defaultParameters
00045     
00046     def __call__(self,process):
00047                 
00048         self.apply(process) 
00049         
00050     def toolCode(self, process):        
00051         ## adapt jet defaults
00052         patJets = getattr(process, jetCollectionString())
00053         patJets.jetSource  = cms.InputTag("iterativeConePu5CaloJets")
00054 
00055         jetCors  = getattr(process, 'patJetCorrFactors')
00056         jetCors.jetSource = cms.InputTag("iterativeConePu5CaloJets")
00057         jetCors.corrLevels = cms.PSet(L2Relative = cms.string("L2Relative_IC5Calo"),
00058                                       L3Absolute = cms.string("L3Absolute_IC5Calo"),
00059                                       L1Offset   = cms.string('none'),
00060                                       L4EMF      = cms.string('none'),
00061                                       L5Flavor   = cms.string('none'),
00062                                       L6UE       = cms.string('none'),
00063                                       L7Parton   = cms.string('none') 
00064                                       )
00065 
00066         partonMatch = getattr(process, 'patJetPartonMatch')
00067         partonMatch.src = cms.InputTag("iterativeConePu5CaloJets")
00068         partonMatch.matched = cms.InputTag("hiPartons")
00069 
00070         jetMatch = getattr(process, 'patJetGenJetMatch')
00071         jetMatch.src     = cms.InputTag("iterativeConePu5CaloJets")
00072         jetMatch.matched = cms.InputTag("heavyIonCleanedGenJets")
00073         
00074         patJets.addBTagInfo         = False
00075         patJets.addTagInfos         = False
00076         patJets.addDiscriminators   = False
00077         patJets.addAssociatedTracks = False
00078         patJets.addJetCharge        = False
00079         patJets.addJetID            = False
00080         patJets.getJetMCFlavour     = False
00081         patJets.addGenPartonMatch   = True
00082         patJets.addGenJetMatch      = True
00083         patJets.embedGenJetMatch    = True
00084         patJets.embedGenPartonMatch   = True
00085 
00086         ## adapt muon defaults
00087         muonMatch = getattr(process, 'muonMatch')
00088         muonMatch.matched = cms.InputTag("hiGenParticles")
00089         patMuons  = getattr(process, 'patMuons')
00090         patMuons.embedGenMatch = cms.bool(True)
00091         process.patMuons.embedCaloMETMuonCorrs = cms.bool(False)
00092         process.patMuons.embedTcMETMuonCorrs   = cms.bool(False)
00093         process.patMuons.embedPFCandidate   = cms.bool(False)
00094         process.patMuons.useParticleFlow    = cms.bool(False)
00095         process.patMuons.addEfficiencies    = cms.bool(False)
00096         process.patMuons.addResolutions     = cms.bool(False)
00097         process.patMuons.pvSrc = cms.InputTag("hiSelectedVertex")
00098         
00099         ## adapt photon defaults
00100         photonMatch = getattr(process, 'photonMatch')
00101         photonMatch.matched = cms.InputTag("hiGenParticles")
00102         patPhotons  = getattr(process, 'patPhotons')
00103         patPhotons.addPhotonID   = cms.bool(True)
00104         patPhotons.addGenMatch   = cms.bool(True)
00105         patPhotons.embedGenMatch = cms.bool(True)
00106         patPhotons.userData.userFloats.src  = cms.VInputTag(
00107             cms.InputTag( "isoCC1"),cms.InputTag( "isoCC2"),cms.InputTag( "isoCC3"),cms.InputTag( "isoCC4"),cms.InputTag("isoCC5"),
00108             cms.InputTag( "isoCR1"),cms.InputTag( "isoCR2"),cms.InputTag( "isoCR3"),cms.InputTag( "isoCR4"),cms.InputTag("isoCR5"),
00109             cms.InputTag( "isoT11"),cms.InputTag( "isoT12"),cms.InputTag( "isoT13"),cms.InputTag( "isoT14"),  
00110             cms.InputTag( "isoT21"),cms.InputTag( "isoT22"),cms.InputTag( "isoT23"),cms.InputTag( "isoT24"),  
00111             cms.InputTag( "isoT31"),cms.InputTag( "isoT32"),cms.InputTag( "isoT33"),cms.InputTag( "isoT34"),  
00112             cms.InputTag( "isoT41"),cms.InputTag( "isoT42"),cms.InputTag( "isoT43"),cms.InputTag( "isoT44"),  
00113             cms.InputTag("isoDR11"),cms.InputTag("isoDR12"),cms.InputTag("isoDR13"),cms.InputTag("isoDR14"),  
00114             cms.InputTag("isoDR21"),cms.InputTag("isoDR22"),cms.InputTag("isoDR23"),cms.InputTag("isoDR24"),  
00115             cms.InputTag("isoDR31"),cms.InputTag("isoDR32"),cms.InputTag("isoDR33"),cms.InputTag("isoDR34"),  
00116             cms.InputTag("isoDR41"),cms.InputTag("isoDR42"),cms.InputTag("isoDR43"),cms.InputTag("isoDR44")
00117             )
00118         patPhotons.photonIDSource = cms.InputTag("PhotonIDProd","PhotonCutBasedIDLoose")
00119         del patPhotons.photonIDSources
00120         
00121 productionDefaults=ProductionDefaults()
00122 
00123 
00124 class SelectionDefaults(ConfigToolBase):
00125 
00126     """ Configure all relevant selected layer1 candidates for heavy ions
00127     """
00128     _label='selectionDefaults'
00129     _defaultParameters=dicttypes.SortedKeysDict()
00130     
00131     def __init__(self):
00132         ConfigToolBase.__init__(self)        
00133         self._parameters=copy.deepcopy(self._defaultParameters)
00134         self._comment = ""
00135 
00136     def getDefaultParameters(self):
00137         return self._defaultParameters
00138 
00139     def __call__(self,process):
00140                 
00141         self.apply(process) 
00142         
00143     def toolCode(self, process):        
00144         selectedJets = getattr(process, jetCollectionString('selected'))
00145         selectedJets.cut = cms.string('pt > 20.')
00146         selectedMuons = getattr(process, 'selectedPatMuons')
00147         selectedMuons.cut = cms.string('pt > 0. & abs(eta) < 12.')
00148         selectedPhotons = getattr(process, 'selectedPatPhotons')
00149         selectedPhotons.cut = cms.string('pt > 0. & abs(eta) < 12.')
00150         
00151 selectionDefaults=SelectionDefaults()
00152 
00153 
00154 class DisbaleMonteCarloDeps(ConfigToolBase):
00155 
00156     """ Cut off all MC dependencies
00157     """
00158     _label='disableMonteCarloDeps'
00159     _defaultParameters=dicttypes.SortedKeysDict()
00160     
00161     def __init__(self):
00162         ConfigToolBase.__init__(self)        
00163         self._parameters=copy.deepcopy(self._defaultParameters)
00164         self._comment = ""
00165 
00166     def getDefaultParameters(self):
00167         return self._defaultParameters
00168 
00169     def __call__(self,process):
00170                 
00171         self.apply(process) 
00172         
00173     def toolCode(self, process):
00174         ## switch MC to false in heavyIon Producer
00175         process.heavyIon.doMC = False
00176         
00177         ## remove MC matching from heavyIonJets
00178         process.makeHeavyIonJets.remove(process.genPartons)
00179         process.makeHeavyIonJets.remove(process.heavyIonCleanedGenJets)
00180         process.makeHeavyIonJets.remove(process.hiPartons)
00181         process.makeHeavyIonJets.remove(process.patJetGenJetMatch)
00182         process.makeHeavyIonJets.remove(process.patJetPartonMatch)
00183         
00184         process.patJets.addGenPartonMatch   = False
00185         process.patJets.embedGenPartonMatch = False
00186         process.patJets.genPartonMatch      = ''
00187         process.patJets.addGenJetMatch      = False
00188         process.patJets.genJetMatch           = ''
00189         process.patJets.getJetMCFlavour     = False
00190         process.patJets.JetPartonMapSource  = ''
00191 
00192         ## remove MC matching from heavyIonMuons        
00193         process.makeHeavyIonMuons.remove(process.muonMatch)
00194         
00195         process.patMuons.addGenMatch        = False
00196         process.patMuons.embedGenMatch      = False
00197         
00198 disableMonteCarloDeps=DisbaleMonteCarloDeps()