52 produces<edm::ValueMap<float>>(
"miniIsoChg");
53 produces<edm::ValueMap<float>>(
"miniIsoAll");
58 produces<edm::ValueMap<float>>(
"PFIsoChg");
59 produces<edm::ValueMap<float>>(
"PFIsoAll");
64 produces<edm::ValueMap<float>>(
"PFIsoChg");
65 produces<edm::ValueMap<float>>(
"PFIsoAll");
123 template <
typename T>
143 unsigned int nInput = src->size();
146 miniIsoChg.reserve(nInput);
147 miniIsoAll.reserve(nInput);
149 for (
const auto &
obj : *src) {
150 auto iso =
obj.miniPFIsolation();
151 auto chg = iso.chargedHadronIso();
152 auto neu = iso.neutralHadronIso();
153 auto pho = iso.photonIso();
158 miniIsoChg.push_back(scale*
chg);
159 miniIsoAll.push_back(scale*(chg+
std::max(0.0,neu+pho-(*rho)*ea)));
164 fillerChg.
insert(src,miniIsoChg.begin(),miniIsoChg.end());
168 fillerAll.
insert(src,miniIsoAll.begin(),miniIsoAll.end());
193 unsigned int nInput = src->size();
196 PFIsoChg.reserve(nInput);
197 PFIsoAll.reserve(nInput);
199 for (
const auto &
obj : *src) {
200 auto iso =
obj.pfIsolationVariables();
201 auto chg = iso.sumChargedHadronPt;
202 auto neu = iso.sumNeutralHadronEt;
203 auto pho = iso.sumPhotonEt;
206 PFIsoChg.push_back(scale*
chg);
207 PFIsoAll.push_back(scale*(chg+
std::max(0.0,neu+pho-(*rho)*ea)));
212 fillerChg.
insert(src,PFIsoChg.begin(),PFIsoChg.end());
216 fillerAll.
insert(src,PFIsoAll.begin(),PFIsoAll.end());
243 unsigned int nInput = src->size();
246 PFIsoChg.reserve(nInput);
247 PFIsoAll.reserve(nInput);
249 for (
unsigned int i=0;
i<nInput;
i++){
250 auto obj = src->ptrAt(
i);
251 auto chg = (*mapIsoChg)[
obj];
252 auto neu = (*mapIsoNeu)[
obj];
253 auto pho = (*mapIsoPho)[
obj];
258 PFIsoChg.push_back(scale*
std::max(0.0,
chg-(*rho)*ea_chg));
259 PFIsoAll.push_back(PFIsoChg.back()+scale*(
std::max(0.0,neu-(*rho)*ea_neu)+
std::max(0.0,pho-(*rho)*ea_pho)));
264 fillerChg.
insert(src,PFIsoChg.begin(),PFIsoChg.end());
268 fillerAll.
insert(src,PFIsoAll.begin(),PFIsoAll.end());
279 template <
typename T>
283 desc.
add<
edm::InputTag>(
"src")->setComment(
"input physics object collection");
284 desc.
add<
bool>(
"relative")->setComment(
"compute relative isolation instead of absolute one");
286 desc.
add<
edm::FileInPath>(
"EAFile_MiniIso")->setComment(
"txt file containing effective areas to be used for mini-isolation pileup subtraction");
287 desc.
add<
edm::InputTag>(
"rho_MiniIso")->setComment(
"rho to be used for effective-area based mini-isolation pileup subtraction");
290 desc.
add<
edm::FileInPath>(
"EAFile_PFIso")->setComment(
"txt file containing effective areas to be used for PF-isolation pileup subtraction for electrons");
291 desc.
add<
edm::InputTag>(
"rho_PFIso")->setComment(
"rho to be used for effective-area based PF-isolation pileup subtraction for electrons");
294 desc.
add<
edm::InputTag>(
"mapIsoChg")->setComment(
"input charged PF isolation calculated in VID for photons");
295 desc.
add<
edm::InputTag>(
"mapIsoNeu")->setComment(
"input neutral PF isolation calculated in VID for photons");
296 desc.
add<
edm::InputTag>(
"mapIsoPho")->setComment(
"input photon PF isolation calculated in VID for photons");
297 desc.
add<
edm::FileInPath>(
"EAFile_PFIso_Chg")->setComment(
"txt file containing effective areas to be used for charged PF-isolation pileup subtraction for photons");
298 desc.
add<
edm::FileInPath>(
"EAFile_PFIso_Neu")->setComment(
"txt file containing effective areas to be used for neutral PF-isolation pileup subtraction for photons");
299 desc.
add<
edm::FileInPath>(
"EAFile_PFIso_Pho")->setComment(
"txt file containing effective areas to be used for photon PF-isolation pileup subtraction for photons");
300 desc.
add<
edm::InputTag>(
"rho_PFIso")->setComment(
"rho to be used for effective-area based PF-isolation pileup subtraction for photons");
303 if (
typeid(
T) ==
typeid(
pat::Muon)) modname+=
"Muon";
305 else if (
typeid(
T) ==
typeid(
pat::Photon)) modname+=
"Pho";
307 modname+=
"IsoValueMapProducer";
308 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)