CMS 3D CMS Logo

PFClusterProducerFromL1EGClusters.cc
Go to the documentation of this file.
6 
11 
12 namespace l1tpf {
14  public:
17 
18  private:
20  double etCut_;
23 
24  void produce(edm::Event &, const edm::EventSetup &) override;
25 
26  }; // class
27 } // namespace l1tpf
28 
30  : src_(consumes<BXVector<l1t::EGamma>>(iConfig.getParameter<edm::InputTag>("src"))),
31  etCut_(iConfig.getParameter<double>("etMin")),
32  corrector_(iConfig.getParameter<std::string>("corrector"), -1),
33  resol_(iConfig.getParameter<edm::ParameterSet>("resol")) {
34  produces<l1t::PFClusterCollection>();
35 }
36 
38  std::unique_ptr<l1t::PFClusterCollection> out(new l1t::PFClusterCollection());
40  iEvent.getByToken(src_, clusters);
41 
42  unsigned int index = 0;
43  for (auto it = clusters->begin(), ed = clusters->end(); it != ed; ++it, ++index) {
44  if (it->pt() <= etCut_)
45  continue;
46 
47  l1t::PFCluster cluster(
48  it->pt(), it->eta(), it->phi(), /*hOverE=*/0., /*isEM=*/true); // it->hovere() seems to return random values
49  if (corrector_.valid())
50  corrector_.correctPt(cluster);
51  cluster.setPtError(resol_(cluster.pt(), std::abs(cluster.eta())));
52  cluster.setHwQual(it->hwQual());
53  out->push_back(cluster);
54  out->back().addConstituent(edm::Ptr<l1t::L1Candidate>(clusters, index));
55  }
56 
57  iEvent.put(std::move(out));
58 }
delete x;
Definition: CaloConfig.h:22
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< l1t::PFCluster > PFClusterCollection
Definition: PFCluster.h:74
HLT enums.
void setPtError(float ptError)
Definition: PFCluster.h:57
void produce(edm::Event &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< BXVector< l1t::EGamma > > src_