43 emOnly_(iConfig.getParameter<
bool>(
"emOnly")),
44 etCut_(iConfig.getParameter<double>(
"etMin")),
45 preEmId_(iConfig.getParameter<
std::
string>(
"preEmId")),
50 corrector_(iConfig.getParameter<
std::
string>(
"corrector"),
53 : iConfig.getParameter<double>(
"correctorEmfMax")),
62 produces<l1t::PFClusterCollection>();
63 produces<l1t::PFClusterCollection>(
"egamma");
65 produces<l1t::PFClusterCollection>(
"em");
66 produces<l1t::PFClusterCollection>(
"had");
72 }
else if (
scenario ==
"allKeepHad") {
75 throw cms::Exception(
"Configuration",
"Unsupported emOnly = True when useEMInterpretation is " +
scenario);
77 }
else if (
scenario ==
"allKeepTot") {
80 throw cms::Exception(
"Configuration",
"Unsupported emOnly = True when useEMInterpretation is " +
scenario);
88 auto out = std::make_unique<l1t::PFClusterCollection>();
89 auto outEgamma = std::make_unique<l1t::PFClusterCollection>();
90 std::unique_ptr<l1t::PFClusterCollection> outEm, outHad;
92 outEm = std::make_unique<l1t::PFClusterCollection>();
93 outHad = std::make_unique<l1t::PFClusterCollection>();
96 iEvent.getByToken(src_, multiclusters);
98 for (
auto it = multiclusters->
begin(0), ed = multiclusters->
end(0);
it != ed; ++
it) {
100 bool isEM = hasEmId_ ? preEmId_(*
it) : emOnly_;
114 it->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM),
it->eta(),
it->phi(),
hoe,
false);
117 outEgamma->push_back(egcluster);
121 if (scenario_ == UseEmInterp::EmOnly) {
123 float pt_new =
it->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
127 }
else if (scenario_ == UseEmInterp::AllKeepHad) {
128 float had_old =
pt - cluster.emEt();
130 float em_new =
it->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
131 float pt_new = had_old + em_new;
133 float hoe_new = em_new > 0 ? (had_old / em_new) : 999;
137 }
else if (scenario_ == UseEmInterp::AllKeepTot) {
139 float em_new =
it->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
140 float hoe_new = em_new > 0 ? (
it->pt() / em_new - 1) : -1;
146 if (!emVsPUID_.method().empty()) {
147 if (!emVsPUID_.passID(*
it, cluster)) {
151 if (!emOnly_ && !emVsPionID_.method().empty()) {
152 isEM = emVsPionID_.passID(*
it, cluster);
154 cluster.
setHwQual((isEM ? 1 : 0) + (
it->hwQual() << 1));
156 if (corrector_.valid())
157 corrector_.correctPt(cluster);
158 cluster.setPtError(resol_(cluster.pt(),
std::abs(cluster.eta())));
161 cluster.setAbsZBarycenter(fabs(
it->zBarycenter()));
162 cluster.setSigmaRR(
it->sigmaRRTot());
164 out->push_back(cluster);
T getParameter(std::string const &) const
unsigned int key(const_iterator &iter) const
PFClusterProducerFromHGC3DClusters(const edm::ParameterSet &)
const_iterator begin(int bx) const
BXVector< HGCalMulticluster > HGCalMulticlusterBxCollection
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
l1tpf::HGC3DClusterEgID emVsPionID_
l1tpf::HGC3DClusterEgID emVsPUID_
l1tpf::ParametricResolution resol_
l1tpf::corrector corrector_
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > src_
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
const_iterator end(int bx) const
void produce(edm::Event &, const edm::EventSetup &) override
StringCutObjectSelector< l1t::HGCalMulticluster > preEmId_
~PFClusterProducerFromHGC3DClusters() override