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 21 of file SuperClusterImporter.cc.

Constructor & Destructor Documentation

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

Definition at line 42 of file SuperClusterImporter.cc.

43  : BlockElementImporterBase(conf, sumes),
46  _srcTowers(sumes.consumes<CaloTowerCollection>(conf.getParameter<edm::InputTag>("source_towers"))),
47  _maxHoverE(conf.getParameter<double>("maximumHoverE")),
48  _pTbyPass(conf.getParameter<double>("minPTforBypass")),
49  _minSCPt(conf.getParameter<double>("minSuperClusterPt")),
50  _hadTower(nullptr),
51  _superClustersArePF(conf.getParameter<bool>("superClustersArePF")) {}
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 57 of file SuperClusterImporter.cc.

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

57  {
58  auto eb_scs = e.getHandle(_srcEB);
59  auto ee_scs = e.getHandle(_srcEE);
60  auto towers = e.getHandle(_srcTowers);
61  _hadTower->setTowerCollection(towers.product());
62  elems.reserve(elems.size() + eb_scs->size() + ee_scs->size());
63  // setup our elements so that all the SCs are grouped together
64  auto SCs_end =
65  std::partition(elems.begin(), elems.end(), [](auto const& a) { return a->type() == reco::PFBlockElement::SC; });
66  // add eb superclusters
67  auto bsc = eb_scs->cbegin();
68  auto esc = eb_scs->cend();
69  reco::PFBlockElementSuperCluster* scbe = nullptr;
71  for (auto sc = bsc; sc != esc; ++sc) {
72  scref = reco::SuperClusterRef(eb_scs, std::distance(bsc, sc));
73  PFBlockElementSCEqual myEqual(scref);
74  auto sc_elem = std::find_if(elems.begin(), SCs_end, myEqual);
75  const double scpT = ptFast(sc->energy(), sc->position(), _zero);
76  const double H_tower = (_hadTower->getDepth1HcalESum(*sc) + _hadTower->getDepth2HcalESum(*sc));
77  const double HoverE = H_tower / sc->energy();
78  if (sc_elem == SCs_end && scpT > _minSCPt && (scpT > _pTbyPass || HoverE < _maxHoverE)) {
79  scbe = new reco::PFBlockElementSuperCluster(scref);
81  SCs_end = elems.emplace(SCs_end, scbe);
82  ++SCs_end; // point to element *after* the new one
83  }
84  } // loop on eb superclusters
85  // add ee superclusters
86  bsc = ee_scs->cbegin();
87  esc = ee_scs->cend();
88  for (auto sc = bsc; sc != esc; ++sc) {
89  scref = reco::SuperClusterRef(ee_scs, std::distance(bsc, sc));
90  PFBlockElementSCEqual myEqual(scref);
91  auto sc_elem = std::find_if(elems.begin(), SCs_end, myEqual);
92  const double scpT = ptFast(sc->energy(), sc->position(), _zero);
93  const double H_tower = (_hadTower->getDepth1HcalESum(*sc) + _hadTower->getDepth2HcalESum(*sc));
94  const double HoverE = H_tower / sc->energy();
95  if (sc_elem == SCs_end && scpT > _minSCPt && (scpT > _pTbyPass || HoverE < _maxHoverE)) {
96  scbe = new reco::PFBlockElementSuperCluster(scref);
98  SCs_end = elems.emplace(SCs_end, scbe);
99  ++SCs_end; // point to element *after* the new one
100  }
101  } // loop on ee superclusters
102  elems.shrink_to_fit();
103 }
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:547
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:119
static const math::XYZPoint _zero
void SuperClusterImporter::updateEventSetup ( const edm::EventSetup es)
overridevirtual

Reimplemented from BlockElementImporterBase.

Definition at line 53 of file SuperClusterImporter.cc.

References _hadTower, and EgammaHadTower::SingleTower.

Member Data Documentation

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

Definition at line 33 of file SuperClusterImporter.cc.

Referenced by importToBlock(), and 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().