73 energyRegressionType_ = iConfig.
getParameter<uint32_t>(
"energyRegressionType");
81 hVertexToken_ = consumes<reco::VertexCollection>(
edm::InputTag(
"offlinePrimaryVertices"));
82 hRhoKt6PFJetsToken_ = consumes<double>(
edm::InputTag(
"kt6PFJets",
"rho"));
84 produces<edm::ValueMap<double> >(nameEnergyReg_);
85 produces<edm::ValueMap<double> >(nameEnergyErrorReg_);
97 regressionEvaluator->initialize(regressionInputFile_.c_str(),
type);
99 geomInitialized_ =
false;
106 delete regressionEvaluator;
112 assert(regressionEvaluator->isInitialized());
114 if (!geomInitialized_) {
117 ecalTopology_ = & (*theCaloTopology);
121 caloGeometry_ = & (*theCaloGeometry);
122 geomInitialized_ =
true;
132 iEvent.
getByToken(electronToken_,egCollection);
135 std::vector<double> energyValues;
136 std::vector<double> energyErrorValues;
137 energyValues.reserve(egCollection->size());
138 energyErrorValues.reserve(egCollection->size());
145 iEvent.
getByToken( recHitCollectionEBToken_, pEBRecHits );
146 iEvent.
getByToken( recHitCollectionEEToken_, pEERecHits );
152 iEvent.
getByToken(hVertexToken_,hVertexProduct);
157 for (reco::VertexCollection::const_iterator inV = inVertices.begin();
158 inV != inVertices.end(); ++inV) {
162 && inV->position().Rho() <= 2.0
163 && fabs(inV->z()) <= 24.0
174 iEvent.
getByToken(hRhoKt6PFJetsToken_, hRhoKt6PFJets);
175 rho = (*hRhoKt6PFJets);
178 for ( reco::GsfElectronCollection::const_iterator egIter = egCandidates.begin();
179 egIter != egCandidates.end(); ++egIter) {
183 recHits = pEBRecHits.
product();
185 recHits = pEERecHits.
product();
189 double energy=regressionEvaluator->calculateRegressionEnergy(&(*egIter),
194 double error=regressionEvaluator->calculateRegressionEnergyUncertainty(&(*egIter),
199 energyValues.push_back(energy);
200 energyErrorValues.push_back(error);
204 energyFiller.
insert( egCollection, energyValues.begin(), energyValues.end() );
207 energyErrorFiller.
insert( egCollection, energyErrorValues.begin(), energyErrorValues.end() );
208 energyErrorFiller.
fill();
210 iEvent.
put(regrEnergyMap,nameEnergyReg_);
211 iEvent.
put(regrEnergyErrorMap,nameEnergyErrorReg_);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ElectronEnergyRegressionEvaluate * regressionEvaluator
~ElectronRegressionEnergyProducer()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
uint32_t energyRegressionType_
#define DEFINE_FWK_MODULE(type)
virtual bool filter(edm::Event &, const edm::EventSetup &)
void insert(const H &h, I begin, I end)
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEEToken_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
ElectronRegressionEnergyProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::VertexCollection > hVertexToken_
const CaloGeometry * caloGeometry_
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEBToken_
std::string nameEnergyErrorReg_
std::string nameEnergyReg_
edm::EDGetTokenT< double > hRhoKt6PFJetsToken_
ElectronEnergyRegressionType
std::string regressionInputFile_
T const * product() const
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
const CaloTopology * ecalTopology_