CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 &cc)
 
 BlockElementImporterBase (const BlockElementImporterBase &)=delete
 
const std::string & name () const
 
BlockElementImporterBaseoperator= (const BlockElementImporterBase &)=delete
 
virtual ~BlockElementImporterBase ()=default
 

Private Attributes

const edm::ESGetToken
< CaloTowerConstituentsMap,
CaloGeometryRecord
_ctmapToken
 
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
 
CaloTowerConstituentsMap const * towerMap_
 

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
 
enum  VetoMode { pfRecTrackCollection = 0, ticlSeedingRegion = 1, pfCandidateCollection = 2 }
 

Detailed Description

Definition at line 21 of file SuperClusterImporter.cc.

Constructor & Destructor Documentation

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

Definition at line 44 of file SuperClusterImporter.cc.

45  : BlockElementImporterBase(conf, cc),
49  _maxHoverE(conf.getParameter<double>("maximumHoverE")),
50  _pTbyPass(conf.getParameter<double>("minPTforBypass")),
51  _minSCPt(conf.getParameter<double>("minSuperClusterPt")),
52  _superClustersArePF(conf.getParameter<bool>("superClustersArePF")),
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > _ctmapToken
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEE
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEB
BlockElementImporterBase(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
edm::EDGetTokenT< CaloTowerCollection > _srcTowers
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

Member Function Documentation

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

Implements BlockElementImporterBase.

Definition at line 57 of file SuperClusterImporter.cc.

References _maxHoverE, _minSCPt, _pTbyPass, _srcEB, _srcEE, _srcTowers, _superClustersArePF, _zero, a, egamma::depth1HcalESum(), egamma::depth2HcalESum(), HLT_FULL_cff::distance, edm::Event::get(), edm::Event::getHandle(), ptFast(), reco::PFBlockElement::SC, reco::PFBlockElementSuperCluster::setFromPFSuperCluster(), towerMap_, HLT_FULL_cff::towers, and egamma::towersOf().

57  {
58  auto eb_scs = e.getHandle(_srcEB);
59  auto ee_scs = e.getHandle(_srcEE);
60  auto const& towers = e.get(_srcTowers);
61  elems.reserve(elems.size() + eb_scs->size() + ee_scs->size());
62  // setup our elements so that all the SCs are grouped together
63  auto SCs_end =
64  std::partition(elems.begin(), elems.end(), [](auto const& a) { return a->type() == reco::PFBlockElement::SC; });
65  // add eb superclusters
66  auto bsc = eb_scs->cbegin();
67  auto esc = eb_scs->cend();
68  reco::PFBlockElementSuperCluster* scbe = nullptr;
70  for (auto sc = bsc; sc != esc; ++sc) {
71  scref = reco::SuperClusterRef(eb_scs, std::distance(bsc, sc));
72  PFBlockElementSCEqual myEqual(scref);
73  auto sc_elem = std::find_if(elems.begin(), SCs_end, myEqual);
74  const double scpT = ptFast(sc->energy(), sc->position(), _zero);
75  const auto towersBehindCluster = egamma::towersOf(*sc, *towerMap_);
76  const double H_tower =
77  (egamma::depth1HcalESum(towersBehindCluster, towers) + egamma::depth2HcalESum(towersBehindCluster, towers));
78  const double HoverE = H_tower / sc->energy();
79  if (sc_elem == SCs_end && scpT > _minSCPt && (scpT > _pTbyPass || HoverE < _maxHoverE)) {
80  scbe = new reco::PFBlockElementSuperCluster(scref);
82  SCs_end = elems.emplace(SCs_end, scbe);
83  ++SCs_end; // point to element *after* the new one
84  }
85  } // loop on eb superclusters
86  // add ee superclusters
87  bsc = ee_scs->cbegin();
88  esc = ee_scs->cend();
89  for (auto sc = bsc; sc != esc; ++sc) {
90  scref = reco::SuperClusterRef(ee_scs, std::distance(bsc, sc));
91  PFBlockElementSCEqual myEqual(scref);
92  auto sc_elem = std::find_if(elems.begin(), SCs_end, myEqual);
93  const double scpT = ptFast(sc->energy(), sc->position(), _zero);
94  const auto towersBehindCluster = egamma::towersOf(*sc, *towerMap_);
95  const double H_tower =
96  (egamma::depth1HcalESum(towersBehindCluster, towers) + egamma::depth2HcalESum(towersBehindCluster, towers));
97  const double HoverE = H_tower / sc->energy();
98  if (sc_elem == SCs_end && scpT > _minSCPt && (scpT > _pTbyPass || HoverE < _maxHoverE)) {
99  scbe = new reco::PFBlockElementSuperCluster(scref);
101  SCs_end = elems.emplace(SCs_end, scbe);
102  ++SCs_end; // point to element *after* the new one
103  }
104  } // loop on ee superclusters
105  elems.shrink_to_fit();
106 }
CaloTowerConstituentsMap const * towerMap_
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:563
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
double depth2HcalESum(std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
double depth1HcalESum(std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
edm::EDGetTokenT< CaloTowerCollection > _srcTowers
double a
Definition: hdecay.h:119
static const math::XYZPoint _zero
std::vector< CaloTowerDetId > towersOf(reco::SuperCluster const &sc, CaloTowerConstituentsMap const &towerMap, HoeMode mode=HoeMode::SingleTower)
void SuperClusterImporter::updateEventSetup ( const edm::EventSetup es)
overridevirtual

Reimplemented from BlockElementImporterBase.

Definition at line 55 of file SuperClusterImporter.cc.

References _ctmapToken, edm::EventSetup::getData(), and towerMap_.

55 { towerMap_ = &es.getData(_ctmapToken); }
CaloTowerConstituentsMap const * towerMap_
const edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > _ctmapToken
bool getData(T &iHolder) const
Definition: EventSetup.h:128

Member Data Documentation

const edm::ESGetToken<CaloTowerConstituentsMap, CaloGeometryRecord> SuperClusterImporter::_ctmapToken
private

Definition at line 37 of file SuperClusterImporter.cc.

Referenced by updateEventSetup().

const double SuperClusterImporter::_maxHoverE
private

Definition at line 32 of file SuperClusterImporter.cc.

Referenced by importToBlock().

const double SuperClusterImporter::_minSCPt
private

Definition at line 32 of file SuperClusterImporter.cc.

Referenced by importToBlock().

const double SuperClusterImporter::_pTbyPass
private

Definition at line 32 of file SuperClusterImporter.cc.

Referenced by importToBlock().

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

Definition at line 30 of file SuperClusterImporter.cc.

Referenced by importToBlock().

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

Definition at line 30 of file SuperClusterImporter.cc.

Referenced by importToBlock().

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

Definition at line 31 of file SuperClusterImporter.cc.

Referenced by importToBlock().

bool SuperClusterImporter::_superClustersArePF
private

Definition at line 34 of file SuperClusterImporter.cc.

Referenced by importToBlock().

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

Definition at line 35 of file SuperClusterImporter.cc.

Referenced by importToBlock().

CaloTowerConstituentsMap const* SuperClusterImporter::towerMap_
private

Definition at line 33 of file SuperClusterImporter.cc.

Referenced by importToBlock(), and updateEventSetup().