22 beamSpotProducer_ (consumes<
reco::
BeamSpot>(config.getParameter<
edm::InputTag>(
"beamSpotProducer"))),
23 useGsfTrack_ (config.getParameter<
bool>(
"useGsfTrack")),
24 useSCRefs_ (config.getParameter<
bool>(
"useSCRefs")),
25 drMax_ (config.getParameter<double>(
"drMax")),
26 drVetoBarrel_ (config.getParameter<double>(
"drVetoBarrel")),
27 drVetoEndcap_ (config.getParameter<double>(
"drVetoEndcap")),
28 ptMin_ (config.getParameter<double>(
"ptMin")),
29 dzMax_ (config.getParameter<double>(
"dzMax")),
30 dxyMax_ (config.getParameter<double>(
"dxyMax")),
31 pfToUse_ (config.getParameter<
int>(
"pfCandidateType")) {
35 produces < reco::RecoEcalCandidateIsolationMap >();
38 produces < reco::ElectronIsolationMap >();
48 desc.
add<
bool>(
"useGsfTrack",
false);
49 desc.
add<
bool>(
"useSCRefs",
false);
50 desc.
add<
double>(
"drMax", 0.3);
51 desc.
add<
double>(
"drVetoBarrel", 0.02);
52 desc.
add<
double>(
"drVetoEndcap", 0.02);
53 desc.
add<
double>(
"ptMin", 0.0);
54 desc.
add<
double>(
"dzMax", 0.2);
55 desc.
add<
double>(
"dxyMax", 0.1);
56 desc.
add<
int>(
"pfCandidateType", 1);
57 descriptions.
add((
"hltEgammaHLTPFChargedIsolationProducer"), desc);
80 for(
unsigned int iReco=0; iReco<recoEcalCandHandle->size(); iReco++) {
83 if (fabs(candRef->eta())<1.479)
89 math::XYZVector candDirectionWrtVtx(candRef->superCluster()->x() - beamSpotPosition.x(),
90 candRef->superCluster()->y() - beamSpotPosition.y(),
91 candRef->superCluster()->z() - beamSpotPosition.z());
96 for(
unsigned i=0;
i<forIsolation->size();
i++) {
104 float dz = fabs(pfc.
trackRef()->dz(beamSpotPosition));
107 float dxy = fabs(pfc.
trackRef()->dxy(beamSpotPosition));
108 if(fabs(dxy) >
dxyMax_)
continue;
110 float dR =
deltaR(candDirectionWrtVtx.Eta(), candDirectionWrtVtx.Phi(), pfc.
momentum().Eta(), pfc.
momentum().Phi());
111 if(dR >
drMax_ || dR < dRveto)
continue;
117 recoEcalCandMap.
insert(candRef, sum);
119 iEvent.
put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandMap));
128 for(
unsigned int iEl=0; iEl<electronHandle->size(); iEl++) {
132 if (fabs(eleRef->eta())<1.479)
140 for(
unsigned i=0;
i<forIsolation->size();
i++) {
148 float dz = fabs(pfc.
trackRef()->dz(eleRef->vertex()));
151 float dxy = fabs(pfc.
trackRef()->dxy(eleRef->vertex()));
152 if(fabs(dxy) >
dxyMax_)
continue;
155 if(dR >
drMax_ || dR < dRveto)
continue;
161 eleMap.
insert(eleRef, sum);
163 iEvent.
put(std::make_unique<reco::ElectronIsolationMap>(eleMap));
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidateProducer_
const double drVetoBarrel_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double pt() const final
transverse momentum
math::XYZPoint Point
point in the space
const double drVetoEndcap_
reco::TrackRef trackRef() const
EgammaHLTPFChargedIsolationProducer(const edm::ParameterSet &)
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
Vector momentum() const final
spatial momentum vector
const edm::EDGetTokenT< reco::BeamSpot > beamSpotProducer_
edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
T const * product() const
void insert(const key_type &k, const data_type &v)
insert an association
XYZVectorD XYZVector
spatial vector with cartesian internal representation
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Particle reconstructed by the particle flow algorithm.
const Point & position() const
position
virtual ParticleType particleId() const
void produce(edm::Event &, const edm::EventSetup &) override