CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PFClusterFromHGCalTrackster Class Reference
Inheritance diagram for PFClusterFromHGCalTrackster:
InitialClusteringStepBase

Public Member Functions

void buildClusters (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &) override
 
PFClusterFromHGCalTracksteroperator= (const PFClusterFromHGCalTrackster &)=delete
 
 PFClusterFromHGCalTrackster (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
 PFClusterFromHGCalTrackster (const PFClusterFromHGCalTrackster &)=delete
 
void updateEvent (const edm::Event &) final
 
 ~PFClusterFromHGCalTrackster () override
 
- Public Member Functions inherited from InitialClusteringStepBase
 InitialClusteringStepBase (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
 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< reco::CaloClusterCollectionclusterH_
 
edm::EDGetTokenT< reco::CaloClusterCollectionclusterToken_
 
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 8 of file PFClusterFromHGCalTrackster.cc.

Constructor & Destructor Documentation

◆ PFClusterFromHGCalTrackster() [1/2]

PFClusterFromHGCalTrackster::PFClusterFromHGCalTrackster ( const edm::ParameterSet conf,
edm::ConsumesCollector cc 
)
inline

Definition at line 10 of file PFClusterFromHGCalTrackster.cc.

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

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

◆ ~PFClusterFromHGCalTrackster()

PFClusterFromHGCalTrackster::~PFClusterFromHGCalTrackster ( )
inlineoverride

Definition at line 20 of file PFClusterFromHGCalTrackster.cc.

20 {}

◆ PFClusterFromHGCalTrackster() [2/2]

PFClusterFromHGCalTrackster::PFClusterFromHGCalTrackster ( const PFClusterFromHGCalTrackster )
delete

Member Function Documentation

◆ buildClusters()

void PFClusterFromHGCalTrackster::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 50 of file PFClusterFromHGCalTrackster.cc.

53  {
54  auto const& hits = *input;
55 
56  const auto& tracksters = *trackstersH_;
57  const auto& clusters = *clusterH_;
58 
59  // for quick indexing back to hit energy
60  std::unordered_map<uint32_t, size_t> detIdToIndex(hits.size());
61  for (uint32_t i = 0; i < hits.size(); ++i) {
62  detIdToIndex[hits[i].detId()] = i;
63  }
64 
65  for (const auto& tst : tracksters) {
66  // Skip empty tracksters
67  if (tst.vertices().empty()) {
68  continue;
69  }
70  // Filter using trackster PID
72  float probTotal = 0.0f;
73  for (int cat : filter_on_categories_) {
74  probTotal += tst.id_probabilities(cat);
75  }
76  if (probTotal < pid_threshold_) {
77  continue;
78  }
79  }
80 
81  DetId seed;
82  double energy = 0.0, highest_energy = 0.0;
83  output.emplace_back();
84  reco::PFCluster& back = output.back();
85 
86  std::vector<std::pair<DetId, float> > hitsAndFractions;
87  int iLC = 0;
88  std::for_each(std::begin(tst.vertices()), std::end(tst.vertices()), [&](unsigned int lcId) {
89  const auto fraction = 1.f / tst.vertex_multiplicity(iLC++);
90  for (const auto& cell : clusters[lcId].hitsAndFractions()) {
91  hitsAndFractions.emplace_back(cell.first, cell.second * fraction);
92  }
93  });
94 
95  for (const auto& hAndF : hitsAndFractions) {
96  auto itr = detIdToIndex.find(hAndF.first);
97  if (itr == detIdToIndex.end()) {
98  continue; // hit wasn't saved in reco
99  }
100  auto ref = makeRefhit(input, itr->second);
101  assert(ref->detId() == hAndF.first.rawId());
102  const double hit_energy = hAndF.second * ref->energy();
103  energy += hit_energy;
104  back.addRecHitFraction(reco::PFRecHitFraction(ref, hAndF.second));
105  // TODO: the following logic to identify the seed of a cluster
106  // could be appropriate for the Run2 Ecal Calorimetric
107  // detector, but could be wrong for the HGCal one. This has to
108  // be reviewd.
109  if (hit_energy > highest_energy || highest_energy == 0.0) {
110  highest_energy = hit_energy;
111  seed = ref->detId();
112  }
113  } // end of hitsAndFractions
114 
115  if (!back.hitsAndFractions().empty()) {
116  back.setSeed(seed);
117  back.setEnergy(energy);
119  } else {
120  back.setSeed(0);
121  back.setEnergy(0.f);
122  }
123  } // end of loop over hgcalTracksters (3D)
124 }

References reco::PFCluster::addRecHitFraction(), cms::cuda::assert(), eostools::cat(), clusterH_, bsc_activity_cfg::clusters, mps_fire::end, HCALHighEnergyHPDFilter_cfi::energy, f, filter_on_categories_, filterByTracksterPID_, HLT_FULL_cff::fraction, 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=()

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

◆ updateEvent()

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

Reimplemented from InitialClusteringStepBase.

Definition at line 45 of file PFClusterFromHGCalTrackster.cc.

45  {
46  ev.getByToken(tracksterToken_, trackstersH_);
47  ev.getByToken(clusterToken_, clusterH_);
48 }

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

Member Data Documentation

◆ clusterH_

edm::Handle<reco::CaloClusterCollection> PFClusterFromHGCalTrackster::clusterH_
private

Definition at line 40 of file PFClusterFromHGCalTrackster.cc.

Referenced by buildClusters(), and updateEvent().

◆ clusterToken_

edm::EDGetTokenT<reco::CaloClusterCollection> PFClusterFromHGCalTrackster::clusterToken_
private

Definition at line 39 of file PFClusterFromHGCalTrackster.cc.

Referenced by PFClusterFromHGCalTrackster(), and updateEvent().

◆ filter_on_categories_

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

Definition at line 34 of file PFClusterFromHGCalTrackster.cc.

Referenced by buildClusters(), and PFClusterFromHGCalTrackster().

◆ filterByTracksterPID_

bool PFClusterFromHGCalTrackster::filterByTracksterPID_
private

Definition at line 32 of file PFClusterFromHGCalTrackster.cc.

Referenced by buildClusters(), and PFClusterFromHGCalTrackster().

◆ pid_threshold_

float PFClusterFromHGCalTrackster::pid_threshold_
private

Definition at line 33 of file PFClusterFromHGCalTrackster.cc.

Referenced by buildClusters(), and PFClusterFromHGCalTrackster().

◆ trackstersH_

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

Definition at line 37 of file PFClusterFromHGCalTrackster.cc.

Referenced by buildClusters(), and updateEvent().

◆ tracksterToken_

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

Definition at line 36 of file PFClusterFromHGCalTrackster.cc.

Referenced by PFClusterFromHGCalTrackster(), and updateEvent().

InitialClusteringStepBase::InitialClusteringStepBase
InitialClusteringStepBase(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
Definition: InitialClusteringStepBase.h:28
reco::CaloCluster::setSeed
void setSeed(const DetId &id)
Definition: CaloCluster.h:146
PFClusterFromHGCalTrackster::trackstersH_
edm::Handle< std::vector< ticl::Trackster > > trackstersH_
Definition: PFClusterFromHGCalTrackster.cc:37
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
PFClusterFromHGCalTrackster::tracksterToken_
edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksterToken_
Definition: PFClusterFromHGCalTrackster.cc:36
cms::cuda::assert
assert(be >=bs)
PFClusterFromHGCalTrackster::filter_on_categories_
std::vector< int > filter_on_categories_
Definition: PFClusterFromHGCalTrackster.cc:34
PFClusterFromHGCalTrackster::clusterToken_
edm::EDGetTokenT< reco::CaloClusterCollection > clusterToken_
Definition: PFClusterFromHGCalTrackster.cc:39
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
DetId
Definition: DetId.h:17
PFClusterFromHGCalTrackster::pid_threshold_
float pid_threshold_
Definition: PFClusterFromHGCalTrackster.cc:33
HLT_FULL_cff.fraction
fraction
Definition: HLT_FULL_cff.py:52823
reco::CaloClusterCollection
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
Definition: CaloClusterFwd.h:19
mps_fire.end
end
Definition: mps_fire.py:242
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
PFClusterFromHGCalTrackster::filterByTracksterPID_
bool filterByTracksterPID_
Definition: PFClusterFromHGCalTrackster.cc:32
cc
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:97
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFClusterFromHGCalTrackster::clusterH_
edm::Handle< reco::CaloClusterCollection > clusterH_
Definition: PFClusterFromHGCalTrackster.cc:40
edm::InputTag
Definition: InputTag.h:15