36 beamSpotTag_ (consumes<
reco::
BeamSpot>(config.getParameter<
edm::InputTag>(
"beamSpotProducer"))),
37 upperTrackNrToRemoveCut_ (config.getParameter<
int>(
"upperTrackNrToRemoveCut")),
38 lowerTrackNrToRemoveCut_ (config.getParameter<
int>(
"lowerTrackNrToRemoveCut")),
39 useDefaultValuesForBarrel_ (config.getParameter<
bool>(
"useDefaultValuesForBarrel")),
40 useDefaultValuesForEndcap_ (config.getParameter<
bool>(
"useDefaultValuesForEndcap"))
44 produces < reco::RecoEcalCandidateIsolationMap >(
"Deta" ).setBranchAlias(
"deta" );
45 produces < reco::RecoEcalCandidateIsolationMap >(
"DetaSeed" ).setBranchAlias(
"detaseed" );
46 produces < reco::RecoEcalCandidateIsolationMap >(
"Dphi" ).setBranchAlias(
"dphi" );
47 produces < reco::RecoEcalCandidateIsolationMap >(
"OneOESuperMinusOneOP" );
48 produces < reco::RecoEcalCandidateIsolationMap >(
"OneOESeedMinusOneOP" );
49 produces < reco::RecoEcalCandidateIsolationMap >(
"MissingHits" ).setBranchAlias(
"missinghits" );
50 produces < reco::RecoEcalCandidateIsolationMap >(
"Chi2" ).setBranchAlias(
"chi2" );
51 produces < reco::RecoEcalCandidateIsolationMap >(
"ValidHits" ).setBranchAlias(
"validhits" );
62 desc.
add<
int>((
"upperTrackNrToRemoveCut"), 9999);
63 desc.
add<
int>((
"lowerTrackNrToRemoveCut"), -1);
64 desc.
add<
bool>((
"useDefaultValuesForBarrel"),
false);
65 desc.
add<
bool>((
"useDefaultValuesForEndcap"),
false);
67 descriptions.
add(
"hltEgammaHLTGsfTrackVarProducer", desc);
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");
218 cacheIDTDGeom_(rhs.cacheIDTDGeom_),
219 cacheIDMagField_(rhs.cacheIDMagField_),
220 magField_(rhs.magField_),
221 trackerHandle_(rhs.trackerHandle_)
245 bool updateField(
false);
252 bool updateGeometry(
false);
254 updateGeometry =
true;
271 return extrapolatedPos;
280 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
bool isBarrel(GeomDetEnumerators::SubDetector m)
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandTag_
const edm::EDGetTokenT< reco::GsfTrackCollection > inputCollectionTag2_
TrackExtrapolator trackExtrapolator_
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_