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::getByToken(), electronIdCutBasedClassBased_cfi::HoverE, NULL, edm::Handle< T >::product(), ptFast(), SimDataFormats::CaloAnalysis::sc, reco::PFBlockElement::SC, and reco::PFBlockElementSuperCluster::setFromPFSuperCluster().

Referenced by updateEventSetup().

67  {
70  e.getByToken(_srcEB,eb_scs);
72  e.getByToken(_srcEE,ee_scs);
74  e.getByToken(_srcTowers,towers);
75  _hadTower->setTowerCollection(towers.product());
76  elems.reserve(elems.size()+eb_scs->size()+ee_scs->size());
77  // setup our elements so that all the SCs are grouped together
78  auto SCs_end = std::partition(elems.begin(),elems.end(),
79  [](const ElementType& a){
80  return a->type() == reco::PFBlockElement::SC;
81  });
82  // add eb superclusters
83  auto bsc = eb_scs->cbegin();
84  auto esc = eb_scs->cend();
87  for( auto sc = bsc; sc != esc; ++sc ) {
88  scref = reco::SuperClusterRef(eb_scs,std::distance(bsc,sc));
89  PFBlockElementSCEqual myEqual(scref);
90  auto sc_elem = std::find_if(elems.begin(),SCs_end,myEqual);
91  const double scpT = ptFast(sc->energy(),sc->position(),_zero);
92  const double H_tower = ( _hadTower->getDepth1HcalESum(*sc) +
93  _hadTower->getDepth2HcalESum(*sc) );
94  const double HoverE = H_tower/sc->energy();
95  if( sc_elem == SCs_end && scpT > _minSCPt &&
96  (scpT > _pTbyPass || HoverE < _maxHoverE) ) {
97  scbe = new reco::PFBlockElementSuperCluster(scref);
99  SCs_end = elems.insert(SCs_end,ElementType(scbe));
100  ++SCs_end; // point to element *after* the new one
101  }
102  }// loop on eb superclusters
103  // add ee superclusters
104  bsc = ee_scs->cbegin();
105  esc = ee_scs->cend();
106  for( auto sc = bsc; sc != esc; ++sc ) {
107  scref = reco::SuperClusterRef(ee_scs,std::distance(bsc,sc));
108  PFBlockElementSCEqual myEqual(scref);
109  auto sc_elem = std::find_if(elems.begin(),SCs_end,myEqual);
110  const double scpT = ptFast(sc->energy(),sc->position(),_zero);
111  const double H_tower = ( _hadTower->getDepth1HcalESum(*sc) +
112  _hadTower->getDepth2HcalESum(*sc) );
113  const double HoverE = H_tower/sc->energy();
114  if( sc_elem == SCs_end && scpT > _minSCPt &&
115  (scpT > _pTbyPass || HoverE < _maxHoverE)) {
116  scbe = new reco::PFBlockElementSuperCluster(scref);
118  SCs_end = elems.insert(SCs_end,ElementType(scbe));
119  ++SCs_end; // point to element *after* the new one
120  }
121  }// loop on ee superclusters
122  elems.shrink_to_fit();
123 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEE
#define NULL
Definition: scimark2.h:8
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)
float energy() const
Energy. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:111
std::unique_ptr< EgammaHadTower > _hadTower
edm::EDGetTokenT< CaloTowerCollection > _srcTowers
T const * product() const
Definition: Handle.h:81
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().