171 for (reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoEcalCandHandle->begin();
172 iRecoEcalCand != recoEcalCandHandle->end();
179 std::vector<const reco::GsfTrack*>
gsfTracks;
180 if (electronHandle.
isValid()) {
181 for (reco::ElectronCollection::const_iterator eleIt = electronHandle->begin(); eleIt != electronHandle->end();
183 if (eleIt->superCluster() == scRef) {
184 gsfTracks.push_back(&*eleIt->gsfTrack());
188 for (reco::GsfTrackCollection::const_iterator trkIt = gsfTracksHandle->begin(); trkIt != gsfTracksHandle->end();
194 if (scRefFromTrk == scRef) {
195 gsfTracks.push_back(&*trkIt);
200 int validHitsValue = 0;
201 float chi2Value = 9999999.;
202 float missingHitsValue = 9999999;
203 float dEtaInValue = 999999;
204 float dEtaSeedInValue = 999999;
205 float dPhiInValue = 999999;
206 float oneOverESuperMinusOneOverPValue = 999999;
207 float oneOverESeedMinusOneOverPValue = 999999;
209 const int nrTracks = gsfTracks.size();
212 const bool useDefaultValues =
215 if (rmCutsDueToNrTracks || useDefaultValues) {
219 missingHitsValue = 0;
220 validHitsValue = 100;
222 oneOverESuperMinusOneOverPValue = 0;
223 oneOverESeedMinusOneOverPValue = 0;
225 for (
size_t trkNr = 0; trkNr < gsfTracks.size(); trkNr++) {
226 GlobalPoint scPos(scRef->x(), scRef->y(), scRef->z());
230 float trkP = gsfTracks[trkNr]->p();
231 if (scRef->energy() != 0 && trkP != 0) {
232 if (fabs(1 / scRef->energy() - 1 / trkP) < oneOverESuperMinusOneOverPValue)
233 oneOverESuperMinusOneOverPValue = fabs(1 / scRef->energy() - 1 / trkP);
235 if (scRef->seed().isNonnull() && scRef->seed()->energy() != 0 && trkP != 0) {
236 if (fabs(1 / scRef->seed()->energy() - 1 / trkP) < oneOverESeedMinusOneOverPValue)
237 oneOverESeedMinusOneOverPValue = fabs(1 / scRef->seed()->energy() - 1 / trkP);
244 validHitsValue = gsfTracks[trkNr]->numberOfValidHits();
247 chi2Value = gsfTracks[trkNr]->normalizedChi2();
249 if (fabs(scAtVtx.dEta()) < dEtaInValue)
250 dEtaInValue = fabs(scAtVtx.dEta());
252 if (fabs(scAtVtx.dEta()) < dEtaSeedInValue)
253 dEtaSeedInValue = fabs(scAtVtx.dEta() - scRef->position().eta() + scRef->seed()->position().eta());
255 if (fabs(scAtVtx.dPhi()) < dPhiInValue)
256 dPhiInValue = fabs(scAtVtx.dPhi());
260 dEtaMap.insert(recoEcalCandRef, dEtaInValue);
261 dEtaSeedMap.insert(recoEcalCandRef, dEtaSeedInValue);
262 dPhiMap.insert(recoEcalCandRef, dPhiInValue);
263 oneOverESuperMinusOneOverPMap.insert(recoEcalCandRef, oneOverESuperMinusOneOverPValue);
264 oneOverESeedMinusOneOverPMap.insert(recoEcalCandRef, oneOverESeedMinusOneOverPValue);
265 missingHitsMap.insert(recoEcalCandRef, missingHitsValue);
266 validHitsMap.insert(recoEcalCandRef, validHitsValue);
267 chi2Map.insert(recoEcalCandRef, chi2Value);
270 auto dEtaMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaMap);
271 auto dEtaSeedMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaSeedMap);
272 auto dPhiMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dPhiMap);
273 auto oneOverESuperMinusOneOverPMapForEvent =
274 std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESuperMinusOneOverPMap);
275 auto oneOverESeedMinusOneOverPMapForEvent =
276 std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESeedMinusOneOverPMap);
277 auto missingHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(missingHitsMap);
278 auto validHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(validHitsMap);
279 auto chi2ForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(chi2Map);
284 iEvent.
put(
std::move(oneOverESuperMinusOneOverPMapForEvent),
"OneOESuperMinusOneOP");
285 iEvent.
put(
std::move(oneOverESeedMinusOneOverPMapForEvent),
"OneOESeedMinusOneOP");
286 iEvent.
put(
std::move(missingHitsForEvent),
"MissingHits");
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandTag_
const edm::EDGetTokenT< reco::GsfTrackCollection > inputCollectionTag2_
TrackExtrapolator trackExtrapolator_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
Abs< T >::type abs(const T &t)
const edm::EDGetTokenT< reco::ElectronCollection > inputCollectionTag1_
const bool useDefaultValuesForBarrel_
const bool useDefaultValuesForEndcap_
const Point & position() const
position
const int upperTrackNrToRemoveCut_