CMS 3D CMS Logo

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::unique_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(std::move(out));
57 }
58 
61 
63 
66 
67 #endif
RunNumber_t run() const
Definition: EventID.h:39
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
CalibratedPhotonProducerRun2T(const edm::ParameterSet &)
edm::EDGetTokenT< edm::View< T > > thePhotonToken
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
CalibratedPhotonProducerRun2T< reco::Photon > CalibratedPhotonProducerRun2
int iEvent
Definition: GenABIO.cc:230
CalibratedPhotonProducerRun2T< pat::Photon > CalibratedPatPhotonProducerRun2
PhotonEnergyCalibratorRun2 theEnCorrectorRun2
virtual void produce(edm::Event &, const edm::EventSetup &) override
void calibrate(SimplePhoton &photon, edm::StreamID const &id=edm::StreamID::invalidStreamID()) const
edm::EventID id() const
Definition: EventBase.h:58
HLT enums.
StreamID streamID() const
Definition: Event.h:81
long double T
def move(src, dest)
Definition: eostools.py:510