Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop type spec in CommonTools #32464

Merged
merged 2 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions CommonTools/ParticleFlow/python/EITopPAG_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
#### condenses information into the new "particleFlow" collection. ####


pfPileUpEI = pfPileUp.clone( PFCandidates = cms.InputTag('particleFlowPtrs') )
pfNoPileUpEI = pfNoPileUp.clone( bottomCollection = cms.InputTag('particleFlowPtrs'),
topCollection = cms.InputTag('pfPileUpEI') )
pfPileUpEI = pfPileUp.clone( PFCandidates = 'particleFlowPtrs' )
pfNoPileUpEI = pfNoPileUp.clone( bottomCollection = 'particleFlowPtrs',
topCollection = 'pfPileUpEI' )

pfPileUpJMEEI = pfPileUpJME.clone( PFCandidates = cms.InputTag('particleFlowPtrs') )
pfNoPileUpJMEEI = pfNoPileUpJME.clone( bottomCollection = cms.InputTag('particleFlowPtrs'),
topCollection = cms.InputTag('pfPileUpJMEEI') )
pfPileUpJMEEI = pfPileUpJME.clone( PFCandidates = 'particleFlowPtrs' )
pfNoPileUpJMEEI = pfNoPileUpJME.clone( bottomCollection = 'particleFlowPtrs',
topCollection = 'pfPileUpJMEEI' )


#### Muons ####
Expand All @@ -47,7 +47,7 @@
makeClones = cms.bool(True)
)

pfMuonsFromVertexEI = pfMuonsFromVertex.clone( src = cms.InputTag('pfAllMuonsEI') )
pfMuonsFromVertexEI = pfMuonsFromVertex.clone( src = 'pfAllMuonsEI' )

pfIsolatedMuonsEI = cms.EDFilter(
"PFCandidateFwdPtrCollectionStringFilter",
Expand Down Expand Up @@ -83,7 +83,7 @@
makeClones = cms.bool(True)
)

pfElectronsFromVertexEI = pfElectronsFromVertex.clone( src = cms.InputTag('pfAllElectronsEI') )
pfElectronsFromVertexEI = pfElectronsFromVertex.clone( src = 'pfAllElectronsEI' )

pfIsolatedElectronsEI = cms.EDFilter(
"PFCandidateFwdPtrCollectionStringFilter",
Expand All @@ -110,22 +110,22 @@
#### Jets ####

pfJetsEI = pfJets.clone()
pfJetsPtrsEI = pfJetsPtrs.clone(src=cms.InputTag("pfJetsEI"))
pfJetsPtrsEI = pfJetsPtrs.clone( src = "pfJetsEI" )

pfJetSequenceEI = cms.Sequence( pfJetsEI+ pfJetsPtrsEI )

pfNoJetEI = pfNoJet.clone(
topCollection = 'pfJetsPtrsEI',
bottomCollection = 'pfNoElectronJME'
)
)

#### Taus ####
pfTausEI = pfTaus.clone()
pfTausPtrsEI = pfTausPtrs.clone(src=cms.InputTag("pfTausEI") )
pfTausPtrsEI = pfTausPtrs.clone( src = "pfTausEI" )
pfNoTauEI = pfNoTau.clone(
topCollection = cms.InputTag('pfTausPtrsEI'),
bottomCollection = cms.InputTag('pfJetsPtrsEI')
)
topCollection = 'pfTausPtrsEI',
bottomCollection = 'pfJetsPtrsEI'
)

pfTauEISequence = cms.Sequence(
pfTausPreSequence+
Expand All @@ -136,20 +136,20 @@

#### B-tagging ####
pfImpactParameterTagInfosEI = pfImpactParameterTagInfos.clone(
jets = cms.InputTag( 'pfJetsEI' )
)
jets = 'pfJetsEI'
)
pfInclusiveSecondaryVertexFinderTagInfosEI = pfInclusiveSecondaryVertexFinderTagInfos.clone(
trackIPTagInfos = cms.InputTag( 'pfImpactParameterTagInfosEI' )
)
trackIPTagInfos = 'pfImpactParameterTagInfosEI'
)
pfCombinedInclusiveSecondaryVertexV2BJetTagsEI = pfCombinedInclusiveSecondaryVertexV2BJetTags.clone(
tagInfos = cms.VInputTag(cms.InputTag("pfImpactParameterTagInfosEI"),
cms.InputTag("pfInclusiveSecondaryVertexFinderTagInfosEI"))
)
tagInfos = ["pfImpactParameterTagInfosEI",
"pfInclusiveSecondaryVertexFinderTagInfosEI"]
)



#### MET ####
pfMetEI = pfMET.clone(srcJets=cms.InputTag("pfJetsEI"))
pfMetEI = pfMET.clone(srcJets="pfJetsEI")

#EITopPAG = cms.Sequence(
EIsequence = cms.Sequence(
Expand Down
16 changes: 9 additions & 7 deletions CommonTools/ParticleFlow/python/PFBRECO_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@
pfSelectedPhotonsPFBRECO = pfSelectedPhotons.clone( src = 'pfAllPhotonsPFBRECO' )
from CommonTools.ParticleFlow.Isolation.pfPhotonIsolationPFBRECO_cff import *
from CommonTools.ParticleFlow.Isolation.pfIsolatedPhotons_cfi import *
pfIsolatedPhotonsPFBRECO = pfIsolatedPhotons.clone( src = 'pfSelectedPhotonsPFBRECO',
isolationValueMapsCharged = cms.VInputTag( cms.InputTag("phPFIsoValueCharged04PFIdPFBRECO") ),
isolationValueMapsNeutral = cms.VInputTag( cms.InputTag("phPFIsoValueNeutral04PFIdPFBRECO"),
cms.InputTag("phPFIsoValueGamma04PFIdPFBRECO") ),
deltaBetaIsolationValueMap = 'phPFIsoValuePU04PFIdPFBRECO' )
pfIsolatedPhotonsPFBRECO = pfIsolatedPhotons.clone(
src = 'pfSelectedPhotonsPFBRECO',
isolationValueMapsCharged = ["phPFIsoValueCharged04PFIdPFBRECO"],
isolationValueMapsNeutral = ["phPFIsoValueNeutral04PFIdPFBRECO",
"phPFIsoValueGamma04PFIdPFBRECO"],
deltaBetaIsolationValueMap = 'phPFIsoValuePU04PFIdPFBRECO'
)
pfPhotonPFBRECOSequence = cms.Sequence(
pfSelectedPhotonsPFBRECO +
pfPhotonIsolationPFBRECOSequence +
Expand All @@ -91,7 +93,7 @@
pfMuonsFromVertexPFBRECO = pfMuonsFromVertex.clone( src = 'pfAllMuonsPFBRECO' )
from CommonTools.ParticleFlow.Isolation.pfIsolatedMuons_cfi import *
pfIsolatedMuonsPFBRECO = pfIsolatedMuons.clone( src = 'pfMuonsFromVertexPFBRECO' )
pfMuonsPFBRECO = pfIsolatedMuonsPFBRECO.clone(cut = cms.string("pt > 5 & muonRef.isAvailable()"))
pfMuonsPFBRECO = pfIsolatedMuonsPFBRECO.clone(cut = "pt > 5 & muonRef.isAvailable()")
pfMuonPFBRECOSequence = cms.Sequence(
pfAllMuonsPFBRECO +
pfMuonsFromVertexPFBRECO +
Expand All @@ -103,7 +105,7 @@
pfElectronsFromVertexPFBRECO = pfElectronsFromVertex.clone( src = 'pfAllElectronsPFBRECO' )
from CommonTools.ParticleFlow.Isolation.pfIsolatedElectrons_cfi import *
pfIsolatedElectronsPFBRECO = pfIsolatedElectrons.clone( src = 'pfElectronsFromVertexPFBRECO' )
pfElectronsPFBRECO = pfIsolatedElectronsPFBRECO.clone( cut = cms.string(" pt > 5 & gsfElectronRef.isAvailable() & gsfTrackRef.hitPattern().numberOfLostHits('MISSING_INNER_HITS')<2"))
pfElectronsPFBRECO = pfIsolatedElectronsPFBRECO.clone( cut = " pt > 5 & gsfElectronRef.isAvailable() & gsfTrackRef.hitPattern().numberOfLostHits('MISSING_INNER_HITS')<2")
pfElectronPFBRECOSequence = cms.Sequence(
pfAllElectronsPFBRECO +
pfElectronsFromVertexPFBRECO +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
from PhysicsTools.SelectorUtils.pvSelector_cfi import pvSelector

goodOnlinePrimaryVertices = cms.EDFilter("PrimaryVertexObjectFilter",
filterParams = pvSelector.clone( minNdof = cms.double(4.0), maxZ = cms.double(24.0) ),
src=cms.InputTag('offlinePrimaryVertices')
filterParams = pvSelector.clone( minNdof = 4.0, maxZ = 24.0 ),
src = cms.InputTag('offlinePrimaryVertices')
)
2 changes: 1 addition & 1 deletion CommonTools/ParticleFlow/python/pfElectrons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from CommonTools.ParticleFlow.Isolation.pfIsolatedElectrons_cfi import *


pfElectrons = pfIsolatedElectrons.clone( cut = cms.string(" pt > 5 & gsfElectronRef.isAvailable() & gsfTrackRef.hitPattern().numberOfLostHits('MISSING_INNER_HITS')<2"))
pfElectrons = pfIsolatedElectrons.clone( cut = " pt > 5 & gsfElectronRef.isAvailable() & gsfTrackRef.hitPattern().numberOfLostHits('MISSING_INNER_HITS')<2")

pfElectronSequence = cms.Sequence(
pfAllElectrons +
Expand Down
15 changes: 8 additions & 7 deletions CommonTools/ParticleFlow/python/pfMET_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from RecoMET.METProducers.pfMet_cfi import *

# Should the name be changed se it is similar to pfMet from reco ??
pfMET = pfMet.clone(alias="pfMET")

# Use PF2PAT cleaned jet collection (pfJets) for MET significance
# instead of standard collection (ak4PFJets)?
# It requires that MET is produced at the end.
pfMET.srcJets = cms.InputTag("pfJets")

pfMET = pfMet.clone(
alias = "pfMET",

# Use PF2PAT cleaned jet collection (pfJets) for MET significance
# instead of standard collection (ak4PFJets)?
# It requires that MET is produced at the end.
srcJets = "pfJets"
)
# print 'PF2PAT: Jet collection used for pfMET significance: ', pfMET.jets
2 changes: 1 addition & 1 deletion CommonTools/ParticleFlow/python/pfMuons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from CommonTools.ParticleFlow.Isolation.pfIsolatedMuons_cfi import *


pfMuons = pfIsolatedMuons.clone(cut = cms.string("pt > 5 & muonRef.isAvailable()"))
pfMuons = pfIsolatedMuons.clone(cut = "pt > 5 & muonRef.isAvailable()")


pfMuonSequence = cms.Sequence(
Expand Down
133 changes: 66 additions & 67 deletions CommonTools/ParticleFlow/python/pfTaus_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,75 +28,72 @@

# PiZeroProducers

pfJetsLegacyHPSPiZeros = ak4PFJetsLegacyHPSPiZeros.clone()
pfJetsLegacyHPSPiZeros.jetSrc = cms.InputTag("ak4PFJets")

pfJetsLegacyHPSPiZeros = ak4PFJetsLegacyHPSPiZeros.clone(
jetSrc = "ak4PFJets"
)
pfTauPFJetsRecoTauChargedHadrons = ak4PFJetsRecoTauChargedHadrons.clone()

pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
pfTauTagInfoProducer.PFCandidateProducer = jetConfig.ak4PFJets.src
pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'

pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone(
PFCandidateProducer = jetConfig.ak4PFJets.src ,
PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
)
# Clone tau producer
pfTausProducer = hpsPFTauProducer.clone()
pfTausProducer = hpsPFTauProducer.clone(
src = "pfTausProducerSansRefs"
)
pfTausCombiner = combinatoricRecoTaus.clone(
jetSrc = "ak4PFJets",
piZeroSrc = "pfJetsLegacyHPSPiZeros",
jetSrc = "ak4PFJets",
piZeroSrc = "pfJetsLegacyHPSPiZeros",
chargedHadronSrc = "pfTauPFJetsRecoTauChargedHadrons"
)
for mod in pfTausCombiner.modifiers:
if mod.name == "TTIworkaround": mod.pfTauTagInfoSrc = "pfTauTagInfoProducer"

pfTausSelectionDiscriminator = hpsSelectionDiscriminator.clone()
pfTausSelectionDiscriminator.PFTauProducer = cms.InputTag("pfTausCombiner")
pfTausProducerSansRefs = hpsPFTauProducerSansRefs.clone()
pfTausProducerSansRefs = cms.EDProducer(
"RecoTauCleaner",
src = cms.InputTag("pfTausCombiner"),
outputSelection = cms.string(""),
verbosity = cms.int32(0),
cleaners = cms.VPSet(
cleaners.unitCharge,
cms.PSet(
name = cms.string("leadStripPtLt2_5"),
plugin = cms.string("RecoTauStringCleanerPlugin"),
tolerance = cleaners.tolerance_default,
selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
selectionPassFunction = cms.string("0"),
selectionFailValue = cms.double(1e3)
),
cms.PSet(
name = cms.string("HPS_Select"),
plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
tolerance = cleaners.tolerance_default,
src = cms.InputTag("pfTausSelectionDiscriminator"),
),
cleaners.combinedIsolation
)
pfTausSelectionDiscriminator = hpsSelectionDiscriminator.clone(
PFTauProducer = "pfTausCombiner"
)
pfTausProducerSansRefs = hpsPFTauProducerSansRefs.clone(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate of the explicit configuration three lines below (a duplicate that was already present in the original config).
The two configurations look different, the explicit one being probably the correct one: which is the one picked up by python?
@mbluj @swozniewski please check and suggest which one of the two instances of pfTausProducerSansRefs to remove (or suggest otherwise, in case I misunderstood the usage of this duplication)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our understanding python takes most recent definition of an object, so here it is the explicit one.
The explicit definition indeed differs a bit from the first one which is a clone of Tau POG default (modulo different input). We guess that it was an intended choice to define it differently, so we suggest to keep only the explicit one. However, maybe owners of this configuration should bless the choice if it is possible to identify them (*)?

Technical suggestion: it could be nicer to have a clone definition with settings as the present in the explicit one? It can either use default Tau POG configuration to clone or one from default cfi (RecoTauTag.RecoTau.recoTauCleaner_cfi) It will look more or less like this:

pfTausProducerSansRefs = hpsPFTauProducerSansRefs.clone(
    src = "pfTausCombiner",
    outputSelection = "",
    verbosity = 0,
    cleaners = [
        cleaners.unitCharge,
        cms.PSet(
            name = cms.string("leadStripPtLt2_5"),
            plugin = cms.string("RecoTauStringCleanerPlugin"),
            tolerance = cleaners.tolerance_default,
            selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
            selectionPassFunction = cms.string("0"),
            selectionFailValue = cms.double(1e3)
        ),
        cms.PSet(
            name = cms.string("HPS_Select"),
            plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
            tolerance = cleaners.tolerance_default,
            src = cms.InputTag("pfTausSelectionDiscriminator"),
        ),
        cleaners.combinedIsolation
    ]
)

(*) Is this config a part of PF2PAT? So, it is owned by PFlow or XPOG?

src = "pfTausCombiner",
outputSelection = "",
verbosity = 0,
cleaners = [
cleaners.unitCharge,
cms.PSet(
name = cms.string("leadStripPtLt2_5"),
plugin = cms.string("RecoTauStringCleanerPlugin"),
tolerance = cleaners.tolerance_default,
selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
selectionPassFunction = cms.string("0"),
selectionFailValue = cms.double(1e3)
),
cms.PSet(
name = cms.string("HPS_Select"),
plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
tolerance = cleaners.tolerance_default,
src = cms.InputTag("pfTausSelectionDiscriminator"),
),
cleaners.combinedIsolation
]
)



pfTausProducerSansRefs.src=cms.InputTag("pfTausCombiner")
pfTausProducer.src = cms.InputTag("pfTausProducerSansRefs")

#cloning discriminants

pfTausDiscriminationByDecayModeFinding = hpsPFTauDiscriminationByDecayModeFinding.clone()
pfTausDiscriminationByDecayModeFinding.PFTauProducer="pfTausProducer"

pfTausDiscriminationByIsolation= hpsPFTauBasicDiscriminators.clone()
pfTausDiscriminationByIsolation.PFTauProducer="pfTausProducer"
pfTausDiscriminationByDecayModeFinding = hpsPFTauDiscriminationByDecayModeFinding.clone(
PFTauProducer = "pfTausProducer"
)

pfTausrequireDecayMode = cms.PSet(
BooleanOperator = cms.string("and"),
decayMode = cms.PSet(
Producer = cms.InputTag('pfTausDiscriminationByDecayModeFinding'),
cut = cms.double(0.5)
Producer = cms.InputTag('pfTausDiscriminationByDecayModeFinding'),
cut = cms.double(0.5)
)
)

pfTausDiscriminationByIsolation.Prediscriminants=pfTausrequireDecayMode.clone()
pfTausDiscriminationByIsolation= hpsPFTauBasicDiscriminators.clone(
PFTauProducer = "pfTausProducer",
Prediscriminants = pfTausrequireDecayMode.clone()
)

# Sequence to reproduce taus and compute our cloned discriminants
pfTausBaseSequence = cms.Sequence(
Expand All @@ -108,11 +105,12 @@
pfTausProducer +
pfTausDiscriminationByDecayModeFinding *
pfTausDiscriminationByIsolation
)
)

# Associate track to pfJets
pfJetTracksAssociatorAtVertex = ak4PFJetTracksAssociatorAtVertex.clone()
pfJetTracksAssociatorAtVertex.jets= cms.InputTag("ak4PFJets")
pfJetTracksAssociatorAtVertex = ak4PFJetTracksAssociatorAtVertex.clone(
jets = "ak4PFJets"
)

pfTauPileUpVertices = cms.EDFilter(
"RecoTauPileUpVertexSelector",
Expand All @@ -122,10 +120,10 @@
)


pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
pfTauTagInfoProducer.PFCandidateProducer = jetConfig.ak4PFJets.src
pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'

pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone(
PFCandidateProducer = jetConfig.ak4PFJets.src ,
PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
)
pfTausPreSequence = cms.Sequence(
pfJetTracksAssociatorAtVertex +
recoTauAK4PFJets08Region +
Expand All @@ -134,21 +132,22 @@
)

# Select taus from given collection that pass cloned discriminants
pfTaus = pfTauSelector.clone()
pfTaus.src = cms.InputTag("pfTausProducer")
pfTaus.discriminators = cms.VPSet(
cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByDecayModeFinding"),selectionCut=cms.double(0.5) ),
)

pfTaus = pfTauSelector.clone(
src = "pfTausProducer",
discriminators = cms.VPSet(
cms.PSet(
discriminator=cms.InputTag("pfTausDiscriminationByDecayModeFinding"),
selectionCut=cms.double(0.5)
),
)
)
pfTausPtrs = cms.EDProducer("PFTauFwdPtrProducer",
src=cms.InputTag("pfTaus")
)
src=cms.InputTag("pfTaus")
)

pfTauSequence = cms.Sequence(
pfTausPreSequence +
pfTausBaseSequence +
pfTaus +
pfTausPtrs
)


)
5 changes: 3 additions & 2 deletions CommonTools/PileupAlgos/python/PUPuppi_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from CommonTools.PileupAlgos.Puppi_cff import *

pupuppi = puppi.clone()
pupuppi.invertPuppi = True
pupuppi = puppi.clone(
invertPuppi = True
)

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

from CommonTools.RecoAlgos.VertexCompositeCandidateCollectionSelector_cfi import VertexCompositeCandidateCollectionSelector

vertexCompositeCandidateCollectionSelector = VertexCompositeCandidateCollectionSelector.clone()
vertexCompositeCandidateCollectionSelector.v0 = cms.InputTag('generalV0Candidates:Kshort') # generalV0Candidates:Lambda
vertexCompositeCandidateCollectionSelector.beamSpot = cms.InputTag('offlineBeamSpot')
vertexCompositeCandidateCollectionSelector.primaryVertex = cms.InputTag('offlinePrimaryVertices')
vertexCompositeCandidateCollectionSelector.pvNDOF = cms.int32(4)
vertexCompositeCandidateCollectionSelector.lxyCUT = cms.double( 16.) # cm (2016 pixel layer3:10.2 cm ; 2017 pixel layer4: 16.0 cm)
vertexCompositeCandidateCollectionSelector.lxyWRTbsCUT = cms.double( 0.) # cm
#vertexCompositeCandidateCollectionSelector.debug = cms.untracked.bool(False)
vertexCompositeCandidateCollectionSelector = VertexCompositeCandidateCollectionSelector.clone(
v0 = 'generalV0Candidates:Kshort', # generalV0Candidates:Lambda
beamSpot = 'offlineBeamSpot',
primaryVertex = 'offlinePrimaryVertices',
pvNDOF = 4,
lxyCUT = 16., # cm (2016 pixel layer3:10.2 cm ; 2017 pixel layer4: 16.0 cm)
lxyWRTbsCUT = 0., # cm
#debug = cms.untracked.bool(False)
)
Loading