4 #ifndef PhysicsTools_PatAlgos_PATJetSelector_h 5 #define PhysicsTools_PatAlgos_PATJetSelector_h 33 filter_( params.exists(
"filter") ? params.getParameter<
bool>(
"filter") :
false ),
34 nLoose_( params.getParameter<unsigned>(
"nLoose") ),
38 produces< std::vector<pat::Jet> >();
39 produces<reco::GenJetCollection> (
"genJets");
40 produces<std::vector<CaloTower> > (
"caloTowers");
41 produces<reco::PFCandidateCollection > (
"pfCandidates");
42 produces<edm::OwnVector<reco::BaseTagInfo> > (
"tagInfos");
52 auto patJets = std::make_unique<std::vector<Jet>>();
54 auto genJetsOut = std::make_unique<reco::GenJetCollection>();
55 auto caloTowersOut = std::make_unique<std::vector<CaloTower> >();
56 auto pfCandidatesOut = std::make_unique<reco::PFCandidateCollection>();
57 auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
71 iend = h_jets->
end(), ijet = ibegin;
72 ijet != iend; ++ijet ) {
74 bool selectedLoose =
false;
81 if (
selector_(*ijet) || selectedLoose ) {
83 for ( CaloTowerFwdPtrVector::const_iterator itowerBegin = ijet->caloTowersFwdPtr().begin(),
84 itowerEnd = ijet->caloTowersFwdPtr().end(), itower = itowerBegin;
85 itower != itowerEnd; ++itower ) {
87 caloTowersOut->push_back( **itower );
92 for ( reco::PFCandidateFwdPtrVector::const_iterator icandBegin = ijet->pfCandidatesFwdPtr().begin(),
93 icandEnd = ijet->pfCandidatesFwdPtr().end(), icand = icandBegin;
94 icand != icandEnd; ++icand ) {
96 pfCandidatesOut->push_back( **icand );
100 for ( TagInfoFwdPtrCollection::const_iterator iinfoBegin = ijet->tagInfosFwdPtr().begin(),
101 iinfoEnd = ijet->tagInfosFwdPtr().end(), iinfo = iinfoBegin;
102 iinfo != iinfoEnd; ++iinfo ) {
104 tagInfosOut->push_back( **iinfo );
108 if ( ijet->genJet() !=
nullptr ) {
109 genJetsOut->push_back( *(ijet->genJet()) );
126 unsigned int caloTowerIndex = 0;
127 unsigned int pfCandidateIndex = 0;
128 unsigned int tagInfoIndex = 0;
129 unsigned int genJetIndex = 0;
133 iend = h_jets->
end(), ijet = ibegin;
134 ijet != iend; ++ijet ) {
136 bool selectedLoose =
false;
138 selectedLoose =
true;
142 if (
selector_(*ijet) || selectedLoose ) {
147 for ( CaloTowerFwdPtrVector::const_iterator itowerBegin = ijet->caloTowersFwdPtr().begin(),
148 itowerEnd = ijet->caloTowersFwdPtr().end(), itower = itowerBegin;
149 itower != itowerEnd; ++itower ) {
154 patJets->back().updateFwdCaloTowerFwdPtr( itower - itowerBegin,
162 for ( reco::PFCandidateFwdPtrVector::const_iterator icandBegin = ijet->pfCandidatesFwdPtr().begin(),
163 icandEnd = ijet->pfCandidatesFwdPtr().end(), icand = icandBegin;
164 icand != icandEnd; ++icand ) {
169 patJets->back().updateFwdPFCandidateFwdPtr( icand - icandBegin,
176 for ( TagInfoFwdPtrCollection::const_iterator iinfoBegin = ijet->tagInfosFwdPtr().begin(),
177 iinfoEnd = ijet->tagInfosFwdPtr().end(), iinfo = iinfoBegin;
178 iinfo != iinfoEnd; ++iinfo ) {
183 patJets->back().updateFwdTagInfoFwdPtr( iinfo - iinfoBegin,
190 if ( ijet->genJet() !=
nullptr ) {
213 iDesc.
setComment(
"Energy Correlation Functions adder");
216 iDesc.
add<
std::string> (
"cutLoose",
"")->setComment(
"Loose jet selection. Will keep nLoose loose jets.");
217 iDesc.
add<
bool> (
"filter",
false)->setComment(
"Filter selection?");
218 iDesc.
add<
unsigned>(
"nLoose", 0)->setComment(
"Keep nLoose loose jets that satisfy cutLoose");
219 descriptions.
add(
"PATJetSelector", iDesc);
const StringCutObjectSelector< Jet > selector_
const StringCutObjectSelector< Jet > selectorLoose_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const std::string cutLoose_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< GenJet > GenJetCollection
collection of GenJet objects
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void setComment(std::string const &value)
~PATJetSelector() override
bool filter(edm::Event &iEvent, const edm::EventSetup &iSetup) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
RefProd< PROD > getRefBeforePut()
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const edm::EDGetTokenT< edm::View< pat::Jet > > srcToken_
PATJetSelector(edm::ParameterSet const ¶ms)