CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

photonTools::AddPhotonUserIsolation 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 = 'addPhotonUserIsolation'

Detailed Description

add userIsolation to patPhoton

Definition at line 3 of file photonTools.py.


Constructor & Destructor Documentation

def photonTools::AddPhotonUserIsolation::__init__ (   self)

Definition at line 10 of file photonTools.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 photonTools::AddPhotonUserIsolation::__call__ (   self,
  process,
  isolationTypes = None 
)

Definition at line 19 of file photonTools.py.

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

Definition at line 16 of file photonTools.py.

00017                                   :
00018         return self._defaultParameters

def photonTools::AddPhotonUserIsolation::toolCode (   self,
  process 
)

Definition at line 25 of file photonTools.py.

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

Member Data Documentation

Definition at line 10 of file photonTools.py.

tuple photonTools::AddPhotonUserIsolation::_defaultParameters = dicttypes.SortedKeysDict() [static, private]

Definition at line 8 of file photonTools.py.

string photonTools::AddPhotonUserIsolation::_label = 'addPhotonUserIsolation' [static, private]

Definition at line 7 of file photonTools.py.

Definition at line 10 of file photonTools.py.