CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CalibratedPhotonProducersRun2.cc
Go to the documentation of this file.
1 #ifndef CalibratedPhotonProducer_h
2 #define CalibratedPhotonProducer_h
3 
10 
14 
15 #include <vector>
16 
17 template<typename T>
19 public:
22  virtual void produce( edm::Event &, const edm::EventSetup & ) override ;
23 
24 private:
27 };
28 
29 template<typename T>
31  thePhotonToken(consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("photons"))),
32  theEnCorrectorRun2(conf.getParameter<bool>("isMC"), conf.getParameter<bool>("isSynchronization"), conf.getParameter<std::string >("correctionFile")) {
33 
34  produces<std::vector<T> >();
35 }
36 
37 template<typename T>
39 {}
40 
41 template<typename T>
42 void
44 
46  iEvent.getByToken(thePhotonToken, in);
47 
48  std::auto_ptr<std::vector<T> > out(new std::vector<T>());
49  out->reserve(in->size());
50 
51  for (const T &ele : *in) {
52  out->push_back(ele);
53  theEnCorrectorRun2.calibrate(out->back(), iEvent.id().run(), iEvent.streamID());
54  }
55 
56  iEvent.put(out);
57 }
58 
61 
63 
66 
67 #endif
RunNumber_t run() const
Definition: EventID.h:39
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
CalibratedPhotonProducerRun2T(const edm::ParameterSet &)
edm::EDGetTokenT< edm::View< T > > thePhotonToken
CalibratedPhotonProducerRun2T< reco::Photon > CalibratedPhotonProducerRun2
int iEvent
Definition: GenABIO.cc:230
CalibratedPhotonProducerRun2T< pat::Photon > CalibratedPatPhotonProducerRun2
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
PhotonEnergyCalibratorRun2 theEnCorrectorRun2
virtual void produce(edm::Event &, const edm::EventSetup &) override
edm::EventID id() const
Definition: EventBase.h:59
StreamID streamID() const
Definition: Event.h:80
long double T