test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CalibratedElectronProducersRun2.cc
Go to the documentation of this file.
1 #ifndef CalibratedElectronProducerRun2_h
2 #define CalibratedElectronProducerRun2_h
3 
10 
13 
18 
19 #include <vector>
20 
21 template<typename T>
23 {
24  public:
27  virtual void produce( edm::Event &, const edm::EventSetup & ) override ;
28 
29  private:
33 
36 };
37 
38 template<typename T>
40  theElectronToken(consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("electrons"))),
41  theGBRForestName(conf.getParameter<std::string>("gbrForestName")),
42  theEpCombinationTool(),
43  theEnCorrectorRun2(theEpCombinationTool, conf.getParameter<bool>("isMC"), conf.getParameter<bool>("isSynchronization"), conf.getParameter<std::string>("correctionFile"))
44 {
45  produces<std::vector<T> >();
46 }
47 
48 template<typename T>
50 {
51 }
52 
53 template<typename T>
54 void
56 {
57  iSetup.get<GBRWrapperRcd>().get(theGBRForestName, theGBRForestHandle);
58  theEpCombinationTool.init(theGBRForestHandle.product());
59 
61  iEvent.getByToken(theElectronToken, in);
62 
63  std::auto_ptr<std::vector<T> > out(new std::vector<T>());
64  out->reserve(in->size());
65 
66  for (const T &ele : *in) {
67  out->push_back(ele);
68  theEnCorrectorRun2.calibrate(out->back(), iEvent.id().run(), iEvent.streamID());
69  }
70 
71  iEvent.put(out);
72 }
73 
76 
78 
81 
82 #endif
RunNumber_t run() const
Definition: EventID.h:39
CalibratedElectronProducerRun2T< reco::GsfElectron > CalibratedElectronProducerRun2
edm::EDGetTokenT< edm::View< T > > theElectronToken
CalibratedElectronProducerRun2T(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
CalibratedElectronProducerRun2T< pat::Electron > CalibratedPatElectronProducerRun2
const T & get() const
Definition: EventSetup.h:56
edm::EventID id() const
Definition: EventBase.h:59
StreamID streamID() const
Definition: Event.h:80
long double T
ElectronEnergyCalibratorRun2 theEnCorrectorRun2