101 for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoEcalCandHandle->begin(); iRecoEcalCand != recoEcalCandHandle->end(); iRecoEcalCand++){
107 std::vector<const reco::GsfTrack*>
gsfTracks;
109 for(reco::ElectronCollection::const_iterator eleIt = electronHandle->begin(); eleIt != electronHandle->end(); eleIt++){
110 if(eleIt->superCluster()==scRef){
111 gsfTracks.push_back(&*eleIt->gsfTrack());
115 for(reco::GsfTrackCollection::const_iterator trkIt =gsfTracksHandle->begin();trkIt!=gsfTracksHandle->end();++trkIt){
120 if(scRefFromTrk==scRef){
121 gsfTracks.push_back(&*trkIt);
127 int validHitsValue = 0;
128 float chi2Value = 9999999.;
129 float missingHitsValue = 9999999;
130 float dEtaInValue=999999;
131 float dEtaSeedInValue=999999;
132 float dPhiInValue=999999;
133 float oneOverESuperMinusOneOverPValue=999999;
134 float oneOverESeedMinusOneOverPValue=999999;
136 const int nrTracks = gsfTracks.size();
142 if(rmCutsDueToNrTracks || useDefaultValues){
146 missingHitsValue = 0;
147 validHitsValue = 100;
149 oneOverESuperMinusOneOverPValue = 0;
150 oneOverESeedMinusOneOverPValue = 0;
152 for(
size_t trkNr=0;trkNr<gsfTracks.size();trkNr++){
154 GlobalPoint scPos(scRef->x(),scRef->y(),scRef->z());
158 float trkP = gsfTracks[trkNr]->p();
159 if(scRef->energy()!=0 && trkP!=0){
160 if(fabs(1/scRef->energy() - 1/trkP)<oneOverESuperMinusOneOverPValue) oneOverESuperMinusOneOverPValue =fabs(1/scRef->energy() - 1/trkP);
162 if(scRef->seed().isNonnull() && scRef->seed()->energy()!=0 && trkP!=0){
163 if(fabs(1/scRef->seed()->energy() - 1/trkP)<oneOverESeedMinusOneOverPValue) oneOverESeedMinusOneOverPValue =fabs(1/scRef->seed()->energy() - 1/trkP);
170 if (gsfTracks[trkNr]->numberOfValidHits() < validHitsValue)
171 validHitsValue = gsfTracks[trkNr]->numberOfValidHits();
173 if (gsfTracks[trkNr]->numberOfValidHits() < chi2Value)
174 chi2Value = gsfTracks[trkNr]->normalizedChi2();
176 if (fabs(scAtVtx.dEta())<dEtaInValue)
177 dEtaInValue=fabs(scAtVtx.dEta());
179 if (fabs(scAtVtx.dEta())<dEtaSeedInValue)
180 dEtaSeedInValue = fabs(scAtVtx.dEta()-scRef->position().eta()+scRef->seed()->position().eta());
182 if (fabs(scAtVtx.dPhi())<dPhiInValue)
183 dPhiInValue=fabs(scAtVtx.dPhi());
187 dEtaMap.insert(recoEcalCandRef, dEtaInValue);
188 dEtaSeedMap.insert(recoEcalCandRef, dEtaSeedInValue);
189 dPhiMap.insert(recoEcalCandRef, dPhiInValue);
190 oneOverESuperMinusOneOverPMap.insert(recoEcalCandRef,oneOverESuperMinusOneOverPValue);
191 oneOverESeedMinusOneOverPMap.insert(recoEcalCandRef,oneOverESeedMinusOneOverPValue);
192 missingHitsMap.insert(recoEcalCandRef, missingHitsValue);
193 validHitsMap.insert(recoEcalCandRef, validHitsValue);
194 chi2Map.insert(recoEcalCandRef, chi2Value);
197 auto dEtaMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaMap);
198 auto dEtaSeedMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaSeedMap);
199 auto dPhiMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dPhiMap);
200 auto oneOverESuperMinusOneOverPMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESuperMinusOneOverPMap);
201 auto oneOverESeedMinusOneOverPMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESeedMinusOneOverPMap);
202 auto missingHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(missingHitsMap);
203 auto validHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(validHitsMap);
204 auto chi2ForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(chi2Map);
207 iEvent.
put(
std::move(dEtaSeedMapForEvent),
"DetaSeed" );
209 iEvent.
put(
std::move(oneOverESuperMinusOneOverPMapForEvent),
"OneOESuperMinusOneOP");
210 iEvent.
put(
std::move(oneOverESeedMinusOneOverPMapForEvent),
"OneOESeedMinusOneOP");
211 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
bool isBarrel(GeomDetEnumerators::SubDetector m)
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_