37 beamSpotTag_ (consumes<
reco::
BeamSpot>(config.getParameter<
edm::InputTag>(
"beamSpotProducer"))),
38 upperTrackNrToRemoveCut_ (config.getParameter<
int>(
"upperTrackNrToRemoveCut")),
39 lowerTrackNrToRemoveCut_ (config.getParameter<
int>(
"lowerTrackNrToRemoveCut")),
40 useDefaultValuesForBarrel_ (config.getParameter<
bool>(
"useDefaultValuesForBarrel")),
41 useDefaultValuesForEndcap_ (config.getParameter<
bool>(
"useDefaultValuesForEndcap"))
45 produces < reco::RecoEcalCandidateIsolationMap >(
"Deta" ).setBranchAlias(
"deta" );
46 produces < reco::RecoEcalCandidateIsolationMap >(
"DetaSeed" ).setBranchAlias(
"detaseed" );
47 produces < reco::RecoEcalCandidateIsolationMap >(
"Dphi" ).setBranchAlias(
"dphi" );
48 produces < reco::RecoEcalCandidateIsolationMap >(
"OneOESuperMinusOneOP" );
49 produces < reco::RecoEcalCandidateIsolationMap >(
"OneOESeedMinusOneOP" );
50 produces < reco::RecoEcalCandidateIsolationMap >(
"MissingHits" ).setBranchAlias(
"missinghits" );
51 produces < reco::RecoEcalCandidateIsolationMap >(
"Chi2" ).setBranchAlias(
"chi2" );
52 produces < reco::RecoEcalCandidateIsolationMap >(
"ValidHits" ).setBranchAlias(
"validhits" );
63 desc.
add<
int>((
"upperTrackNrToRemoveCut"), 9999);
64 desc.
add<
int>((
"lowerTrackNrToRemoveCut"), -1);
65 desc.
add<
bool>((
"useDefaultValuesForBarrel"),
false);
66 desc.
add<
bool>((
"useDefaultValuesForEndcap"),
false);
68 descriptions.
add(
"hltEgammaHLTGsfTrackVarProducer", desc);
102 for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoEcalCandHandle->begin(); iRecoEcalCand != recoEcalCandHandle->end(); iRecoEcalCand++){
108 std::vector<const reco::GsfTrack*>
gsfTracks;
110 for(reco::ElectronCollection::const_iterator eleIt = electronHandle->begin(); eleIt != electronHandle->end(); eleIt++){
111 if(eleIt->superCluster()==scRef){
112 gsfTracks.push_back(&*eleIt->gsfTrack());
116 for(reco::GsfTrackCollection::const_iterator trkIt =gsfTracksHandle->begin();trkIt!=gsfTracksHandle->end();++trkIt){
121 if(scRefFromTrk==scRef){
122 gsfTracks.push_back(&*trkIt);
128 int validHitsValue = 0;
129 float chi2Value = 9999999.;
130 float missingHitsValue = 9999999;
131 float dEtaInValue=999999;
132 float dEtaSeedInValue=999999;
133 float dPhiInValue=999999;
134 float oneOverESuperMinusOneOverPValue=999999;
135 float oneOverESeedMinusOneOverPValue=999999;
137 const int nrTracks = gsfTracks.size();
143 if(rmCutsDueToNrTracks || useDefaultValues){
147 missingHitsValue = 0;
148 validHitsValue = 100;
150 oneOverESuperMinusOneOverPValue = 0;
151 oneOverESeedMinusOneOverPValue = 0;
153 for(
size_t trkNr=0;trkNr<gsfTracks.size();trkNr++){
155 GlobalPoint scPos(scRef->x(),scRef->y(),scRef->z());
159 float trkP = gsfTracks[trkNr]->p();
160 if(scRef->energy()!=0 && trkP!=0){
161 if(fabs(1/scRef->energy() - 1/trkP)<oneOverESuperMinusOneOverPValue) oneOverESuperMinusOneOverPValue =fabs(1/scRef->energy() - 1/trkP);
163 if(scRef->seed().isNonnull() && scRef->seed()->energy()!=0 && trkP!=0){
164 if(fabs(1/scRef->seed()->energy() - 1/trkP)<oneOverESeedMinusOneOverPValue) oneOverESeedMinusOneOverPValue =fabs(1/scRef->seed()->energy() - 1/trkP);
171 if (gsfTracks[trkNr]->numberOfValidHits() < validHitsValue)
172 validHitsValue = gsfTracks[trkNr]->numberOfValidHits();
174 if (gsfTracks[trkNr]->numberOfValidHits() < chi2Value)
175 chi2Value = gsfTracks[trkNr]->normalizedChi2();
177 if (fabs(scAtVtx.dEta())<dEtaInValue)
178 dEtaInValue=fabs(scAtVtx.dEta());
180 if (fabs(scAtVtx.dEta())<dEtaSeedInValue)
181 dEtaSeedInValue = fabs(scAtVtx.dEta()-scRef->position().eta()+scRef->seed()->position().eta());
183 if (fabs(scAtVtx.dPhi())<dPhiInValue)
184 dPhiInValue=fabs(scAtVtx.dPhi());
188 dEtaMap.
insert(recoEcalCandRef, dEtaInValue);
189 dEtaSeedMap.
insert(recoEcalCandRef, dEtaSeedInValue);
190 dPhiMap.
insert(recoEcalCandRef, dPhiInValue);
191 oneOverESuperMinusOneOverPMap.
insert(recoEcalCandRef,oneOverESuperMinusOneOverPValue);
192 oneOverESeedMinusOneOverPMap.
insert(recoEcalCandRef,oneOverESeedMinusOneOverPValue);
193 missingHitsMap.
insert(recoEcalCandRef, missingHitsValue);
194 validHitsMap.
insert(recoEcalCandRef, validHitsValue);
195 chi2Map.
insert(recoEcalCandRef, chi2Value);
198 auto dEtaMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaMap);
199 auto dEtaSeedMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dEtaSeedMap);
200 auto dPhiMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(dPhiMap);
201 auto oneOverESuperMinusOneOverPMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESuperMinusOneOverPMap);
202 auto oneOverESeedMinusOneOverPMapForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(oneOverESeedMinusOneOverPMap);
203 auto missingHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(missingHitsMap);
204 auto validHitsForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(validHitsMap);
205 auto chi2ForEvent = std::make_unique<reco::RecoEcalCandidateIsolationMap>(chi2Map);
208 iEvent.
put(
std::move(dEtaSeedMapForEvent),
"DetaSeed" );
210 iEvent.
put(
std::move(oneOverESuperMinusOneOverPMapForEvent),
"OneOESuperMinusOneOP");
211 iEvent.
put(
std::move(oneOverESeedMinusOneOverPMapForEvent),
"OneOESeedMinusOneOP");
212 iEvent.
put(
std::move(missingHitsForEvent),
"MissingHits");
219 cacheIDTDGeom_(rhs.cacheIDTDGeom_),
220 cacheIDMagField_(rhs.cacheIDMagField_),
221 magField_(rhs.magField_),
222 trackerHandle_(rhs.trackerHandle_),
223 mtsMode_(rhs.mtsMode_)
249 bool updateField(
false);
256 bool updateGeometry(
false);
258 updateGeometry =
true;
275 return extrapolatedPos;
284 return extrapolatedMom;
unsigned long long cacheIdentifier() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool positionFromModeCartesian(const TrajectoryStateOnSurface tsos, GlobalPoint &position) const
~EgammaHLTGsfTrackVarProducer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool momentumFromModeCartesian(const TrajectoryStateOnSurface tsos, GlobalVector &momentum) const
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandTag_
const edm::EDGetTokenT< reco::GsfTrackCollection > inputCollectionTag2_
TrackExtrapolator trackExtrapolator_
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
const int upperTrackNrToRemoveCut_
T const * product() const
const int lowerTrackNrToRemoveCut_