CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GsfElectronFull5x5Filler Class Reference

#include <GsfElectronFull5x5Filler.h>

Inheritance diagram for GsfElectronFull5x5Filler:
edm::stream::EDProducer<>

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 &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~GsfElectronFull5x5Filler () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 13 of file GsfElectronFull5x5Filler.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file GsfElectronFull5x5Filler.cc.

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

38  {
39  _source = consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("source"));
40 
41  ElectronHcalHelper::Configuration hcalCfg, hcalCfgPflow;
42 
43  hcalCfg.hOverEConeSize = cfg.getParameter<double>("hOverEConeSize") ;
44  if (hcalCfg.hOverEConeSize>0)
45  {
46  hcalCfg.useTowers = true ;
47  hcalCfg.hcalTowers =
48  consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers")) ;
49  hcalCfg.hOverEPtMin = cfg.getParameter<double>("hOverEPtMin") ;
50  }
51  hcalCfgPflow.hOverEConeSize = cfg.getParameter<double>("hOverEConeSizePflow") ;
52  if (hcalCfgPflow.hOverEConeSize>0)
53  {
54  hcalCfgPflow.useTowers = true ;
55  hcalCfgPflow.hcalTowers =
56  consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers")) ;
57  hcalCfgPflow.hOverEPtMin = cfg.getParameter<double>("hOverEPtMinPflow") ;
58  }
59  _hcalHelper.reset(new ElectronHcalHelper(hcalCfg));
60  _hcalHelperPflow.reset(new ElectronHcalHelper(hcalCfg));
61 
62  _ebRecHitsToken = consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("barrelRecHitCollectionTag"));
63  _eeRecHitsToken = consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("endcapRecHitCollectionTag"));
64 
65  produces<reco::GsfElectronCollection >();
66  }
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 ( )
override

Definition at line 68 of file GsfElectronFull5x5Filler.cc.

69  {}

Member Function Documentation

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

Definition at line 93 of file GsfElectronFull5x5Filler.cc.

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

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

Definition at line 103 of file GsfElectronFull5x5Filler.cc.

References EcalClusterToolsT< noZS >::covariances(), gamEcalExtractorBlocks_cff::detector, 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(), nullptr, reco::GsfElectron::ShowerShape::r9, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, reco::GsfElectron::ShowerShape::sigmaIphiIphi, mathSSE::sqrt(), and DetId::subdetId().

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

Definition at line 72 of file GsfElectronFull5x5Filler.cc.

References reco::GsfElectron::full5x5_setShowerShape(), eostools::move(), MillePedeFileConverter_cfg::out, reco::GsfElectron::superCluster(), and groupFilesInBlocks::temp.

73  {
74  auto out = std::make_unique<reco::GsfElectronCollection>();
75 
77  event.getByToken(_source,eles);
78 
79  event.getByToken(_ebRecHitsToken,_ebRecHits);
80  event.getByToken(_eeRecHitsToken,_eeRecHits);
81 
82  for( const auto& ele : *eles ) {
85  calculateShowerShape_full5x5(temp.superCluster(),true,full5x5_ss);
86  temp.full5x5_setShowerShape(full5x5_ss);
87  out->push_back(temp);
88  }
89 
90  event.put(std::move(out));
91  }
edm::EDGetTokenT< EcalRecHitCollection > _ebRecHitsToken
edm::Handle< EcalRecHitCollection > _eeRecHits
edm::EDGetTokenT< reco::GsfElectronCollection > _source
edm::Handle< EcalRecHitCollection > _ebRecHits
void calculateShowerShape_full5x5(const reco::SuperClusterRef &theClus, bool pflow, reco::GsfElectron::ShowerShape &showerShape)
def move(src, dest)
Definition: eostools.py:511
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.