CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
ElectronHEEPIDValueMapProducer Class Reference
Inheritance diagram for ElectronHEEPIDValueMapProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  DataFormat
 
struct  DualToken
 

Public Member Functions

 ElectronHEEPIDValueMapProducer (const edm::ParameterSet &)
 
 ~ElectronHEEPIDValueMapProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

float calTrkIso (const reco::GsfElectron &ele, const edm::View< reco::GsfElectron > &eles, const std::vector< edm::Handle< pat::PackedCandidateCollection > > &handles, const std::vector< EleTkIsolFromCands::PIDVeto > &pidVetos) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 
template<typename T >
void setToken (edm::EDGetTokenT< T > &token, edm::InputTag tag)
 
template<typename T >
void setToken (edm::EDGetTokenT< T > &token, const edm::ParameterSet &iPara, const std::string &tag)
 
template<typename T >
void setToken (std::vector< edm::EDGetTokenT< T > > &tokens, const edm::ParameterSet &iPara, const std::string &tagName)
 
template<typename T >
void setToken (DualToken< T > &token, const edm::ParameterSet &iPara, const std::string &tagAOD, const std::string &tagMiniAOD, DataFormat format)
 
template<typename T >
void setToken (std::vector< DualToken< T > > &tokens, const edm::ParameterSet &iPara, const std::string &tagAOD, const std::string &tagMiniAOD, DataFormat format)
 

Static Private Member Functions

template<typename T >
static edm::Handle< TgetHandle (const edm::Event &iEvent, const edm::EDGetTokenT< T > &token)
 
template<typename T >
static edm::Handle< TgetHandle (const edm::Event &iEvent, const DualToken< T > &token)
 
template<typename T >
static std::vector< edm::Handle< T > > getHandles (const edm::Event &iEvent, const std::vector< DualToken< T > > &tokens)
 
template<typename T >
static bool isEventAOD (const edm::Event &iEvent, const DualToken< T > &token)
 
static int nrSaturatedCrysIn5x5 (const reco::GsfElectron &ele, edm::Handle< EcalRecHitCollection > &ebHits, edm::Handle< EcalRecHitCollection > &eeHits, edm::ESHandle< CaloTopology > &caloTopo)
 
template<typename T >
static void writeValueMap (edm::Event &iEvent, const edm::Handle< edm::View< reco::GsfElectron > > &handle, const std::vector< T > &values, const std::string &label)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
std::vector< DualToken< pat::PackedCandidateCollection > > candTokens_
 
std::vector< EleTkIsolFromCands::PIDVetocandVetosAOD_
 
std::vector< EleTkIsolFromCands::PIDVetocandVetosMiniAOD_
 
DataFormat dataFormat_
 
DualToken< EcalRecHitCollectionebRecHitToken_
 
DualToken< EcalRecHitCollectioneeRecHitToken_
 
DualToken< edm::View< reco::GsfElectron > > eleToken_
 
EleTkIsolFromCands trkIsoCalc_
 

Static Private Attributes

static const std::string eleNrSaturateIn5x5Label_ ="eleNrSaturateIn5x5"
 
static const std::string eleTrkPtIsoLabel_ ="eleTrkPtIso"
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 32 of file ElectronHEEPIDValueMapProducer.cc.

Constructor & Destructor Documentation

ElectronHEEPIDValueMapProducer::ElectronHEEPIDValueMapProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 170 of file ElectronHEEPIDValueMapProducer.cc.

References beamSpotToken_, candTokens_, candVetosAOD_, candVetosMiniAOD_, dataFormat_, ebRecHitToken_, eeRecHitToken_, eleNrSaturateIn5x5Label_, eleToken_, eleTrkPtIsoLabel_, Exception, edm::ParameterSet::getParameter(), recoMuon::in, MillePedeFileConverter_cfg::out, EleTkIsolFromCands::pidVetoFromStr(), setToken(), findQualityFiles::size, and create_public_lumi_plots::transform.

Referenced by ElectronHEEPIDValueMapProducer::DataFormat::operator()().

170  :
171  trkIsoCalc_(iConfig.getParameter<edm::ParameterSet>("trkIsoConfig")),
172  dataFormat_(iConfig.getParameter<int>("dataFormat"))
173 {
174  setToken(ebRecHitToken_,iConfig,"ebRecHitsAOD","ebRecHitsMiniAOD",dataFormat_);
175  setToken(eeRecHitToken_,iConfig,"eeRecHitsAOD","eeRecHitsMiniAOD",dataFormat_);
176  setToken(eleToken_,iConfig,"elesAOD","elesMiniAOD",dataFormat_);
177  setToken(candTokens_,iConfig,"candsAOD","candsMiniAOD",dataFormat_);
178  setToken(beamSpotToken_,iConfig,"beamSpot");
179 
180  auto fillVetos=[](const auto& in,auto& out){
181  std::transform(in.begin(),in.end(),std::back_inserter(out),EleTkIsolFromCands::pidVetoFromStr);
182  };
183 
184  fillVetos(iConfig.getParameter<std::vector<std::string> >("candVetosAOD"),candVetosAOD_);
185  if(candVetosAOD_.size()!=iConfig.getParameter<std::vector<edm::InputTag> >("candsAOD").size()){
186  throw cms::Exception("ConfigError") <<" Error candVetosAOD should be the same size as candsAOD "<<std::endl;
187  }
188 
189  fillVetos(iConfig.getParameter<std::vector<std::string> >("candVetosMiniAOD"),candVetosMiniAOD_);
190  if(candVetosMiniAOD_.size()!=iConfig.getParameter<std::vector<edm::InputTag> >("candsMiniAOD").size()){
191  throw cms::Exception("ConfigError") <<" Error candVetosMiniAOD should be the same size as candsMiniAOD "<<std::endl;
192  }
193 
194  produces<edm::ValueMap<float> >(eleTrkPtIsoLabel_);
195  produces<edm::ValueMap<int> >(eleNrSaturateIn5x5Label_);
196 }
size
Write out results.
T getParameter(std::string const &) const
DualToken< EcalRecHitCollection > ebRecHitToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
std::vector< DualToken< pat::PackedCandidateCollection > > candTokens_
std::vector< EleTkIsolFromCands::PIDVeto > candVetosMiniAOD_
DualToken< edm::View< reco::GsfElectron > > eleToken_
DualToken< EcalRecHitCollection > eeRecHitToken_
static PIDVeto pidVetoFromStr(const std::string &vetoStr)
std::vector< EleTkIsolFromCands::PIDVeto > candVetosAOD_
void setToken(edm::EDGetTokenT< T > &token, edm::InputTag tag)
ElectronHEEPIDValueMapProducer::~ElectronHEEPIDValueMapProducer ( )
override

Definition at line 198 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer::DataFormat::operator()().

199 {
200 
201 }

Member Function Documentation

float ElectronHEEPIDValueMapProducer::calTrkIso ( const reco::GsfElectron ele,
const edm::View< reco::GsfElectron > &  eles,
const std::vector< edm::Handle< pat::PackedCandidateCollection > > &  handles,
const std::vector< EleTkIsolFromCands::PIDVeto > &  pidVetos 
) const
private

Definition at line 241 of file ElectronHEEPIDValueMapProducer.cc.

References EleTkIsolFromCands::calIsolPt(), Exception, reco::GsfElectron::gsfTrack(), cmsBatch::handle, edm::Ref< C, T, F >::isNull(), SiStripPI::max, and trkIsoCalc_.

Referenced by nrSaturatedCrysIn5x5(), ElectronHEEPIDValueMapProducer::DataFormat::operator()(), and produce().

245 {
246  if(ele.gsfTrack().isNull()) return std::numeric_limits<float>::max();
247  else{
248  float trkIso=0.;
249  for(size_t handleNr=0;handleNr<handles.size();handleNr++){
250  auto& handle = handles[handleNr];
251  if(handle.isValid()){
252  if(handleNr<pidVetos.size()){
253  trkIso+= trkIsoCalc_.calIsolPt(*ele.gsfTrack(),*handle,pidVetos[handleNr]);
254  }else{
255  throw cms::Exception("LogicError") <<" somehow the pidVetos and handles do not much, given this is checked at construction time, something has gone wrong in the code handle nr "<<handleNr<<" size of vetos "<<pidVetos.size();
256  }
257  }
258  }
259  return trkIso;
260  }
261 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
double calIsolPt(Args &&...args) const
bool isNull() const
Checks for null.
Definition: Ref.h:250
void ElectronHEEPIDValueMapProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 276 of file ElectronHEEPIDValueMapProducer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and EleTkIsolFromCands::pSetDescript().

Referenced by ElectronHEEPIDValueMapProducer::DataFormat::operator()().

276  {
277 
279  desc.add<edm::InputTag>("beamSpot",edm::InputTag("offlineBeamSpot"));
280  desc.add<edm::InputTag>("ebRecHitsAOD",edm::InputTag("reducedEcalRecHitsEB"));
281  desc.add<edm::InputTag>("eeRecHitsAOD",edm::InputTag("reducedEcalRecHitsEE"));
282  desc.add<std::vector<edm::InputTag> >("candsAOD",{edm::InputTag("packedCandidates")});
283  desc.add<std::vector<std::string> >("candVetosAOD",{"none"});
284  desc.add<edm::InputTag>("elesAOD",edm::InputTag("gedGsfElectrons"));
285 
286  desc.add<edm::InputTag>("ebRecHitsMiniAOD",edm::InputTag("reducedEcalRecHitsEB"));
287  desc.add<edm::InputTag>("eeRecHitsMiniAOD",edm::InputTag("reducedEcalRecHitsEE"));
288  desc.add<std::vector<edm::InputTag> >("candsMiniAOD",{edm::InputTag("packedCandidates")});
289  desc.add<std::vector<std::string> >("candVetosMiniAOD",{"none"});
290  desc.add<edm::InputTag>("elesMiniAOD",edm::InputTag("gedGsfElectrons"));
291  desc.add<int>("dataFormat",0);
292 
293  desc.add("trkIsoConfig",EleTkIsolFromCands::pSetDescript());
294 
295  descriptions.addDefault(desc);
296 }
void addDefault(ParameterSetDescription const &psetDescription)
static edm::ParameterSetDescription pSetDescript()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
template<typename T >
static edm::Handle<T> ElectronHEEPIDValueMapProducer::getHandle ( const edm::Event iEvent,
const edm::EDGetTokenT< T > &  token 
)
inlinestaticprivate

Definition at line 109 of file ElectronHEEPIDValueMapProducer.cc.

References edm::Event::getByToken(), and cmsBatch::handle.

Referenced by produce().

110  {
112  iEvent.getByToken(token,handle);
113  return handle;
114  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
template<typename T >
static edm::Handle<T> ElectronHEEPIDValueMapProducer::getHandle ( const edm::Event iEvent,
const DualToken< T > &  token 
)
inlinestaticprivate

Definition at line 116 of file ElectronHEEPIDValueMapProducer.cc.

References ElectronHEEPIDValueMapProducer::DualToken< T >::aod, edm::Event::getByToken(), cmsBatch::handle, edm::HandleBase::isValid(), and ElectronHEEPIDValueMapProducer::DualToken< T >::miniAOD.

117  {
119  if(!token.aod.isUninitialized()) iEvent.getByToken(token.aod,handle);
120  if(!handle.isValid() && !token.miniAOD.isUninitialized()) iEvent.getByToken(token.miniAOD,handle);
121  return handle;
122  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
bool isValid() const
Definition: HandleBase.h:74
template<typename T >
static std::vector<edm::Handle<T> > ElectronHEEPIDValueMapProducer::getHandles ( const edm::Event iEvent,
const std::vector< DualToken< T > > &  tokens 
)
inlinestaticprivate

Definition at line 126 of file ElectronHEEPIDValueMapProducer.cc.

References ElectronHEEPIDValueMapProducer::DualToken< T >::aod, edm::Event::getByToken(), and ElectronHEEPIDValueMapProducer::DualToken< T >::miniAOD.

Referenced by produce().

126  {
127  std::vector<edm::Handle<T> > handles(tokens.size());
128  if(tokens.empty()) return handles;
129  if(!tokens[0].aod.isUninitialized()) iEvent.getByToken(tokens[0].aod,handles[0]);
130  bool isAOD = handles[0].isValid();
131  if(!isAOD && !tokens[0].miniAOD.isUninitialized() ) iEvent.getByToken(tokens[0].miniAOD,handles[0]);
132 
133  for(size_t tokenNr=1;tokenNr<tokens.size();tokenNr++){
134  auto token = isAOD ? tokens[tokenNr].aod : tokens[tokenNr].miniAOD;
135  if(!token.isUninitialized()) iEvent.getByToken(token,handles[tokenNr]);
136  }
137  return handles;
138  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
template<typename T >
static bool ElectronHEEPIDValueMapProducer::isEventAOD ( const edm::Event iEvent,
const DualToken< T > &  token 
)
inlinestaticprivate

Definition at line 141 of file ElectronHEEPIDValueMapProducer.cc.

References ElectronHEEPIDValueMapProducer::DualToken< T >::aod, edm::Event::getByToken(), cmsBatch::handle, and edm::HandleBase::isValid().

Referenced by produce().

141  {
143  if(!token.aod.isUninitialized()) iEvent.getByToken(token.aod,handle);
144  if(handle.isValid()) return true;
145  else return false;
146  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
bool isValid() const
Definition: HandleBase.h:74
int ElectronHEEPIDValueMapProducer::nrSaturatedCrysIn5x5 ( const reco::GsfElectron ele,
edm::Handle< EcalRecHitCollection > &  ebHits,
edm::Handle< EcalRecHitCollection > &  eeHits,
edm::ESHandle< CaloTopology > &  caloTopo 
)
staticprivate

Definition at line 229 of file ElectronHEEPIDValueMapProducer.cc.

References calTrkIso(), EcalBarrel, EcalClusterToolsT< noZS >::nrSaturatedCrysIn5x5(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), and reco::GsfElectron::superCluster().

Referenced by ElectronHEEPIDValueMapProducer::DataFormat::operator()(), and produce().

233 {
234  DetId id = ele.superCluster()->seed()->seed();
235  auto recHits = id.subdetId()==EcalBarrel ? ebHits.product() : eeHits.product();
236  return noZS::EcalClusterTools::nrSaturatedCrysIn5x5(id,recHits,caloTopo.product());
237 
238 }
static int nrSaturatedCrysIn5x5(const DetId &id, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: DetId.h:18
T const * product() const
Definition: Handle.h:81
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
T const * product() const
Definition: ESHandle.h:86
void ElectronHEEPIDValueMapProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 203 of file ElectronHEEPIDValueMapProducer.cc.

References beamSpotToken_, calTrkIso(), candTokens_, candVetosAOD_, candVetosMiniAOD_, ebRecHitToken_, eeRecHitToken_, eleNrSaturateIn5x5Label_, eleToken_, eleTrkPtIsoLabel_, edm::EventSetup::get(), getHandle(), getHandles(), isEventAOD(), nrSaturatedCrysIn5x5(), and writeValueMap().

Referenced by ElectronHEEPIDValueMapProducer::DataFormat::operator()().

204 {
205  auto eleHandle = getHandle(iEvent,eleToken_);
206  auto ebRecHitHandle = getHandle(iEvent,ebRecHitToken_);
207  auto eeRecHitHandle = getHandle(iEvent,eeRecHitToken_);
208  auto beamSpotHandle = getHandle(iEvent,beamSpotToken_);
209  auto candHandles = getHandles(iEvent,candTokens_);
210 
211  bool isAOD = isEventAOD(iEvent,eleToken_);
212  const auto& candVetos = isAOD ? candVetosAOD_ : candVetosMiniAOD_;
213 
214  edm::ESHandle<CaloTopology> caloTopoHandle;
215  iSetup.get<CaloTopologyRecord>().get(caloTopoHandle);
216 
217  std::vector<float> eleTrkPtIso;
218  std::vector<int> eleNrSaturateIn5x5;
219  for(size_t eleNr=0;eleNr<eleHandle->size();eleNr++){
220  auto elePtr = eleHandle->ptrAt(eleNr);
221  eleTrkPtIso.push_back(calTrkIso(*elePtr,*eleHandle,candHandles,candVetos));
222  eleNrSaturateIn5x5.push_back(nrSaturatedCrysIn5x5(*elePtr,ebRecHitHandle,eeRecHitHandle,caloTopoHandle));
223  }
224 
225  writeValueMap(iEvent,eleHandle,eleTrkPtIso,eleTrkPtIsoLabel_);
226  writeValueMap(iEvent,eleHandle,eleNrSaturateIn5x5,eleNrSaturateIn5x5Label_);
227 }
DualToken< EcalRecHitCollection > ebRecHitToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
static void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::GsfElectron > > &handle, const std::vector< T > &values, const std::string &label)
static int nrSaturatedCrysIn5x5(const reco::GsfElectron &ele, edm::Handle< EcalRecHitCollection > &ebHits, edm::Handle< EcalRecHitCollection > &eeHits, edm::ESHandle< CaloTopology > &caloTopo)
std::vector< DualToken< pat::PackedCandidateCollection > > candTokens_
std::vector< EleTkIsolFromCands::PIDVeto > candVetosMiniAOD_
DualToken< edm::View< reco::GsfElectron > > eleToken_
DualToken< EcalRecHitCollection > eeRecHitToken_
static edm::Handle< T > getHandle(const edm::Event &iEvent, const edm::EDGetTokenT< T > &token)
static std::vector< edm::Handle< T > > getHandles(const edm::Event &iEvent, const std::vector< DualToken< T > > &tokens)
const T & get() const
Definition: EventSetup.h:55
float calTrkIso(const reco::GsfElectron &ele, const edm::View< reco::GsfElectron > &eles, const std::vector< edm::Handle< pat::PackedCandidateCollection > > &handles, const std::vector< EleTkIsolFromCands::PIDVeto > &pidVetos) const
std::vector< EleTkIsolFromCands::PIDVeto > candVetosAOD_
static bool isEventAOD(const edm::Event &iEvent, const DualToken< T > &token)
template<typename T >
void ElectronHEEPIDValueMapProducer::setToken ( edm::EDGetTokenT< T > &  token,
edm::InputTag  tag 
)
inlineprivate
template<typename T >
void ElectronHEEPIDValueMapProducer::setToken ( edm::EDGetTokenT< T > &  token,
const edm::ParameterSet iPara,
const std::string &  tag 
)
inlineprivate
template<typename T >
void ElectronHEEPIDValueMapProducer::setToken ( std::vector< edm::EDGetTokenT< T > > &  tokens,
const edm::ParameterSet iPara,
const std::string &  tagName 
)
inlineprivate

Definition at line 78 of file ElectronHEEPIDValueMapProducer.cc.

References edm::ParameterSet::getParameter(), setToken(), GlobalPosition_Frontier_DevDB_cff::tag, and JetPlusTrackCorrections_cff::tagName.

78  {
79  auto tags =iPara.getParameter<std::vector<edm::InputTag> >(tagName);
80  for(auto& tag : tags) {
81  edm::EDGetTokenT<T> token;
82  setToken(token,tag);
83  tokens.push_back(token);
84  }
85  }
T getParameter(std::string const &) const
void setToken(edm::EDGetTokenT< T > &token, edm::InputTag tag)
template<typename T >
void ElectronHEEPIDValueMapProducer::setToken ( DualToken< T > &  token,
const edm::ParameterSet iPara,
const std::string &  tagAOD,
const std::string &  tagMiniAOD,
DataFormat  format 
)
inlineprivate
template<typename T >
void ElectronHEEPIDValueMapProducer::setToken ( std::vector< DualToken< T > > &  tokens,
const edm::ParameterSet iPara,
const std::string &  tagAOD,
const std::string &  tagMiniAOD,
DataFormat  format 
)
inlineprivate

Definition at line 90 of file ElectronHEEPIDValueMapProducer.cc.

References ElectronHEEPIDValueMapProducer::DualToken< T >::aod, edm::ParameterSet::getParameter(), SiStripPI::max, copyPickMerge_cfg::maxSize, ElectronHEEPIDValueMapProducer::DualToken< T >::miniAOD, setToken(), ElectronHEEPIDValueMapProducer::DataFormat::tryAOD(), and ElectronHEEPIDValueMapProducer::DataFormat::tryMiniAOD().

90  {
91  auto tagsAOD =iPara.getParameter<std::vector<edm::InputTag> >(tagAOD);
92  auto tagsMiniAOD =iPara.getParameter<std::vector<edm::InputTag> >(tagMiniAOD);
93  size_t maxSize = std::max(tagsAOD.size(),tagsMiniAOD.size());
94  tokens.clear();
95  tokens.resize(maxSize);
96  if(format.tryAOD()){
97  for(size_t tagNr=0;tagNr<tagsAOD.size();tagNr++) {
98  setToken(tokens[tagNr].aod,tagsAOD[tagNr]);
99  }
100  }
101  if(format.tryMiniAOD()){
102  for(size_t tagNr=0;tagNr<tagsMiniAOD.size();tagNr++) {
103  setToken(tokens[tagNr].miniAOD,tagsMiniAOD[tagNr]);
104  }
105  }
106  }
T getParameter(std::string const &) const
void setToken(edm::EDGetTokenT< T > &token, edm::InputTag tag)
template<typename T >
void ElectronHEEPIDValueMapProducer::writeValueMap ( edm::Event iEvent,
const edm::Handle< edm::View< reco::GsfElectron > > &  handle,
const std::vector< T > &  values,
const std::string &  label 
)
staticprivate

Definition at line 264 of file ElectronHEEPIDValueMapProducer.cc.

References edm::helper::Filler< Map >::fill(), objects.autophobj::filler, cmsBatch::handle, edm::helper::Filler< Map >::insert(), eostools::move(), and edm::Event::put().

Referenced by ElectronHEEPIDValueMapProducer::DataFormat::operator()(), and produce().

268 {
269  std::unique_ptr<edm::ValueMap<T> > valMap(new edm::ValueMap<T>());
270  typename edm::ValueMap<T>::Filler filler(*valMap);
271  filler.insert(handle, values.begin(), values.end());
272  filler.fill();
273  iEvent.put(std::move(valMap),label);
274 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> ElectronHEEPIDValueMapProducer::beamSpotToken_
private

Definition at line 154 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

std::vector<DualToken<pat::PackedCandidateCollection> > ElectronHEEPIDValueMapProducer::candTokens_
private

Definition at line 153 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

std::vector<EleTkIsolFromCands::PIDVeto> ElectronHEEPIDValueMapProducer::candVetosAOD_
private

Definition at line 158 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

std::vector<EleTkIsolFromCands::PIDVeto> ElectronHEEPIDValueMapProducer::candVetosMiniAOD_
private

Definition at line 159 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

DataFormat ElectronHEEPIDValueMapProducer::dataFormat_
private

Definition at line 157 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer().

DualToken<EcalRecHitCollection> ElectronHEEPIDValueMapProducer::ebRecHitToken_
private

Definition at line 150 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

DualToken<EcalRecHitCollection> ElectronHEEPIDValueMapProducer::eeRecHitToken_
private

Definition at line 151 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

const std::string ElectronHEEPIDValueMapProducer::eleNrSaturateIn5x5Label_ ="eleNrSaturateIn5x5"
staticprivate

Definition at line 162 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

DualToken<edm::View<reco::GsfElectron> > ElectronHEEPIDValueMapProducer::eleToken_
private

Definition at line 152 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

const std::string ElectronHEEPIDValueMapProducer::eleTrkPtIsoLabel_ ="eleTrkPtIso"
staticprivate

Definition at line 161 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by ElectronHEEPIDValueMapProducer(), and produce().

EleTkIsolFromCands ElectronHEEPIDValueMapProducer::trkIsoCalc_
private

Definition at line 156 of file ElectronHEEPIDValueMapProducer.cc.

Referenced by calTrkIso().