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.);
86 for (
int ieta = 0; ieta <
neta; ieta++) {
87 mapEtaRangesOut->at(ieta) =
etaRanges[ieta];
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);
92 int njets = jets->size();
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;
106 for (
auto jet = jets->begin();
jet != jets->end(); ++
jet) {
116 float pt =
jet->pt();
117 float area =
jet->jetArea();
120 if (eta < mapEtaRangesOut->at(0) || eta > mapEtaRangesOut->at(neta - 1))
123 rhoVec[nacc] = pt / area;
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);
138 for (
int ieta = 0; ieta < (neta - 1); ieta++) {
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++) {
149 if (etaVec[
i] >= etaMin && etaVec[
i] < etaMax) {
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;
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 &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double calcMedian(std::vector< double > &v)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::Event &, const edm::EventSetup &) override
double calcMd(const reco::Jet *jet)
T getParameter(std::string const &) const
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
virtual std::vector< const reco::Candidate * > getJetConstituentsQuick() const
quick list of constituents