78 pfCandidateCollection_(
82 rho_(consumes<double>(iConfig.getParameter<edm::
InputTag>(
"rho"))),
83 pfJetPtCut(iConfig.getParameter<double>(
"pfJetPtCut")),
84 pfJetEtaCut(iConfig.getParameter<double>(
"pfJetEtaCut")),
88 doJetTags(iConfig.getParameter<bool>(
"doJetTags")),
89 doCandidates(iConfig.getParameter<bool>(
"doCandidates")),
90 doMet(iConfig.getParameter<bool>(
"doMet")) {
92 produces<Run3ScoutingPFJetCollection>();
93 produces<Run3ScoutingParticleCollection>();
94 produces<double>(
"rho");
95 produces<double>(
"pfMetPt");
96 produces<double>(
"pfMetPhi");
110 outVertices->emplace_back(vtx.x(),
125 std::unique_ptr<double> outRho(
new double(-999));
127 outRho = std::make_unique<double>(*rho);
132 std::unique_ptr<double> outMetPt(
new double(-999));
133 std::unique_ptr<double> outMetPhi(
new double(-999));
135 outMetPt = std::make_unique<double>(
metCollection->front().pt());
136 outMetPhi = std::make_unique<double>(
metCollection->front().phi());
145 int vertex_index = -1;
146 int index_counter = 0;
148 for (
auto &vtx : *outVertices) {
149 double tmp_dr2 =
pow(vtx.x() - cand.vx(), 2) +
pow(vtx.y() - cand.vy(), 2) +
pow(vtx.z() - cand.vz(), 2);
152 vertex_index = index_counter;
175 bool haveJetTags =
false;
184 float tagValue = -20;
187 for (
auto &
tag : *pfJetTagCollection) {
191 tagValue =
tag.second;
196 std::vector<int> candIndices;
198 for (
auto &cand :
jet.getPFConstituents()) {
199 if (not(cand.isNonnull() and cand.isAvailable())) {
201 <<
"invalid reference to reco::PFCandidate from reco::PFJet::getPFConstituents()";
205 float minDR2 = 0.0001;
208 for (
auto &outCand : *outPFCandidates) {
209 float dR2 =
pow(cand->eta() - outCand.eta(), 2) +
pow(cand->phi() - outCand.phi(), 2);
212 matchIndex = outIndex;
219 candIndices.push_back(matchIndex);
223 outPFJets->emplace_back(
jet.pt(),
228 jet.chargedHadronEnergy(),
229 jet.neutralHadronEnergy(),
231 jet.electronEnergy(),
233 jet.HFHadronEnergy(),
235 jet.chargedHadronMultiplicity(),
236 jet.neutralHadronMultiplicity(),
237 jet.photonMultiplicity(),
238 jet.electronMultiplicity(),
239 jet.muonMultiplicity(),
240 jet.HFHadronMultiplicity(),
241 jet.HFEMMultiplicity(),
266 desc.
add<
double>(
"pfJetPtCut", 20.0);
267 desc.
add<
double>(
"pfJetEtaCut", 3.0);
268 desc.
add<
double>(
"pfCandidatePtCut", 0.6);
269 desc.
add<
double>(
"pfCandidateEtaCut", 5.0);
270 desc.
add<
int>(
"mantissaPrecision", 10)->setComment(
"default float16, change to 23 for float32");
271 desc.
add<
bool>(
"doJetTags",
true);
272 desc.
add<
bool>(
"doCandidates",
true);
273 desc.
add<
bool>(
"doMet",
true);
274 descriptions.
add(
"hltScoutingPFProducer", desc);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const double pfCandidateEtaCut
std::vector< Run3ScoutingVertex > Run3ScoutingVertexCollection
const edm::EDGetTokenT< reco::PFMETCollection > metCollection_
~HLTScoutingPFProducer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< l1t::PFCandidate > PFCandidateCollection
std::vector< Run3ScoutingPFJet > Run3ScoutingPFJetCollection
JetFloatAssociation::Container JetTagCollection
std::vector< Vertex > VertexCollection
const edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidateCollection_
tuple pfCandidateCollection
const edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
void produce(edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const final
std::vector< Run3ScoutingParticle > Run3ScoutingParticleCollection
Abs< T >::type abs(const T &t)
const edm::EDGetTokenT< reco::PFJetCollection > pfJetCollection_
HLTScoutingPFProducer(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< reco::JetTagCollection > pfJetTagCollection_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const edm::EDGetTokenT< double > rho_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static float reduceMantissaToNbitsRounding(const float &f)
std::vector< PFJet > PFJetCollection
collection of PFJet objects
const int mantissaPrecision
Power< A, B >::type pow(const A &a, const B &b)
const double pfCandidatePtCut