17 : gridWidth_(iConfig.getParameter<double>(
"gridWidth")),
18 band_(iConfig.getParameter<double>(
"bandWidth")),
19 hiBinCut_(iConfig.getParameter<int>(
"hiBinCut")),
20 doCentrality_(iConfig.getParameter<bool>(
"doCentrality")),
21 keepGridInfo_(iConfig.getParameter<bool>(
"keepGridInfo")) {
50 produces<std::vector<double>>(
"mapEmptyCorrFac");
51 produces<std::vector<double>>(
"mapToRhoCorr");
52 produces<std::vector<double>>(
"mapToRhoMCorr");
53 produces<std::vector<double>>(
"mapToRhoCorr1Bin");
54 produces<std::vector<double>>(
"mapToRhoMCorr1Bin");
57 produces<std::vector<double>>(
"mapRhoVsEtaGrid");
58 produces<std::vector<double>>(
"mapMeanRhoVsEtaGrid");
59 produces<std::vector<double>>(
"mapEtaMaxGrid");
60 produces<std::vector<double>>(
"mapEtaMinGrid");
84 bool doEmptyArea =
true;
95 int neta = (int)mapEtaRanges->size();
97 auto mapToRhoCorrOut = std::make_unique<std::vector<double>>(
neta - 1, 1
e-6);
98 auto mapToRhoMCorrOut = std::make_unique<std::vector<double>>(
neta - 1, 1
e-6);
99 auto mapToRhoCorr1BinOut = std::make_unique<std::vector<double>>(
neta - 1, 1
e-6);
100 auto mapToRhoMCorr1BinOut = std::make_unique<std::vector<double>>(
neta - 1, 1
e-6);
105 double allAcceptanceCorr = 1;
116 for (
int ieta = 0; ieta < (
neta - 1); ieta++) {
117 double correctionKt = 1;
118 double rho = mapRho->at(ieta);
119 double rhoM = mapRhoM->at(ieta);
122 double etamin = mapEtaRanges->at(ieta);
123 double etamax = mapEtaRanges->at(ieta + 1);
132 mapToRhoCorrOut->at(ieta) = correctionKt *
rho;
133 mapToRhoMCorrOut->at(ieta) = correctionKt * rhoM;
135 mapToRhoCorr1BinOut->at(ieta) = allAcceptanceCorr *
rho;
136 mapToRhoMCorr1BinOut->at(ieta) = allAcceptanceCorr * rhoM;
140 iEvent.
put(
std::move(mapToRhoMCorrOut),
"mapToRhoMCorr");
141 iEvent.
put(
std::move(mapToRhoCorr1BinOut),
"mapToRhoCorr1Bin");
142 iEvent.
put(
std::move(mapToRhoMCorr1BinOut),
"mapToRhoMCorr1Bin");
146 auto mapRhoVsEtaGridOut = std::make_unique<std::vector<double>>(
ny_, 0.);
147 auto mapMeanRhoVsEtaGridOut = std::make_unique<std::vector<double>>(
ny_, 0.);
148 auto mapEtaMaxGridOut = std::make_unique<std::vector<double>>(
ny_, 0.);
149 auto mapEtaMinGridOut = std::make_unique<std::vector<double>>(
ny_, 0.);
152 for (
int ieta = 0; ieta <
ny_; ieta++) {
153 mapRhoVsEtaGridOut->at(ieta) =
rhoVsEta_[ieta];
159 iEvent.
put(
std::move(mapRhoVsEtaGridOut),
"mapRhoVsEtaGrid");
160 iEvent.
put(
std::move(mapMeanRhoVsEtaGridOut),
"mapMeanRhoVsEtaGrid");
161 iEvent.
put(
std::move(mapEtaMaxGridOut),
"mapEtaMaxGrid");
162 iEvent.
put(
std::move(mapEtaMinGridOut),
"mapEtaMinGrid");
172 vector<vector<double>> scalarPt(
ny_, vector<double>(
nphi_, 0.0));
177 for (
unsigned icand = 0; icand < pfCandidateColl->size(); icand++) {
184 scalarPt[jeta][jphi] += pfCandidate.
pt();
189 for (
int jeta = 0; jeta <
ny_; jeta++) {
192 vector<double> rhoVsPhi;
195 for (
int jphi = 0; jphi <
nphi_; jphi++) {
196 double binpt = scalarPt[jeta][jphi];
200 rhoVsPhi.push_back(binpt);
208 sort(rhoVsPhi.begin(), rhoVsPhi.end());
210 int nFull = nphi_ - nEmpty;
215 if (nFull % 2 == 0) {
216 rhoVsEta_[jeta] = (rhoVsPhi[(int)(nFull / 2 - 1)] + rhoVsPhi[(int)(nFull / 2)]) / 2;
218 rhoVsEta_[jeta] = rhoVsPhi[(int)(nFull / 2)];
221 rhoVsEta_[jeta] *= (((double)nFull) / ((double)nphi_));
234 for (
auto jet = jets->begin();
jet != jets->end(); ++
jet) {
238 double areaKt =
jet->jetArea();
240 std::vector<std::pair<int, int>> pfIndicesJet;
241 std::vector<std::pair<int, int>> pfIndicesJetInbound;
243 int nConstitJetInbound = 0;
244 for (
auto daughter :
jet->getJetConstituentsQuick()) {
249 pfIndicesJet.push_back(std::make_pair(jphi, jeta));
253 pfIndicesJetInbound.push_back(std::make_pair(jphi, jeta));
254 nConstitJetInbound++;
258 if (nConstitJet == nConstitJetInbound) {
269 int nthisInbound = 0;
270 if (nConstitJetInbound > 0)
273 double fractionArea = ((double)nthisInbound) / ((double)nthis);
303 ny_ = int(nyDouble + 0.5);
318 for (
int jeta = 0; jeta <
ny_; jeta++) {
320 etaMaxGrid_[jeta] = etamin + dy_ * ((double)jeta + 1.);
359 int iy = int(floor((pfCand->
eta() -
ymin_) /
dy_));
360 if (iy < 0 || iy >=
ny_)
363 assert(iy < ny_ && iy >= 0);
385 nyJet_ = int(nyDouble + 0.5);
408 if (iyjet < 0 || iyjet >=
nyJet_)
411 assert(iyjet < nyJet_ && iyjet >= 0);
420 int lowestJPhi =
indices[0].first;
421 int lowestJEta =
indices[0].second;
422 int highestJEta = lowestJEta;
425 for (
unsigned int iconst = 1; iconst <
indices.size(); iconst++) {
426 int jphi =
indices[iconst].first;
427 int jeta =
indices[iconst].second;
428 if (jphi == lowestJPhi) {
429 if (jeta < lowestJEta)
431 if (jeta > highestJEta)
435 ngrid += highestJEta - lowestJEta + 1;
440 ngrid += highestJEta - lowestJEta + 1;
456 desc.
add<
double>(
"gridWidth", 0.05);
457 desc.
add<
double>(
"bandWidth", 0.2);
458 desc.
add<
bool>(
"doCentrality",
true);
459 desc.
add<
int>(
"hiBinCut", 100);
460 desc.
add<
bool>(
"keepGridInfo",
false);
461 descriptions.
add(
"hiFJGridEmptyAreaCalculator", desc);
edm::EDGetTokenT< std::vector< double > > mapRhoToken_
~HiFJGridEmptyAreaCalculator() override
edm::EDGetTokenT< int > centralityBinToken_
std::vector< double > rhoVsEta_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
int numJetGridCells(std::vector< std::pair< int, int >> &indices)
number of grid cells that overlap with jet constituents filling in the in between area ...
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double ymin_
internal parameters for grid
double pt() const final
transverse momentum
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_
input tokens
int tileIndexEta(const reco::PFCandidate *pfCand)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandsToken_
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
std::vector< double > etaMinGrid_
std::vector< double > meanRhoVsEta_
void endStream() override
void setupGrid(double eta_min, double eta_max)
configure the grid
edm::EDGetTokenT< std::vector< double > > mapRhoMToken_
int tileIndexEtaJet(const reco::PFCandidate *pfCand)
void setupGridJet(const reco::Jet *jet)
edm::EDGetTokenT< std::vector< double > > mapEtaToken_
int tileIndexPhi(const reco::PFCandidate *pfCand)
std::vector< double > etaMaxGrid_
void calculateAreaFractionOfJets(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const double twopi_
information about the grid
void beginStream(edm::StreamID) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
T const * product() const
void calculateGridRho(const edm::Event &iEvent, const edm::EventSetup &iSetup)
HiFJGridEmptyAreaCalculator(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Particle reconstructed by the particle flow algorithm.
double gridWidth_
input parameters
double phi() const final
momentum azimuthal angle
double eta() const final
momentum pseudorapidity