74 electronToken_{consumes<reco::ElectronCollection>(
config.getParameter<
edm::InputTag>(
"inputCollection"))},
75 gsfTrackToken_{consumes<reco::GsfTrackCollection>(
config.getParameter<
edm::InputTag>(
"inputCollection"))},
76 beamSpotToken_{consumes<reco::BeamSpot>(
config.getParameter<
edm::InputTag>(
"beamSpotProducer"))},
77 magneticFieldToken_{esConsumes<MagneticField, IdealMagneticFieldRecord>()},
78 trackerGeometryToken_{esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()},
79 upperTrackNrToRemoveCut_{
config.getParameter<
int>(
"upperTrackNrToRemoveCut")},
80 lowerTrackNrToRemoveCut_{
config.getParameter<
int>(
"lowerTrackNrToRemoveCut")},
81 useDefaultValuesForBarrel_{
config.getParameter<
bool>(
"useDefaultValuesForBarrel")},
82 useDefaultValuesForEndcap_{
config.getParameter<
bool>(
"useDefaultValuesForEndcap")},
83 dEtaMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Deta").setBranchAlias(
"deta")},
84 dEtaSeedMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"DetaSeed").setBranchAlias(
"detaseed")},
85 dPhiMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Dphi").setBranchAlias(
"dphi")},
86 oneOverESuperMinusOneOverPMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"OneOESuperMinusOneOP")},
87 oneOverESeedMinusOneOverPMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"OneOESeedMinusOneOP")},
88 missingHitsMapPutToken_{
89 produces<reco::RecoEcalCandidateIsolationMap>(
"MissingHits").setBranchAlias(
"missinghits")},
90 validHitsMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"ValidHits").setBranchAlias(
"validhits")},
91 nLayerITMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"NLayerIT").setBranchAlias(
"nlayerit")},
92 chi2MapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Chi2").setBranchAlias(
"chi2")} {}
99 desc.
add<
int>((
"upperTrackNrToRemoveCut"), 9999);
100 desc.
add<
int>((
"lowerTrackNrToRemoveCut"), -1);
101 desc.
add<
bool>((
"useDefaultValuesForBarrel"),
false);
102 desc.
add<
bool>((
"useDefaultValuesForEndcap"),
false);
104 descriptions.
add(
"hltEgammaHLTGsfTrackVarProducer", desc);
127 for (
unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoEcalCandHandle->size(); ++iRecoEcalCand) {
132 std::vector<const reco::GsfTrack*>
gsfTracks;
134 for (
auto const& ele : *electronHandle) {
135 if (ele.superCluster() == scRef) {
136 gsfTracks.push_back(ele.gsfTrack().get());
148 int nLayerITValue = -1;
149 int validHitsValue = 0;
150 float chi2Value = 9999999.;
151 float missingHitsValue = 9999999;
152 float dEtaInValue = 999999;
153 float dEtaSeedInValue = 999999;
154 float dPhiInValue = 999999;
155 float oneOverESuperMinusOneOverPValue = 999999;
156 float oneOverESeedMinusOneOverPValue = 999999;
161 const bool useDefaultValues =
std::abs(recoEcalCandRef->eta()) < 1.479
165 if (rmCutsDueToNrTracks || useDefaultValues) {
170 missingHitsValue = 0;
171 validHitsValue = 100;
173 oneOverESuperMinusOneOverPValue = 0;
174 oneOverESeedMinusOneOverPValue = 0;
176 for (
size_t trkNr = 0; trkNr <
gsfTracks.size(); trkNr++) {
177 GlobalPoint scPos(scRef->x(), scRef->y(), scRef->z());
183 auto posTSOS = extrapolator.extrapolate(innTSOS, scPos);
187 EleRelPointPair scAtVtx(scRef->position(), trackExtrapToSC, beamSpotPosition);
190 if (scRef->energy() != 0 && trkP != 0) {
191 if (
std::abs(1 / scRef->energy() - 1 / trkP) < oneOverESuperMinusOneOverPValue) {
192 oneOverESuperMinusOneOverPValue =
std::abs(1 / scRef->energy() - 1 / trkP);
195 if (scRef->seed().
isNonnull() && scRef->seed()->energy() != 0 && trkP != 0) {
196 if (
std::abs(1 / scRef->seed()->energy() - 1 / trkP) < oneOverESeedMinusOneOverPValue) {
197 oneOverESeedMinusOneOverPValue =
std::abs(1 / scRef->seed()->energy() - 1 / trkP);
206 validHitsValue =
gsfTracks[trkNr]->numberOfValidHits();
210 if (
gsfTracks[trkNr]->hitPattern().pixelLayersWithMeasurement() > nLayerITValue) {
211 nLayerITValue =
gsfTracks[trkNr]->hitPattern().pixelLayersWithMeasurement();
215 chi2Value =
gsfTracks[trkNr]->normalizedChi2();
218 if (
std::abs(scAtVtx.dEta()) < dEtaInValue) {
220 dEtaInValue =
std::abs(scAtVtx.dEta());
223 if (
std::abs(scAtVtx.dEta()) < dEtaSeedInValue) {
224 dEtaSeedInValue =
std::abs(scAtVtx.dEta() - scRef->position().eta() + scRef->seed()->position().eta());
227 if (
std::abs(scAtVtx.dPhi()) < dPhiInValue) {
229 dPhiInValue =
std::abs(scAtVtx.dPhi());
234 dEtaMap.
insert(recoEcalCandRef, dEtaInValue);
235 dEtaSeedMap.
insert(recoEcalCandRef, dEtaSeedInValue);
236 dPhiMap.
insert(recoEcalCandRef, dPhiInValue);
237 oneOverESuperMinusOneOverPMap.
insert(recoEcalCandRef, oneOverESuperMinusOneOverPValue);
238 oneOverESeedMinusOneOverPMap.
insert(recoEcalCandRef, oneOverESeedMinusOneOverPValue);
239 missingHitsMap.
insert(recoEcalCandRef, missingHitsValue);
240 validHitsMap.
insert(recoEcalCandRef, validHitsValue);
241 nLayerITMap.
insert(recoEcalCandRef, nLayerITValue);
242 chi2Map.
insert(recoEcalCandRef, chi2Value);