86 offsetPerPU_(iConfig.getParameter<double>(
"offsetPerPU")),
90 produces<edm::ValueMap<float>>(
"sigmaEtaEta");
91 produces<edm::ValueMap<float>>(
"sigmaPhiPhi");
92 produces<edm::ValueMap<int>>(
"centralEtaStripSize");
93 produces<edm::ValueMap<int>>(
"adjacentEtaStripsSize");
111 std::vector<float> v_sigmaEtaEta, v_sigmaPhiPhi;
112 v_sigmaEtaEta.reserve(theJets->size());
113 v_sigmaPhiPhi.reserve(theJets->size());
114 std::vector<int> v_size_CentralEtaStrip, v_size_AdjacentEtaStrips;
115 v_size_CentralEtaStrip.reserve(theJets->size());
116 v_size_AdjacentEtaStrips.reserve(theJets->size());
122 for (
auto const&
jet : *theJets) {
123 double pt_jet =
jet.pt();
124 double eta_jet =
jet.eta();
128 v_sigmaEtaEta.push_back(-1.);
129 v_sigmaPhiPhi.push_back(-1.);
130 v_size_CentralEtaStrip.push_back(0);
131 v_size_AdjacentEtaStrips.push_back(0);
134 double sumptPFcands = 0.;
136 for (
unsigned i = 0;
i <
jet.numberOfSourceCandidatePtrs(); ++
i) {
141 double pt_PUsub = icand->
pt() - puoffset;
144 sumptPFcands += pt_PUsub;
148 int size_CentralEtaStrip(0.), size_AdjacentEtaStrips(0.);
149 double sigmaEtaEtaSq(0.), sigmaPhiPhiSq(0.);
150 double sumweightsPFcands = 0;
151 for (
unsigned i = 0;
i <
jet.numberOfSourceCandidatePtrs(); ++
i) {
159 double pt_PUsub = icand->
pt() - puoffset;
163 if (dphi <= hfTowerPhiWidth_ * 0.5)
164 size_CentralEtaStrip++;
165 else if (dphi <= hfTowerPhiWidth_ * 1.5)
166 size_AdjacentEtaStrips++;
171 double weight = pt_PUsub / sumptPFcands;
172 sigmaEtaEtaSq += deta * deta *
weight;
173 sigmaPhiPhiSq += dphi * dphi *
weight;
174 sumweightsPFcands +=
weight;
178 v_size_CentralEtaStrip.push_back(size_CentralEtaStrip);
179 v_size_AdjacentEtaStrips.push_back(size_AdjacentEtaStrips);
181 if (sumweightsPFcands > 0 && sigmaEtaEtaSq > 0 && sigmaPhiPhiSq > 0) {
182 v_sigmaEtaEta.push_back(
sqrt(sigmaEtaEtaSq / sumweightsPFcands));
183 v_sigmaPhiPhi.push_back(
sqrt(sigmaPhiPhiSq / sumweightsPFcands));
185 v_sigmaEtaEta.push_back(-1.);
186 v_sigmaPhiPhi.push_back(-1.);
192 putInEvent(
"sigmaEtaEta", theJets, v_sigmaEtaEta, iEvent);
193 putInEvent(
"sigmaPhiPhi", theJets, v_sigmaPhiPhi, iEvent);
194 putInEvent(
"centralEtaStripSize", theJets, v_size_CentralEtaStrip, iEvent);
195 putInEvent(
"adjacentEtaStripsSize", theJets, v_size_AdjacentEtaStrips, iEvent);
199 template <
typename T>
202 std::vector<T> product,
204 auto out = std::make_unique<edm::ValueMap<T>>();
206 filler.insert(
jets, product.begin(), product.end());
216 desc.
add<
double>(
"jetPtThreshold", 25.);
217 desc.
add<
double>(
"jetEtaThreshold", 2.9);
218 desc.
add<
double>(
"hfTowerEtaWidth", 0.175);
219 desc.
add<
double>(
"hfTowerPhiWidth", 0.175);
220 desc.
add<
double>(
"vertexRecoEffcy", 0.7);
221 desc.
add<
double>(
"offsetPerPU", 0.4);
222 desc.
add<
double>(
"jetReferenceRadius", 0.4);
223 desc.
add<
double>(
"stripPtThreshold", 10.);
224 desc.
add<
double>(
"widthPtThreshold", 3.);
225 descriptions.
add(
"hfJetShowerShape", desc);
void putInEvent(const std::string &, const edm::Handle< edm::View< reco::Jet >> &, std::vector< T >, edm::Event &) const
Function to put product into event.
const double jetReferenceRadius_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const double vertexRecoEffcy_
void produce(edm::Event &, const edm::EventSetup &) override
const double widthPtThreshold_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
#define DEFINE_FWK_MODULE(type)
virtual int pdgId() const =0
PDG identifier.
const double hfTowerPhiWidth_
Abs< T >::type abs(const T &t)
bool get(ProductID const &oid, Handle< PROD > &result) const
const double jetPtThreshold_
const edm::EDGetTokenT< std::vector< reco::Vertex > > vertices_token_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< edm::View< reco::Jet > > jets_token_
const double offsetPerPU_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HFJetShowerShape(const edm::ParameterSet &)
const double stripPtThreshold_
const double jetEtaThreshold_
const double hfTowerEtaWidth_
virtual double phi() const =0
momentum azimuthal angle