CMS 3D CMS Logo

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")),
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 {
59 
61  iEvent.getByToken(theElectronToken, in);
62 
63  std::unique_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(std::move(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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
CalibratedElectronProducerRun2T(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool init(const GBRForest *forest)
virtual void produce(edm::Event &, const edm::EventSetup &) override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void calibrate(SimpleElectron &electron, edm::StreamID const &id=edm::StreamID::invalidStreamID()) const
int iEvent
Definition: GenABIO.cc:230
CalibratedElectronProducerRun2T< pat::Electron > CalibratedPatElectronProducerRun2
const T & get() const
Definition: EventSetup.h:55
edm::EventID id() const
Definition: EventBase.h:60
HLT enums.
StreamID streamID() const
Definition: Event.h:81
long double T
T const * product() const
Definition: ESHandle.h:86
ElectronEnergyCalibratorRun2 theEnCorrectorRun2
def move(src, dest)
Definition: eostools.py:510