CMS 3D CMS Logo

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

#include <PFClusterFromHGCalMultiCluster.h>

Inheritance diagram for PFClusterFromHGCalMultiCluster:
InitialClusteringStepBase

Public Member Functions

void buildClusters (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &) override
 
PFClusterFromHGCalMultiClusteroperator= (const PFClusterFromHGCalMultiCluster &)=delete
 
 PFClusterFromHGCalMultiCluster (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
 PFClusterFromHGCalMultiCluster (const PFClusterFromHGCalMultiCluster &)=delete
 
void updateEvent (const edm::Event &) final
 
 ~PFClusterFromHGCalMultiCluster () override
 
- 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 ~InitialClusteringStepBase ()=default
 

Private Attributes

edm::Handle< std::vector< reco::HGCalMultiCluster > > clusterH_
 
edm::EDGetTokenT< std::vector< reco::HGCalMultiCluster > > clusterToken_
 
std::vector< int > filter_on_categories_
 
bool filterByTracksterPID_
 
float pid_threshold_
 
edm::Handle< std::vector< ticl::Trackster > > trackstersH_
 
edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksterToken_
 

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 9 of file PFClusterFromHGCalMultiCluster.h.

Constructor & Destructor Documentation

◆ PFClusterFromHGCalMultiCluster() [1/2]

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

Definition at line 11 of file PFClusterFromHGCalMultiCluster.h.

12  : InitialClusteringStepBase(conf, sumes) {
13  filterByTracksterPID_ = conf.getParameter<bool>("filterByTracksterPID");
14  pid_threshold_ = conf.getParameter<double>("pid_threshold");
15  filter_on_categories_ = conf.getParameter<std::vector<int> >("filter_on_categories");
16 
18  sumes.consumes<std::vector<reco::HGCalMultiCluster> >(conf.getParameter<edm::InputTag>("clusterSrc"));
19  tracksterToken_ = sumes.consumes<std::vector<ticl::Trackster> >(conf.getParameter<edm::InputTag>("tracksterSrc"));
20  }

References clusterToken_, edm::ConsumesCollector::consumes(), filter_on_categories_, filterByTracksterPID_, edm::ParameterSet::getParameter(), pid_threshold_, and tracksterToken_.

◆ ~PFClusterFromHGCalMultiCluster()

PFClusterFromHGCalMultiCluster::~PFClusterFromHGCalMultiCluster ( )
inlineoverride

Definition at line 22 of file PFClusterFromHGCalMultiCluster.h.

22 {}

◆ PFClusterFromHGCalMultiCluster() [2/2]

PFClusterFromHGCalMultiCluster::PFClusterFromHGCalMultiCluster ( const PFClusterFromHGCalMultiCluster )
delete

Member Function Documentation

◆ buildClusters()

void PFClusterFromHGCalMultiCluster::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 13 of file PFClusterFromHGCalMultiCluster.cc.

16  {
17  const auto& hgcalMultiClusters = *clusterH_;
18  auto const& hits = *input;
19 
20  const auto& tracksters = *trackstersH_;
21 
22  // for quick indexing back to hit energy
23  std::unordered_map<uint32_t, size_t> detIdToIndex(hits.size());
24  for (uint32_t i = 0; i < hits.size(); ++i) {
25  detIdToIndex[hits[i].detId()] = i;
26  }
27 
28  int iMultiClus = -1;
29  for (const auto& mcl : hgcalMultiClusters) {
30  iMultiClus++;
31  // Skip empty multiclusters
32  if (mcl.hitsAndFractions().empty()) {
33  continue;
34  }
35  // Filter using trackster PID
37  float probTotal = 0.0f;
38  for (int cat : filter_on_categories_) {
39  probTotal += tracksters[iMultiClus].id_probabilities(cat);
40  }
41  if (probTotal < pid_threshold_) {
42  continue;
43  }
44  }
45 
46  DetId seed;
47  double energy = 0.0, highest_energy = 0.0;
48  output.emplace_back();
49  reco::PFCluster& back = output.back();
50  const auto& hitsAndFractions_mcl = mcl.hitsAndFractions();
51 
52  std::vector<std::pair<DetId, float> > hitsAndFractions;
53  hitsAndFractions.insert(hitsAndFractions.end(), hitsAndFractions_mcl.begin(), hitsAndFractions_mcl.end());
54 
55  // Use the H&F of the clusters inside the multicluster if the latter's H&F are not stored
56  if (hitsAndFractions.empty()) {
57  for (const auto& cl : mcl) {
58  const auto& hAndF_temp = cl->hitsAndFractions();
59  hitsAndFractions.insert(hitsAndFractions.end(), hAndF_temp.begin(), hAndF_temp.end());
60  }
61  }
62 
63  for (const auto& hAndF : hitsAndFractions) {
64  auto itr = detIdToIndex.find(hAndF.first);
65  if (itr == detIdToIndex.end()) {
66  continue; // hit wasn't saved in reco
67  }
68  auto ref = makeRefhit(input, itr->second);
69  assert(ref->detId() == hAndF.first.rawId());
70  const double hit_energy = hAndF.second * ref->energy();
71  energy += hit_energy;
72  back.addRecHitFraction(reco::PFRecHitFraction(ref, hAndF.second));
73  // TODO: the following logic to identify the seed of a cluster
74  // could be appropriate for the Run2 Ecal Calorimetric
75  // detector, but could be wrong for the HGCal one. This has to
76  // be reviewd.
77  if (hit_energy > highest_energy || highest_energy == 0.0) {
78  highest_energy = hit_energy;
79  seed = ref->detId();
80  }
81  } // end of hitsAndFractions
82 
83  if (!back.hitsAndFractions().empty()) {
84  back.setSeed(seed);
85  back.setEnergy(energy);
87  } else {
88  back.setSeed(0);
89  back.setEnergy(0.f);
90  }
91  } // end of loop over hgcalMulticlusters (3D)
92 }

References reco::PFCluster::addRecHitFraction(), cms::cuda::assert(), eostools::cat(), GetRecoTauVFromDQM_MC_cff::cl, clusterH_, HCALHighEnergyHPDFilter_cfi::energy, f, filter_on_categories_, filterByTracksterPID_, hfClusterShapes_cfi::hits, reco::CaloCluster::hitsAndFractions(), mps_fire::i, input, InitialClusteringStepBase::makeRefhit(), convertSQLitetoXML_cfg::output, pid_threshold_, fileCollector::seed, reco::CaloCluster::setCorrectedEnergy(), reco::CaloCluster::setEnergy(), reco::CaloCluster::setSeed(), and trackstersH_.

◆ operator=()

PFClusterFromHGCalMultiCluster& PFClusterFromHGCalMultiCluster::operator= ( const PFClusterFromHGCalMultiCluster )
delete

◆ updateEvent()

void PFClusterFromHGCalMultiCluster::updateEvent ( const edm::Event ev)
finalvirtual

Reimplemented from InitialClusteringStepBase.

Definition at line 8 of file PFClusterFromHGCalMultiCluster.cc.

8  {
9  ev.getByToken(clusterToken_, clusterH_);
10  ev.getByToken(tracksterToken_, trackstersH_);
11 }

References clusterH_, clusterToken_, ev, trackstersH_, and tracksterToken_.

Member Data Documentation

◆ clusterH_

edm::Handle<std::vector<reco::HGCalMultiCluster> > PFClusterFromHGCalMultiCluster::clusterH_
private

Definition at line 39 of file PFClusterFromHGCalMultiCluster.h.

Referenced by buildClusters(), and updateEvent().

◆ clusterToken_

edm::EDGetTokenT<std::vector<reco::HGCalMultiCluster> > PFClusterFromHGCalMultiCluster::clusterToken_
private

Definition at line 38 of file PFClusterFromHGCalMultiCluster.h.

Referenced by PFClusterFromHGCalMultiCluster(), and updateEvent().

◆ filter_on_categories_

std::vector<int> PFClusterFromHGCalMultiCluster::filter_on_categories_
private

◆ filterByTracksterPID_

bool PFClusterFromHGCalMultiCluster::filterByTracksterPID_
private

◆ pid_threshold_

float PFClusterFromHGCalMultiCluster::pid_threshold_
private

◆ trackstersH_

edm::Handle<std::vector<ticl::Trackster> > PFClusterFromHGCalMultiCluster::trackstersH_
private

Definition at line 42 of file PFClusterFromHGCalMultiCluster.h.

Referenced by buildClusters(), and updateEvent().

◆ tracksterToken_

edm::EDGetTokenT<std::vector<ticl::Trackster> > PFClusterFromHGCalMultiCluster::tracksterToken_
private

Definition at line 41 of file PFClusterFromHGCalMultiCluster.h.

Referenced by PFClusterFromHGCalMultiCluster(), and updateEvent().

reco::CaloCluster::setSeed
void setSeed(const DetId &id)
Definition: CaloCluster.h:146
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
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:72
reco::CaloCluster::setCorrectedEnergy
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:137
eostools.cat
def cat(path)
Definition: eostools.py:401
PFClusterFromHGCalMultiCluster::pid_threshold_
float pid_threshold_
Definition: PFClusterFromHGCalMultiCluster.h:35
InitialClusteringStepBase::InitialClusteringStepBase
InitialClusteringStepBase(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
Definition: InitialClusteringStepBase.h:28
cms::cuda::assert
assert(be >=bs)
InitialClusteringStepBase::makeRefhit
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
Definition: InitialClusteringStepBase.h:103
fileCollector.seed
seed
Definition: fileCollector.py:127
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
DetId
Definition: DetId.h:17
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
PFClusterFromHGCalMultiCluster::trackstersH_
edm::Handle< std::vector< ticl::Trackster > > trackstersH_
Definition: PFClusterFromHGCalMultiCluster.h:42
PFClusterFromHGCalMultiCluster::filter_on_categories_
std::vector< int > filter_on_categories_
Definition: PFClusterFromHGCalMultiCluster.h:36
PFClusterFromHGCalMultiCluster::clusterToken_
edm::EDGetTokenT< std::vector< reco::HGCalMultiCluster > > clusterToken_
Definition: PFClusterFromHGCalMultiCluster.h:38
reco::PFCluster::addRecHitFraction
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:33
reco::CaloCluster::setEnergy
void setEnergy(double energy)
Definition: CaloCluster.h:136
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
PFClusterFromHGCalMultiCluster::clusterH_
edm::Handle< std::vector< reco::HGCalMultiCluster > > clusterH_
Definition: PFClusterFromHGCalMultiCluster.h:39
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFClusterFromHGCalMultiCluster::tracksterToken_
edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksterToken_
Definition: PFClusterFromHGCalMultiCluster.h:41
PFClusterFromHGCalMultiCluster::filterByTracksterPID_
bool filterByTracksterPID_
Definition: PFClusterFromHGCalMultiCluster.h:34
edm::InputTag
Definition: InputTag.h:15