48 relative_(iConfig.getParameter<bool>(
"relative")) {
51 produces<edm::ValueMap<float>>(
"miniIsoChg");
52 produces<edm::ValueMap<float>>(
"miniIsoAll");
58 produces<edm::ValueMap<float>>(
"PFIsoChg");
59 produces<edm::ValueMap<float>>(
"PFIsoAll");
60 produces<edm::ValueMap<float>>(
"PFIsoAll04");
64 produces<edm::ValueMap<float>>(
"PFIsoChg");
65 produces<edm::ValueMap<float>>(
"PFIsoAll");
107 template <
typename T>
120 template <
typename T>
134 template <
typename T>
141 unsigned int nInput = src->size();
143 std::vector<float> miniIsoChg, miniIsoAll;
144 miniIsoChg.reserve(nInput);
145 miniIsoAll.reserve(nInput);
147 for (
const auto&
obj : *src) {
148 auto iso =
obj.miniPFIsolation();
149 auto chg = iso.chargedHadronIso();
150 auto neu = iso.neutralHadronIso();
151 auto pho = iso.photonIso();
152 auto ea = ea_miniiso_->getEffectiveArea(fabs(getEtaForEA(&
obj)));
155 float scale = relative_ ? 1.0 /
obj.pt() : 1;
156 miniIsoChg.push_back(scale *
chg);
157 miniIsoAll.push_back(scale * (chg +
std::max(0.0, neu + pho - (*rho) * ea)));
162 fillerChg.
insert(src, miniIsoChg.begin(), miniIsoChg.end());
166 fillerAll.
insert(src, miniIsoAll.begin(), miniIsoAll.end());
176 template <
typename T>
186 unsigned int nInput = src->size();
188 std::vector<float> PFIsoChg, PFIsoAll, PFIsoAll04;
189 PFIsoChg.reserve(nInput);
190 PFIsoAll.reserve(nInput);
191 PFIsoAll04.reserve(nInput);
193 for (
const auto&
obj : *src) {
194 auto iso =
obj.pfIsolationVariables();
195 auto chg = iso.sumChargedHadronPt;
196 auto neu = iso.sumNeutralHadronEt;
197 auto pho = iso.sumPhotonEt;
198 auto ea = ea_pfiso_->getEffectiveArea(fabs(getEtaForEA(&
obj)));
199 float scale = relative_ ? 1.0 /
obj.pt() : 1;
200 PFIsoChg.push_back(scale *
chg);
201 PFIsoAll.push_back(scale * (chg +
std::max(0.0, neu + pho - (*rho) * ea)));
202 PFIsoAll04.push_back(scale * (
obj.chargedHadronIso() +
203 std::max(0.0,
obj.neutralHadronIso() +
obj.photonIso() - (*rho) * ea * 16. / 9.)));
208 fillerChg.
insert(src, PFIsoChg.begin(), PFIsoChg.end());
212 fillerAll.
insert(src, PFIsoAll.begin(), PFIsoAll.end());
216 fillerAll04.
insert(src, PFIsoAll04.begin(), PFIsoAll04.end());
224 template <
typename T>
234 unsigned int nInput = src->size();
236 std::vector<float> PFIsoChg, PFIsoAll;
237 PFIsoChg.reserve(nInput);
238 PFIsoAll.reserve(nInput);
240 for (
const auto&
obj : *src) {
241 auto chg =
obj.chargedHadronIso();
242 auto neu =
obj.neutralHadronIso();
243 auto pho =
obj.photonIso();
244 auto ea_chg = ea_pfiso_chg_->getEffectiveArea(fabs(getEtaForEA(&
obj)));
245 auto ea_neu = ea_pfiso_neu_->getEffectiveArea(fabs(getEtaForEA(&
obj)));
246 auto ea_pho = ea_pfiso_pho_->getEffectiveArea(fabs(getEtaForEA(&
obj)));
247 float scale = relative_ ? 1.0 /
obj.pt() : 1;
248 PFIsoChg.push_back(scale *
std::max(0.0,
chg - (*rho) * ea_chg));
249 PFIsoAll.push_back(PFIsoChg.back() +
250 scale * (
std::max(0.0, neu - (*rho) * ea_neu) +
std::max(0.0, pho - (*rho) * ea_pho)));
255 fillerChg.
insert(src, PFIsoChg.begin(), PFIsoChg.end());
259 fillerAll.
insert(src, PFIsoAll.begin(), PFIsoAll.end());
267 template <
typename T>
270 desc.
add<
edm::InputTag>(
"src")->setComment(
"input physics object collection");
271 desc.
add<
bool>(
"relative")->setComment(
"compute relative isolation instead of absolute one");
275 ->setComment(
"txt file containing effective areas to be used for mini-isolation pileup subtraction");
277 ->setComment(
"rho to be used for effective-area based mini-isolation pileup subtraction");
282 "txt file containing effective areas to be used for PF-isolation pileup subtraction for electrons");
284 ->setComment(
"rho to be used for effective-area based PF-isolation pileup subtraction for electrons");
287 desc.
add<
edm::InputTag>(
"mapIsoChg")->setComment(
"input charged PF isolation calculated in VID for photons");
288 desc.
add<
edm::InputTag>(
"mapIsoNeu")->setComment(
"input neutral PF isolation calculated in VID for photons");
289 desc.
add<
edm::InputTag>(
"mapIsoPho")->setComment(
"input photon PF isolation calculated in VID for photons");
292 "txt file containing effective areas to be used for charged PF-isolation pileup subtraction for photons");
295 "txt file containing effective areas to be used for neutral PF-isolation pileup subtraction for photons");
298 "txt file containing effective areas to be used for photon PF-isolation pileup subtraction for photons");
300 ->setComment(
"rho to be used for effective-area based PF-isolation pileup subtraction for photons");
310 modname +=
"IsoTrack";
311 modname +=
"IsoValueMapProducer";
312 descriptions.
add(modname, desc);
Analysis-level Photon class.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
IsoValueMapProducer(const edm::ParameterSet &iConfig)
IsoValueMapProducer< pat::Muon > MuonIsoValueMapProducer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< double > rho_pfiso_
void insert(const H &h, I begin, I end)
void doPFIsoEle(edm::Event &) const
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
IsoValueMapProducer< pat::Photon > PhoIsoValueMapProducer
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
~IsoValueMapProducer() override
void doMiniIso(edm::Event &) const
IsoValueMapProducer< pat::IsolatedTrack > IsoTrackIsoValueMapProducer
ParameterDescriptionBase * add(U const &iLabel, T const &value)
IsoValueMapProducer< pat::Electron > EleIsoValueMapProducer
std::unique_ptr< EffectiveAreas > ea_pfiso_chg_
std::unique_ptr< EffectiveAreas > ea_pfiso_pho_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::EDGetTokenT< edm::View< T > > src_
std::unique_ptr< EffectiveAreas > ea_pfiso_neu_
T getParameter(std::string const &) const
Analysis-level electron class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
reco::SuperClusterRef superCluster() const override
override the superCluster method from CaloJet, to access the internal storage of the supercluster ...
float getEtaForEA(const T *) const
void doPFIsoPho(edm::Event &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< double > rho_miniiso_
std::unique_ptr< EffectiveAreas > ea_pfiso_
std::unique_ptr< EffectiveAreas > ea_miniiso_
Analysis-level muon class.
Power< A, B >::type pow(const A &a, const B &b)