CMS 3D CMS Logo

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());
52  c->setCaloRecHit(Ptr<CaloRecHit>(hits, idx));
53  cands->push_back(c);
54  }
55  evt.put(std::move(cands));
56  }
57 
58  } // namespace modules
59 } // namespace reco
60 
63 
68 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
reco::modules::CaloRecHitCandidateProducer< ZDCRecHitCollection > ZDCRecHitCandidateProducer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
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 template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< HitCollection > srcToken_
source collection tag
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
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511