116 produces<reco::RecoEcalCandidateIsolationMap>(
"Deta").setBranchAlias(
"deta");
117 produces<reco::RecoEcalCandidateIsolationMap>(
"DetaSeed").setBranchAlias(
"detaseed");
118 produces<reco::RecoEcalCandidateIsolationMap>(
"Dphi").setBranchAlias(
"dphi");
119 produces<reco::RecoEcalCandidateIsolationMap>(
"OneOESuperMinusOneOP");
120 produces<reco::RecoEcalCandidateIsolationMap>(
"OneOESeedMinusOneOP");
121 produces<reco::RecoEcalCandidateIsolationMap>(
"MissingHits").setBranchAlias(
"missinghits");
122 produces<reco::RecoEcalCandidateIsolationMap>(
"Chi2").setBranchAlias(
"chi2");
123 produces<reco::RecoEcalCandidateIsolationMap>(
"ValidHits").setBranchAlias(
"validhits");
133 desc.
add<
int>((
"upperTrackNrToRemoveCut"), 9999);
134 desc.
add<
int>((
"lowerTrackNrToRemoveCut"), -1);
135 desc.
add<
bool>((
"useDefaultValuesForBarrel"),
false);
136 desc.
add<
bool>((
"useDefaultValuesForEndcap"),
false);
138 descriptions.
add(
"hltEgammaHLTGsfTrackVarProducer", desc);
171 for (reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoEcalCandHandle->begin();
172 iRecoEcalCand != recoEcalCandHandle->end();
179 std::vector<const reco::GsfTrack*>
gsfTracks;
180 if (electronHandle.
isValid()) {
181 for (reco::ElectronCollection::const_iterator eleIt = electronHandle->begin(); eleIt != electronHandle->end();
183 if (eleIt->superCluster() == scRef) {
184 gsfTracks.push_back(&*eleIt->gsfTrack());
188 for (reco::GsfTrackCollection::const_iterator trkIt = gsfTracksHandle->begin(); trkIt != gsfTracksHandle->end();
194 if (scRefFromTrk == scRef) {
195 gsfTracks.push_back(&*trkIt);
200 int validHitsValue = 0;
201 float chi2Value = 9999999.;
202 float missingHitsValue = 9999999;
203 float dEtaInValue = 999999;
204 float dEtaSeedInValue = 999999;
205 float dPhiInValue = 999999;
206 float oneOverESuperMinusOneOverPValue = 999999;
207 float oneOverESeedMinusOneOverPValue = 999999;
209 const int nrTracks = gsfTracks.size();
212 const bool useDefaultValues =
215 if (rmCutsDueToNrTracks || useDefaultValues) {
219 missingHitsValue = 0;
220 validHitsValue = 100;
222 oneOverESuperMinusOneOverPValue = 0;
223 oneOverESeedMinusOneOverPValue = 0;
225 for (
size_t trkNr = 0; trkNr < gsfTracks.size(); trkNr++) {
226 GlobalPoint scPos(scRef->x(), scRef->y(), scRef->z());
230 float trkP = gsfTracks[trkNr]->p();
231 if (scRef->energy() != 0 && trkP != 0) {
232 if (fabs(1 / scRef->energy() - 1 / trkP) < oneOverESuperMinusOneOverPValue)
233 oneOverESuperMinusOneOverPValue = fabs(1 / scRef->energy() - 1 / trkP);
235 if (scRef->seed().isNonnull() && scRef->seed()->energy() != 0 && trkP != 0) {
236 if (fabs(1 / scRef->seed()->energy() - 1 / trkP) < oneOverESeedMinusOneOverPValue)
237 oneOverESeedMinusOneOverPValue = fabs(1 / scRef->seed()->energy() - 1 / trkP);
244 validHitsValue = gsfTracks[trkNr]->numberOfValidHits();
247 chi2Value = gsfTracks[trkNr]->normalizedChi2();
249 if (fabs(scAtVtx.dEta()) < dEtaInValue)
250 dEtaInValue = fabs(scAtVtx.dEta());
252 if (fabs(scAtVtx.dEta()) < dEtaSeedInValue)
253 dEtaSeedInValue = fabs(scAtVtx.dEta() - scRef->position().eta() + scRef->seed()->position().eta());
255 if (fabs(scAtVtx.dPhi()) < dPhiInValue)
256 dPhiInValue = fabs(scAtVtx.dPhi());
260 dEtaMap.
insert(recoEcalCandRef, dEtaInValue);
261 dEtaSeedMap.
insert(recoEcalCandRef, dEtaSeedInValue);
262 dPhiMap.
insert(recoEcalCandRef, dPhiInValue);
263 oneOverESuperMinusOneOverPMap.
insert(recoEcalCandRef, oneOverESuperMinusOneOverPValue);
264 oneOverESeedMinusOneOverPMap.
insert(recoEcalCandRef, oneOverESeedMinusOneOverPValue);
265 missingHitsMap.
insert(recoEcalCandRef, missingHitsValue);
266 validHitsMap.
insert(recoEcalCandRef, validHitsValue);
267 chi2Map.
insert(recoEcalCandRef, chi2Value);
270 auto dEtaMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaMap);
271 auto dEtaSeedMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaSeedMap);
272 auto dPhiMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dPhiMap);
273 auto oneOverESuperMinusOneOverPMapForEvent =
274 std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESuperMinusOneOverPMap);
275 auto oneOverESeedMinusOneOverPMapForEvent =
276 std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESeedMinusOneOverPMap);
277 auto missingHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(missingHitsMap);
278 auto validHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(validHitsMap);
279 auto chi2ForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(chi2Map);
284 iEvent.
put(
std::move(oneOverESuperMinusOneOverPMapForEvent),
"OneOESuperMinusOneOP");
285 iEvent.
put(
std::move(oneOverESeedMinusOneOverPMapForEvent),
"OneOESeedMinusOneOP");
286 iEvent.
put(
std::move(missingHitsForEvent),
"MissingHits");
293 : cacheIDTDGeom_(rhs.cacheIDTDGeom_),
294 cacheIDMagField_(rhs.cacheIDMagField_),
295 magField_(rhs.magField_),
296 trackerHandle_(rhs.trackerHandle_) {
321 bool updateField(
false);
328 bool updateGeometry(
false);
330 updateGeometry =
true;
347 return extrapolatedPos;
356 return extrapolatedMom;
unsigned long long cacheIdentifier() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
~EgammaHLTGsfTrackVarProducer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandTag_
const edm::EDGetTokenT< reco::GsfTrackCollection > inputCollectionTag2_
TrackExtrapolator trackExtrapolator_
#define DEFINE_FWK_MODULE(type)
bool positionFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalPoint &position)
const edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Abs< T >::type abs(const T &t)
EgammaHLTGsfTrackVarProducer(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< Electron > ElectronCollection
collectin of Electron objects
void produce(edm::Event &, const edm::EventSetup &) override
const edm::EDGetTokenT< reco::ElectronCollection > inputCollectionTag1_
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 Point & position() const
position
bool momentumFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalVector &momentum)
const int upperTrackNrToRemoveCut_
T const * product() const
const int lowerTrackNrToRemoveCut_