3 using namespace l1tpf_impl;
6 if (iConfig.
existsAs<std::vector<edm::ParameterSet>>(
"regions")) {
9 std::vector<double> etaBoundaries =
preg.getParameter<std::vector<double>>(
"etaBoundaries");
10 unsigned int phiSlices =
preg.getParameter<uint32_t>(
"phiSlices");
11 float etaExtra =
preg.getParameter<
double>(
"etaExtra");
12 float phiExtra =
preg.getParameter<
double>(
"phiExtra");
13 float phiWidth = 2 *
M_PI / phiSlices;
14 unsigned int ncalomax = 0, nemcalomax = 0, ntrackmax = 0, nmuonmax = 0, npfmax = 0, npuppimax = 0;
15 if (
preg.existsAs<uint32_t>(
"caloNMax"))
16 ncalomax =
preg.getParameter<uint32_t>(
"caloNMax");
17 if (
preg.existsAs<uint32_t>(
"emcaloNMax"))
18 nemcalomax =
preg.getParameter<uint32_t>(
"emcaloNMax");
19 if (
preg.existsAs<uint32_t>(
"trackNMax"))
20 ntrackmax =
preg.getParameter<uint32_t>(
"trackNMax");
21 if (
preg.existsAs<uint32_t>(
"muonNMax"))
22 nmuonmax =
preg.getParameter<uint32_t>(
"muonNMax");
23 if (
preg.existsAs<uint32_t>(
"pfNMax"))
24 npfmax =
preg.getParameter<uint32_t>(
"pfNMax");
25 if (
preg.existsAs<uint32_t>(
"puppiNMax"))
26 npuppimax =
preg.getParameter<uint32_t>(
"puppiNMax");
27 for (
unsigned int ieta = 0,
neta = etaBoundaries.size() - 1; ieta <
neta; ++ieta) {
28 for (
unsigned int iphi = 0; iphi < phiSlices; ++iphi) {
29 float phiCenter = (iphi + 0.5) * phiWidth -
M_PI;
31 etaBoundaries[ieta + 1],
49 if (trackRegionMode ==
"atVertex")
51 else if (trackRegionMode ==
"atCalo")
53 else if (trackRegionMode ==
"any")
58 "Unsupported value for trackRegionMode: " + trackRegionMode +
" (allowed are 'atVertex', 'atCalo', 'any')");
61 unsigned int ncalomax = 0, nemcalomax = 0, ntrackmax = 0, nmuonmax = 0, npfmax = 0, npuppimax = 0;
94 inside =
r.contains(t.
eta(), t.
phi());
106 prop.fillPropagated(t.
pt(),
115 r.track.push_back(prop);
128 if (
r.contains(mu.
eta(), mu.
phi())) {
131 r.muon.push_back(prop);
140 if (
r.contains(mu.
eta(), mu.
phi())) {
143 r.muon.push_back(prop);
157 if (
r.contains(p.
eta(), p.
phi())) {
160 r.calo.push_back(calo);
173 if (
r.contains(p.
eta(), p.
phi())) {
176 r.emcalo.push_back(calo);
186 auto ret = std::make_unique<l1t::PFCandidateCollection>();
192 inside =
r.fiducialLocal(
p.floatVtxEta(),
p.floatVtxPhi());
195 inside =
r.fiducialLocal(
p.floatEta(),
p.floatPhi());
198 inside =
r.fiducialLocal(
p.floatVtxEta(),
p.floatVtxPhi());
203 if (
p.floatPt() >
ptMin) {
205 p.floatPt(),
r.globalEta(
p.floatVtxEta()),
r.globalPhi(
p.floatVtxPhi()), 0.13
f);
208 ret->back().setStatus(
p.hwStatus);
212 throw cms::Exception(
"CorruptData") <<
"Invalid cluster pointer in PF candidate id " <<
p.hwId <<
" pt "
213 << p4.pt() <<
" eta " << p4.eta() <<
" phi " << p4.phi();
215 ret->back().setPFCluster(
match->second);
220 throw cms::Exception(
"CorruptData") <<
"Invalid track pointer in PF candidate id " <<
p.hwId <<
" pt "
221 << p4.pt() <<
" eta " << p4.eta() <<
" phi " << p4.phi();
223 ret->back().setPFTrack(
match->second);
228 throw cms::Exception(
"CorruptData") <<
"Invalid muon pointer in PF candidate id " <<
p.hwId <<
" pt "
229 << p4.pt() <<
" eta " << p4.eta() <<
" phi " << p4.phi();
240 auto ret = std::make_unique<l1t::PFCandidateCollection>();
243 if (!
r.fiducialLocal(
p.floatEta(),
p.floatPhi()))
245 if (
p.floatPt() >
ptMin) {
249 ret->emplace_back(kind, 0, p4);
254 <<
"Invalid cluster pointer in cluster pt " << p4.pt() <<
" eta " << p4.eta() <<
" phi " << p4.phi();
256 ret->back().setPFCluster(
match->second);
265 auto ret = std::make_unique<l1t::PFCandidateCollection>();
273 inside =
r.fiducialLocal(p.floatVtxEta(), p.floatVtxPhi());
276 inside =
r.fiducialLocal(p.floatEta(), p.floatPhi());
279 inside =
r.fiducialLocal(p.floatVtxEta(), p.floatVtxPhi());
284 if (p.floatPt() >
ptMin) {
286 p.floatVtxPt(),
r.globalEta(p.floatVtxEta()),
r.globalPhi(p.floatVtxPhi()), 0.13
f);
288 ret->emplace_back(kind, p.intCharge(), p4);
294 <<
"Invalid track pointer in PF track pt " << p4.pt() <<
" eta " << p4.eta() <<
" phi " << p4.phi();
296 ret->back().setPFTrack(
match->second);
305 unsigned ntot = 0, nmax = 0;
311 return std::make_pair(ntot, nmax);
315 auto v = std::make_unique<std::vector<unsigned>>();
324 unsigned ntot = 0, nmax = 0;
330 return std::make_pair(ntot, nmax);
334 auto v = std::make_unique<std::vector<unsigned>>();
bool useRelativeRegionalCoordinates_
tuple ret
prodAgent to be discontinued
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
void addMuon(const l1t::Muon &t)
bool isMuon() const override
double pt() const final
transverse momentum
std::unordered_map< const l1t::PFTrack *, l1t::PFTrackRef > trackRefMap_
enum l1tpf_impl::RegionMapper::TrackAssoMode trackRegionMode_
RegionMapper(const edm::ParameterSet &)
std::unordered_map< const l1t::PFCluster *, l1t::PFClusterRef > clusterRefMap_
const Point & vertex() const override
vertex position (overwritten by PF...)
std::unique_ptr< std::vector< unsigned > > vecInput(int type) const
float caloEta() const
eta coordinate propagated at the calorimeter surface used for track-cluster matching ...
float trkPtError() const
uncertainty on track pt
std::pair< unsigned, unsigned > totAndMaxInput(int type) const
std::pair< unsigned, unsigned > totAndMaxOutput(int type, bool puppi) const
std::unique_ptr< l1t::PFCandidateCollection > fetchTracks(float ptMin=0.01, bool fromPV=false) const
void addTrack(const l1t::PFTrack &t)
math::XYZPoint Point
point in the space
std::vector< Region > regions_
void addCalo(const l1t::PFCluster &t)
std::unique_ptr< l1t::PFCandidateCollection > fetch(bool puppi=true, float ptMin=0.01) const
std::unique_ptr< std::vector< unsigned > > vecOutput(int type, bool puppi) const
std::unordered_map< const l1t::Muon *, l1t::PFCandidate::MuonRef > muonRefMap_
T getParameter(std::string const &) const
void addEmCalo(const l1t::PFCluster &t)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
std::unique_ptr< l1t::PFCandidateCollection > fetchCalo(float ptMin=0.01, bool emcalo=false) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
double phi() const final
momentum azimuthal angle
float caloPhi() const
phi coordinate propagated at the calorimeter surface used for track-cluster matching ...
unsigned int nStubs() const
int charge() const final
electric charge
float caloPtError() const
uncertainty on calorimetric response for a hadron with pt equal to this track's pt ...
double eta() const final
momentum pseudorapidity