102 for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoEcalCandHandle->begin(); iRecoEcalCand != recoEcalCandHandle->end(); iRecoEcalCand++){
108 std::vector<const reco::GsfTrack*>
gsfTracks;
110 for(reco::ElectronCollection::const_iterator eleIt = electronHandle->begin(); eleIt != electronHandle->end(); eleIt++){
111 if(eleIt->superCluster()==scRef){
112 gsfTracks.push_back(&*eleIt->gsfTrack());
116 for(reco::GsfTrackCollection::const_iterator trkIt =gsfTracksHandle->begin();trkIt!=gsfTracksHandle->end();++trkIt){
121 if(scRefFromTrk==scRef){
122 gsfTracks.push_back(&*trkIt);
128 int validHitsValue = 0;
129 float chi2Value = 9999999.;
130 float missingHitsValue = 9999999;
131 float dEtaInValue=999999;
132 float dEtaSeedInValue=999999;
133 float dPhiInValue=999999;
134 float oneOverESuperMinusOneOverPValue=999999;
135 float oneOverESeedMinusOneOverPValue=999999;
144 missingHitsValue = 0;
145 validHitsValue = 100;
147 oneOverESuperMinusOneOverPValue = 0;
148 oneOverESeedMinusOneOverPValue = 0;
150 for(
size_t trkNr=0;trkNr<gsfTracks.size();trkNr++){
152 GlobalPoint scPos(scRef->x(),scRef->y(),scRef->z());
156 float trkP = gsfTracks[trkNr]->p();
157 if(scRef->energy()!=0 && trkP!=0){
158 if(fabs(1/scRef->energy() - 1/trkP)<oneOverESuperMinusOneOverPValue) oneOverESuperMinusOneOverPValue =fabs(1/scRef->energy() - 1/trkP);
160 if(scRef->seed().isNonnull() && scRef->seed()->energy()!=0 && trkP!=0){
161 if(fabs(1/scRef->seed()->energy() - 1/trkP)<oneOverESeedMinusOneOverPValue) oneOverESeedMinusOneOverPValue =fabs(1/scRef->seed()->energy() - 1/trkP);
168 if (gsfTracks[trkNr]->numberOfValidHits() < validHitsValue)
169 validHitsValue = gsfTracks[trkNr]->numberOfValidHits();
171 if (gsfTracks[trkNr]->numberOfValidHits() < chi2Value)
172 chi2Value = gsfTracks[trkNr]->normalizedChi2();
174 if (fabs(scAtVtx.dEta())<dEtaInValue)
175 dEtaInValue=fabs(scAtVtx.dEta());
177 if (fabs(scAtVtx.dEta())<dEtaSeedInValue)
178 dEtaSeedInValue = fabs(scAtVtx.dEta()-scRef->position().eta()+scRef->seed()->position().eta());
180 if (fabs(scAtVtx.dPhi())<dPhiInValue)
181 dPhiInValue=fabs(scAtVtx.dPhi());
185 dEtaMap.insert(recoEcalCandRef, dEtaInValue);
186 dEtaSeedMap.insert(recoEcalCandRef, dEtaSeedInValue);
187 dPhiMap.insert(recoEcalCandRef, dPhiInValue);
188 oneOverESuperMinusOneOverPMap.insert(recoEcalCandRef,oneOverESuperMinusOneOverPValue);
189 oneOverESeedMinusOneOverPMap.insert(recoEcalCandRef,oneOverESeedMinusOneOverPValue);
190 missingHitsMap.insert(recoEcalCandRef, missingHitsValue);
191 validHitsMap.insert(recoEcalCandRef, validHitsValue);
192 chi2Map.insert(recoEcalCandRef, chi2Value);
195 auto dEtaMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaMap);
196 auto dEtaSeedMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaSeedMap);
197 auto dPhiMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dPhiMap);
198 auto oneOverESuperMinusOneOverPMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESuperMinusOneOverPMap);
199 auto oneOverESeedMinusOneOverPMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESeedMinusOneOverPMap);
200 auto missingHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(missingHitsMap);
201 auto validHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(validHitsMap);
202 auto chi2ForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(chi2Map);
205 iEvent.
put(
std::move(dEtaSeedMapForEvent),
"DetaSeed" );
207 iEvent.
put(
std::move(oneOverESuperMinusOneOverPMapForEvent),
"OneOESuperMinusOneOP");
208 iEvent.
put(
std::move(oneOverESeedMinusOneOverPMapForEvent),
"OneOESeedMinusOneOP");
209 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_
const int lowerTrackNrToRemoveCut_