95 float calRelDelta(
float a,
float b,
float defaultVal = 0.
f) {
return a != 0.f ? (
a -
b) /
a : defaultVal; }
100 : recoEcalCandToken_(
102 electronToken_{consumes<reco::ElectronCollection>(
config.getParameter<
edm::InputTag>(
"inputCollection"))},
103 gsfTrackToken_{consumes<reco::GsfTrackCollection>(
config.getParameter<
edm::InputTag>(
"inputCollection"))},
104 beamSpotToken_{consumes<reco::BeamSpot>(
config.getParameter<
edm::InputTag>(
"beamSpotProducer"))},
107 upperTrackNrToRemoveCut_{
config.getParameter<
int>(
"upperTrackNrToRemoveCut")},
108 lowerTrackNrToRemoveCut_{
config.getParameter<
int>(
"lowerTrackNrToRemoveCut")},
109 useDefaultValuesForBarrel_{
config.getParameter<
bool>(
"useDefaultValuesForBarrel")},
110 useDefaultValuesForEndcap_{
config.getParameter<
bool>(
"useDefaultValuesForEndcap")},
111 produceAbsValues_{
config.getParameter<
bool>(
"produceAbsValues")},
112 dEtaMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Deta").setBranchAlias(
"deta")},
113 dEtaSeedMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"DetaSeed").setBranchAlias(
"detaseed")},
114 dPhiMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Dphi").setBranchAlias(
"dphi")},
115 oneOverESuperMinusOneOverPMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"OneOESuperMinusOneOP")},
116 oneOverESeedMinusOneOverPMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"OneOESeedMinusOneOP")},
117 missingHitsMapPutToken_{
118 produces<reco::RecoEcalCandidateIsolationMap>(
"MissingHits").setBranchAlias(
"missinghits")},
119 validHitsMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"ValidHits").setBranchAlias(
"validhits")},
120 nLayerITMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"NLayerIT").setBranchAlias(
"nlayerit")},
121 chi2MapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"Chi2").setBranchAlias(
"chi2")},
122 fbremMapPutToken_{produces<reco::RecoEcalCandidateIsolationMap>(
"fbrem")} {}
129 desc.add<
int>((
"upperTrackNrToRemoveCut"), 9999);
130 desc.add<
int>((
"lowerTrackNrToRemoveCut"), -1);
131 desc.add<
bool>((
"useDefaultValuesForBarrel"),
false);
132 desc.add<
bool>((
"useDefaultValuesForEndcap"),
false);
133 desc.add<
bool>((
"produceAbsValues"),
false);
135 descriptions.
add(
"hltEgammaHLTGsfTrackVarProducer",
desc);
159 for (
unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoEcalCandHandle->size(); ++iRecoEcalCand) {
165 std::vector<const reco::GsfTrack*>
gsfTracks;
167 for (
auto const& ele : *electronHandle) {
168 if (ele.superCluster() == scRef) {
169 gsfTracks.push_back(ele.gsfTrack().get());
181 int nLayerITValue = -1;
182 int validHitsValue = 0;
183 float chi2Value = 9999999.;
184 float missingHitsValue = 9999999;
185 float dEtaInValue = 999999;
186 float dEtaSeedInValue = 999999;
187 float dPhiInValue = 999999;
188 float oneOverESuperMinusOneOverPValue = 999999;
189 float oneOverESeedMinusOneOverPValue = 999999;
190 float fbrem = 999999;
195 const bool useDefaultValues =
std::abs(recoEcalCandRef->eta()) < 1.479
202 if (rmCutsDueToNrTracks || useDefaultValues) {
207 missingHitsValue = 0;
208 validHitsValue = 100;
210 oneOverESuperMinusOneOverPValue = 0;
211 oneOverESeedMinusOneOverPValue = 0;
214 for (
size_t trkNr = 0; trkNr <
gsfTracks.size(); trkNr++) {
215 GlobalPoint scPos(scRef->x(), scRef->y(), scRef->z());
217 gsfTrackExtrapolations(*
gsfTracks[trkNr], *scRef, mtsTransform);
219 EleRelPointPair scAtVtx(scRef->position(), gsfTrackExtrapolations.sclPos, beamSpotPosition);
221 fbrem = calRelDelta(gsfTrackExtrapolations.innMom.mag(), gsfTrackExtrapolations.outMom.mag(),
fbrem);
224 if (scRef->energy() != 0 && trkP != 0) {
225 fillAbsAbleVar(oneOverESuperMinusOneOverPValue, 1 / scRef->energy() - 1 / trkP);
227 if (scRef->seed().
isNonnull() && scRef->seed()->energy() != 0 && trkP != 0) {
228 fillAbsAbleVar(oneOverESeedMinusOneOverPValue, 1 / scRef->seed()->energy() - 1 / trkP);
231 if (
gsfTracks[trkNr]->missingInnerHits() < missingHitsValue) {
232 missingHitsValue =
gsfTracks[trkNr]->missingInnerHits();
238 validHitsValue =
gsfTracks[trkNr]->numberOfValidHits();
241 if (
gsfTracks[trkNr]->hitPattern().pixelLayersWithMeasurement() > nLayerITValue) {
242 nLayerITValue =
gsfTracks[trkNr]->hitPattern().pixelLayersWithMeasurement();
246 chi2Value =
gsfTracks[trkNr]->normalizedChi2();
250 fillAbsAbleVar(dEtaSeedInValue, scAtVtx.dEta() - scRef->position().eta() + scRef->seed()->position().eta());
255 dEtaMap.
insert(recoEcalCandRef, dEtaInValue);
256 dEtaSeedMap.
insert(recoEcalCandRef, dEtaSeedInValue);
257 dPhiMap.
insert(recoEcalCandRef, dPhiInValue);
258 oneOverESuperMinusOneOverPMap.
insert(recoEcalCandRef, oneOverESuperMinusOneOverPValue);
259 oneOverESeedMinusOneOverPMap.
insert(recoEcalCandRef, oneOverESeedMinusOneOverPValue);
260 missingHitsMap.
insert(recoEcalCandRef, missingHitsValue);
261 validHitsMap.
insert(recoEcalCandRef, validHitsValue);
262 nLayerITMap.
insert(recoEcalCandRef, nLayerITValue);
263 chi2Map.
insert(recoEcalCandRef, chi2Value);
const edm::EDGetTokenT< reco::ElectronCollection > electronToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandToken_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Global3DPoint GlobalPoint
bool isNonnull() const
Checks for non-null.
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > oneOverESuperMinusOneOverPMapPutToken_
double x() const
x coordinate of cluster centroid
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)
double z() const
z coordinate of cluster centroid
double y() const
y coordinate of cluster centroid
EgammaHLTGsfTrackVarProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > dEtaMapPutToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > fbremMapPutToken_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > oneOverESeedMinusOneOverPMapPutToken_
const bool produceAbsValues_
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)
void fillAbsAbleVar(float &existVal, const float newVal) const
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_
bool momentumFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalVector &momentum)
const int upperTrackNrToRemoveCut_
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > missingHitsMapPutToken_
const int lowerTrackNrToRemoveCut_