52 produces<edm::ValueMap<float>>(
"miniIsoChg");
53 produces<edm::ValueMap<float>>(
"miniIsoAll");
58 produces<edm::ValueMap<float>>(
"PFIsoChg");
59 produces<edm::ValueMap<float>>(
"PFIsoAll");
60 produces<edm::ValueMap<float>>(
"PFIsoAll04");
65 produces<edm::ValueMap<float>>(
"PFIsoChg");
66 produces<edm::ValueMap<float>>(
"PFIsoAll");
124 template <
typename T>
144 unsigned int nInput = src->size();
147 miniIsoChg.reserve(nInput);
148 miniIsoAll.reserve(nInput);
150 for (
const auto &
obj : *src) {
151 auto iso =
obj.miniPFIsolation();
152 auto chg = iso.chargedHadronIso();
153 auto neu = iso.neutralHadronIso();
154 auto pho = iso.photonIso();
159 miniIsoChg.push_back(scale*
chg);
160 miniIsoAll.push_back(scale*(chg+
std::max(0.0,neu+pho-(*rho)*ea)));
165 fillerChg.
insert(src,miniIsoChg.begin(),miniIsoChg.end());
169 fillerAll.
insert(src,miniIsoAll.begin(),miniIsoAll.end());
194 unsigned int nInput = src->size();
197 PFIsoChg.reserve(nInput);
198 PFIsoAll.reserve(nInput);
199 PFIsoAll04.reserve(nInput);
201 for (
const auto &
obj : *src) {
202 auto iso =
obj.pfIsolationVariables();
203 auto chg = iso.sumChargedHadronPt;
204 auto neu = iso.sumNeutralHadronEt;
205 auto pho = iso.sumPhotonEt;
208 PFIsoChg.push_back(scale*
chg);
209 PFIsoAll.push_back(scale*(chg+
std::max(0.0,neu+pho-(*rho)*ea)));
210 PFIsoAll04.push_back(scale*(
obj.chargedHadronIso()+
std::max(0.0,
obj.neutralHadronIso()+
obj.photonIso()-(*rho)*ea*16./9.)));
215 fillerChg.
insert(src,PFIsoChg.begin(),PFIsoChg.end());
219 fillerAll.
insert(src,PFIsoAll.begin(),PFIsoAll.end());
223 fillerAll04.
insert(src,PFIsoAll04.begin(),PFIsoAll04.end());
251 unsigned int nInput = src->size();
254 PFIsoChg.reserve(nInput);
255 PFIsoAll.reserve(nInput);
257 for (
unsigned int i=0;
i<nInput;
i++){
258 auto obj = src->ptrAt(
i);
259 auto chg = (*mapIsoChg)[
obj];
260 auto neu = (*mapIsoNeu)[
obj];
261 auto pho = (*mapIsoPho)[
obj];
266 PFIsoChg.push_back(scale*
std::max(0.0,
chg-(*rho)*ea_chg));
267 PFIsoAll.push_back(PFIsoChg.back()+scale*(
std::max(0.0,neu-(*rho)*ea_neu)+
std::max(0.0,pho-(*rho)*ea_pho)));
272 fillerChg.
insert(src,PFIsoChg.begin(),PFIsoChg.end());
276 fillerAll.
insert(src,PFIsoAll.begin(),PFIsoAll.end());
287 template <
typename T>
291 desc.
add<
edm::InputTag>(
"src")->setComment(
"input physics object collection");
292 desc.
add<
bool>(
"relative")->setComment(
"compute relative isolation instead of absolute one");
294 desc.
add<
edm::FileInPath>(
"EAFile_MiniIso")->setComment(
"txt file containing effective areas to be used for mini-isolation pileup subtraction");
295 desc.
add<
edm::InputTag>(
"rho_MiniIso")->setComment(
"rho to be used for effective-area based mini-isolation pileup subtraction");
298 desc.
add<
edm::FileInPath>(
"EAFile_PFIso")->setComment(
"txt file containing effective areas to be used for PF-isolation pileup subtraction for electrons");
299 desc.
add<
edm::InputTag>(
"rho_PFIso")->setComment(
"rho to be used for effective-area based PF-isolation pileup subtraction for electrons");
302 desc.
add<
edm::InputTag>(
"mapIsoChg")->setComment(
"input charged PF isolation calculated in VID for photons");
303 desc.
add<
edm::InputTag>(
"mapIsoNeu")->setComment(
"input neutral PF isolation calculated in VID for photons");
304 desc.
add<
edm::InputTag>(
"mapIsoPho")->setComment(
"input photon PF isolation calculated in VID for photons");
305 desc.
add<
edm::FileInPath>(
"EAFile_PFIso_Chg")->setComment(
"txt file containing effective areas to be used for charged PF-isolation pileup subtraction for photons");
306 desc.
add<
edm::FileInPath>(
"EAFile_PFIso_Neu")->setComment(
"txt file containing effective areas to be used for neutral PF-isolation pileup subtraction for photons");
307 desc.
add<
edm::FileInPath>(
"EAFile_PFIso_Pho")->setComment(
"txt file containing effective areas to be used for photon PF-isolation pileup subtraction for photons");
308 desc.
add<
edm::InputTag>(
"rho_PFIso")->setComment(
"rho to be used for effective-area based PF-isolation pileup subtraction for photons");
311 if (
typeid(
T) ==
typeid(
pat::Muon)) modname+=
"Muon";
313 else if (
typeid(
T) ==
typeid(
pat::Photon)) modname+=
"Pho";
315 modname+=
"IsoValueMapProducer";
316 descriptions.
add(modname,desc);
T getParameter(std::string const &) const
Analysis-level Photon class.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
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 superCluster method from CaloJet, to access the internal storage of the supercluster ...
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_
edm::EDGetTokenT< edm::ValueMap< float > > mapIsoChg_
edm::EDGetTokenT< edm::View< T > > src_
edm::EDGetTokenT< edm::ValueMap< float > > mapIsoNeu_
edm::EDGetTokenT< edm::ValueMap< float > > mapIsoPho_
std::unique_ptr< EffectiveAreas > ea_pfiso_neu_
Analysis-level electron class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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.
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
Power< A, B >::type pow(const A &a, const B &b)