CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

std::string dataFormat_
 
edm::EDGetTokenT
< EcalRecHitCollection
ebReducedRecHitCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
eeReducedRecHitCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
esReducedRecHitCollection_
 
noZS::EcalClusterLazyToolslazyToolnoZS
 
edm::EDGetToken src_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 65 of file ElectronIDValueMapProducer.cc.

References dataFormat_, ebReducedRecHitCollection_, eeReducedRecHitCollection_, eleFull5x5Circularity_, eleFull5x5E1x5_, eleFull5x5E2x5_, eleFull5x5E5x5_, eleFull5x5R9_, eleFull5x5SigmaIEtaIEta_, eleFull5x5SigmaIEtaIPhi_, esReducedRecHitCollection_, edm::hlt::Exception, edm::ParameterSet::getParameter(), src_, and AlCaHLTBitMon_QueryRunRegistry::string.

65  {
66 
67  ebReducedRecHitCollection_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("ebReducedRecHitCollection"));
68  eeReducedRecHitCollection_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("eeReducedRecHitCollection"));
69  esReducedRecHitCollection_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("esReducedRecHitCollection"));
70 
71  src_ = consumes<edm::View<reco::GsfElectron> >(iConfig.getParameter<edm::InputTag>("src"));
72 
73  dataFormat_ = iConfig.getParameter<std::string>("dataFormat");
74  if( dataFormat_ != "RECO" && dataFormat_ != "PAT") {
75  throw cms::Exception("InvalidConfiguration")
76  << "ElectronIDValueMapProducer runs in \"RECO\" or \"PAT\" mode!";
77  }
78 
79  produces<edm::ValueMap<float> >(eleFull5x5SigmaIEtaIEta_);
80  produces<edm::ValueMap<float> >(eleFull5x5SigmaIEtaIPhi_);
81  produces<edm::ValueMap<float> >(eleFull5x5E1x5_);
82  produces<edm::ValueMap<float> >(eleFull5x5E2x5_);
83  produces<edm::ValueMap<float> >(eleFull5x5E5x5_);
84  produces<edm::ValueMap<float> >(eleFull5x5R9_);
85  produces<edm::ValueMap<float> >(eleFull5x5Circularity_);
86 
87 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
ElectronIDValueMapProducer::~ElectronIDValueMapProducer ( )

Definition at line 89 of file ElectronIDValueMapProducer.cc.

89  {
90 }

Member Function Documentation

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

Definition at line 162 of file ElectronIDValueMapProducer.cc.

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

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

Implements edm::stream::EDProducerBase.

Definition at line 92 of file ElectronIDValueMapProducer.cc.

References dataFormat_, EcalClusterLazyToolsT< EcalClusterToolsImpl >::e1x5(), EcalClusterLazyToolsT< EcalClusterToolsImpl >::e2x5Max(), EcalClusterLazyToolsT< EcalClusterToolsImpl >::e3x3(), EcalClusterLazyToolsT< EcalClusterToolsImpl >::e5x5(), ebReducedRecHitCollection_, eeReducedRecHitCollection_, eleFull5x5Circularity_, eleFull5x5E1x5_, eleFull5x5E2x5_, eleFull5x5E5x5_, eleFull5x5R9_, eleFull5x5SigmaIEtaIEta_, eleFull5x5SigmaIEtaIPhi_, edm::hlt::Exception, edm::Event::getByToken(), edm::detail::isnan(), lazyToolnoZS, EcalClusterLazyToolsT< EcalClusterToolsImpl >::localCovariances(), cmsHarvester::sep, mathSSE::sqrt(), alcazmumu_cfi::src, src_, run_regression::test, and writeValueMap().

92  {
93 
94  using namespace edm;
95 
96  lazyToolnoZS = new noZS::EcalClusterLazyTools(iEvent, iSetup, ebReducedRecHitCollection_, eeReducedRecHitCollection_); //, esReducedRecHitCollection_
97 
99  iEvent.getByToken(src_, src);
100 
101  if( dataFormat_ == "PAT" && src->size() ) {
102  edm::Ptr<pat::Electron> test(src->ptrVector()[0]);
103  if( test.isNull() || !test.isAvailable() ) {
104  throw cms::Exception("InvalidConfiguration")
105  <<"DataFormat set to \"PAT\" but cannot cast to pat::Electron!";
106  }
107  }
108 
109  // size_t n = src->size();
110  std::vector<float> eleFull5x5SigmaIEtaIEta, eleFull5x5SigmaIEtaIPhi;
111  std::vector<float> eleFull5x5R9, eleFull5x5Circularity;
112  std::vector<float> eleFull5x5E1x5,eleFull5x5E2x5,eleFull5x5E5x5;
113 
114  // reco::GsfElectron::superCluster() is virtual so we can exploit polymorphism
115  for (const auto& iEle : src->ptrVector()){
116 
117  const auto& theseed = *(iEle->superCluster()->seed());
118 
119  std::vector<float> vCov = lazyToolnoZS->localCovariances( theseed );
120  const float see = (isnan(vCov[0]) ? 0. : sqrt(vCov[0]));
121  const float sep = vCov[1];
122  eleFull5x5SigmaIEtaIEta.push_back(see);
123  eleFull5x5SigmaIEtaIPhi.push_back(sep);
124  eleFull5x5R9.push_back(lazyToolnoZS->e3x3( theseed ) / iEle->superCluster()->rawEnergy() );
125 
126  const float e1x5 = lazyToolnoZS->e1x5( theseed );
127  const float e2x5 = lazyToolnoZS->e2x5Max( theseed );
128  const float e5x5 = lazyToolnoZS->e5x5( theseed );
129  const float circularity = (e5x5 != 0.) ? 1.-e1x5/e5x5 : -1;
130 
131  eleFull5x5E1x5.push_back(e1x5);
132  eleFull5x5E2x5.push_back(e2x5);
133  eleFull5x5E5x5.push_back(e5x5);
134  eleFull5x5Circularity.push_back(circularity);
135  }
136 
137  writeValueMap(iEvent, src, eleFull5x5SigmaIEtaIEta, eleFull5x5SigmaIEtaIEta_);
138  writeValueMap(iEvent, src, eleFull5x5SigmaIEtaIPhi, eleFull5x5SigmaIEtaIPhi_);
139  writeValueMap(iEvent, src, eleFull5x5R9, eleFull5x5R9_);
140  writeValueMap(iEvent, src, eleFull5x5E1x5, eleFull5x5E1x5_);
141  writeValueMap(iEvent, src, eleFull5x5E2x5, eleFull5x5E2x5_);
142  writeValueMap(iEvent, src, eleFull5x5E5x5, eleFull5x5E5x5_);
143  writeValueMap(iEvent, src, eleFull5x5Circularity, eleFull5x5Circularity_);
144 
145  delete lazyToolnoZS;
146 }
float e5x5(const reco::BasicCluster &cluster)
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
float e3x3(const reco::BasicCluster &cluster)
EcalClusterLazyToolsT< noZS::EcalClusterTools > EcalClusterLazyTools
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:48
float e2x5Max(const reco::BasicCluster &cluster)
std::vector< float > localCovariances(const reco::BasicCluster &cluster, float w0=4.7)
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
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 148 of file ElectronIDValueMapProducer.cc.

References edm::helper::Filler< Map >::fill(), patZpeak::handle, edm::helper::Filler< Map >::insert(), and edm::Event::put().

Referenced by produce().

152 {
153  using namespace edm;
154  using namespace std;
155  auto_ptr<ValueMap<float> > valMap(new ValueMap<float>());
156  edm::ValueMap<float>::Filler filler(*valMap);
157  filler.insert(handle, values.begin(), values.end());
158  filler.fill();
159  iEvent.put(valMap, label);
160 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116

Member Data Documentation

std::string ElectronIDValueMapProducer::dataFormat_
private

Definition at line 46 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

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

Definition at line 41 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

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

Definition at line 42 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5Circularity_ = "eleFull5x5Circularity"
staticprivate

Definition at line 54 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5E1x5_ = "eleFull5x5E1x5"
staticprivate

Definition at line 50 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5E2x5_ = "eleFull5x5E2x5"
staticprivate

Definition at line 51 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5E5x5_ = "eleFull5x5E5x5"
staticprivate

Definition at line 52 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5R9_ = "eleFull5x5R9"
staticprivate

Definition at line 53 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5SigmaIEtaIEta_ = "eleFull5x5SigmaIEtaIEta"
staticprivate

Definition at line 48 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

char ElectronIDValueMapProducer::eleFull5x5SigmaIEtaIPhi_ = "eleFull5x5SigmaIEtaIPhi"
staticprivate

Definition at line 49 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().

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

Definition at line 43 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer().

noZS::EcalClusterLazyTools* ElectronIDValueMapProducer::lazyToolnoZS
private

Definition at line 39 of file ElectronIDValueMapProducer.cc.

Referenced by produce().

edm::EDGetToken ElectronIDValueMapProducer::src_
private

Definition at line 44 of file ElectronIDValueMapProducer.cc.

Referenced by ElectronIDValueMapProducer(), and produce().