CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloRecHitCandidateProducer.cc
Go to the documentation of this file.
4 
5 namespace reco {
6  namespace modules {
7 
8  template <typename HitCollection>
10  public:
13  : srcToken_(consumes<HitCollection>(cfg.template getParameter<edm::InputTag>("src"))) {}
16 
17  private:
19  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
22  };
23  } // namespace modules
24 } // namespace reco
25 
29 
30 namespace reco {
31  namespace modules {
32 
33  template <typename HitCollection>
35  edm::Event &evt,
36  const edm::EventSetup &) const {
37  using namespace edm;
38  using namespace reco;
39  using namespace std;
41  evt.getByToken(srcToken_, hits);
42  unique_ptr<CandidateCollection> cands(new CandidateCollection);
43  size_t size = hits->size();
44  cands->reserve(size);
45  for (size_t idx = 0; idx != size; ++idx) {
46  const CaloRecHit &hit = (*hits)[idx];
48  double eta = 0, phi = 0, energy = hit.energy();
49  math::RhoEtaPhiVector p(1, eta, phi);
50  p *= (energy / p.r());
53  cands->push_back(c);
54  }
55  evt.put(std::move(cands));
56  }
57 
58  } // namespace modules
59 } // namespace reco
60 
63 
68 
constexpr float energy() const
Definition: CaloRecHit.h:29
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EventSetup & c
tuple cfg
Definition: looper.py:296
reco::modules::CaloRecHitCandidateProducer< ZDCRecHitCollection > ZDCRecHitCandidateProducer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:33
reco::modules::CaloRecHitCandidateProducer< HORecHitCollection > HORecHitCandidateProducer
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
reco::modules::CaloRecHitCandidateProducer< HFRecHitCollection > HFRecHitCandidateProducer
def move
Definition: eostools.py:511
const edm::EDGetTokenT< HitCollection > srcToken_
source collection tag
void setCaloRecHit(const CaloRecHitRef &r)
set CaloRecHit reference
CaloRecHitCandidateProducer(const edm::ParameterSet &cfg)
constructor
reco::modules::CaloRecHitCandidateProducer< HBHERecHitCollection > HBHERecHitCandidateProducer
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
process one event
std::vector< Hit > HitCollection
Definition: HitCollection.h:35
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
tuple size
Write out results.
def template
Definition: svgfig.py:521