CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
IsoValueMapProducer< T > Class Template Reference

#include <PhysicsTools/NanoAOD/plugins/IsoValueMapProducer.cc>

Inheritance diagram for IsoValueMapProducer< T >:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 IsoValueMapProducer (const edm::ParameterSet &iConfig)
 
 ~IsoValueMapProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void doMiniIso (edm::Event &) const
 
template<>
void doMiniIso (edm::Event &iEvent) const
 
void doPFIsoEle (edm::Event &) const
 
template<>
void doPFIsoEle (edm::Event &iEvent) const
 
void doPFIsoPho (edm::Event &) const
 
template<>
void doPFIsoPho (edm::Event &iEvent) const
 
void doPFIsoPhoQuadratic (edm::Event &) const
 
template<>
void doPFIsoPhoQuadratic (edm::Event &iEvent) const
 
float getEtaForEA (const T *) const
 
template<>
float getEtaForEA (const pat::Electron *el) const
 
template<>
float getEtaForEA (const pat::Photon *ph) const
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

bool doQuadratic_
 
std::unique_ptr< EffectiveAreasea_miniiso_
 
std::unique_ptr< EffectiveAreasea_pfiso_
 
std::unique_ptr< EffectiveAreasea_pfiso_chg_
 
std::unique_ptr< EffectiveAreasea_pfiso_neu_
 
std::unique_ptr< EffectiveAreasea_pfiso_pho_
 
std::unique_ptr< EffectiveAreasquadratic_ea_pfiso_chg_
 
std::unique_ptr< EffectiveAreasquadratic_ea_pfiso_ecal_
 
std::unique_ptr< EffectiveAreasquadratic_ea_pfiso_hcal_
 
bool relative_
 
edm::EDGetTokenT< double > rho_miniiso_
 
edm::EDGetTokenT< double > rho_pfiso_
 
edm::EDGetTokenT< edm::View< T > > src_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

template<typename T>
class IsoValueMapProducer< T >

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 44 of file IsoValueMapProducer.cc.

Constructor & Destructor Documentation

◆ IsoValueMapProducer()

template<typename T >
IsoValueMapProducer< T >::IsoValueMapProducer ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 46 of file IsoValueMapProducer.cc.

References IsoValueMapProducer< T >::doQuadratic_, IsoValueMapProducer< T >::ea_miniiso_, IsoValueMapProducer< T >::ea_pfiso_, IsoValueMapProducer< T >::ea_pfiso_chg_, IsoValueMapProducer< T >::ea_pfiso_neu_, IsoValueMapProducer< T >::ea_pfiso_pho_, edm::ParameterSet::getParameter(), IsoValueMapProducer< T >::quadratic_ea_pfiso_chg_, IsoValueMapProducer< T >::quadratic_ea_pfiso_ecal_, IsoValueMapProducer< T >::quadratic_ea_pfiso_hcal_, IsoValueMapProducer< T >::rho_miniiso_, and IsoValueMapProducer< T >::rho_pfiso_.

48  relative_(iConfig.getParameter<bool>("relative")),
49  doQuadratic_(iConfig.getParameter<bool>("doQuadratic")) {
50  if ((typeid(T) == typeid(pat::Muon)) || (typeid(T) == typeid(pat::Electron)) ||
51  typeid(T) == typeid(pat::IsolatedTrack)) {
52  produces<edm::ValueMap<float>>("miniIsoChg");
53  produces<edm::ValueMap<float>>("miniIsoAll");
54  ea_miniiso_ =
55  std::make_unique<EffectiveAreas>((iConfig.getParameter<edm::FileInPath>("EAFile_MiniIso")).fullPath());
56  rho_miniiso_ = consumes<double>(iConfig.getParameter<edm::InputTag>("rho_MiniIso"));
57  }
58  if ((typeid(T) == typeid(pat::Electron))) {
59  produces<edm::ValueMap<float>>("PFIsoChg");
60  produces<edm::ValueMap<float>>("PFIsoAll");
61  produces<edm::ValueMap<float>>("PFIsoAll04");
62  ea_pfiso_ = std::make_unique<EffectiveAreas>((iConfig.getParameter<edm::FileInPath>("EAFile_PFIso")).fullPath());
63  rho_pfiso_ = consumes<double>(iConfig.getParameter<edm::InputTag>("rho_PFIso"));
64  } else if ((typeid(T) == typeid(pat::Photon))) {
65  rho_pfiso_ = consumes<double>(iConfig.getParameter<edm::InputTag>("rho_PFIso"));
66 
67  if (!doQuadratic_) {
68  produces<edm::ValueMap<float>>("PFIsoChg");
69  produces<edm::ValueMap<float>>("PFIsoAll");
70 
72  std::make_unique<EffectiveAreas>((iConfig.getParameter<edm::FileInPath>("EAFile_PFIso_Chg")).fullPath());
74  std::make_unique<EffectiveAreas>((iConfig.getParameter<edm::FileInPath>("EAFile_PFIso_Neu")).fullPath());
76  std::make_unique<EffectiveAreas>((iConfig.getParameter<edm::FileInPath>("EAFile_PFIso_Pho")).fullPath());
77 
78  }
79 
80  else {
81  produces<edm::ValueMap<float>>("PFIsoChgQuadratic");
82  produces<edm::ValueMap<float>>("PFIsoAllQuadratic");
83 
84  quadratic_ea_pfiso_chg_ = std::make_unique<EffectiveAreas>(
85  (iConfig.getParameter<edm::FileInPath>("QuadraticEAFile_PFIso_Chg")).fullPath(), true);
86  quadratic_ea_pfiso_ecal_ = std::make_unique<EffectiveAreas>(
87  (iConfig.getParameter<edm::FileInPath>("QuadraticEAFile_PFIso_ECal")).fullPath(), true);
88  quadratic_ea_pfiso_hcal_ = std::make_unique<EffectiveAreas>(
89  (iConfig.getParameter<edm::FileInPath>("QuadraticEAFile_PFIso_HCal")).fullPath(), true);
90  }
91  }
92  }
Analysis-level Photon class.
Definition: Photon.h:46
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::unique_ptr< EffectiveAreas > quadratic_ea_pfiso_chg_
std::unique_ptr< EffectiveAreas > quadratic_ea_pfiso_hcal_
edm::EDGetTokenT< double > rho_pfiso_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unique_ptr< EffectiveAreas > ea_pfiso_chg_
std::unique_ptr< EffectiveAreas > ea_pfiso_pho_
edm::EDGetTokenT< edm::View< T > > src_
std::unique_ptr< EffectiveAreas > ea_pfiso_neu_
Analysis-level electron class.
Definition: Electron.h:51
std::unique_ptr< EffectiveAreas > quadratic_ea_pfiso_ecal_
edm::EDGetTokenT< double > rho_miniiso_
std::unique_ptr< EffectiveAreas > ea_pfiso_
long double T
std::unique_ptr< EffectiveAreas > ea_miniiso_
Analysis-level muon class.
Definition: Muon.h:51

◆ ~IsoValueMapProducer()

template<typename T >
IsoValueMapProducer< T >::~IsoValueMapProducer ( )
inlineoverride

Definition at line 94 of file IsoValueMapProducer.cc.

94 {}

Member Function Documentation

◆ doMiniIso() [1/2]

template<typename T >
void IsoValueMapProducer< T >::doMiniIso ( edm::Event iEvent) const
private

Definition at line 163 of file IsoValueMapProducer.cc.

References chg, iEvent, SiStripPI::max, SiStripPI::min, electrons_cff::miniIsoAll, electrons_cff::miniIsoChg, eostools::move(), getGTfromDQMFile::obj, conifer::pow(), dttmaxenums::R, IsoPhotonEBSkim_cff::rho, pfClustersFromCombinedCaloHF_cfi::scale, and TrackRefitter_38T_cff::src.

163  {
164  auto src = iEvent.getHandle(src_);
165  const auto& rho = iEvent.get(rho_miniiso_);
166 
167  unsigned int nInput = src->size();
168 
169  std::vector<float> miniIsoChg, miniIsoAll;
170  miniIsoChg.reserve(nInput);
171  miniIsoAll.reserve(nInput);
172 
173  for (const auto& obj : *src) {
174  auto iso = obj.miniPFIsolation();
175  auto chg = iso.chargedHadronIso();
176  auto neu = iso.neutralHadronIso();
177  auto pho = iso.photonIso();
178  auto ea = ea_miniiso_->getEffectiveArea(fabs(getEtaForEA(&obj)));
179  float R = 10.0 / std::min(std::max(obj.pt(), 50.0), 200.0);
180  ea *= std::pow(R / 0.3, 2);
181  float scale = relative_ ? 1.0 / obj.pt() : 1;
182  miniIsoChg.push_back(scale * chg);
183  miniIsoAll.push_back(scale * (chg + std::max(0.0, neu + pho - rho * ea)));
184  }
185 
186  auto miniIsoChgV = std::make_unique<edm::ValueMap<float>>();
187  edm::ValueMap<float>::Filler fillerChg(*miniIsoChgV);
188  fillerChg.insert(src, miniIsoChg.begin(), miniIsoChg.end());
189  fillerChg.fill();
190  auto miniIsoAllV = std::make_unique<edm::ValueMap<float>>();
191  edm::ValueMap<float>::Filler fillerAll(*miniIsoAllV);
192  fillerAll.insert(src, miniIsoAll.begin(), miniIsoAll.end());
193  fillerAll.fill();
194 
195  iEvent.put(std::move(miniIsoChgV), "miniIsoChg");
196  iEvent.put(std::move(miniIsoAllV), "miniIsoAll");
197 }
float getEtaForEA(const T *) const
const float chg[109]
Definition: CoreSimTrack.cc:5
constexpr int pow(int x)
Definition: conifer.h:24
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< T > > src_
edm::EDGetTokenT< double > rho_miniiso_
std::unique_ptr< EffectiveAreas > ea_miniiso_
def move(src, dest)
Definition: eostools.py:511

◆ doMiniIso() [2/2]

template<>
void IsoValueMapProducer< pat::Photon >::doMiniIso ( edm::Event iEvent) const
private

Definition at line 200 of file IsoValueMapProducer.cc.

200 {}

◆ doPFIsoEle() [1/2]

template<typename T >
void IsoValueMapProducer< T >::doPFIsoEle ( edm::Event iEvent) const
private

Definition at line 203 of file IsoValueMapProducer.cc.

203 {}

◆ doPFIsoEle() [2/2]

template<>
void IsoValueMapProducer< pat::Electron >::doPFIsoEle ( edm::Event iEvent) const
private

Definition at line 206 of file IsoValueMapProducer.cc.

References chg, iEvent, SiStripPI::max, eostools::move(), getGTfromDQMFile::obj, electrons_cff::PFIsoAll, electrons_cff::PFIsoAll04, electrons_cff::PFIsoChg, IsoPhotonEBSkim_cff::rho, pfClustersFromCombinedCaloHF_cfi::scale, and TrackRefitter_38T_cff::src.

206  {
208  iEvent.getByToken(src_, src);
209  const auto& rho = iEvent.get(rho_pfiso_);
210 
211  unsigned int nInput = src->size();
212 
213  std::vector<float> PFIsoChg, PFIsoAll, PFIsoAll04;
214  PFIsoChg.reserve(nInput);
215  PFIsoAll.reserve(nInput);
216  PFIsoAll04.reserve(nInput);
217 
218  for (const auto& obj : *src) {
219  auto iso = obj.pfIsolationVariables();
220  auto chg = iso.sumChargedHadronPt;
221  auto neu = iso.sumNeutralHadronEt;
222  auto pho = iso.sumPhotonEt;
223  auto ea = ea_pfiso_->getEffectiveArea(fabs(getEtaForEA(&obj)));
224  float scale = relative_ ? 1.0 / obj.pt() : 1;
225  PFIsoChg.push_back(scale * chg);
226  PFIsoAll.push_back(scale * (chg + std::max(0.0, neu + pho - rho * ea)));
227  PFIsoAll04.push_back(scale * (obj.chargedHadronIso() +
228  std::max(0.0, obj.neutralHadronIso() + obj.photonIso() - rho * ea * 16. / 9.)));
229  }
230 
231  auto PFIsoChgV = std::make_unique<edm::ValueMap<float>>();
232  edm::ValueMap<float>::Filler fillerChg(*PFIsoChgV);
233  fillerChg.insert(src, PFIsoChg.begin(), PFIsoChg.end());
234  fillerChg.fill();
235  auto PFIsoAllV = std::make_unique<edm::ValueMap<float>>();
236  edm::ValueMap<float>::Filler fillerAll(*PFIsoAllV);
237  fillerAll.insert(src, PFIsoAll.begin(), PFIsoAll.end());
238  fillerAll.fill();
239  auto PFIsoAll04V = std::make_unique<edm::ValueMap<float>>();
240  edm::ValueMap<float>::Filler fillerAll04(*PFIsoAll04V);
241  fillerAll04.insert(src, PFIsoAll04.begin(), PFIsoAll04.end());
242  fillerAll04.fill();
243 
244  iEvent.put(std::move(PFIsoChgV), "PFIsoChg");
245  iEvent.put(std::move(PFIsoAllV), "PFIsoAll");
246  iEvent.put(std::move(PFIsoAll04V), "PFIsoAll04");
247 }
float getEtaForEA(const T *) const
const float chg[109]
Definition: CoreSimTrack.cc:5
edm::EDGetTokenT< double > rho_pfiso_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< T > > src_
std::unique_ptr< EffectiveAreas > ea_pfiso_
def move(src, dest)
Definition: eostools.py:511

◆ doPFIsoPho() [1/2]

template<typename T >
void IsoValueMapProducer< T >::doPFIsoPho ( edm::Event iEvent) const
private

Definition at line 250 of file IsoValueMapProducer.cc.

250 {}

◆ doPFIsoPho() [2/2]

template<>
void IsoValueMapProducer< pat::Photon >::doPFIsoPho ( edm::Event iEvent) const
private

Definition at line 253 of file IsoValueMapProducer.cc.

References chg, iEvent, SiStripPI::max, eostools::move(), getGTfromDQMFile::obj, electrons_cff::PFIsoAll, electrons_cff::PFIsoChg, IsoPhotonEBSkim_cff::rho, pfClustersFromCombinedCaloHF_cfi::scale, and TrackRefitter_38T_cff::src.

253  {
255  iEvent.getByToken(src_, src);
256  const auto& rho = iEvent.get(rho_pfiso_);
257 
258  unsigned int nInput = src->size();
259 
260  std::vector<float> PFIsoChg, PFIsoAll;
261 
262  PFIsoChg.reserve(nInput);
263  PFIsoAll.reserve(nInput);
264 
265  for (const auto& obj : *src) {
266  auto chg = obj.chargedHadronIso();
267  auto neu = obj.neutralHadronIso();
268  auto pho = obj.photonIso();
269 
270  auto ea_chg = ea_pfiso_chg_->getEffectiveArea(fabs(getEtaForEA(&obj)));
271  auto ea_neu = ea_pfiso_neu_->getEffectiveArea(fabs(getEtaForEA(&obj)));
272  auto ea_pho = ea_pfiso_pho_->getEffectiveArea(fabs(getEtaForEA(&obj)));
273 
274  float scale = relative_ ? 1.0 / obj.pt() : 1;
275  PFIsoChg.push_back(scale * std::max(0.0, chg - rho * ea_chg));
276  PFIsoAll.push_back(PFIsoChg.back() +
277  scale * (std::max(0.0, neu - rho * ea_neu) + std::max(0.0, pho - rho * ea_pho)));
278  }
279 
280  auto PFIsoChgV = std::make_unique<edm::ValueMap<float>>();
281  edm::ValueMap<float>::Filler fillerChg(*PFIsoChgV);
282  fillerChg.insert(src, PFIsoChg.begin(), PFIsoChg.end());
283  fillerChg.fill();
284  auto PFIsoAllV = std::make_unique<edm::ValueMap<float>>();
285  edm::ValueMap<float>::Filler fillerAll(*PFIsoAllV);
286  fillerAll.insert(src, PFIsoAll.begin(), PFIsoAll.end());
287  fillerAll.fill();
288 
289  iEvent.put(std::move(PFIsoChgV), "PFIsoChg");
290  iEvent.put(std::move(PFIsoAllV), "PFIsoAll");
291 }
float getEtaForEA(const T *) const
const float chg[109]
Definition: CoreSimTrack.cc:5
edm::EDGetTokenT< double > rho_pfiso_
int iEvent
Definition: GenABIO.cc:224
std::unique_ptr< EffectiveAreas > ea_pfiso_chg_
std::unique_ptr< EffectiveAreas > ea_pfiso_pho_
edm::EDGetTokenT< edm::View< T > > src_
std::unique_ptr< EffectiveAreas > ea_pfiso_neu_
def move(src, dest)
Definition: eostools.py:511

◆ doPFIsoPhoQuadratic() [1/2]

template<typename T >
void IsoValueMapProducer< T >::doPFIsoPhoQuadratic ( edm::Event iEvent) const
private

Definition at line 294 of file IsoValueMapProducer.cc.

294 {}

◆ doPFIsoPhoQuadratic() [2/2]

template<>
void IsoValueMapProducer< pat::Photon >::doPFIsoPhoQuadratic ( edm::Event iEvent) const
private

Definition at line 297 of file IsoValueMapProducer.cc.

References chg, iEvent, SiStripPI::max, eostools::move(), getGTfromDQMFile::obj, photons_cff::PFIsoAllQuadratic, photons_cff::PFIsoChgQuadratic, IsoPhotonEBSkim_cff::rho, pfClustersFromCombinedCaloHF_cfi::scale, and TrackRefitter_38T_cff::src.

297  {
299  iEvent.getByToken(src_, src);
300  const auto& rho = iEvent.get(rho_pfiso_);
301 
302  unsigned int nInput = src->size();
303 
304  std::vector<float> PFIsoChgQuadratic, PFIsoAllQuadratic;
305 
306  PFIsoChgQuadratic.reserve(nInput);
307  PFIsoAllQuadratic.reserve(nInput);
308 
309  for (const auto& obj : *src) {
310  auto chg = obj.chargedHadronIso();
311  auto ecal = obj.ecalPFClusterIso();
312  auto hcal = obj.hcalPFClusterIso();
313 
314  auto quadratic_ea_chg = quadratic_ea_pfiso_chg_->getQuadraticEA(fabs(getEtaForEA(&obj)));
315  auto linear_ea_chg = quadratic_ea_pfiso_chg_->getLinearEA(fabs(getEtaForEA(&obj)));
316  auto quadratic_ea_ecal = quadratic_ea_pfiso_ecal_->getQuadraticEA(fabs(getEtaForEA(&obj)));
317  auto linear_ea_ecal = quadratic_ea_pfiso_ecal_->getLinearEA(fabs(getEtaForEA(&obj)));
318  auto quadratic_ea_hcal = quadratic_ea_pfiso_hcal_->getQuadraticEA(fabs(getEtaForEA(&obj)));
319  auto linear_ea_hcal = quadratic_ea_pfiso_hcal_->getLinearEA(fabs(getEtaForEA(&obj)));
320 
321  float scale = relative_ ? 1.0 / obj.pt() : 1;
322 
323  PFIsoChgQuadratic.push_back(scale * std::max(0.0, chg - (quadratic_ea_chg * rho * rho + linear_ea_chg * rho)));
324  PFIsoAllQuadratic.push_back(PFIsoChgQuadratic.back() +
325  scale * (std::max(0.0, ecal - (quadratic_ea_ecal * rho * rho + linear_ea_ecal * rho)) +
326  std::max(0.0, hcal - (quadratic_ea_hcal * rho * rho + linear_ea_hcal * rho))));
327  }
328 
329  auto PFIsoChgQuadraticV = std::make_unique<edm::ValueMap<float>>();
330  edm::ValueMap<float>::Filler fillerChgQuadratic(*PFIsoChgQuadraticV);
331  fillerChgQuadratic.insert(src, PFIsoChgQuadratic.begin(), PFIsoChgQuadratic.end());
332  fillerChgQuadratic.fill();
333 
334  auto PFIsoAllQuadraticV = std::make_unique<edm::ValueMap<float>>();
335  edm::ValueMap<float>::Filler fillerAllQuadratic(*PFIsoAllQuadraticV);
336  fillerAllQuadratic.insert(src, PFIsoAllQuadratic.begin(), PFIsoAllQuadratic.end());
337  fillerAllQuadratic.fill();
338 
339  iEvent.put(std::move(PFIsoChgQuadraticV), "PFIsoChgQuadratic");
340  iEvent.put(std::move(PFIsoAllQuadraticV), "PFIsoAllQuadratic");
341 }
float getEtaForEA(const T *) const
std::unique_ptr< EffectiveAreas > quadratic_ea_pfiso_chg_
const float chg[109]
Definition: CoreSimTrack.cc:5
std::unique_ptr< EffectiveAreas > quadratic_ea_pfiso_hcal_
edm::EDGetTokenT< double > rho_pfiso_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< T > > src_
std::unique_ptr< EffectiveAreas > quadratic_ea_pfiso_ecal_
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

template<typename T >
void IsoValueMapProducer< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 345 of file IsoValueMapProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, timingPdfMaker::modname, and AlCaHLTBitMon_QueryRunRegistry::string.

345  {
347  desc.add<edm::InputTag>("src")->setComment("input physics object collection");
348  desc.add<bool>("relative")->setComment("compute relative isolation instead of absolute one");
349  desc.add<bool>("doQuadratic", false)->setComment("flag to do quadratic EA corections for photons");
350  if ((typeid(T) == typeid(pat::Muon)) || (typeid(T) == typeid(pat::Electron)) ||
351  typeid(T) == typeid(pat::IsolatedTrack)) {
352  desc.add<edm::FileInPath>("EAFile_MiniIso")
353  ->setComment("txt file containing effective areas to be used for mini-isolation pileup subtraction");
354  desc.add<edm::InputTag>("rho_MiniIso")
355  ->setComment("rho to be used for effective-area based mini-isolation pileup subtraction");
356  }
357  if ((typeid(T) == typeid(pat::Electron))) {
358  desc.add<edm::FileInPath>("EAFile_PFIso")
359  ->setComment(
360  "txt file containing effective areas to be used for PF-isolation pileup subtraction for electrons");
361  desc.add<edm::InputTag>("rho_PFIso")
362  ->setComment("rho to be used for effective-area based PF-isolation pileup subtraction for electrons");
363  }
364  if ((typeid(T) == typeid(pat::Photon))) {
365  desc.addOptional<edm::InputTag>("mapIsoChg")
366  ->setComment("input charged PF isolation calculated in VID for photons");
367  desc.addOptional<edm::InputTag>("mapIsoNeu")
368  ->setComment("input neutral PF isolation calculated in VID for photons");
369  desc.addOptional<edm::InputTag>("mapIsoPho")->setComment("input photon PF isolation calculated in VID for photons");
370 
371  desc.addOptional<edm::FileInPath>("EAFile_PFIso_Chg")
372  ->setComment(
373  "txt file containing effective areas to be used for charged PF-isolation pileup subtraction for photons");
374  desc.addOptional<edm::FileInPath>("EAFile_PFIso_Neu")
375  ->setComment(
376  "txt file containing effective areas to be used for neutral PF-isolation pileup subtraction for photons");
377  desc.addOptional<edm::FileInPath>("EAFile_PFIso_Pho")
378  ->setComment(
379  "txt file containing effective areas to be used for photon PF-isolation pileup subtraction for photons");
380 
381  desc.add<edm::InputTag>("rho_PFIso")
382  ->setComment("rho to be used for effective-area based PF-isolation pileup subtraction for photons");
383 
384  desc.addOptional<edm::FileInPath>("QuadraticEAFile_PFIso_Chg")
385  ->setComment(
386  "txt file containing quadratic effective areas to be used for charged PF-isolation pileup subtraction for "
387  "photons");
388  desc.addOptional<edm::FileInPath>("QuadraticEAFile_PFIso_ECal")
389  ->setComment(
390  "txt file containing quadratic effective areas to be used for ecal PF-isolation pileup subtraction for "
391  "photons");
392  desc.addOptional<edm::FileInPath>("QuadraticEAFile_PFIso_HCal")
393  ->setComment(
394  "txt file containing quadratic effective areas to be used for hcal PF-isolation pileup subtraction for "
395  "photons");
396  }
397 
399  if (typeid(T) == typeid(pat::Muon))
400  modname += "Muon";
401  else if (typeid(T) == typeid(pat::Electron))
402  modname += "Ele";
403  else if (typeid(T) == typeid(pat::Photon))
404  modname += "Pho";
405  else if (typeid(T) == typeid(pat::IsolatedTrack))
406  modname += "IsoTrack";
407  modname += "IsoValueMapProducer";
408  descriptions.add(modname, desc);
409 }
Analysis-level Photon class.
Definition: Photon.h:46
Analysis-level electron class.
Definition: Electron.h:51
void add(std::string const &label, ParameterSetDescription const &psetDescription)
long double T
Analysis-level muon class.
Definition: Muon.h:51

◆ getEtaForEA() [1/3]

template<typename T >
float IsoValueMapProducer< T >::getEtaForEA ( const T obj) const
private

Definition at line 133 of file IsoValueMapProducer.cc.

References getGTfromDQMFile::obj.

133  {
134  return obj->eta();
135 }

◆ getEtaForEA() [2/3]

template<>
float IsoValueMapProducer< pat::Electron >::getEtaForEA ( const pat::Electron el) const
private

Definition at line 137 of file IsoValueMapProducer.cc.

References pat::Electron::superCluster().

137  {
138  return el->superCluster()->eta();
139 }
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...

◆ getEtaForEA() [3/3]

template<>
float IsoValueMapProducer< pat::Photon >::getEtaForEA ( const pat::Photon ph) const
private

Definition at line 141 of file IsoValueMapProducer.cc.

141  {
142  return ph->superCluster()->eta();
143 }

◆ produce()

template<typename T >
void IsoValueMapProducer< T >::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 146 of file IsoValueMapProducer.cc.

References iEvent.

146  {
147  if ((typeid(T) == typeid(pat::Muon)) || (typeid(T) == typeid(pat::Electron)) ||
148  typeid(T) == typeid(pat::IsolatedTrack)) {
149  doMiniIso(iEvent);
150  };
151  if ((typeid(T) == typeid(pat::Electron))) {
153  }
154  if ((typeid(T) == typeid(pat::Photon))) {
155  if (!doQuadratic_)
157  else
159  }
160 }
Analysis-level Photon class.
Definition: Photon.h:46
int iEvent
Definition: GenABIO.cc:224
void doMiniIso(edm::Event &) const
void doPFIsoEle(edm::Event &) const
Analysis-level electron class.
Definition: Electron.h:51
void doPFIsoPho(edm::Event &) const
void doPFIsoPhoQuadratic(edm::Event &) const
long double T
Analysis-level muon class.
Definition: Muon.h:51

Member Data Documentation

◆ doQuadratic_

template<typename T >
bool IsoValueMapProducer< T >::doQuadratic_
private

◆ ea_miniiso_

template<typename T >
std::unique_ptr<EffectiveAreas> IsoValueMapProducer< T >::ea_miniiso_
private

◆ ea_pfiso_

template<typename T >
std::unique_ptr<EffectiveAreas> IsoValueMapProducer< T >::ea_pfiso_
private

◆ ea_pfiso_chg_

template<typename T >
std::unique_ptr<EffectiveAreas> IsoValueMapProducer< T >::ea_pfiso_chg_
private

◆ ea_pfiso_neu_

template<typename T >
std::unique_ptr<EffectiveAreas> IsoValueMapProducer< T >::ea_pfiso_neu_
private

◆ ea_pfiso_pho_

template<typename T >
std::unique_ptr<EffectiveAreas> IsoValueMapProducer< T >::ea_pfiso_pho_
private

◆ quadratic_ea_pfiso_chg_

template<typename T >
std::unique_ptr<EffectiveAreas> IsoValueMapProducer< T >::quadratic_ea_pfiso_chg_
private

◆ quadratic_ea_pfiso_ecal_

template<typename T >
std::unique_ptr<EffectiveAreas> IsoValueMapProducer< T >::quadratic_ea_pfiso_ecal_
private

◆ quadratic_ea_pfiso_hcal_

template<typename T >
std::unique_ptr<EffectiveAreas> IsoValueMapProducer< T >::quadratic_ea_pfiso_hcal_
private

◆ relative_

template<typename T >
bool IsoValueMapProducer< T >::relative_
private

Definition at line 104 of file IsoValueMapProducer.cc.

◆ rho_miniiso_

template<typename T >
edm::EDGetTokenT<double> IsoValueMapProducer< T >::rho_miniiso_
private

◆ rho_pfiso_

template<typename T >
edm::EDGetTokenT<double> IsoValueMapProducer< T >::rho_pfiso_
private

◆ src_

template<typename T >
edm::EDGetTokenT<edm::View<T> > IsoValueMapProducer< T >::src_
private

Definition at line 103 of file IsoValueMapProducer.cc.