72 energyRegressionType_ = iConfig.
getParameter<uint32_t>(
"energyRegressionType");
80 hVertexToken_ = consumes<reco::VertexCollection>(
edm::InputTag(
"offlinePrimaryVertices"));
81 hRhoKt6PFJetsToken_ = consumes<double>(
edm::InputTag(
"kt6PFJets",
"rho"));
83 produces<edm::ValueMap<double> >(nameEnergyReg_);
84 produces<edm::ValueMap<double> >(nameEnergyErrorReg_);
96 regressionEvaluator->initialize(regressionInputFile_.c_str(),
type);
98 geomInitialized_ =
false;
105 delete regressionEvaluator;
111 assert(regressionEvaluator->isInitialized());
113 if (!geomInitialized_) {
116 ecalTopology_ = & (*theCaloTopology);
120 caloGeometry_ = & (*theCaloGeometry);
121 geomInitialized_ =
true;
131 iEvent.
getByToken(electronToken_,egCollection);
134 std::vector<double> energyValues;
135 std::vector<double> energyErrorValues;
136 energyValues.reserve(egCollection->size());
137 energyErrorValues.reserve(egCollection->size());
144 iEvent.
getByToken( recHitCollectionEBToken_, pEBRecHits );
145 iEvent.
getByToken( recHitCollectionEEToken_, pEERecHits );
151 iEvent.
getByToken(hVertexToken_,hVertexProduct);
156 for (reco::VertexCollection::const_iterator inV = inVertices.begin();
157 inV != inVertices.end(); ++inV) {
161 && inV->position().Rho() <= 2.0
162 && fabs(inV->z()) <= 24.0
173 iEvent.
getByToken(hRhoKt6PFJetsToken_, hRhoKt6PFJets);
174 rho = (*hRhoKt6PFJets);
177 for ( reco::GsfElectronCollection::const_iterator egIter = egCandidates.begin();
178 egIter != egCandidates.end(); ++egIter) {
182 recHits = pEBRecHits.
product();
184 recHits = pEERecHits.
product();
188 double energy=regressionEvaluator->calculateRegressionEnergy(&(*egIter),
193 double error=regressionEvaluator->calculateRegressionEnergyUncertainty(&(*egIter),
198 energyValues.push_back(energy);
199 energyErrorValues.push_back(error);
203 energyFiller.
insert( egCollection, energyValues.begin(), energyValues.end() );
206 energyErrorFiller.
insert( egCollection, energyErrorValues.begin(), energyErrorValues.end() );
207 energyErrorFiller.
fill();
209 iEvent.
put(regrEnergyMap,nameEnergyReg_);
210 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
T const * product() const
std::string regressionInputFile_
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
const CaloTopology * ecalTopology_