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::Event &, const edm::EventSetup&) override;
22  };
23  }
24 }
25 
29 
30 namespace reco {
31  namespace modules {
32 
33  template<typename HitCollection>
35  using namespace edm;
36  using namespace reco;
37  using namespace std;
39  evt.getByToken( srcToken_, hits );
40  unique_ptr<CandidateCollection> cands( new CandidateCollection );
41  size_t size = hits->size();
42  cands->reserve( size );
43  for( size_t idx = 0; idx != size; ++ idx ) {
44  const CaloRecHit & hit = (*hits)[ idx ];
46  double eta = 0, phi = 0, energy = hit.energy();
47  math::RhoEtaPhiVector p( 1, eta, phi );
48  p *= ( energy / p.r() );
49  CaloRecHitCandidate * c = new CaloRecHitCandidate( Candidate::LorentzVector( p.x(), p.y(), p.z(), energy ) );
51  cands->push_back( c );
52  }
53  evt.put(std::move(cands));
54  }
55 
56  }
57 }
58 
61 
66 
size
Write out results.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
reco::modules::CaloRecHitCandidateProducer< ZDCRecHitCollection > ZDCRecHitCandidateProducer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< HitCollection > srcToken_
source collection tag
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:32
reco::modules::CaloRecHitCandidateProducer< HORecHitCollection > HORecHitCandidateProducer
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
reco::modules::CaloRecHitCandidateProducer< HFRecHitCollection > HFRecHitCandidateProducer
float energy() const
Definition: CaloRecHit.h:17
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:520
void setCaloRecHit(const CaloRecHitRef &r)
set CaloRecHit reference
CaloRecHitCandidateProducer(const edm::ParameterSet &cfg)
constructor
reco::modules::CaloRecHitCandidateProducer< HBHERecHitCollection > HBHERecHitCandidateProducer
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:510
void produce(edm::Event &, const edm::EventSetup &) override
process one event