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
Updates to MiniAOD to satisfy JME/SMP/B2G requests for NanoAOD #20638
Changes from 4 commits
4ce2fbb
38c66ab
847aad7
79ee390
a47d8cc
cb5ba06
9fdc27e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,11 @@ namespace pat { | |
PATJetSelector( edm::ParameterSet const & params ) : | ||
srcToken_(consumes<edm::View<pat::Jet> >( params.getParameter<edm::InputTag>("src") )), | ||
cut_( params.getParameter<std::string>("cut") ), | ||
cutLoose_( params.getParameter<std::string>("cutLoose") ), | ||
filter_( params.exists("filter") ? params.getParameter<bool>("filter") : false ), | ||
selector_( cut_ ) | ||
nLoose_( params.getParameter<unsigned>("nLoose") ), | ||
selector_( cut_ ), | ||
selectorLoose_( cutLoose_ ) | ||
{ | ||
produces< std::vector<pat::Jet> >(); | ||
produces<reco::GenJetCollection> ("genJets"); | ||
|
@@ -38,7 +41,7 @@ namespace pat { | |
produces<edm::OwnVector<reco::BaseTagInfo> > ("tagInfos"); | ||
} | ||
|
||
virtual ~PATJetSelector() {} | ||
~PATJetSelector() override {} | ||
|
||
virtual void beginJob() {} | ||
virtual void endJob() {} | ||
|
@@ -61,13 +64,20 @@ namespace pat { | |
edm::Handle< edm::View<pat::Jet> > h_jets; | ||
iEvent.getByToken( srcToken_, h_jets ); | ||
|
||
unsigned nl = 0; // number of loose jets | ||
// First loop over the products and make the secondary output collections | ||
for ( edm::View<pat::Jet>::const_iterator ibegin = h_jets->begin(), | ||
iend = h_jets->end(), ijet = ibegin; | ||
ijet != iend; ++ijet ) { | ||
|
||
// Check the selection | ||
if ( selector_(*ijet) ) { | ||
bool selectedLoose = false; | ||
if ( nLoose_ > 0 && selectorLoose_(*ijet) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No reason to compute it when nl>nLoose: unsigned nl = nLoose; // number of remaining loose jets to consider |
||
selectedLoose = true; | ||
++nl; | ||
} | ||
|
||
if ( selector_(*ijet) || ( nl <= nLoose_ && selectedLoose ) ) { | ||
// Copy over the calo towers | ||
for ( CaloTowerFwdPtrVector::const_iterator itowerBegin = ijet->caloTowersFwdPtr().begin(), | ||
itowerEnd = ijet->caloTowersFwdPtr().end(), itower = itowerBegin; | ||
|
@@ -117,15 +127,21 @@ namespace pat { | |
unsigned int tagInfoIndex = 0; | ||
unsigned int genJetIndex = 0; | ||
// Now set the Ptrs with the orphan handles. | ||
nl = 0; // Reset number of loose jets | ||
for ( edm::View<pat::Jet>::const_iterator ibegin = h_jets->begin(), | ||
iend = h_jets->end(), ijet = ibegin; | ||
ijet != iend; ++ijet ) { | ||
|
||
// Check the selection | ||
if ( selector_(*ijet) ) { | ||
bool selectedLoose = false; | ||
if ( nLoose_ > 0 && selectorLoose_(*ijet) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No reason to compute it when nl>nLoose: unsigned nl = nLoose; // number of remaining loose jets to consider |
||
selectedLoose = true; | ||
++nl; | ||
} | ||
if ( selector_(*ijet) || (nl <= nLoose_ && selectedLoose ) ) { | ||
// Add the jets that pass to the output collection | ||
patJets->push_back( *ijet ); | ||
|
||
// Copy over the calo towers | ||
for ( CaloTowerFwdPtrVector::const_iterator itowerBegin = ijet->caloTowersFwdPtr().begin(), | ||
itowerEnd = ijet->caloTowersFwdPtr().end(), itower = itowerBegin; | ||
|
@@ -190,11 +206,26 @@ namespace pat { | |
return true; | ||
} | ||
|
||
|
||
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { | ||
edm::ParameterSetDescription iDesc; | ||
iDesc.setComment("Energy Correlation Functions adder"); | ||
iDesc.add<edm::InputTag>("src", edm::InputTag("no default"))->setComment("input collection"); | ||
iDesc.add<std::string> ("cut", "")->setComment("Jet selection."); | ||
iDesc.add<std::string> ("cutLoose", "")->setComment("Loose jet selection. Will keep nLoose loose jets."); | ||
iDesc.add<bool> ("filter", false)->setComment("Filter selection?"); | ||
iDesc.add<unsigned>("nLoose", 0)->setComment("Keep nLoose loose jets that satisfy cutLoose"); | ||
descriptions.add("PATJetSelector", iDesc); | ||
} | ||
|
||
protected: | ||
const edm::EDGetTokenT<edm::View<pat::Jet> > srcToken_; | ||
const std::string cut_; | ||
const bool filter_; | ||
const StringCutObjectSelector<Jet> selector_; | ||
const std::string cutLoose_; // Cut to define loose jets. | ||
const bool filter_; | ||
const unsigned nLoose_; // If desired, keep nLoose loose jets. | ||
const StringCutObjectSelector<Jet> selector_; | ||
const StringCutObjectSelector<Jet> selectorLoose_; // Selector for loose jets. | ||
}; | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to compute it when nl>nLoose:
unsigned nl = nLoose; // number of remaining loose jets to consider
...
bool selectedLoose = false;
if (nl>0) { selectedLoose = true; --nl; }
bool pass = cut_(*it) || selectedLoose