52 src_(iConfig.getParameter<
edm::InputTag>(
"jetSource")),
53 nExcl_(iConfig.getParameter<
int>(
"nExcl")),
54 etaMaxExcl_(iConfig.getParameter<double>(
"etaMaxExcl")),
55 ptMinExcl_(iConfig.getParameter<double>(
"ptMinExcl")),
56 nExcl2_(iConfig.getParameter<
int>(
"nExcl2")),
57 etaMaxExcl2_(iConfig.getParameter<double>(
"etaMaxExcl2")),
58 ptMinExcl2_(iConfig.getParameter<double>(
"ptMinExcl2")),
60 usingPackedCand(
false)
65 produces<std::vector<double > >(
"mapEtaEdges");
66 produces<std::vector<double > >(
"mapToRho");
67 produces<std::vector<double > >(
"mapToRhoM");
68 produces<std::vector<double > >(
"ptJets");
69 produces<std::vector<double > >(
"areaJets");
70 produces<std::vector<double > >(
"etaJets");
92 auto mapEtaRangesOut = std::make_unique<std::vector<double>>(neta,-999.);
94 for(
int ieta = 0; ieta < neta; ieta++){
95 mapEtaRangesOut->at(ieta) =
etaRanges[ieta];
97 auto mapToRhoOut = std::make_unique<std::vector<double>>(neta-1,1
e-6);
98 auto mapToRhoMOut = std::make_unique<std::vector<double>>(neta-1,1
e-6);
100 int njets = jets->size();
102 auto ptJetsOut = std::make_unique<std::vector<double>>(njets,1
e-6);
103 auto areaJetsOut = std::make_unique<std::vector<double>>(njets,1
e-6);
104 auto etaJetsOut = std::make_unique<std::vector<double>>(njets,1
e-6);
112 unsigned int njetsEx = 0;
113 unsigned int njetsEx2 = 0;
114 for(
auto jet = jets->begin();
jet != jets->end(); ++
jet) {
123 float pt =
jet->pt();
127 if(eta<mapEtaRangesOut->at(0) || eta>mapEtaRangesOut->at(neta-1))
continue;
129 rhoVec[nacc] = pt/
area;
132 ptJetsOut->at(nacc) =
pt;
133 areaJetsOut->at(nacc) =
area;
134 etaJetsOut->at(nacc) =
eta;
139 ptJetsOut->resize(nacc);
140 areaJetsOut->resize(nacc);
141 etaJetsOut->resize(nacc);
144 for(
int ieta = 0; ieta<(neta-1); ieta++) {
145 std::vector<double> rhoVecCur;
146 std::vector<double> rhomVecCur;
152 double rhoCurSum = 0.;
153 double rhomCurSum = 0.;
154 for(
int i = 0;
i<nacc;
i++) {
155 if(etaVec[
i]>=etaMin && etaVec[
i]<etaMax) {
156 rhoVecCur.push_back(rhoVec[
i]);
157 rhomVecCur.push_back(rhomVec[i]);
159 rhoCurSum += rhoVec[
i];
160 rhomCurSum += rhomVec[
i];
168 mapToRhoOut->at(ieta) = rhoCur;
169 mapToRhoMOut->at(ieta) = rhomCur;
219 else throw cms::Exception(
"WrongJetCollection",
"Jet constituents are not particle flow candidates");
228 desc.
add<
int>(
"nExcl", 2);
229 desc.
add<
double>(
"etaMaxExcl",2.);
230 desc.
add<
double>(
"ptMinExcl",20.);
231 desc.
add<
int>(
"nExcl2", 2);
232 desc.
add<
double>(
"etaMaxExcl2",2.);
233 desc.
add<
double>(
"ptMinExcl2",20.);
234 desc.
add<std::vector<double> >(
"etaRanges");
235 descriptions.
add(
"hiFJRhoProducer",desc);
247 auto n = v.size() / 2;
248 std::nth_element(v.begin(), v.begin()+
n, v.end());
250 if(!(v.size() & 1)) {
251 auto max_it = std::max_element(v.begin(), v.begin()+
n);
252 med = (*max_it + med) / 2.0;
T getParameter(std::string const &) const
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)
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