75 electronToken_{consumes<reco::ElectronCollection>(
config.getParameter<
edm::InputTag>(
"inputCollection"))},
76 gsfTrackToken_{consumes<reco::GsfTrackCollection>(
config.getParameter<
edm::InputTag>(
"inputCollection"))},
77 beamSpotToken_{consumes<reco::BeamSpot>(
config.getParameter<
edm::InputTag>(
"beamSpotProducer"))},
80 upperTrackNrToRemoveCut_{
config.getParameter<
int>(
"upperTrackNrToRemoveCut")},
81 lowerTrackNrToRemoveCut_{
config.getParameter<
int>(
"lowerTrackNrToRemoveCut")},
82 useDefaultValuesForBarrel_{
config.getParameter<
bool>(
"useDefaultValuesForBarrel")},
83 useDefaultValuesForEndcap_{
config.getParameter<
bool>(
"useDefaultValuesForEndcap")},
84 dEtaMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Deta").setBranchAlias(
"deta")},
85 dEtaSeedMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"DetaSeed").setBranchAlias(
"detaseed")},
86 dPhiMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Dphi").setBranchAlias(
"dphi")},
87 oneOverESuperMinusOneOverPMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"OneOESuperMinusOneOP")},
88 oneOverESeedMinusOneOverPMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"OneOESeedMinusOneOP")},
89 missingHitsMapPutToken_{
90 produces<reco::RecoEcalCandidateIsolationMap>(
"MissingHits").setBranchAlias(
"missinghits")},
91 validHitsMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"ValidHits").setBranchAlias(
"validhits")},
92 nLayerITMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"NLayerIT").setBranchAlias(
"nlayerit")},
93 chi2MapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Chi2").setBranchAlias(
"chi2")} {}
100 desc.add<
int>((
"upperTrackNrToRemoveCut"), 9999);
101 desc.add<
int>((
"lowerTrackNrToRemoveCut"), -1);
102 desc.add<
bool>((
"useDefaultValuesForBarrel"),
false);
103 desc.add<
bool>((
"useDefaultValuesForEndcap"),
false);
105 descriptions.
add(
"hltEgammaHLTGsfTrackVarProducer",
desc);
128 for (
unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoEcalCandHandle->size(); ++iRecoEcalCand) {
134 std::vector<const reco::GsfTrack*>
gsfTracks;
136 for (
auto const& ele : *electronHandle) {
137 if (ele.superCluster() == scRef) {
138 gsfTracks.push_back(ele.gsfTrack().get());
150 int nLayerITValue = -1;
151 int validHitsValue = 0;
152 float chi2Value = 9999999.;
153 float missingHitsValue = 9999999;
154 float dEtaInValue = 999999;
155 float dEtaSeedInValue = 999999;
156 float dPhiInValue = 999999;
157 float oneOverESuperMinusOneOverPValue = 999999;
158 float oneOverESeedMinusOneOverPValue = 999999;
163 const bool useDefaultValues =
std::abs(recoEcalCandRef->eta()) < 1.479
167 if (rmCutsDueToNrTracks || useDefaultValues) {
172 missingHitsValue = 0;
173 validHitsValue = 100;
175 oneOverESuperMinusOneOverPValue = 0;
176 oneOverESeedMinusOneOverPValue = 0;
178 for (
size_t trkNr = 0; trkNr <
gsfTracks.size(); trkNr++) {
179 GlobalPoint scPos(scRef->x(), scRef->y(), scRef->z());
185 auto posTSOS = extrapolator.extrapolate(innTSOS, scPos);
189 EleRelPointPair scAtVtx(scRef->position(), trackExtrapToSC, beamSpotPosition);
192 if (scRef->energy() != 0 && trkP != 0) {
193 if (
std::abs(1 / scRef->energy() - 1 / trkP) < oneOverESuperMinusOneOverPValue) {
194 oneOverESuperMinusOneOverPValue =
std::abs(1 / scRef->energy() - 1 / trkP);
197 if (scRef->seed().
isNonnull() && scRef->seed()->energy() != 0 && trkP != 0) {
198 if (
std::abs(1 / scRef->seed()->energy() - 1 / trkP) < oneOverESeedMinusOneOverPValue) {
199 oneOverESeedMinusOneOverPValue =
std::abs(1 / scRef->seed()->energy() - 1 / trkP);
203 if (
gsfTracks[trkNr]->missingInnerHits() < missingHitsValue) {
204 missingHitsValue =
gsfTracks[trkNr]->missingInnerHits();
210 validHitsValue =
gsfTracks[trkNr]->numberOfValidHits();
213 if (
gsfTracks[trkNr]->hitPattern().pixelLayersWithMeasurement() > nLayerITValue) {
214 nLayerITValue =
gsfTracks[trkNr]->hitPattern().pixelLayersWithMeasurement();
218 chi2Value =
gsfTracks[trkNr]->normalizedChi2();
221 if (
std::abs(scAtVtx.dEta()) < dEtaInValue) {
223 dEtaInValue =
std::abs(scAtVtx.dEta());
226 if (
std::abs(scAtVtx.dEta()) < dEtaSeedInValue) {
227 dEtaSeedInValue =
std::abs(scAtVtx.dEta() - scRef->position().eta() + scRef->seed()->position().eta());
230 if (
std::abs(scAtVtx.dPhi()) < dPhiInValue) {
232 dPhiInValue =
std::abs(scAtVtx.dPhi());
237 dEtaMap.
insert(recoEcalCandRef, dEtaInValue);
238 dEtaSeedMap.
insert(recoEcalCandRef, dEtaSeedInValue);
239 dPhiMap.
insert(recoEcalCandRef, dPhiInValue);
240 oneOverESuperMinusOneOverPMap.
insert(recoEcalCandRef, oneOverESuperMinusOneOverPValue);
241 oneOverESeedMinusOneOverPMap.
insert(recoEcalCandRef, oneOverESeedMinusOneOverPValue);
242 missingHitsMap.
insert(recoEcalCandRef, missingHitsValue);
243 validHitsMap.
insert(recoEcalCandRef, validHitsValue);
244 nLayerITMap.
insert(recoEcalCandRef, nLayerITValue);
245 chi2Map.
insert(recoEcalCandRef, chi2Value);
const edm::EDGetTokenT< reco::ElectronCollection > electronToken_
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandToken_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
bool isNonnull() const
Checks for non-null.
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > oneOverESuperMinusOneOverPMapPutToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > chi2MapPutToken_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
bool positionFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalPoint &position)
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > validHitsMapPutToken_
Abs< T >::type abs(const T &t)
EgammaHLTGsfTrackVarProducer(const edm::ParameterSet &)
bool getData(T &iHolder) const
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > dEtaMapPutToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > oneOverESeedMinusOneOverPMapPutToken_
void insert(const key_type &k, const data_type &v)
insert an association
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const bool useDefaultValuesForBarrel_
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
const bool useDefaultValuesForEndcap_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > dPhiMapPutToken_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > nLayerITMapPutToken_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > dEtaSeedMapPutToken_
const edm::EDGetTokenT< reco::GsfTrackCollection > gsfTrackToken_
const int upperTrackNrToRemoveCut_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > missingHitsMapPutToken_
const int lowerTrackNrToRemoveCut_