test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
GsfElectronFull5x5Filler Class Reference

#include <GsfElectronFull5x5Filler.h>

Inheritance diagram for GsfElectronFull5x5Filler:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void calculateShowerShape_full5x5 (const reco::SuperClusterRef &theClus, bool pflow, reco::GsfElectron::ShowerShape &showerShape)
 
 GsfElectronFull5x5Filler (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~GsfElectronFull5x5Filler ()
 
- 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 ()
 

Private Attributes

edm::Handle< EcalRecHitCollection_ebRecHits
 
edm::EDGetTokenT
< EcalRecHitCollection
_ebRecHitsToken
 
edm::Handle< EcalRecHitCollection_eeRecHits
 
edm::EDGetTokenT
< EcalRecHitCollection
_eeRecHitsToken
 
const CaloGeometry_geometry
 
std::unique_ptr
< ElectronHcalHelper
_hcalHelper
 
std::unique_ptr
< ElectronHcalHelper
_hcalHelperPflow
 
edm::EDGetTokenT
< reco::GsfElectronCollection
_source
 
const CaloTopology_topology
 

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
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 13 of file GsfElectronFull5x5Filler.h.

Constructor & Destructor Documentation

GsfElectronFull5x5Filler::GsfElectronFull5x5Filler ( const edm::ParameterSet cfg)
explicit

Definition at line 38 of file GsfElectronFull5x5Filler.cc.

References edm::ParameterSet::getParameter(), ElectronHcalHelper::Configuration::hcalTowers, ElectronHcalHelper::Configuration::hOverEConeSize, ElectronHcalHelper::Configuration::hOverEPtMin, funct::true, and ElectronHcalHelper::Configuration::useTowers.

39  {
40  _source = consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("source"));
41 
42  ElectronHcalHelper::Configuration hcalCfg, hcalCfgPflow;
43 
44  hcalCfg.hOverEConeSize = cfg.getParameter<double>("hOverEConeSize") ;
45  if (hcalCfg.hOverEConeSize>0)
46  {
47  hcalCfg.useTowers = true ;
48  hcalCfg.hcalTowers =
49  consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers")) ;
50  hcalCfg.hOverEPtMin = cfg.getParameter<double>("hOverEPtMin") ;
51  }
52  hcalCfgPflow.hOverEConeSize = cfg.getParameter<double>("hOverEConeSizePflow") ;
53  if (hcalCfgPflow.hOverEConeSize>0)
54  {
55  hcalCfgPflow.useTowers = true ;
56  hcalCfgPflow.hcalTowers =
57  consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers")) ;
58  hcalCfgPflow.hOverEPtMin = cfg.getParameter<double>("hOverEPtMinPflow") ;
59  }
60  _hcalHelper.reset(new ElectronHcalHelper(hcalCfg));
61  _hcalHelperPflow.reset(new ElectronHcalHelper(hcalCfg));
62 
63  _ebRecHitsToken = consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("barrelRecHitCollectionTag"));
64  _eeRecHitsToken = consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("endcapRecHitCollectionTag"));
65 
66  produces<reco::GsfElectronCollection >();
67  }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > _ebRecHitsToken
edm::EDGetTokenT< reco::GsfElectronCollection > _source
std::unique_ptr< ElectronHcalHelper > _hcalHelperPflow
std::unique_ptr< ElectronHcalHelper > _hcalHelper
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
edm::EDGetTokenT< EcalRecHitCollection > _eeRecHitsToken
GsfElectronFull5x5Filler::~GsfElectronFull5x5Filler ( )
virtual

Definition at line 69 of file GsfElectronFull5x5Filler.cc.

70  {}

Member Function Documentation

void GsfElectronFull5x5Filler::beginLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &  es 
)
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 94 of file GsfElectronFull5x5Filler.cc.

References edm::EventSetup::get(), and edm::ESHandle< class >::product().

95  {
98  es.get<CaloGeometryRecord>().get(caloGeom);
99  es.get<CaloTopologyRecord>().get(caloTopo);
100  _geometry = caloGeom.product();
101  _topology = caloTopo.product();
102 }
T const * product() const
Definition: ESHandle.h:62
void GsfElectronFull5x5Filler::calculateShowerShape_full5x5 ( const reco::SuperClusterRef theClus,
bool  pflow,
reco::GsfElectron::ShowerShape showerShape 
)

Definition at line 104 of file GsfElectronFull5x5Filler.cc.

References EcalClusterToolsT< noZS >::covariances(), EcalClusterToolsT< noZS >::e1x5(), reco::GsfElectron::ShowerShape::e1x5, EcalClusterToolsT< noZS >::e2x5Max(), reco::GsfElectron::ShowerShape::e2x5Max, EcalClusterToolsT< noZS >::e3x3(), EcalClusterToolsT< noZS >::e5x5(), reco::GsfElectron::ShowerShape::e5x5, EcalBarrel, reco::GsfElectron::ShowerShape::hcalDepth1OverEcal, reco::GsfElectron::ShowerShape::hcalDepth1OverEcalBc, reco::GsfElectron::ShowerShape::hcalDepth2OverEcal, reco::GsfElectron::ShowerShape::hcalDepth2OverEcalBc, reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), edm::isNotFinite(), EcalClusterToolsT< noZS >::localCovariances(), reco::GsfElectron::ShowerShape::r9, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, reco::GsfElectron::ShowerShape::sigmaIphiIphi, mathSSE::sqrt(), and DetId::subdetId().

105  {
106  const reco::CaloCluster & seedCluster = *(theClus->seed()) ;
107  // temporary, till CaloCluster->seed() is made available
108  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ;
109  int detector = seedXtalId.subdetId() ;
110 
111  const EcalRecHitCollection * recHits = 0 ;
112  if (detector==EcalBarrel)
113  {
114  recHits = _ebRecHits.product() ;
115  }
116  else
117  {
118  recHits = _eeRecHits.product() ;
119  }
120 
121  std::vector<float> covariances = noZS::EcalClusterTools::covariances(seedCluster,recHits,_topology,_geometry) ;
122  std::vector<float> localCovariances = noZS::EcalClusterTools::localCovariances(seedCluster,recHits,_topology) ;
123  showerShape.sigmaEtaEta = sqrt(covariances[0]) ;
124  showerShape.sigmaIetaIeta = sqrt(localCovariances[0]) ;
125  if (!edm::isNotFinite(localCovariances[2])) showerShape.sigmaIphiIphi = sqrt(localCovariances[2]) ;
126  showerShape.e1x5 = noZS::EcalClusterTools::e1x5(seedCluster,recHits,_topology) ;
127  showerShape.e2x5Max = noZS::EcalClusterTools::e2x5Max(seedCluster,recHits,_topology) ;
128  showerShape.e5x5 = noZS::EcalClusterTools::e5x5(seedCluster,recHits,_topology) ;
129  showerShape.r9 = noZS::EcalClusterTools::e3x3(seedCluster,recHits,_topology)/theClus->rawEnergy() ;
130 
131  if (pflow)
132  {
133  showerShape.hcalDepth1OverEcal = _hcalHelperPflow->hcalESumDepth1(*theClus)/theClus->energy() ;
134  showerShape.hcalDepth2OverEcal = _hcalHelperPflow->hcalESumDepth2(*theClus)/theClus->energy() ;
135  showerShape.hcalTowersBehindClusters = _hcalHelperPflow->hcalTowersBehindClusters(*theClus) ;
136  showerShape.hcalDepth1OverEcalBc = _hcalHelperPflow->hcalESumDepth1BehindClusters(showerShape.hcalTowersBehindClusters)/showerShape.e5x5 ;
137  showerShape.hcalDepth2OverEcalBc = _hcalHelperPflow->hcalESumDepth2BehindClusters(showerShape.hcalTowersBehindClusters)/showerShape.e5x5 ;
138  }
139  else
140  {
141  showerShape.hcalDepth1OverEcal = _hcalHelper->hcalESumDepth1(*theClus)/theClus->energy() ;
142  showerShape.hcalDepth2OverEcal = _hcalHelper->hcalESumDepth2(*theClus)/theClus->energy() ;
143  showerShape.hcalTowersBehindClusters = _hcalHelper->hcalTowersBehindClusters(*theClus) ;
144  showerShape.hcalDepth1OverEcalBc = _hcalHelper->hcalESumDepth1BehindClusters(showerShape.hcalTowersBehindClusters)/showerShape.e5x5 ;
145  showerShape.hcalDepth2OverEcalBc = _hcalHelper->hcalESumDepth2BehindClusters(showerShape.hcalTowersBehindClusters)/showerShape.e5x5 ;
146  }
147  }
static std::vector< float > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:190
edm::Handle< EcalRecHitCollection > _eeRecHits
bool isNotFinite(T x)
Definition: isFinite.h:10
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:383
edm::Handle< EcalRecHitCollection > _ebRecHits
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::unique_ptr< ElectronHcalHelper > _hcalHelperPflow
Definition: DetId.h:18
std::unique_ptr< ElectronHcalHelper > _hcalHelper
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static std::vector< float > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
static float e1x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
void GsfElectronFull5x5Filler::produce ( edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 73 of file GsfElectronFull5x5Filler.cc.

References reco::GsfElectron::full5x5_setShowerShape(), dbtoconf::out, reco::GsfElectron::superCluster(), and groupFilesInBlocks::temp.

74  {
75  std::auto_ptr<reco::GsfElectronCollection> out(new reco::GsfElectronCollection);
76 
78  event.getByToken(_source,eles);
79 
80  event.getByToken(_ebRecHitsToken,_ebRecHits);
81  event.getByToken(_eeRecHitsToken,_eeRecHits);
82 
83  for( const auto& ele : *eles ) {
86  calculateShowerShape_full5x5(temp.superCluster(),true,full5x5_ss);
87  temp.full5x5_setShowerShape(full5x5_ss);
88  out->push_back(temp);
89  }
90 
91  event.put(out);
92  }
edm::EDGetTokenT< EcalRecHitCollection > _ebRecHitsToken
edm::Handle< EcalRecHitCollection > _eeRecHits
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
edm::EDGetTokenT< reco::GsfElectronCollection > _source
edm::Handle< EcalRecHitCollection > _ebRecHits
tuple out
Definition: dbtoconf.py:99
void calculateShowerShape_full5x5(const reco::SuperClusterRef &theClus, bool pflow, reco::GsfElectron::ShowerShape &showerShape)
edm::EDGetTokenT< EcalRecHitCollection > _eeRecHitsToken

Member Data Documentation

edm::Handle<EcalRecHitCollection> GsfElectronFull5x5Filler::_ebRecHits
private

Definition at line 31 of file GsfElectronFull5x5Filler.h.

edm::EDGetTokenT<EcalRecHitCollection> GsfElectronFull5x5Filler::_ebRecHitsToken
private

Definition at line 29 of file GsfElectronFull5x5Filler.h.

edm::Handle<EcalRecHitCollection> GsfElectronFull5x5Filler::_eeRecHits
private

Definition at line 32 of file GsfElectronFull5x5Filler.h.

edm::EDGetTokenT<EcalRecHitCollection> GsfElectronFull5x5Filler::_eeRecHitsToken
private

Definition at line 29 of file GsfElectronFull5x5Filler.h.

const CaloGeometry* GsfElectronFull5x5Filler::_geometry
private

Definition at line 34 of file GsfElectronFull5x5Filler.h.

std::unique_ptr<ElectronHcalHelper> GsfElectronFull5x5Filler::_hcalHelper
private

Definition at line 30 of file GsfElectronFull5x5Filler.h.

std::unique_ptr<ElectronHcalHelper> GsfElectronFull5x5Filler::_hcalHelperPflow
private

Definition at line 30 of file GsfElectronFull5x5Filler.h.

edm::EDGetTokenT<reco::GsfElectronCollection> GsfElectronFull5x5Filler::_source
private

Definition at line 28 of file GsfElectronFull5x5Filler.h.

const CaloTopology* GsfElectronFull5x5Filler::_topology
private

Definition at line 33 of file GsfElectronFull5x5Filler.h.