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

80x re-miniAOD+Boosted Tau #13100

Merged
merged 26 commits into from
Feb 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c214dd2
Merge remote-tracking branch 'tau-pog-cmssw/80xReMiniAOD' into from-C…
cgalloni Jan 25, 2016
4c1718f
initial commit with code for boosted taus
cgalloni Jan 25, 2016
0526183
Added missing keep statements, updated configs to miniAOD v2
andrewj314 Dec 9, 2015
7bfb23c
port of tau ID updates from 76xReMiniAOD branch to CMSSW 8_0_x
Dec 10, 2015
6d00a03
- fixed typo
Dec 10, 2015
a0b57be
remove workaround for 76xReMiniAOD v2
Dec 17, 2015
e01591b
fixed discriminator names (added "hpsPFTauProducer")
Jan 4, 2016
9b958d8
removed spaces from collection names
Jan 4, 2016
bce4ce2
Removing old without lifetime discriminators which cause the matrix t…
isobelojalvo Jan 25, 2016
87ca089
Merge branch '80xReMiniAOD-BoostedTau' of github.com:cms-tau-pog/cmss…
isobelojalvo Jan 26, 2016
760b818
git checkout 80xReMiniAOD-BoostedTauMerge branch '80ReMiniAODwBoosted…
isobelojalvo Jan 26, 2016
d541f5f
Merge branch 'cgalloni-80ReMiniAODwBoostedTaus_forPull_v800pre4' into…
isobelojalvo Jan 26, 2016
3f9afdd
missing keep statement added
cgalloni Jan 28, 2016
8f10923
Merge pull request #22 from cgalloni/80ReMiniAODwBoostedTaus_forPull_…
isobelojalvo Jan 28, 2016
b94b5ae
removing the new IDs so we can pass the relvals, these must be readde…
isobelojalvo Jan 28, 2016
87ed750
missing keep statement added
cgalloni Jan 28, 2016
254de6b
removing the new IDs so we can pass the relvals, these must be readde…
isobelojalvo Jan 28, 2016
96c08df
Merge branch '80xReMiniAOD-BoostedTau' of github.com:cms-tau-pog/cmss…
isobelojalvo Feb 1, 2016
525d3dd
Merge branch 'CMSSW_8_0_X' of https://github.com/cms-sw/cmssw into 80…
isobelojalvo Feb 1, 2016
c3e041b
added suggestions by Carl
cgalloni Feb 1, 2016
02b4323
Merge pull request #24 from cgalloni/80ReMiniAODwBoostedTaus_forPull_…
isobelojalvo Feb 1, 2016
1596adf
cleaning up
isobelojalvo Feb 1, 2016
3b602d9
Merge branch '80xReMiniAOD-BoostedTau' of github.com:cms-tau-pog/cmss…
isobelojalvo Feb 1, 2016
4b8b5fc
move ca8 jet cut to 100 and removed MVA3woLT discriminator
cgalloni Feb 4, 2016
2938d2f
move ca8 jet cut to 100 and remove woLT discriminator
cgalloni Feb 4, 2016
a9e01a4
Merge pull request #26 from cgalloni/80ReMiniAODwBoostedTaus_forPull_…
isobelojalvo Feb 4, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'keep *_slimmedElectrons_*_*',
'keep *_slimmedMuons_*_*',
'keep *_slimmedTaus_*_*',
'keep *_slimmedTausBoosted_*_*',
'keep *_slimmedJets_*_*',
'keep *_slimmedJetsAK8_*_*',
'keep *_slimmedJetsPuppi_*_*',
Expand Down
10 changes: 10 additions & 0 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ def miniAOD_customizeCommon(process):
for idmod in photon_ids:
setupAllVIDIdsInModule(process,idmod,setupVIDPhotonSelection,None,False)

#---------------------------------------------------------------------------
#Adding Boosted Subjets taus
from RecoTauTag.Configuration.boostedHPSPFTaus_cfi import addBoostedTaus
addBoostedTaus(process)
#---------------------------------------------------------------------------

# Adding puppi jets
process.load('CommonTools.PileupAlgos.Puppi_cff')
process.load('RecoJets.JetProducers.ak4PFJetsPuppi_cfi')
Expand Down Expand Up @@ -302,6 +308,9 @@ def miniAOD_customizeMC(process):
process.photonMatch.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
process.tauMatch.matched = "prunedGenParticles"
process.tauGenJets.GenParticles = "prunedGenParticles"
#Boosted taus
process.tauMatchBoosted.matched = "prunedGenParticles"
process.tauGenJetsBoosted.GenParticles = "prunedGenParticles"
process.patJetPartons.particles = "prunedGenParticles"
process.patJetPartonMatch.matched = "prunedGenParticles"
process.patJetPartonMatch.mcStatus = [ 3, 23 ]
Expand All @@ -311,6 +320,7 @@ def miniAOD_customizeMC(process):
process.patElectrons.embedGenMatch = False
process.patPhotons.embedGenMatch = False
process.patTaus.embedGenMatch = False
process.patTausBoosted.embedGenMatch = False
process.patJets.embedGenPartonMatch = False
#also jet flavour must be switched
process.patJetFlavourAssociation.rParam = 0.4
Expand Down
13 changes: 11 additions & 2 deletions PhysicsTools/PatAlgos/python/tools/coreTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RunOnData(ConfigToolBase):
_defaultParameters=dicttypes.SortedKeysDict()
def __init__(self):
ConfigToolBase.__init__(self)
self.addParameter(self._defaultParameters,'names',['All'], "collection name; supported are 'Photons', 'Electrons','Muons', 'Taus', 'Jets', 'METs', 'All', 'PFAll', 'PFElectrons','PFTaus','PFMuons'", allowedValues=['Photons', 'Electrons','Muons', 'Taus', 'Jets', 'METs', 'All', 'PFAll', 'PFElectrons','PFTaus','PFMuons'])
self.addParameter(self._defaultParameters,'names',['All'], "collection name; supported are 'Photons', 'Electrons','Muons', 'Taus', 'TausBoosted', 'Jets', 'METs', 'All', 'PFAll', 'PFElectrons','PFTaus','PFMuons'", allowedValues=['Photons', 'Electrons','Muons', 'Taus', 'TausBoosted', 'Jets', 'METs', 'All', 'PFAll', 'PFElectrons','PFTaus','PFMuons'])
self.addParameter(self._defaultParameters,'postfix',"", "postfix of default sequence")
self.addParameter(self._defaultParameters,'outputModules',['out'], "names of all output modules specified to be adapted (default is ['out'])")
self._parameters=copy.deepcopy(self._defaultParameters)
Expand Down Expand Up @@ -68,7 +68,7 @@ class RemoveMCMatching(ConfigToolBase):
_defaultParameters=dicttypes.SortedKeysDict()
def __init__(self):
ConfigToolBase.__init__(self)
self.addParameter(self._defaultParameters,'names',['All'], "collection name; supported are 'Photons', 'Electrons','Muons', 'Taus', 'Jets', 'METs', 'All', 'PFAll', 'PFElectrons','PFTaus','PFMuons'", allowedValues=['Photons', 'Electrons','Muons', 'Taus', 'Jets', 'METs', 'All', 'PFAll', 'PFElectrons','PFTaus','PFMuons'])
self.addParameter(self._defaultParameters,'names',['All'], "collection name; supported are 'Photons', 'Electrons','Muons', 'Taus', 'TausBoosted', 'Jets', 'METs', 'All', 'PFAll', 'PFElectrons','PFTaus','PFMuons'", allowedValues=['Photons', 'Electrons','Muons', 'Taus', 'TausBoosted', 'Jets', 'METs', 'All', 'PFAll', 'PFElectrons','PFTaus','PFMuons'])
self.addParameter(self._defaultParameters,'postfix',"", "postfix of default sequence")
self.addParameter(self._defaultParameters,'outputModules',['out'], "names of all output modules specified to be adapted (default is ['out'])")
self._parameters=copy.deepcopy(self._defaultParameters)
Expand Down Expand Up @@ -116,6 +116,15 @@ def toolCode(self, process):
tauProducer.addGenJetMatch = False
tauProducer.embedGenJetMatch = False
tauProducer.genJetMatch = ''
#Boosted Taus
if( names[obj] == 'TausBoosted' or names[obj] == 'All' ):
print "removing MC dependencies for taus boosted %s" %postfix
_removeMCMatchingForPATObject(process, 'tauMatchBoosted', 'patTausBoosted', postfix)
## remove mc extra configs for taus
tauProducer = getattr(process,'patTausBoosted'+postfix)
tauProducer.addGenJetMatch = False
tauProducer.embedGenJetMatch = False
tauProducer.genJetMatch = ''
if( names[obj] == 'Jets' or names[obj] == 'All' ):
print "removing MC dependencies for jets"
jetPostfixes = []
Expand Down
6 changes: 5 additions & 1 deletion RecoJets/JetAlgorithms/src/CMSBoostedTauSeedingAlgorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
//
// You should have received a copy of the GNU General Public License
// along with this code. If not, see <http://www.gnu.org/licenses/>.

//CG: From CMSSW 8_0_X cut on eta subjets <3. Anyways taus are cut at 2.3

//----------------------------------------------------------------------

#include "RecoJets/JetAlgorithms/interface/CMSBoostedTauSeedingAlgorithm.h"
Expand Down Expand Up @@ -85,6 +88,7 @@ namespace contrib{

std::pair<PseudoJet, PseudoJet> CMSBoostedTauSeedingAlgorithm::findSubjets(const PseudoJet& jet, int depth, bool& subjetsFound) const
{
const float etaMax_ = 3.0; // cut on eta subjets <3. Anyway taus are cut at 2.3
if ( verbosity_ >= 2 ) {
std::cout << "<CMSBoostedTauSeedingAlgorithm::findSubjets>:" << std::endl;
std::cout << " jet: Pt = " << jet.pt() << ", eta = " << jet.eta() << ", phi = " << jet.phi() << ", mass = " << jet.m() << std::endl;
Expand All @@ -102,7 +106,7 @@ namespace contrib{
double mu = ( jet.m() > 0. ) ?
sqrt(std::max(subjet1.m2(), subjet2.m2())/jet.m2()) : -1.;
// check if subjets pass selection required for seeding boosted tau reconstruction
if ( subjet1.pt() > ptMin_ && subjet2.pt() > ptMin_ && dR > dRMin_ && dR < dRMax_ && mu > muMin_ && mu < muMax_ && kT < (yMax_*jet.m2()) && kT > (yMin_*jet.m2()) ) {
if ( subjet1.pt() > ptMin_ && fabs(subjet1.eta()) < etaMax_ && subjet2.pt() > ptMin_ && fabs(subjet2.eta()) < etaMax_ && dR > dRMin_ && dR < dRMax_ && mu > muMin_ && mu < muMax_ && kT < (yMax_*jet.m2()) && kT > (yMin_*jet.m2()) ) {
subjetsFound = true;
return std::make_pair(subjet1, subjet2);
} else if ( subjet1.pt() > ptMin_ ) {
Expand Down
36 changes: 11 additions & 25 deletions RecoJets/JetProducers/plugins/BoostedTauSeedsProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ BoostedTauSeedsProducer::BoostedTauSeedsProducer(const edm::ParameterSet& cfg)

produces<reco::PFJetCollection>();
produces<JetToPFCandidateAssociation>("pfCandAssocMapForIsolation");
produces<JetToPFCandidateAssociation>("pfCandAssocMapForIsoDepositVetos");
//produces<JetToPFCandidateAssociation>("pfCandAssocMapForIsoDepositVetos");
}

namespace
Expand Down Expand Up @@ -159,22 +159,24 @@ namespace
}
}

std::vector<reco::PFCandidateRef> getPFCandidates_exclJetConstituents(const edm::Handle<reco::PFCandidateCollection>& pfCandidates, const reco::Jet::Constituents& jetConstituents, double dRmatch, bool invert)
{
std::vector<reco::PFCandidateRef> getPFCandidates_exclJetConstituents(const reco::Jet& jet, const edm::Handle<reco::PFCandidateCollection>& pfCandidates, const reco::Jet::Constituents& jetConstituents, double dRmatch, bool invert)
{
auto const & collection_cand = (*pfCandidates);
std::vector<reco::PFCandidateRef> pfCandidates_exclJetConstituents;
size_t numPFCandidates = pfCandidates->size();
for ( size_t pfCandidateIdx = 0; pfCandidateIdx < numPFCandidates; ++pfCandidateIdx ) {
reco::PFCandidateRef pfCandidate(pfCandidates, pfCandidateIdx);
if(!(deltaR(collection_cand[pfCandidateIdx].p4(), jet.p4())<1.0)) continue;
bool isJetConstituent = false;
for ( reco::Jet::Constituents::const_iterator jetConstituent = jetConstituents.begin();
jetConstituent != jetConstituents.end(); ++jetConstituent ) {
double dR = deltaR(pfCandidate->p4(), (*jetConstituent)->p4());
double dR = deltaR(collection_cand[pfCandidateIdx].p4(), (*jetConstituent)->p4());
if ( dR < dRmatch ) {
isJetConstituent = true;
break;
}
}
if ( !(isJetConstituent^invert) ) {
reco::PFCandidateRef pfCandidate(pfCandidates, pfCandidateIdx);
pfCandidates_exclJetConstituents.push_back(pfCandidate);
}
}
Expand Down Expand Up @@ -215,8 +217,8 @@ void BoostedTauSeedsProducer::produce(edm::Event& evt, const edm::EventSetup& es
std::auto_ptr<reco::PFJetCollection> selectedSubjets(new reco::PFJetCollection());
edm::RefProd<reco::PFJetCollection> selectedSubjetRefProd = evt.getRefBeforePut<reco::PFJetCollection>();

std::auto_ptr<JetToPFCandidateAssociation> selectedSubjetPFCandidateAssociationForIsolation(new JetToPFCandidateAssociation());
std::auto_ptr<JetToPFCandidateAssociation> selectedSubjetPFCandidateAssociationForIsoDepositVetos(new JetToPFCandidateAssociation());
std::auto_ptr<JetToPFCandidateAssociation> selectedSubjetPFCandidateAssociationForIsolation(new JetToPFCandidateAssociation(&evt.productGetter()));
//std::auto_ptr<JetToPFCandidateAssociation> selectedSubjetPFCandidateAssociationForIsoDepositVetos(new JetToPFCandidateAssociation(&evt.productGetter()));

for ( size_t idx = 0; idx < (subjets->size() / 2); ++idx ) {
const reco::Jet* subjet1 = &subjets->at(2*idx);
Expand Down Expand Up @@ -249,8 +251,8 @@ void BoostedTauSeedsProducer::produce(edm::Event& evt, const edm::EventSetup& es
edm::Ref<reco::PFJetCollection> subjetRef2(selectedSubjetRefProd, selectedSubjets->size() - 1);

// find all PFCandidates that are not constituents of the **other** subjet
std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet1 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents2, 1.e-4, false);
std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet2 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents1, 1.e-4, false);
std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet1 = getPFCandidates_exclJetConstituents(*subjet1, pfCandidates, subjetConstituents2, 1.e-4, false);
std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet2 = getPFCandidates_exclJetConstituents(*subjet2, pfCandidates, subjetConstituents1, 1.e-4, false);
if ( verbosity_ >= 1 ) {
std::cout << "#pfCandidatesNotInSubjet1 = " << pfCandidatesNotInSubjet1.size() << std::endl;
std::cout << "#pfCandidatesNotInSubjet2 = " << pfCandidatesNotInSubjet2.size() << std::endl;
Expand All @@ -264,26 +266,10 @@ void BoostedTauSeedsProducer::produce(edm::Event& evt, const edm::EventSetup& es
BOOST_FOREACH( const reco::PFCandidateRef& pfCandidate, pfCandidatesNotInSubjet2 ) {
selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef2, pfCandidate);
}

// find all PFCandidates that are constituents of the **other** subjet
std::vector<reco::PFCandidateRef> pfCandidatesInSubjet1 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents2, 1.e-4, true);
std::vector<reco::PFCandidateRef> pfCandidatesInSubjet2 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents1, 1.e-4, true);
if ( verbosity_ >= 1 ) {
std::cout << "#pfCandidatesInSubjet1 = " << pfCandidatesInSubjet1.size() << std::endl;
std::cout << "#pfCandidatesInSubjet2 = " << pfCandidatesInSubjet2.size() << std::endl;
}

BOOST_FOREACH( const reco::PFCandidateRef& pfCandidate, pfCandidatesInSubjet1 ) {
selectedSubjetPFCandidateAssociationForIsoDepositVetos->insert(subjetRef1, pfCandidate);
}
BOOST_FOREACH( const reco::PFCandidateRef& pfCandidate, pfCandidatesInSubjet2 ) {
selectedSubjetPFCandidateAssociationForIsoDepositVetos->insert(subjetRef2, pfCandidate);
}
}

evt.put(selectedSubjets);
evt.put(selectedSubjetPFCandidateAssociationForIsolation, "pfCandAssocMapForIsolation");
evt.put(selectedSubjetPFCandidateAssociationForIsoDepositVetos, "pfCandAssocMapForIsoDepositVetos");
}

#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
yMax = cms.double(+1.e+6), # maximum asymmetry
dRMin = cms.double(0.0), # minimum delta R between subjets
dRMax = cms.double(0.8), # maximum delta R between subjets
maxDepth = cms.int32(4) # maximum depth for descending into clustering sequence
maxDepth = cms.int32(100) # maximum depth for descending into clustering sequence;

)

Loading