CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

electronTools::AddElectronUserIsolation Class Reference

Inherits FWCore::GuiBrowsers::ConfigToolBase::ConfigToolBase.

List of all members.

Public Member Functions

def __call__
def __init__
def getDefaultParameters
def toolCode

Private Attributes

 _comment
 _parameters

Static Private Attributes

tuple _defaultParameters = dicttypes.SortedKeysDict()
string _label = 'addElectronUserIsolation'

Detailed Description

add userIsolation to patElectron

Definition at line 3 of file electronTools.py.


Constructor & Destructor Documentation

def electronTools::AddElectronUserIsolation::__init__ (   self)

Definition at line 10 of file electronTools.py.

00011                       :
00012         ConfigToolBase.__init__(self)
00013         self.addParameter(self._defaultParameters,'isolationTypes',['All'],'List of predefined userIsolation types to be added; possible values are [\'Tracker\',\'Ecal\',\'Hcal\'] or just [\'All\']', allowedValues=['Tracker','Ecal','Hcal','All'])
00014         self._parameters=copy.deepcopy(self._defaultParameters)
00015         self._comment = ''


Member Function Documentation

def electronTools::AddElectronUserIsolation::__call__ (   self,
  process,
  isolationTypes = None 
)

Definition at line 19 of file electronTools.py.

00020                                                    :
00021         if  isolationTypes is None:
00022             isolationTypes=self._defaultParameters['isolationTypes'].value 
00023         self.setParameter('isolationTypes',isolationTypes)
00024         self.apply(process) 
        
def electronTools::AddElectronUserIsolation::getDefaultParameters (   self)

Definition at line 16 of file electronTools.py.

00017                                   :
00018         return self._defaultParameters

def electronTools::AddElectronUserIsolation::toolCode (   self,
  process 
)

Definition at line 25 of file electronTools.py.

00025                                :                
00026         isolationTypes=self._parameters['isolationTypes'].value
00027 
00028         # includes to fix fastsim problems
00029         from RecoEgamma.EgammaIsolationAlgos.eleIsoDeposits_cff import eleIsoDepositTk, eleIsoDepositEcalFromHits, eleIsoDepositHcalFromTowers
00030         from RecoEgamma.EgammaIsolationAlgos.eleIsoFromDeposits_cff import eleIsoFromDepsTk, eleIsoFromDepsEcalFromHitsByCrystal, eleIsoFromDepsHcalFromTowers
00031         
00032         eleIsoDepositEcalFromHits.ExtractorPSet.barrelEcalHits = cms.InputTag("reducedEcalRecHitsEB")
00033         eleIsoDepositEcalFromHits.ExtractorPSet.endcapEcalHits = cms.InputTag("reducedEcalRecHitsEE")
00034         
00035         # key to define the parameter sets
00036         isolationKey=0
00037         # add pre-requisits to the electron
00038         for obj in range(len(isolationTypes)):
00039             if ( isolationTypes[obj] == 'Tracker' or isolationTypes[obj] == 'All'):
00040                 print "adding predefined userIsolation to pat::Electron for Tracker"
00041                 print " -> to access this information call pat::Electron::userIsolation(pat::TrackIso) in your analysis code <-"
00042                 isolationKey=isolationKey+1
00043                 from PhysicsTools.PatAlgos.recoLayer0.electronIsolation_cff import patElectronTrackIsolation
00044                 process.patElectronTrackIsolation
00045                 process.patDefaultSequence.replace( process.patElectrons, process.patElectronTrackIsolation*process.patElectrons )
00046                 
00047             if ( isolationTypes[obj] == 'Ecal'    or isolationTypes[obj] == 'All'):
00048                 print "adding predefined userIsolation to pat::Electron for Ecal"
00049                 print " -> to access this information call pat::Electron::userIsolation(pat::EcalIso ) in your analysis code <-"
00050                 isolationKey=isolationKey+10
00051                 from PhysicsTools.PatAlgos.recoLayer0.electronIsolation_cff import patElectronEcalIsolation
00052                 process.patElectronEcalIsolation            
00053                 process.patDefaultSequence.replace( process.patElectrons, process.patElectronEcalIsolation*process.patElectrons )
00054                 
00055             if ( isolationTypes[obj] == 'Hcal'    or isolationTypes[obj] == 'All'):
00056                 print "adding predefined userIsolation to pat::Electron for Hcal"
00057                 print " -> to access this information call pat::Electron::userIsolation(pat::HcalIso ) in your analysis code <-"
00058                 isolationKey=isolationKey+100
00059                 from PhysicsTools.PatAlgos.recoLayer0.electronIsolation_cff import patElectronHcalIsolation            
00060                 process.patElectronHcalIsolation = patElectronHcalIsolation
00061                 process.patDefaultSequence.replace( process.patElectrons, process.patElectronHcalIsolation*process.patElectrons )  
00062                 
00063         # do the corresponding replacements in the pat electron
00064         if ( isolationKey ==   1 ):
00065             # tracker
00066             process.patElectrons.isoDeposits = cms.PSet(
00067                 tracker = cms.InputTag("eleIsoDepositTk"),
00068             )
00069             process.patElectrons.userIsolation = cms.PSet(
00070                 tracker = cms.PSet(
00071                 src = cms.InputTag("eleIsoFromDepsTk"),
00072                 ),
00073             )
00074         if ( isolationKey ==  10 ):
00075             # ecal
00076             process.patElectrons.isoDeposits = cms.PSet(
00077                 ecal    = cms.InputTag("eleIsoDepositEcalFromHits"),
00078             )
00079             process.patElectrons.userIsolation = cms.PSet(
00080                 ecal = cms.PSet(
00081                 src = cms.InputTag("eleIsoFromDepsEcalFromHitsByCrystal"),
00082                 ),
00083             )
00084         if ( isolationKey == 100 ):
00085             # hcal
00086             process.patElectrons.isoDeposits = cms.PSet(
00087                 hcal    = cms.InputTag("eleIsoDepositHcalFromTowers"),
00088             )
00089             process.patElectrons.userIsolation = cms.PSet(
00090                 hcal = cms.PSet(
00091                 src = cms.InputTag("eleIsoFromDepsHcalFromTowers"),
00092                 ),
00093             )
00094         if ( isolationKey ==  11 ):
00095             # ecal + tracker
00096             process.patElectrons.isoDeposits = cms.PSet(
00097                 tracker = cms.InputTag("eleIsoDepositTk"),
00098                 ecal    = cms.InputTag("eleIsoDepositEcalFromHits"),
00099             )
00100             process.patElectrons.userIsolation = cms.PSet(
00101                 tracker = cms.PSet(
00102                 src = cms.InputTag("eleIsoFromDepsTk"),
00103                 ),
00104                 ecal = cms.PSet(
00105                 src = cms.InputTag("eleIsoFromDepsEcalFromHitsByCrystal"),
00106                 ),
00107             )
00108         if ( isolationKey == 101 ):
00109             # hcal + tracker
00110             process.patElectrons.isoDeposits = cms.PSet(
00111                 tracker = cms.InputTag("eleIsoDepositTk"),
00112                 hcal    = cms.InputTag("eleIsoDepositHcalFromTowers"),
00113             )
00114             process.patElectrons.userIsolation = cms.PSet(
00115                 tracker = cms.PSet(
00116                 src = cms.InputTag("eleIsoFromDepsTk"),
00117                 ),
00118                 hcal = cms.PSet(
00119                 src = cms.InputTag("eleIsoFromDepsHcalFromTowers"),
00120                 ),
00121             )
00122         if ( isolationKey == 110 ):
00123             # hcal + ecal
00124             process.patElectrons.isoDeposits = cms.PSet(
00125                 ecal    = cms.InputTag("eleIsoDepositEcalFromHits"),
00126                 hcal    = cms.InputTag("eleIsoDepositHcalFromTowers"),
00127             )
00128             process.patElectrons.userIsolation = cms.PSet(
00129                 ecal = cms.PSet(
00130                 src = cms.InputTag("eleIsoFromDepsEcalFromHitsByCrystal"),
00131                 ),
00132                 hcal = cms.PSet(
00133                 src = cms.InputTag("eleIsoFromDepsHcalFromTowers"),
00134                 ),
00135             )
00136         if ( isolationKey == 111 ):
00137             # hcal + ecal + tracker 
00138             process.patElectrons.isoDeposits = cms.PSet(
00139                 tracker = cms.InputTag("eleIsoDepositTk"),
00140                 ecal    = cms.InputTag("eleIsoDepositEcalFromHits"),
00141                 hcal    = cms.InputTag("eleIsoDepositHcalFromTowers"),
00142             )
00143             process.patElectrons.userIsolation = cms.PSet(
00144                 tracker = cms.PSet(
00145                 src = cms.InputTag("eleIsoFromDepsTk"),
00146                 ),
00147                 ecal = cms.PSet(
00148                 src = cms.InputTag("eleIsoFromDepsEcalFromHitsByCrystal"),
00149                 ),
00150                 hcal = cms.PSet(
00151                 src = cms.InputTag("eleIsoFromDepsHcalFromTowers"),
00152                 ),
00153             )
00154 
00155 
00156 addElectronUserIsolation=AddElectronUserIsolation()
00157 

Member Data Documentation

Definition at line 10 of file electronTools.py.

tuple electronTools::AddElectronUserIsolation::_defaultParameters = dicttypes.SortedKeysDict() [static, private]

Definition at line 8 of file electronTools.py.

string electronTools::AddElectronUserIsolation::_label = 'addElectronUserIsolation' [static, private]

Definition at line 7 of file electronTools.py.

Definition at line 10 of file electronTools.py.