CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloJetSlimmer.cc
Go to the documentation of this file.
1 
4 
9 
12 
13 #include <vector>
14 
16 public:
18  : srcToken_(consumes<edm::View<reco::CaloJet> >(params.getParameter<edm::InputTag>("src"))),
19  cut_(params.getParameter<std::string>("cut")),
20  selector_(cut_) {
21  produces<reco::CaloJetCollection>();
22  }
23 
24  ~CaloJetSlimmer() override {}
25 
26  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override {
27  auto caloJets = std::make_unique<reco::CaloJetCollection>();
28 
30  iEvent.getByToken(srcToken_, h_jets);
31 
32  for (auto const& ijet : *h_jets) {
33  if (selector_(ijet)) {
34  reco::CaloJet::Specific tmp_specific;
35  const reco::Candidate::Point orivtx(0, 0, 0);
36  tmp_specific.mEnergyFractionEm = ijet.emEnergyFraction();
37  tmp_specific.mEnergyFractionHadronic = ijet.energyFractionHadronic();
38  reco::CaloJet newCaloJet(ijet.p4(), orivtx, tmp_specific);
39  float jetArea = ijet.jetArea();
40  newCaloJet.setJetArea(jetArea);
41  caloJets->push_back(newCaloJet);
42  }
43  }
44  iEvent.put(std::move(caloJets), "");
45  }
46 
47 protected:
51 };
52 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
Jets made from CaloTowers.
Definition: CaloJet.h:27
float mEnergyFractionHadronic
Hadronic energy fraction.
Definition: CaloJet.h:66
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
float mEnergyFractionEm
Em energy fraction.
Definition: CaloJet.h:68
const std::string cut_
~CaloJetSlimmer() override
const StringCutObjectSelector< reco::Jet > selector_
CaloJetSlimmer(edm::ParameterSet const &params)
virtual float jetArea() const
get jet area
Definition: Jet.h:103
const edm::EDGetTokenT< edm::View< reco::CaloJet > > srcToken_
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override