56 nExcl_(iConfig.getParameter<
int>(
"nExcl")),
57 nExcl2_(iConfig.getParameter<
int>(
"nExcl2")),
58 etaMaxExcl_(iConfig.getParameter<double>(
"etaMaxExcl")),
59 ptMinExcl_(iConfig.getParameter<double>(
"ptMinExcl")),
60 etaMaxExcl2_(iConfig.getParameter<double>(
"etaMaxExcl2")),
61 ptMinExcl2_(iConfig.getParameter<double>(
"ptMinExcl2")),
62 etaRanges_(iConfig.getParameter<
std::
vector<double>>(
"etaRanges")) {
64 produces<std::vector<double>>(
"mapEtaEdges");
65 produces<std::vector<double>>(
"mapToRho");
66 produces<std::vector<double>>(
"mapToRhoM");
67 produces<std::vector<double>>(
"ptJets");
68 produces<std::vector<double>>(
"areaJets");
69 produces<std::vector<double>>(
"etaJets");
79 auto mapEtaRangesOut = std::make_unique<std::vector<double>>(
neta, -999.);
84 auto mapToRhoOut = std::make_unique<std::vector<double>>(
neta - 1, 1
e-6);
85 auto mapToRhoMOut = std::make_unique<std::vector<double>>(
neta - 1, 1
e-6);
87 int njets =
static_cast<int>(
jets->size());
89 auto ptJetsOut = std::make_unique<std::vector<double>>();
90 ptJetsOut->reserve(
njets);
91 auto areaJetsOut = std::make_unique<std::vector<double>>();
92 areaJetsOut->reserve(
njets);
93 auto etaJetsOut = std::make_unique<std::vector<double>>();
94 etaJetsOut->reserve(
njets);
96 std::vector<double> rhoVec;
97 rhoVec.reserve(
njets);
98 std::vector<double> rhomVec;
99 rhomVec.reserve(
njets);
102 unsigned int njetsEx = 0;
103 unsigned int njetsEx2 = 0;
104 for (
auto const&
jet : *
jets) {
118 if (eta < mapEtaRangesOut->at(0) ||
eta > mapEtaRangesOut->at(
neta - 1))
121 rhoVec.push_back(
pt /
area);
123 ptJetsOut->push_back(
pt);
124 areaJetsOut->push_back(
area);
125 etaJetsOut->push_back(
eta);
131 const double radius = 0.2;
133 std::vector<double> rhoVecCur;
134 rhoVecCur.reserve(nacc);
135 std::vector<double> rhomVecCur;
136 rhomVecCur.reserve(nacc);
141 for (
int i = 0;
i < nacc; ++
i) {
143 rhoVecCur.push_back(rhoVec[
i]);
144 rhomVecCur.push_back(rhomVec[
i]);
148 if (not rhoVecCur.empty()) {
167 for (
auto const* daughter :
jet.getJetConstituentsQuick()) {
188 throw cms::Exception(
"WrongJetCollection",
"Jet constituents are not particle flow candidates");
196 desc.add<
int>(
"nExcl", 2);
197 desc.add<
double>(
"etaMaxExcl", 2.);
198 desc.add<
double>(
"ptMinExcl", 20.);
199 desc.add<
int>(
"nExcl2", 2);
200 desc.add<
double>(
"etaMaxExcl2", 2.);
201 desc.add<
double>(
"ptMinExcl2", 20.);
202 desc.add<std::vector<double>>(
"etaRanges", {});
203 descriptions.
add(
"hiFJRhoProducer",
desc);
213 auto n =
v.size() / 2;
214 std::nth_element(
v.begin(),
v.begin() +
n,
v.end());
216 if (!(
v.size() & 1)) {
217 auto max_it = std::max_element(
v.begin(),
v.begin() +
n);
218 med = (*max_it + med) / 2.0;
HiFJRhoProducer(const edm::ParameterSet &)
~HiFJRhoProducer() override=default
Base class for all types of Jets.
double calcMedian(std::vector< double > &v) const
const double etaMaxExcl2_
const unsigned int nExcl2_
const std::vector< double > etaRanges_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isPackedCandidate(reco::Candidate const *candidate) const
double calcMd(reco::Jet const &jet) const
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Particle reconstructed by the particle flow algorithm.
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
std::once_flag checkJetCand_
const unsigned int nExcl_
const edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_