CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
SuperClusterImporter Class Reference
Inheritance diagram for SuperClusterImporter:
BlockElementImporterBase

Public Member Functions

void importToBlock (const edm::Event &, ElementList &) const override
 
 SuperClusterImporter (const edm::ParameterSet &, edm::ConsumesCollector &)
 
void updateEventSetup (const edm::EventSetup &es) override
 
- Public Member Functions inherited from BlockElementImporterBase
 BlockElementImporterBase (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
 BlockElementImporterBase (const BlockElementImporterBase &)=delete
 
const std::string & name () const
 
BlockElementImporterBaseoperator= (const BlockElementImporterBase &)=delete
 
virtual ~BlockElementImporterBase ()=default
 

Private Attributes

std::unique_ptr< EgammaHadTower_hadTower
 
const double _maxHoverE
 
const double _minSCPt
 
const double _pTbyPass
 
edm::EDGetTokenT< reco::SuperClusterCollection_srcEB
 
edm::EDGetTokenT< reco::SuperClusterCollection_srcEE
 
edm::EDGetTokenT< CaloTowerCollection_srcTowers
 
bool _superClustersArePF
 

Static Private Attributes

static const math::XYZPoint _zero = math::XYZPoint(0,0,0)
 

Additional Inherited Members

- Public Types inherited from BlockElementImporterBase
typedef std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
 

Detailed Description

Definition at line 23 of file SuperClusterImporter.cc.

Constructor & Destructor Documentation

SuperClusterImporter::SuperClusterImporter ( const edm::ParameterSet conf,
edm::ConsumesCollector sumes 
)

Definition at line 47 of file SuperClusterImporter.cc.

References updateEventSetup().

48  :
49  BlockElementImporterBase(conf,sumes),
52  _srcTowers(sumes.consumes<CaloTowerCollection>(conf.getParameter<edm::InputTag>("source_towers"))),
53  _maxHoverE(conf.getParameter<double>("maximumHoverE")),
54  _pTbyPass(conf.getParameter<double>("minPTforBypass")),
55  _minSCPt(conf.getParameter<double>("minSuperClusterPt")),
56  _hadTower(nullptr),
57  _superClustersArePF(conf.getParameter<bool>("superClustersArePF")) {
58 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEE
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEB
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::unique_ptr< EgammaHadTower > _hadTower
edm::EDGetTokenT< CaloTowerCollection > _srcTowers
BlockElementImporterBase(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)

Member Function Documentation

void SuperClusterImporter::importToBlock ( const edm::Event e,
BlockElementImporterBase::ElementList elems 
) const
overridevirtual

Implements BlockElementImporterBase.

Definition at line 66 of file SuperClusterImporter.cc.

References _hadTower, _maxHoverE, _minSCPt, _pTbyPass, _srcEB, _srcEE, _srcTowers, _superClustersArePF, _zero, a, SoftLeptonByDistance_cfi::distance, SimCluster::energy(), edm::Event::getHandle(), electronIdCutBasedClassBased_cfi::HoverE, ptFast(), SimDataFormats::CaloAnalysis::sc, reco::PFBlockElement::SC, and reco::PFBlockElementSuperCluster::setFromPFSuperCluster().

Referenced by updateEventSetup().

67  {
68  auto eb_scs = e.getHandle(_srcEB);
69  auto ee_scs = e.getHandle(_srcEE);
70  auto towers = e.getHandle(_srcTowers);
71  _hadTower->setTowerCollection(towers.product());
72  elems.reserve(elems.size()+eb_scs->size()+ee_scs->size());
73  // setup our elements so that all the SCs are grouped together
74  auto SCs_end = std::partition(elems.begin(),elems.end(),
75  [](auto const& a){
76  return a->type() == reco::PFBlockElement::SC;
77  });
78  // add eb superclusters
79  auto bsc = eb_scs->cbegin();
80  auto esc = eb_scs->cend();
81  reco::PFBlockElementSuperCluster* scbe = nullptr;
83  for( auto sc = bsc; sc != esc; ++sc ) {
84  scref = reco::SuperClusterRef(eb_scs,std::distance(bsc,sc));
85  PFBlockElementSCEqual myEqual(scref);
86  auto sc_elem = std::find_if(elems.begin(),SCs_end,myEqual);
87  const double scpT = ptFast(sc->energy(),sc->position(),_zero);
88  const double H_tower = ( _hadTower->getDepth1HcalESum(*sc) +
89  _hadTower->getDepth2HcalESum(*sc) );
90  const double HoverE = H_tower/sc->energy();
91  if( sc_elem == SCs_end && scpT > _minSCPt &&
92  (scpT > _pTbyPass || HoverE < _maxHoverE) ) {
93  scbe = new reco::PFBlockElementSuperCluster(scref);
95  SCs_end = elems.emplace(SCs_end, scbe);
96  ++SCs_end; // point to element *after* the new one
97  }
98  }// loop on eb superclusters
99  // add ee superclusters
100  bsc = ee_scs->cbegin();
101  esc = ee_scs->cend();
102  for( auto sc = bsc; sc != esc; ++sc ) {
103  scref = reco::SuperClusterRef(ee_scs,std::distance(bsc,sc));
104  PFBlockElementSCEqual myEqual(scref);
105  auto sc_elem = std::find_if(elems.begin(),SCs_end,myEqual);
106  const double scpT = ptFast(sc->energy(),sc->position(),_zero);
107  const double H_tower = ( _hadTower->getDepth1HcalESum(*sc) +
108  _hadTower->getDepth2HcalESum(*sc) );
109  const double HoverE = H_tower/sc->energy();
110  if( sc_elem == SCs_end && scpT > _minSCPt &&
111  (scpT > _pTbyPass || HoverE < _maxHoverE)) {
112  scbe = new reco::PFBlockElementSuperCluster(scref);
114  SCs_end = elems.emplace(SCs_end, scbe);
115  ++SCs_end; // point to element *after* the new one
116  }
117  }// loop on ee superclusters
118  elems.shrink_to_fit();
119 }
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEE
edm::Ref< SuperClusterCollection > SuperClusterRef
reference to an object in a collection of SuperCluster objects
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEB
double ptFast(const double energy, const math::XYZPoint &position, const math::XYZPoint &origin)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:539
float energy() const
Energy. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:104
std::unique_ptr< EgammaHadTower > _hadTower
edm::EDGetTokenT< CaloTowerCollection > _srcTowers
double a
Definition: hdecay.h:121
static const math::XYZPoint _zero
void SuperClusterImporter::updateEventSetup ( const edm::EventSetup es)
overridevirtual

Reimplemented from BlockElementImporterBase.

Definition at line 61 of file SuperClusterImporter.cc.

References _hadTower, importToBlock(), and EgammaHadTower::SingleTower.

Referenced by SuperClusterImporter().

Member Data Documentation

std::unique_ptr<EgammaHadTower> SuperClusterImporter::_hadTower
private

Definition at line 36 of file SuperClusterImporter.cc.

Referenced by importToBlock(), and updateEventSetup().

const double SuperClusterImporter::_maxHoverE
private

Definition at line 35 of file SuperClusterImporter.cc.

Referenced by importToBlock().

const double SuperClusterImporter::_minSCPt
private

Definition at line 35 of file SuperClusterImporter.cc.

Referenced by importToBlock().

const double SuperClusterImporter::_pTbyPass
private

Definition at line 35 of file SuperClusterImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT<reco::SuperClusterCollection> SuperClusterImporter::_srcEB
private

Definition at line 33 of file SuperClusterImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT<reco::SuperClusterCollection> SuperClusterImporter::_srcEE
private

Definition at line 33 of file SuperClusterImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT<CaloTowerCollection> SuperClusterImporter::_srcTowers
private

Definition at line 34 of file SuperClusterImporter.cc.

Referenced by importToBlock().

bool SuperClusterImporter::_superClustersArePF
private

Definition at line 37 of file SuperClusterImporter.cc.

Referenced by importToBlock().

const math::XYZPoint SuperClusterImporter::_zero = math::XYZPoint(0,0,0)
staticprivate

Definition at line 38 of file SuperClusterImporter.cc.

Referenced by importToBlock().