test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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::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  auto_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( cands );
54  }
55 
56  }
57 }
58 
61 
66 
tuple cfg
Definition: looper.py:293
reco::modules::CaloRecHitCandidateProducer< ZDCRecHitCollection > ZDCRecHitCandidateProducer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#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
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
float energy() const
Definition: CaloRecHit.h:17
void setCaloRecHit(const CaloRecHitRef &r)
set CaloRecHit reference
CaloRecHitCandidateProducer(const edm::ParameterSet &cfg)
constructor
reco::modules::CaloRecHitCandidateProducer< HBHERecHitCollection > HBHERecHitCandidateProducer
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
Geom::Phi< T > phi() const
tuple size
Write out results.
def template
Definition: svgfig.py:520
void produce(edm::Event &, const edm::EventSetup &) override
process one event