1 #ifndef LEPTONS_PRODUCER
2 #define LEPTONS_PRODUCER
4 #include <cp3_llbb/Framework/interface/CandidatesProducer.h>
5 #include <RecoEgamma/EgammaTools/interface/EffectiveAreas.h>
6 #include <DataFormats/PatCandidates/interface/Muon.h>
13 LeptonsProducer(
const std::string& name,
const ROOT::TreeGroup&
tree,
const edm::ParameterSet& config):
16 m_ea_R04(config.getUntrackedParameter<edm::FileInPath>(
"ea_R04").fullPath()),
17 m_ea_R03(config.getUntrackedParameter<edm::FileInPath>(
"ea_R03").fullPath())
22 virtual void doConsumes(
const edm::ParameterSet& config, edm::ConsumesCollector&& collector)
override {
23 m_leptons_token = collector.consumes<std::vector<T>>(config.getUntrackedParameter<edm::InputTag>(
"src"));
24 m_rho_token = collector.consumes<
double>(config.getUntrackedParameter<edm::InputTag>(
"rho", edm::InputTag(
"fixedGridRhoFastjetAll")));
30 void computeIsolations_R03(
float chargedHadronIso,
float neutralHadronIso,
float photonIso,
float puChargedHadronIso,
float pt,
float eta,
float rho) {
31 chargedHadronIsoR03.push_back(chargedHadronIso);
32 neutralHadronIsoR03.push_back(neutralHadronIso);
33 photonIsoR03.push_back(photonIso);
34 puChargedHadronIsoR03.push_back(puChargedHadronIso);
35 relativeIsoR03.push_back((chargedHadronIso + neutralHadronIso + photonIso) / pt);
36 relativeIsoR03_deltaBeta.push_back((chargedHadronIso + std::max((neutralHadronIso + photonIso) - 0.5f * puChargedHadronIso, 0.0f)) / pt);
38 float EA = m_ea_R03.getEffectiveArea(eta);
39 relativeIsoR03_withEA.push_back((chargedHadronIso + std::max((neutralHadronIso + photonIso) - rho * EA, 0.0f)) / pt);
43 void computeIsolations_R04(
float chargedHadronIso,
float neutralHadronIso,
float photonIso,
float puChargedHadronIso,
float pt,
float eta,
float rho) {
44 chargedHadronIsoR04.push_back(chargedHadronIso);
45 neutralHadronIsoR04.push_back(neutralHadronIso);
46 photonIsoR04.push_back(photonIso);
47 puChargedHadronIsoR04.push_back(puChargedHadronIso);
48 relativeIsoR04.push_back((chargedHadronIso + neutralHadronIso + photonIso) / pt);
49 relativeIsoR04_deltaBeta.push_back((chargedHadronIso + std::max((neutralHadronIso + photonIso) - 0.5f * puChargedHadronIso, 0.0f)) / pt);
51 float EA = m_ea_R04.getEffectiveArea(eta);
52 relativeIsoR04_withEA.push_back((chargedHadronIso + std::max((neutralHadronIso + photonIso) - rho * EA, 0.0f)) / pt);
57 edm::EDGetTokenT<std::vector<T>> m_leptons_token;
58 edm::EDGetTokenT<double> m_rho_token;
63 EffectiveAreas m_ea_R04;
64 EffectiveAreas m_ea_R03;
68 std::vector<float>& EA_R03 = this->tree[
"EAR03"].template write<std::vector<float>>();
69 std::vector<float>& EA_R04 = this->tree[
"EAR04"].template write<std::vector<float>>();
71 std::vector<float>& chargedHadronIsoR03 = this->tree[
"chargedHadronIsoR03"].template write<std::vector<float>>();
72 std::vector<float>& neutralHadronIsoR03 = this->tree[
"neutralHadronIsoR03"].template write<std::vector<float>>();
73 std::vector<float>& photonIsoR03 = this->tree[
"photonIsoR03"].template write<std::vector<float>>();
74 std::vector<float>& puChargedHadronIsoR03 = this->tree[
"puChargedHadronIsoR03"].template write<std::vector<float>>();
75 std::vector<float>& relativeIsoR03 = this->tree[
"relativeIsoR03"].template write<std::vector<float>>();
76 std::vector<float>& relativeIsoR03_deltaBeta = this->tree[
"relativeIsoR03_deltaBeta"].template write<std::vector<float>>();
77 std::vector<float>& relativeIsoR03_withEA = this->tree[
"relativeIsoR03_withEA"].template write<std::vector<float>>();
79 std::vector<float>& chargedHadronIsoR04 = this->tree[
"chargedHadronIsoR04"].template write<std::vector<float>>();
80 std::vector<float>& neutralHadronIsoR04 = this->tree[
"neutralHadronIsoR04"].template write<std::vector<float>>();
81 std::vector<float>& photonIsoR04 = this->tree[
"photonIsoR04"].template write<std::vector<float>>();
82 std::vector<float>& puChargedHadronIsoR04 = this->tree[
"puChargedHadronIsoR04"].template write<std::vector<float>>();
83 std::vector<float>& relativeIsoR04 = this->tree[
"relativeIsoR04"].template write<std::vector<float>>();
84 std::vector<float>& relativeIsoR04_deltaBeta = this->tree[
"relativeIsoR04_deltaBeta"].template write<std::vector<float>>();
85 std::vector<float>& relativeIsoR04_withEA = this->tree[
"relativeIsoR04_withEA"].template write<std::vector<float>>();
Definition: CandidatesProducer.h:9
ROOT::TreeGroup tree
Access point to output tree.
Definition: Producer.h:132
Definition: LeptonsProducer.h:10
virtual void doConsumes(const edm::ParameterSet &config, edm::ConsumesCollector &&collector) override
Hook for the CMSSW consumes interface.
Definition: LeptonsProducer.h:22