51 : src_(iConfig.getParameter<
edm::
InputTag>(
"jetSource")),
52 nExcl_(iConfig.getParameter<
int>(
"nExcl")),
53 etaMaxExcl_(iConfig.getParameter<double>(
"etaMaxExcl")),
54 ptMinExcl_(iConfig.getParameter<double>(
"ptMinExcl")),
55 nExcl2_(iConfig.getParameter<
int>(
"nExcl2")),
56 etaMaxExcl2_(iConfig.getParameter<double>(
"etaMaxExcl2")),
57 ptMinExcl2_(iConfig.getParameter<double>(
"ptMinExcl2")),
59 usingPackedCand(
false) {
63 produces<std::vector<double>>(
"mapEtaEdges");
64 produces<std::vector<double>>(
"mapToRho");
65 produces<std::vector<double>>(
"mapToRhoM");
66 produces<std::vector<double>>(
"ptJets");
67 produces<std::vector<double>>(
"areaJets");
68 produces<std::vector<double>>(
"etaJets");
84 auto mapEtaRangesOut = std::make_unique<std::vector<double>>(
neta, -999.);
89 auto mapToRhoOut = std::make_unique<std::vector<double>>(
neta - 1, 1
e-6);
90 auto mapToRhoMOut = std::make_unique<std::vector<double>>(
neta - 1, 1
e-6);
94 auto ptJetsOut = std::make_unique<std::vector<double>>(
njets, 1
e-6);
95 auto areaJetsOut = std::make_unique<std::vector<double>>(
njets, 1
e-6);
96 auto etaJetsOut = std::make_unique<std::vector<double>>(
njets, 1
e-6);
104 unsigned int njetsEx = 0;
105 unsigned int njetsEx2 = 0;
116 float pt =
jet->pt();
120 if (eta < mapEtaRangesOut->at(0) ||
eta > mapEtaRangesOut->at(
neta - 1))
126 ptJetsOut->at(nacc) =
pt;
127 areaJetsOut->at(nacc) =
area;
128 etaJetsOut->at(nacc) =
eta;
133 ptJetsOut->resize(nacc);
134 areaJetsOut->resize(nacc);
135 etaJetsOut->resize(nacc);
139 std::vector<double> rhoVecCur;
140 std::vector<double> rhomVecCur;
146 double rhoCurSum = 0.;
147 double rhomCurSum = 0.;
148 for (
int i = 0;
i < nacc;
i++) {
150 rhoVecCur.push_back(rhoVec[
i]);
151 rhomVecCur.push_back(rhomVec[
i]);
153 rhoCurSum += rhoVec[
i];
154 rhomCurSum += rhomVec[
i];
162 mapToRhoOut->at(
ieta) = rhoCur;
163 mapToRhoMOut->at(
ieta) = rhomCur;
191 for (
auto daughter :
jet->getJetConstituentsQuick()) {
211 throw cms::Exception(
"WrongJetCollection",
"Jet constituents are not particle flow candidates");
220 desc.add<
int>(
"nExcl", 2);
221 desc.add<
double>(
"etaMaxExcl", 2.);
222 desc.add<
double>(
"ptMinExcl", 20.);
223 desc.add<
int>(
"nExcl2", 2);
224 desc.add<
double>(
"etaMaxExcl2", 2.);
225 desc.add<
double>(
"ptMinExcl2", 20.);
226 desc.add<std::vector<double>>(
"etaRanges", {});
227 descriptions.
add(
"hiFJRhoProducer",
desc);
237 auto n =
v.size() / 2;
238 std::nth_element(
v.begin(),
v.begin() +
n,
v.end());
240 if (!(
v.size() & 1)) {
241 auto max_it = std::max_element(
v.begin(),
v.begin() +
n);
242 med = (*max_it + med) / 2.0;
HiFJRhoProducer(const edm::ParameterSet &)
T getParameter(std::string const &) const
double calcMedian(std::vector< double > &v)
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
std::vector< double > etaRanges
void beginStream(edm::StreamID) override
bool isPackedCandidate(const reco::Candidate *candidate)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~HiFJRhoProducer() override
void produce(edm::Event &, const edm::EventSetup &) override
double calcMd(const reco::Jet *jet)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_
Particle reconstructed by the particle flow algorithm.
void endStream() override