Functions | |
def | adaptTauDiscriminator |
def | adaptTauDiscriminatorSequence |
def | recoTauTypeMapper |
def | setTauSource |
def | subParameterSets |
Variables | |
tuple | leadTrackFinding |
tuple | noPrediscriminants |
producerIsTauTypeMapper = lambdatauProducer:tauProducer | |
tuple | recoTauTypeMapperRegex = re.compile("(\w*)Producer") |
tuple | requireLeadPion |
tuple | requireLeadTrack |
tuple | requireLeadTrackCalo |
def TauDiscriminatorTools::adaptTauDiscriminator | ( | discriminator, | |
newTauProducer = 'shrinkingConePFTauProducer' , |
|||
oldTauTypeMapper = recoTauTypeMapper , |
|||
newTauTypeMapper = recoTauTypeMapper , |
|||
preservePFTauProducer = False |
|||
) |
Change a TauDiscriminator to use a different tau/prediscriminant sources Tau discriminators use the following convention: [tauType]DiscriminationByXXX i.e. fixedConePFTauDiscriminationByIsolation, allLayer1TausDiscriminationByIsolation, etc However, the mapping of tauType to tau producer name is not constant. In RECO, the form is [tauType]Producer. In PAT, the producer is just named [tauType]. To manage this oldTauTypeMapper and newTauTypeMapper are functions with signature f(str) that translate a TauProducer name (like shrinkingConePFTauProducer) to its type (shrinkingConePFTau). Two types of mapping are provided, * recoTauTypeMapper shrinkingConePFTauProducer->shrinkingConePFTau * producerIsTauTypeMapper allLayer1Taus->allLayer1Taus
Definition at line 51 of file TauDiscriminatorTools.py.
00054 : 00055 ''' Change a TauDiscriminator to use a different tau/prediscriminant sources 00056 00057 Tau discriminators use the following convention: 00058 [tauType]DiscriminationByXXX 00059 00060 i.e. fixedConePFTauDiscriminationByIsolation, 00061 allLayer1TausDiscriminationByIsolation, etc 00062 00063 However, the mapping of tauType to tau producer name is not constant. In 00064 RECO, the form is [tauType]Producer. In PAT, the producer is just named 00065 [tauType]. To manage this oldTauTypeMapper and newTauTypeMapper are 00066 functions with signature f(str) that translate a TauProducer name (like 00067 shrinkingConePFTauProducer) to its type (shrinkingConePFTau). Two types of 00068 mapping are provided, 00069 * recoTauTypeMapper 00070 shrinkingConePFTauProducer->shrinkingConePFTau 00071 * producerIsTauTypeMapper 00072 allLayer1Taus->allLayer1Taus 00073 00074 ''' 00075 00076 oldTauProducer = discriminator.PFTauProducer 00077 if isinstance(newTauProducer, str): 00078 newTauProducer = cms.InputTag(newTauProducer) 00079 00080 # This is useful for the PF2PAT case where you wish to set the producer name 00081 # seperately 00082 if not preservePFTauProducer: 00083 discriminator.PFTauProducer = newTauProducer 00084 00085 oldTauType = oldTauTypeMapper(oldTauProducer.value()) 00086 newTauType = newTauTypeMapper(newTauProducer.value()) 00087 00088 replacementRegex = re.compile(oldTauType) 00089 00090 # Adapt all the prediscriminants 00091 for prediscriminant in subParameterSets(discriminator.Prediscriminants): 00092 oldProducer = prediscriminant.Producer.value() 00093 # Replace the old tau type by the new tau type in the prediscrimant 00094 # producer 00095 prediscriminant.Producer = cms.InputTag(replacementRegex.sub(newTauType, 00096 oldProducer))
def TauDiscriminatorTools::adaptTauDiscriminatorSequence | ( | sequence, | |
kwargs | |||
) |
Definition at line 97 of file TauDiscriminatorTools.py.
def TauDiscriminatorTools::recoTauTypeMapper | ( | tauProducer | ) |
Definition at line 45 of file TauDiscriminatorTools.py.
def TauDiscriminatorTools::setTauSource | ( | discriminator, | |
newTauProducer | |||
) |
Same as adaptTauDiscriminator, kept for backwards compatibility
Definition at line 103 of file TauDiscriminatorTools.py.
def TauDiscriminatorTools::subParameterSets | ( | pSet | ) |
Generator to return all sub-PSets in a PSet
Definition at line 36 of file TauDiscriminatorTools.py.
00001 cms.PSet( 00002 Producer = cms.InputTag('pfRecoTauDiscriminationByLeadingTrackFinding'), 00003 cut = cms.double(0.5) 00004 )
Definition at line 4 of file TauDiscriminatorTools.py.
00001 cms.PSet( 00002 BooleanOperator = cms.string("and"), 00003 )
Definition at line 10 of file TauDiscriminatorTools.py.
TauDiscriminatorTools::producerIsTauTypeMapper = lambdatauProducer:tauProducer |
Definition at line 49 of file TauDiscriminatorTools.py.
tuple TauDiscriminatorTools::recoTauTypeMapperRegex = re.compile("(\w*)Producer") |
Definition at line 44 of file TauDiscriminatorTools.py.
00001 cms.PSet( 00002 BooleanOperator = cms.string("and"), 00003 leadPion = leadTrackFinding, 00004 )
Definition at line 31 of file TauDiscriminatorTools.py.
00001 cms.PSet( 00002 BooleanOperator = cms.string("and"), 00003 leadTrack = leadTrackFinding, 00004 )
Definition at line 15 of file TauDiscriminatorTools.py.
00001 cms.PSet( 00002 BooleanOperator = cms.string("and"), 00003 leadTrack = cms.PSet( 00004 Producer = cms.InputTag('caloRecoTauDiscriminationByLeadingTrackFinding'), 00005 cut = cms.double(0.5) 00006 ) 00007 )
Definition at line 21 of file TauDiscriminatorTools.py.