4 #ifndef PhysicsTools_PatAlgos_PATJetSelector_h 5 #define PhysicsTools_PatAlgos_PATJetSelector_h 32 filter_( params.exists(
"filter") ? params.getParameter<
bool>(
"filter") :
false ),
33 nLoose_( params.getParameter<unsigned>(
"nLoose") ),
37 produces< std::vector<pat::Jet> >();
38 produces<reco::GenJetCollection> (
"genJets");
39 produces<std::vector<CaloTower> > (
"caloTowers");
40 produces<reco::PFCandidateCollection > (
"pfCandidates");
41 produces<edm::OwnVector<reco::BaseTagInfo> > (
"tagInfos");
51 auto patJets = std::make_unique<std::vector<Jet>>();
53 auto genJetsOut = std::make_unique<reco::GenJetCollection>();
54 auto caloTowersOut = std::make_unique<std::vector<CaloTower> >();
55 auto pfCandidatesOut = std::make_unique<reco::PFCandidateCollection>();
56 auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
70 iend = h_jets->
end(), ijet = ibegin;
71 ijet != iend; ++ijet ) {
73 bool selectedLoose =
false;
80 if (
selector_(*ijet) || selectedLoose ) {
82 for ( CaloTowerFwdPtrVector::const_iterator itowerBegin = ijet->caloTowersFwdPtr().begin(),
83 itowerEnd = ijet->caloTowersFwdPtr().end(), itower = itowerBegin;
84 itower != itowerEnd; ++itower ) {
86 caloTowersOut->push_back( **itower );
91 for ( reco::PFCandidateFwdPtrVector::const_iterator icandBegin = ijet->pfCandidatesFwdPtr().begin(),
92 icandEnd = ijet->pfCandidatesFwdPtr().end(), icand = icandBegin;
93 icand != icandEnd; ++icand ) {
95 pfCandidatesOut->push_back( **icand );
99 for ( TagInfoFwdPtrCollection::const_iterator iinfoBegin = ijet->tagInfosFwdPtr().begin(),
100 iinfoEnd = ijet->tagInfosFwdPtr().end(), iinfo = iinfoBegin;
101 iinfo != iinfoEnd; ++iinfo ) {
103 tagInfosOut->push_back( **iinfo );
107 if ( ijet->genJet() !=
nullptr ) {
108 genJetsOut->push_back( *(ijet->genJet()) );
125 unsigned int caloTowerIndex = 0;
126 unsigned int pfCandidateIndex = 0;
127 unsigned int tagInfoIndex = 0;
128 unsigned int genJetIndex = 0;
132 iend = h_jets->
end(), ijet = ibegin;
133 ijet != iend; ++ijet ) {
135 bool selectedLoose =
false;
137 selectedLoose =
true;
141 if (
selector_(*ijet) || selectedLoose ) {
146 for ( CaloTowerFwdPtrVector::const_iterator itowerBegin = ijet->caloTowersFwdPtr().begin(),
147 itowerEnd = ijet->caloTowersFwdPtr().end(), itower = itowerBegin;
148 itower != itowerEnd; ++itower ) {
153 patJets->back().updateFwdCaloTowerFwdPtr( itower - itowerBegin,
161 for ( reco::PFCandidateFwdPtrVector::const_iterator icandBegin = ijet->pfCandidatesFwdPtr().begin(),
162 icandEnd = ijet->pfCandidatesFwdPtr().end(), icand = icandBegin;
163 icand != icandEnd; ++icand ) {
168 patJets->back().updateFwdPFCandidateFwdPtr( icand - icandBegin,
175 for ( TagInfoFwdPtrCollection::const_iterator iinfoBegin = ijet->tagInfosFwdPtr().begin(),
176 iinfoEnd = ijet->tagInfosFwdPtr().end(), iinfo = iinfoBegin;
177 iinfo != iinfoEnd; ++iinfo ) {
182 patJets->back().updateFwdTagInfoFwdPtr( iinfo - iinfoBegin,
189 if ( ijet->genJet() !=
nullptr ) {
212 iDesc.
setComment(
"Energy Correlation Functions adder");
215 iDesc.
add<
std::string> (
"cutLoose",
"")->setComment(
"Loose jet selection. Will keep nLoose loose jets.");
216 iDesc.
add<
bool> (
"filter",
false)->setComment(
"Filter selection?");
217 iDesc.
add<
unsigned>(
"nLoose", 0)->setComment(
"Keep nLoose loose jets that satisfy cutLoose");
218 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)