CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ECALPFSeedCleaner.cc
Go to the documentation of this file.
4 
6 public:
8  ECALPFSeedCleaner(const ECALPFSeedCleaner&) = delete;
10 
11  void update(const edm::EventSetup&) override;
12 
13  void clean(const edm::Handle<reco::PFRecHitCollection>& input, std::vector<bool>& mask) override;
14 
15 private:
18 };
19 
21 
23  : RecHitTopologicalCleanerBase(conf, cc), thsToken_(cc.esConsumes<edm::Transition::BeginLuminosityBlock>()) {}
24 
26 
28  //need to run over energy sorted rechits, as this is order used in seeding step
29  // this can cause ambiguity, isn't it better to index by detid ?
30  auto const& hits = *input;
31  std::vector<unsigned> ordered_hits(hits.size());
32  for (unsigned i = 0; i < hits.size(); ++i)
33  ordered_hits[i] = i;
34 
35  std::sort(ordered_hits.begin(), ordered_hits.end(), [&](unsigned i, unsigned j) {
36  return hits[i].energy() > hits[j].energy();
37  });
38 
39  for (const auto& idx : ordered_hits) {
40  if (!mask[idx])
41  continue; // is it useful ?
42  const reco::PFRecHit& rechit = hits[idx];
43 
44  float threshold = (*ths_)[rechit.detId()];
45  if (rechit.energy() < threshold)
46  mask[idx] = false;
47 
48  } // rechit loop
49 }
unsigned detId() const
rechit detId
Definition: PFRecHit.h:93
void update(const edm::EventSetup &) override
static std::string const input
Definition: EdmProvDump.cc:47
edm::ESGetToken< EcalPFSeedingThresholds, EcalPFSeedingThresholdsRcd > thsToken_
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
void clean(const edm::Handle< reco::PFRecHitCollection > &input, std::vector< bool > &mask) override
Transition
Definition: Transition.h:12
edm::ESHandle< EcalPFSeedingThresholds > ths_
float energy() const
rechit energy
Definition: PFRecHit.h:99
#define DEFINE_EDM_PLUGIN(factory, type, name)
ECALPFSeedCleaner & operator=(const ECALPFSeedCleaner &)=delete
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
ECALPFSeedCleaner(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)