CMS 3D CMS Logo

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

Public Member Functions

 ElectronIDValueMapProducer (const edm::ParameterSet &)
 
 ~ElectronIDValueMapProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
void writeValueMap (edm::Event &iEvent, const edm::Handle< edm::View< reco::GsfElectron > > &handle, const std::vector< float > &values, const std::string &label) const
 

Private Attributes

edm::EDGetTokenT< EcalRecHitCollectionebReducedRecHitCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionebReducedRecHitCollectionMiniAOD_
 
edm::EDGetTokenT< EcalRecHitCollectioneeReducedRecHitCollection_
 
edm::EDGetTokenT< EcalRecHitCollectioneeReducedRecHitCollectionMiniAOD_
 
edm::EDGetTokenT< EcalRecHitCollectionesReducedRecHitCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionesReducedRecHitCollectionMiniAOD_
 
noZS::EcalClusterLazyToolslazyToolnoZS
 
edm::EDGetToken src_
 
edm::EDGetToken srcMiniAOD_
 

Static Private Attributes

static char eleFull5x5Circularity_ [] = "eleFull5x5Circularity"
 
static char eleFull5x5E1x5_ [] = "eleFull5x5E1x5"
 
static char eleFull5x5E2x5_ [] = "eleFull5x5E2x5"
 
static char eleFull5x5E5x5_ [] = "eleFull5x5E5x5"
 
static char eleFull5x5R9_ [] = "eleFull5x5R9"
 
static char eleFull5x5SigmaIEtaIEta_ [] = "eleFull5x5SigmaIEtaIEta"
 
static char eleFull5x5SigmaIEtaIPhi_ [] = "eleFull5x5SigmaIEtaIPhi"
 

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
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 21 of file ElectronIDValueMapProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 70 of file ElectronIDValueMapProducer.cc.

References ebReducedRecHitCollection_, ebReducedRecHitCollectionMiniAOD_, eeReducedRecHitCollection_, eeReducedRecHitCollectionMiniAOD_, eleFull5x5Circularity_, eleFull5x5E1x5_, eleFull5x5E2x5_, eleFull5x5E5x5_, eleFull5x5R9_, eleFull5x5SigmaIEtaIEta_, eleFull5x5SigmaIEtaIPhi_, esReducedRecHitCollection_, esReducedRecHitCollectionMiniAOD_, edm::ParameterSet::getParameter(), src_, and srcMiniAOD_.

70  {
71 
72  //
73  // Declare consummables, handle both AOD and miniAOD case
74  //
75  ebReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
76  ("ebReducedRecHitCollection"));
77  ebReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
78  ("ebReducedRecHitCollectionMiniAOD"));
79 
80  eeReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
81  ("eeReducedRecHitCollection"));
82  eeReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
83  ("eeReducedRecHitCollectionMiniAOD"));
84 
85  esReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
86  ("esReducedRecHitCollection"));
87  esReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
88  ("esReducedRecHitCollectionMiniAOD"));
89 
90  src_ = mayConsume<edm::View<reco::GsfElectron> >(iConfig.getParameter<edm::InputTag>("src"));
91  srcMiniAOD_ = mayConsume<edm::View<reco::GsfElectron> >(iConfig.getParameter<edm::InputTag>("srcMiniAOD"));
92 
93  produces<edm::ValueMap<float> >(eleFull5x5SigmaIEtaIEta_);
94  produces<edm::ValueMap<float> >(eleFull5x5SigmaIEtaIPhi_);
95  produces<edm::ValueMap<float> >(eleFull5x5E1x5_);
96  produces<edm::ValueMap<float> >(eleFull5x5E2x5_);
97  produces<edm::ValueMap<float> >(eleFull5x5E5x5_);
98  produces<edm::ValueMap<float> >(eleFull5x5R9_);
99  produces<edm::ValueMap<float> >(eleFull5x5Circularity_);
100 
101 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
ElectronIDValueMapProducer::~ElectronIDValueMapProducer ( )

Definition at line 103 of file ElectronIDValueMapProducer.cc.

103  {
104 }

Member Function Documentation

void ElectronIDValueMapProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 187 of file ElectronIDValueMapProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

187  {
188  //The following says we do not know what parameters are allowed so do no validation
189  // Please change this to state exactly what you do use, even if it is no parameters
191  desc.setUnknown();
192  descriptions.addDefault(desc);
193 }
void addDefault(ParameterSetDescription const &psetDescription)
void ElectronIDValueMapProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 106 of file ElectronIDValueMapProducer.cc.

References heepElectronID_HEEPV50_CSA14_25ns_cff::e1x5, EcalClusterLazyToolsT< EcalClusterToolsImpl >::e1x5(), heepElectronID_HEEPV50_CSA14_25ns_cff::e2x5, EcalClusterLazyToolsT< EcalClusterToolsImpl >::e2x5Max(), EcalClusterLazyToolsT< EcalClusterToolsImpl >::e3x3(), heepElectronID_HEEPV50_CSA14_25ns_cff::e5x5, EcalClusterLazyToolsT< EcalClusterToolsImpl >::e5x5(), ebReducedRecHitCollection_, ebReducedRecHitCollectionMiniAOD_, eeReducedRecHitCollection_, eeReducedRecHitCollectionMiniAOD_, eleFull5x5Circularity_, eleFull5x5E1x5_, eleFull5x5E2x5_, eleFull5x5E5x5_, eleFull5x5R9_, eleFull5x5SigmaIEtaIEta_, eleFull5x5SigmaIEtaIPhi_, esReducedRecHitCollection_, esReducedRecHitCollectionMiniAOD_, edm::Event::getByToken(), mps_fire::i, edm::detail::isnan(), edm::HandleBase::isValid(), lazyToolnoZS, EcalClusterLazyToolsT< EcalClusterToolsImpl >::localCovariances(), mathSSE::sqrt(), TrackRefitter_38T_cff::src, src_, srcMiniAOD_, and writeValueMap().

106  {
107 
108  using namespace edm;
109 
111 
112  // Retrieve the collection of electrons from the event.
113  // If we fail to retrieve the collection with the standard AOD
114  // name, we next look for the one with the stndard miniAOD name.
115  bool isAOD = true;
116  iEvent.getByToken(src_, src);
117 
118  if( !src.isValid() ){
119  isAOD = false;
120  iEvent.getByToken(srcMiniAOD_,src);
121  }
122 
123  if( isAOD )
124  lazyToolnoZS = new noZS::EcalClusterLazyTools(iEvent, iSetup,
128  else
129  lazyToolnoZS = new noZS::EcalClusterLazyTools(iEvent, iSetup,
133 
134  // size_t n = src->size();
135  std::vector<float> eleFull5x5SigmaIEtaIEta, eleFull5x5SigmaIEtaIPhi;
136  std::vector<float> eleFull5x5R9, eleFull5x5Circularity;
137  std::vector<float> eleFull5x5E1x5,eleFull5x5E2x5,eleFull5x5E5x5;
138 
139  // reco::GsfElectron::superCluster() is virtual so we can exploit polymorphism
140  for (size_t i = 0; i < src->size(); ++i){
141  auto iEle = src->ptrAt(i);
142  const auto& theseed = *(iEle->superCluster()->seed());
143 
144  std::vector<float> vCov = lazyToolnoZS->localCovariances( theseed );
145  const float see = (isnan(vCov[0]) ? 0. : sqrt(vCov[0]));
146  const float sep = vCov[1];
147  eleFull5x5SigmaIEtaIEta.push_back(see);
148  eleFull5x5SigmaIEtaIPhi.push_back(sep);
149  eleFull5x5R9.push_back(lazyToolnoZS->e3x3( theseed ) / iEle->superCluster()->rawEnergy() );
150 
151  const float e1x5 = lazyToolnoZS->e1x5( theseed );
152  const float e2x5 = lazyToolnoZS->e2x5Max( theseed );
153  const float e5x5 = lazyToolnoZS->e5x5( theseed );
154  const float circularity = (e5x5 != 0.) ? 1.-e1x5/e5x5 : -1;
155 
156  eleFull5x5E1x5.push_back(e1x5);
157  eleFull5x5E2x5.push_back(e2x5);
158  eleFull5x5E5x5.push_back(e5x5);
159  eleFull5x5Circularity.push_back(circularity);
160  }
161 
162  writeValueMap(iEvent, src, eleFull5x5SigmaIEtaIEta, eleFull5x5SigmaIEtaIEta_);
163  writeValueMap(iEvent, src, eleFull5x5SigmaIEtaIPhi, eleFull5x5SigmaIEtaIPhi_);
164  writeValueMap(iEvent, src, eleFull5x5R9, eleFull5x5R9_);
165  writeValueMap(iEvent, src, eleFull5x5E1x5, eleFull5x5E1x5_);
166  writeValueMap(iEvent, src, eleFull5x5E2x5, eleFull5x5E2x5_);
167  writeValueMap(iEvent, src, eleFull5x5E5x5, eleFull5x5E5x5_);
168  writeValueMap(iEvent, src, eleFull5x5Circularity, eleFull5x5Circularity_);
169 
170  delete lazyToolnoZS;
171 }
float e5x5(const reco::BasicCluster &cluster)
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
float e3x3(const reco::BasicCluster &cluster)
EcalClusterLazyToolsT< noZS::EcalClusterTools > EcalClusterLazyTools
bool isnan(float x)
Definition: math.h:13
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
T sqrt(T t)
Definition: SSEVec.h:18
float e2x5Max(const reco::BasicCluster &cluster)
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
bool isValid() const
Definition: HandleBase.h:74
std::vector< float > localCovariances(const reco::BasicCluster &cluster, float w0=4.7)
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
HLT enums.
float e1x5(const reco::BasicCluster &cluster)
noZS::EcalClusterLazyTools * lazyToolnoZS
void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::GsfElectron > > &handle, const std::vector< float > &values, const std::string &label) const
void ElectronIDValueMapProducer::writeValueMap ( edm::Event iEvent,
const edm::Handle< edm::View< reco::GsfElectron > > &  handle,
const std::vector< float > &  values,
const std::string &  label 
) const
private

Definition at line 173 of file ElectronIDValueMapProducer.cc.

References objects.autophobj::filler, cmsBatch::handle, eostools::move(), and edm::Event::put().

Referenced by produce().

177 {
178  using namespace edm;
179  using namespace std;
180  auto valMap = std::make_unique<ValueMap<float>>();
182  filler.insert(handle, values.begin(), values.end());
183  filler.fill();
184  iEvent.put(std::move(valMap), label);
185 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
HLT enums.
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<EcalRecHitCollection> ElectronIDValueMapProducer::ebReducedRecHitCollection_
private

Definition at line 42 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> ElectronIDValueMapProducer::ebReducedRecHitCollectionMiniAOD_
private

Definition at line 48 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> ElectronIDValueMapProducer::eeReducedRecHitCollection_
private

Definition at line 43 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> ElectronIDValueMapProducer::eeReducedRecHitCollectionMiniAOD_
private

Definition at line 49 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5Circularity_ = "eleFull5x5Circularity"
staticprivate

Definition at line 59 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5E1x5_ = "eleFull5x5E1x5"
staticprivate

Definition at line 55 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5E2x5_ = "eleFull5x5E2x5"
staticprivate

Definition at line 56 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5E5x5_ = "eleFull5x5E5x5"
staticprivate

Definition at line 57 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5R9_ = "eleFull5x5R9"
staticprivate

Definition at line 58 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5SigmaIEtaIEta_ = "eleFull5x5SigmaIEtaIEta"
staticprivate

Definition at line 53 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5SigmaIEtaIPhi_ = "eleFull5x5SigmaIEtaIPhi"
staticprivate

Definition at line 54 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> ElectronIDValueMapProducer::esReducedRecHitCollection_
private

Definition at line 44 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> ElectronIDValueMapProducer::esReducedRecHitCollectionMiniAOD_
private

Definition at line 50 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

noZS::EcalClusterLazyTools* ElectronIDValueMapProducer::lazyToolnoZS
private

Definition at line 39 of file ElectronIDValueMapProducer.cc.

Referenced by produce().

edm::EDGetToken ElectronIDValueMapProducer::src_
private

Definition at line 45 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

edm::EDGetToken ElectronIDValueMapProducer::srcMiniAOD_
private

Definition at line 51 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().