25 constexpr char sigmaIEtaIPhi_[] =
"sigmaIEtaIPhi";
32 constexpr char clusterMaxDR_[] =
"clusterMaxDR";
33 constexpr char clusterMaxDRDPhi_[] =
"clusterMaxDRDPhi";
34 constexpr char clusterMaxDRDEta_[] =
"clusterMaxDRDEta";
35 constexpr char clusterMaxDRRawEnergy_[] =
"clusterMaxDRRawEnergy";
36 constexpr char clusterRawEnergy0_[] =
"clusterRawEnergy0";
37 constexpr char clusterRawEnergy1_[] =
"clusterRawEnergy1";
38 constexpr char clusterRawEnergy2_[] =
"clusterRawEnergy2";
39 constexpr char clusterDPhiToSeed0_[] =
"clusterDPhiToSeed0";
40 constexpr char clusterDPhiToSeed1_[] =
"clusterDPhiToSeed1";
41 constexpr char clusterDPhiToSeed2_[] =
"clusterDPhiToSeed2";
42 constexpr char clusterDEtaToSeed0_[] =
"clusterDEtaToSeed0";
43 constexpr char clusterDEtaToSeed1_[] =
"clusterDEtaToSeed1";
44 constexpr char clusterDEtaToSeed2_[] =
"clusterDEtaToSeed2";
66 const std::vector<float> &
values,
71 const std::vector<int> & values,
74 std::unique_ptr<EcalClusterLazyToolsBase>
lazyTools;
92 use_full5x5_(iConfig.getParameter<bool>(
"useFull5x5")) {
98 (
"ebReducedRecHitCollection"));
100 (
"ebReducedRecHitCollectionMiniAOD"));
103 (
"eeReducedRecHitCollection"));
105 (
"eeReducedRecHitCollectionMiniAOD"));
108 (
"esReducedRecHitCollection"));
110 (
"esReducedRecHitCollectionMiniAOD"));
115 produces<edm::ValueMap<float> >(sigmaIEtaIPhi_);
116 produces<edm::ValueMap<float> >(eMax_);
117 produces<edm::ValueMap<float> >(e2nd_);
118 produces<edm::ValueMap<float> >(eTop_);
119 produces<edm::ValueMap<float> >(eBottom_);
120 produces<edm::ValueMap<float> >(eLeft_);
121 produces<edm::ValueMap<float> >(eRight_);
122 produces<edm::ValueMap<float> >(clusterMaxDR_);
123 produces<edm::ValueMap<float> >(clusterMaxDRDPhi_);
124 produces<edm::ValueMap<float> >(clusterMaxDRDEta_);
125 produces<edm::ValueMap<float> >(clusterMaxDRRawEnergy_);
126 produces<edm::ValueMap<float> >(clusterRawEnergy0_);
127 produces<edm::ValueMap<float> >(clusterRawEnergy1_);
128 produces<edm::ValueMap<float> >(clusterRawEnergy2_);
129 produces<edm::ValueMap<float> >(clusterDPhiToSeed0_);
130 produces<edm::ValueMap<float> >(clusterDPhiToSeed1_);
131 produces<edm::ValueMap<float> >(clusterDPhiToSeed2_);
132 produces<edm::ValueMap<float> >(clusterDEtaToSeed0_);
133 produces<edm::ValueMap<float> >(clusterDEtaToSeed1_);
134 produces<edm::ValueMap<float> >(clusterDEtaToSeed2_);
135 produces<edm::ValueMap<int> >(eleIPhi_);
136 produces<edm::ValueMap<int> >(eleIEta_);
137 produces<edm::ValueMap<float> >(eleCryPhi_);
138 produces<edm::ValueMap<float> >(eleCryEta_);
144 template<
typename LazyTools>
148 std::vector<float>& vsigmaIEtaIPhi,
149 std::vector<float>& veMax,
150 std::vector<float>& ve2nd,
151 std::vector<float>& veTop,
152 std::vector<float>& veBottom,
153 std::vector<float>& veLeft,
154 std::vector<float>& veRight,
155 std::vector<float>& vclusterMaxDR,
156 std::vector<float>& vclusterMaxDRDPhi,
157 std::vector<float>& vclusterMaxDRDEta,
158 std::vector<float>& vclusterMaxDRRawEnergy,
159 std::vector<float>& vclusterRawEnergy0,
160 std::vector<float>& vclusterRawEnergy1,
161 std::vector<float>& vclusterRawEnergy2,
162 std::vector<float>& vclusterDPhiToSeed0,
163 std::vector<float>& vclusterDPhiToSeed1,
164 std::vector<float>& vclusterDPhiToSeed2,
165 std::vector<float>& vclusterDEtaToSeed0,
166 std::vector<float>& vclusterDEtaToSeed1,
167 std::vector<float>& vclusterDEtaToSeed2,
168 std::vector<int>& veleIPhi,
169 std::vector<int>& veleIEta,
170 std::vector<float>& veleCryPhi,
171 std::vector<float>& veleCryEta) {
172 LazyTools* tools =
static_cast<LazyTools*
>(tools_tocast);
174 const auto& the_sc = iEle->superCluster();
175 const auto& theseed = the_sc->seed();
177 std::vector<float> vCov = tools->localCovariances( *theseed );
179 const float eMax = tools->eMax( *theseed );
180 const float e2nd = tools->e2nd( *theseed );
181 const float eTop = tools->eTop( *theseed );
182 const float eLeft = tools->eLeft( *theseed );
183 const float eRight = tools->eRight( *theseed );
184 const float eBottom = tools->eBottom( *theseed );
193 _ecalLocal.
localCoordsEB(*theseed, iSetup, cryEta, cryPhi, iEta, iPhi, dummy, dummy);
195 _ecalLocal.
localCoordsEE(*theseed, iSetup, cryEta, cryPhi, iEta, iPhi, dummy, dummy);
197 double see = (
isnan(vCov[0]) ? 0. :
sqrt(vCov[0]));
198 double spp = (
isnan(vCov[2]) ? 0. :
sqrt(vCov[2]));
201 sep = vCov[1] / (see * spp);
202 else if (vCov[1] > 0)
207 vsigmaIEtaIPhi.push_back(sep);
208 veMax.push_back(eMax);
209 ve2nd.push_back(e2nd);
210 veTop.push_back(eTop);
211 veBottom.push_back(eBottom);
212 veLeft.push_back(eLeft);
213 veRight.push_back(eRight);
214 veleIPhi.push_back(iPhi);
215 veleIEta.push_back(iEta);
216 veleCryPhi.push_back(cryPhi);
217 veleCryEta.push_back(cryEta);
220 auto clusend = the_sc->clustersEnd();
221 int numberOfClusters = the_sc->clusters().size();
223 std::vector<float> _clusterRawEnergy;
224 _clusterRawEnergy.resize(
std::max(3, numberOfClusters), 0);
225 std::vector<float> _clusterDEtaToSeed;
226 _clusterDEtaToSeed.resize(
std::max(3, numberOfClusters), 0);
227 std::vector<float> _clusterDPhiToSeed;
228 _clusterDPhiToSeed.resize(
std::max(3, numberOfClusters), 0);
229 float _clusterMaxDR = 999.;
230 float _clusterMaxDRDPhi = 999.;
231 float _clusterMaxDRDEta = 999.;
232 float _clusterMaxDRRawEnergy = 0.;
237 for(
auto clus = the_sc->clustersBegin(); clus != clusend; ++clus ) {
240 if(theseed == pclus )
242 _clusterRawEnergy.push_back(pclus->energy());
243 _clusterDPhiToSeed.push_back(
reco::deltaPhi(pclus->phi(),theseed->phi()));
244 _clusterDEtaToSeed.push_back(pclus->eta() - theseed->eta());
249 _clusterMaxDR = maxDR;
250 _clusterMaxDRDPhi = _clusterDPhiToSeed[iclus];
251 _clusterMaxDRDEta = _clusterDEtaToSeed[iclus];
252 _clusterMaxDRRawEnergy = _clusterRawEnergy[iclus];
258 vclusterMaxDR.push_back(_clusterMaxDR);
259 vclusterMaxDRDPhi.push_back(_clusterMaxDRDPhi);
260 vclusterMaxDRDEta.push_back(_clusterMaxDRDEta);
261 vclusterMaxDRRawEnergy.push_back(_clusterMaxDRRawEnergy);
262 vclusterRawEnergy0.push_back(_clusterRawEnergy[0]);
263 vclusterRawEnergy1.push_back(_clusterRawEnergy[1]);
264 vclusterRawEnergy2.push_back(_clusterRawEnergy[2]);
265 vclusterDPhiToSeed0.push_back(_clusterDPhiToSeed[0]);
266 vclusterDPhiToSeed1.push_back(_clusterDPhiToSeed[1]);
267 vclusterDPhiToSeed2.push_back(_clusterDPhiToSeed[2]);
268 vclusterDEtaToSeed0.push_back(_clusterDEtaToSeed[0]);
269 vclusterDEtaToSeed1.push_back(_clusterDEtaToSeed[1]);
270 vclusterDEtaToSeed2.push_back(_clusterDEtaToSeed[2]);
285 if( !
src.isValid() ) {
304 lazyTools = std::make_unique<noZS::EcalClusterLazyTools>(
iEvent, iSetup,
311 std::vector<float> sigmaIEtaIPhi;
312 std::vector<float> eMax;
313 std::vector<float> e2nd;
314 std::vector<float> eTop;
315 std::vector<float> eBottom;
316 std::vector<float> eLeft;
317 std::vector<float> eRight;
318 std::vector<float> clusterMaxDR;
319 std::vector<float> clusterMaxDRDPhi;
320 std::vector<float> clusterMaxDRDEta;
321 std::vector<float> clusterMaxDRRawEnergy;
322 std::vector<float> clusterRawEnergy0;
323 std::vector<float> clusterRawEnergy1;
324 std::vector<float> clusterRawEnergy2;
325 std::vector<float> clusterDPhiToSeed0;
326 std::vector<float> clusterDPhiToSeed1;
327 std::vector<float> clusterDPhiToSeed2;
328 std::vector<float> clusterDEtaToSeed0;
329 std::vector<float> clusterDEtaToSeed1;
330 std::vector<float> clusterDEtaToSeed2;
331 std::vector<int> eleIPhi;
332 std::vector<int> eleIEta;
333 std::vector<float> eleCryPhi;
334 std::vector<float> eleCryEta;
337 for (
size_t i = 0;
i <
src->size(); ++
i){
338 auto iEle =
src->ptrAt(
i);
341 calculateValues<noZS::EcalClusterLazyTools>(
lazyTools.get(),
354 clusterMaxDRRawEnergy,
369 calculateValues<EcalClusterLazyTools>(
lazyTools.get(),
382 clusterMaxDRRawEnergy,
428 const std::vector<float> &
values,
437 iEvent.
put(valMap, label);
442 const std::vector<int> &
values,
451 iEvent.
put(valMap, label);
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~ElectronRegressionValueMapProducer()
#define DEFINE_FWK_MODULE(type)
void insert(const H &h, I begin, I end)
double deltaR(const T1 &t1, const T2 &t2)
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
void addDefault(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::GsfElectron > > &handle, const std::vector< float > &values, const std::string &label) const
std::unique_ptr< EcalClusterLazyToolsBase > lazyTools
edm::EDGetToken srcMiniAOD_
double deltaPhi(double phi1, double phi2)
ElectronRegressionValueMapProducer(const edm::ParameterSet &)
void calculateValues(EcalClusterLazyToolsBase *tools_tocast, const edm::Ptr< reco::GsfElectron > &iEle, const edm::EventSetup &iSetup, std::vector< float > &vsigmaIEtaIPhi, std::vector< float > &veMax, std::vector< float > &ve2nd, std::vector< float > &veTop, std::vector< float > &veBottom, std::vector< float > &veLeft, std::vector< float > &veRight, std::vector< float > &vclusterMaxDR, std::vector< float > &vclusterMaxDRDPhi, std::vector< float > &vclusterMaxDRDEta, std::vector< float > &vclusterMaxDRRawEnergy, std::vector< float > &vclusterRawEnergy0, std::vector< float > &vclusterRawEnergy1, std::vector< float > &vclusterRawEnergy2, std::vector< float > &vclusterDPhiToSeed0, std::vector< float > &vclusterDPhiToSeed1, std::vector< float > &vclusterDPhiToSeed2, std::vector< float > &vclusterDEtaToSeed0, std::vector< float > &vclusterDEtaToSeed1, std::vector< float > &vclusterDEtaToSeed2, std::vector< int > &veleIPhi, std::vector< int > &veleIEta, std::vector< float > &veleCryPhi, std::vector< float > &veleCryEta)
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
virtual void produce(edm::Event &, const edm::EventSetup &) override
void localCoordsEB(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt) const
void localCoordsEE(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &xcry, float &ycry, int &ix, int &iy, float &thetatilt, float &phitilt) const