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;
137 const int nrTracks = gsfTracks.size();
143 if(rmCutsDueToNrTracks || useDefaultValues){
147 missingHitsValue = 0;
148 validHitsValue = 100;
150 oneOverESuperMinusOneOverPValue = 0;
151 oneOverESeedMinusOneOverPValue = 0;
153 for(
size_t trkNr=0;trkNr<gsfTracks.size();trkNr++){
155 GlobalPoint scPos(scRef->x(),scRef->y(),scRef->z());
159 float trkP = gsfTracks[trkNr]->p();
160 if(scRef->energy()!=0 && trkP!=0){
161 if(fabs(1/scRef->energy() - 1/trkP)<oneOverESuperMinusOneOverPValue) oneOverESuperMinusOneOverPValue =fabs(1/scRef->energy() - 1/trkP);
163 if(scRef->seed().isNonnull() && scRef->seed()->energy()!=0 && trkP!=0){
164 if(fabs(1/scRef->seed()->energy() - 1/trkP)<oneOverESeedMinusOneOverPValue) oneOverESeedMinusOneOverPValue =fabs(1/scRef->seed()->energy() - 1/trkP);
171 if (gsfTracks[trkNr]->numberOfValidHits() < validHitsValue)
172 validHitsValue = gsfTracks[trkNr]->numberOfValidHits();
174 if (gsfTracks[trkNr]->numberOfValidHits() < chi2Value)
175 chi2Value = gsfTracks[trkNr]->normalizedChi2();
177 if (fabs(scAtVtx.dEta())<dEtaInValue)
178 dEtaInValue=fabs(scAtVtx.dEta());
180 if (fabs(scAtVtx.dEta())<dEtaSeedInValue)
181 dEtaSeedInValue = fabs(scAtVtx.dEta()-scRef->position().eta()+scRef->seed()->position().eta());
183 if (fabs(scAtVtx.dPhi())<dPhiInValue)
184 dPhiInValue=fabs(scAtVtx.dPhi());
188 dEtaMap.insert(recoEcalCandRef, dEtaInValue);
189 dEtaSeedMap.insert(recoEcalCandRef, dEtaSeedInValue);
190 dPhiMap.insert(recoEcalCandRef, dPhiInValue);
191 oneOverESuperMinusOneOverPMap.insert(recoEcalCandRef,oneOverESuperMinusOneOverPValue);
192 oneOverESeedMinusOneOverPMap.insert(recoEcalCandRef,oneOverESeedMinusOneOverPValue);
193 missingHitsMap.insert(recoEcalCandRef, missingHitsValue);
194 validHitsMap.insert(recoEcalCandRef, validHitsValue);
195 chi2Map.insert(recoEcalCandRef, chi2Value);
198 auto dEtaMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaMap);
199 auto dEtaSeedMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaSeedMap);
200 auto dPhiMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dPhiMap);
201 auto oneOverESuperMinusOneOverPMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESuperMinusOneOverPMap);
202 auto oneOverESeedMinusOneOverPMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESeedMinusOneOverPMap);
203 auto missingHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(missingHitsMap);
204 auto validHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(validHitsMap);
205 auto chi2ForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(chi2Map);
208 iEvent.
put(
std::move(dEtaSeedMapForEvent),
"DetaSeed" );
210 iEvent.
put(
std::move(oneOverESuperMinusOneOverPMapForEvent),
"OneOESuperMinusOneOP");
211 iEvent.
put(
std::move(oneOverESeedMinusOneOverPMapForEvent),
"OneOESeedMinusOneOP");
212 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_