CMS 3D CMS Logo

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

#include <Basic2DGenericTopoClusterizer.h>

Inheritance diagram for Basic2DGenericTopoClusterizer:
InitialClusteringStepBase

Public Member Functions

 Basic2DGenericTopoClusterizer (const B2DGT &)=delete
 
 Basic2DGenericTopoClusterizer (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
void buildClusters (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &) override
 
B2DGToperator= (const B2DGT &)=delete
 
 ~Basic2DGenericTopoClusterizer () override=default
 
- Public Member Functions inherited from InitialClusteringStepBase
 InitialClusteringStepBase (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
 InitialClusteringStepBase (const ICSB &)=delete
 
std::ostream & operator<< (std::ostream &o) const
 
ICSBoperator= (const ICSB &)=delete
 
void reset ()
 
virtual void update (const edm::EventSetup &)
 
virtual void updateEvent (const edm::Event &)
 
virtual ~InitialClusteringStepBase ()=default
 

Private Types

typedef Basic2DGenericTopoClusterizer B2DGT
 

Private Member Functions

void buildTopoCluster (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, unsigned int, std::vector< bool > &, reco::PFCluster &)
 

Private Attributes

const bool _useCornerCells
 

Additional Inherited Members

- Protected Types inherited from InitialClusteringStepBase
typedef std::tuple< std::vector< int >, std::vector< double >, std::vector< double > > I3tuple
 
- Protected Member Functions inherited from InitialClusteringStepBase
reco::PFRecHitRef makeRefhit (const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
 
- Protected Attributes inherited from InitialClusteringStepBase
const std::unordered_map< std::string, int > _layerMap
 
unsigned _nClustersFound
 
unsigned _nSeeds
 
std::unordered_map< int, I3tuple_thresholds
 

Detailed Description

Definition at line 7 of file Basic2DGenericTopoClusterizer.h.

Member Typedef Documentation

◆ B2DGT

Definition at line 8 of file Basic2DGenericTopoClusterizer.h.

Constructor & Destructor Documentation

◆ Basic2DGenericTopoClusterizer() [1/2]

Basic2DGenericTopoClusterizer::Basic2DGenericTopoClusterizer ( const edm::ParameterSet conf,
edm::ConsumesCollector sumes 
)
inline

Definition at line 11 of file Basic2DGenericTopoClusterizer.h.

12  : InitialClusteringStepBase(conf, sumes), _useCornerCells(conf.getParameter<bool>("useCornerCells")) {}

◆ ~Basic2DGenericTopoClusterizer()

Basic2DGenericTopoClusterizer::~Basic2DGenericTopoClusterizer ( )
overridedefault

◆ Basic2DGenericTopoClusterizer() [2/2]

Basic2DGenericTopoClusterizer::Basic2DGenericTopoClusterizer ( const B2DGT )
delete

Member Function Documentation

◆ buildClusters()

void Basic2DGenericTopoClusterizer::buildClusters ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  rechitMask,
const std::vector< bool > &  seedable,
reco::PFClusterCollection output 
)
overridevirtual

Implements InitialClusteringStepBase.

Definition at line 16 of file Basic2DGenericTopoClusterizer.cc.

19  {
20  auto const& hits = *input;
21  std::vector<bool> used(hits.size(), false);
22  std::vector<unsigned int> seeds;
23 
24  // get the seeds and sort them descending in energy
25  seeds.reserve(hits.size());
26  for (unsigned int i = 0; i < hits.size(); ++i) {
27  if (!rechitMask[i] || !seedable[i] || used[i])
28  continue;
29  seeds.emplace_back(i);
30  }
31  // maxHeap would be better
32  std::sort(
33  seeds.begin(), seeds.end(), [&](unsigned int i, unsigned int j) { return hits[i].energy() > hits[j].energy(); });
34 
36  for (auto seed : seeds) {
37  if (!rechitMask[seed] || !seedable[seed] || used[seed])
38  continue;
39  temp.reset();
40  buildTopoCluster(input, rechitMask, seed, used, temp);
41  if (!temp.recHitFractions().empty())
42  output.push_back(temp);
43  }
44 }

References buildTopoCluster(), hfClusterShapes_cfi::hits, mps_fire::i, input, dqmiolumiharvest::j, convertSQLitetoXML_cfg::output, SurveyInfoScenario_cff::seed, InitialStep_cff::seeds, and groupFilesInBlocks::temp.

◆ buildTopoCluster()

void Basic2DGenericTopoClusterizer::buildTopoCluster ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  rechitMask,
unsigned int  kcell,
std::vector< bool > &  used,
reco::PFCluster topocluster 
)
private

Definition at line 46 of file Basic2DGenericTopoClusterizer.cc.

50  {
51  auto const& cell = (*input)[kcell];
52  int cell_layer = (int)cell.layer();
53  if (cell_layer == PFLayer::HCAL_BARREL2 && std::abs(cell.positionREP().eta()) > 0.34) {
54  cell_layer *= 100;
55  }
56 
57  auto const& thresholds = _thresholds.find(cell_layer)->second;
58  double thresholdE = 0.;
59  double thresholdPT2 = 0.;
60 
61  for (unsigned int j = 0; j < (std::get<1>(thresholds)).size(); ++j) {
62  int depth = std::get<0>(thresholds)[j];
63 
64  if ((cell_layer == PFLayer::HCAL_BARREL1 && cell.depth() == depth) ||
65  (cell_layer == PFLayer::HCAL_ENDCAP && cell.depth() == depth) ||
66  (cell_layer != PFLayer::HCAL_BARREL1 && cell_layer != PFLayer::HCAL_ENDCAP)) {
67  thresholdE = std::get<1>(thresholds)[j];
68  thresholdPT2 = std::get<2>(thresholds)[j];
69  }
70  }
71 
72  if (cell.energy() < thresholdE || cell.pt2() < thresholdPT2) {
73  LOGDRESSED("GenericTopoCluster::buildTopoCluster()")
74  << "RecHit " << cell.detId() << " with enegy " << cell.energy() << " GeV was rejected!." << std::endl;
75  return;
76  }
77 
78  auto k = kcell;
79  used[k] = true;
80  auto ref = makeRefhit(input, k);
81  topocluster.addRecHitFraction(reco::PFRecHitFraction(ref, 1.0));
82 
83  auto const& neighbours = (_useCornerCells ? cell.neighbours8() : cell.neighbours4());
84 
85  for (auto nb : neighbours) {
86  if (used[nb] || !rechitMask[nb]) {
87  LOGDRESSED("GenericTopoCluster::buildTopoCluster()")
88  << " RecHit " << cell.detId() << "\'s"
89  << " neighbor RecHit " << input->at(nb).detId() << " with enegy " << input->at(nb).energy()
90  << " GeV was rejected!"
91  << " Reasons : " << used[nb] << " (used) " << !rechitMask[nb] << " (masked)." << std::endl;
92  continue;
93  }
94  buildTopoCluster(input, rechitMask, nb, used, topocluster);
95  }
96 }

References InitialClusteringStepBase::_thresholds, _useCornerCells, funct::abs(), reco::PFCluster::addRecHitFraction(), LEDCalibrationChannels::depth, PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PFLayer::HCAL_ENDCAP, input, createfilelist::int, dqmiolumiharvest::j, dqmdumpme::k, LOGDRESSED, InitialClusteringStepBase::makeRefhit(), findQualityFiles::size, and particleFlowZeroSuppressionECAL_cff::thresholds.

Referenced by buildClusters().

◆ operator=()

B2DGT& Basic2DGenericTopoClusterizer::operator= ( const B2DGT )
delete

Member Data Documentation

◆ _useCornerCells

const bool Basic2DGenericTopoClusterizer::_useCornerCells
private

Definition at line 23 of file Basic2DGenericTopoClusterizer.h.

Referenced by buildTopoCluster().

mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
Basic2DGenericTopoClusterizer::buildTopoCluster
void buildTopoCluster(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, unsigned int, std::vector< bool > &, reco::PFCluster &)
Definition: Basic2DGenericTopoClusterizer.cc:46
particleFlowZeroSuppressionECAL_cff.thresholds
thresholds
Definition: particleFlowZeroSuppressionECAL_cff.py:31
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
InitialClusteringStepBase::_thresholds
std::unordered_map< int, I3tuple > _thresholds
Definition: InitialClusteringStepBase.h:110
reco::PFRecHitFraction
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
Definition: PFRecHitFraction.h:18
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
InitialClusteringStepBase::InitialClusteringStepBase
InitialClusteringStepBase(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
Definition: InitialClusteringStepBase.h:28
PFLayer::HCAL_ENDCAP
Definition: PFLayer.h:37
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
Basic2DGenericTopoClusterizer::_useCornerCells
const bool _useCornerCells
Definition: Basic2DGenericTopoClusterizer.h:23
InitialClusteringStepBase::makeRefhit
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
Definition: InitialClusteringStepBase.h:103
PFLayer::HCAL_BARREL2
Definition: PFLayer.h:36
PFLayer::HCAL_BARREL1
Definition: PFLayer.h:35
LOGDRESSED
#define LOGDRESSED(x)
Definition: Basic2DGenericTopoClusterizer.cc:13
dqmdumpme.k
k
Definition: dqmdumpme.py:60
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:232
createfilelist.int
int
Definition: createfilelist.py:10
reco::PFCluster::addRecHitFraction
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:77
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:46
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443