CMS 3D CMS Logo

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

#include <PFlow2DClusterizerWithTime.h>

Inheritance diagram for PFlow2DClusterizerWithTime:
PFClusterBuilderBase

Public Member Functions

void buildClusters (const reco::PFClusterCollection &, const std::vector< bool > &, reco::PFClusterCollection &outclus) override
 
B2DGPFoperator= (const B2DGPF &)=delete
 
 PFlow2DClusterizerWithTime (const B2DGPF &)=delete
 
 PFlow2DClusterizerWithTime (const edm::ParameterSet &conf)
 
void update (const edm::EventSetup &es) override
 
 ~PFlow2DClusterizerWithTime () override=default
 
- Public Member Functions inherited from PFClusterBuilderBase
std::ostream & operator<< (std::ostream &o) const
 
PFCBBoperator= (const PFCBB &)=delete
 
 PFClusterBuilderBase (const edm::ParameterSet &conf)
 
 PFClusterBuilderBase (const PFCBB &)=delete
 
void reset ()
 
virtual ~PFClusterBuilderBase ()=default
 

Private Types

typedef PFlow2DClusterizerWithTime B2DGPF
 

Private Member Functions

void clusterTimeResolution (reco::PFCluster &cluster, double &res) const
 
void clusterTimeResolutionFromSeed (reco::PFCluster &cluster, double &res) const
 
double dist2Time (const reco::PFCluster &, const reco::PFRecHitRef &, int cell_layer, double prev_timeres2) const
 
void growPFClusters (const reco::PFCluster &, const std::vector< bool > &, const unsigned toleranceScaling, const unsigned iter, double dist, reco::PFClusterCollection &) const
 
bool passChi2Prob (size_t iCluster, double dist2, std::vector< double > &clus_chi2, std::vector< size_t > &clus_chi2_nhits) const
 
void prunePFClusters (reco::PFClusterCollection &) const
 
void seedPFClustersFromTopo (const reco::PFCluster &, const std::vector< bool > &, reco::PFClusterCollection &) const
 

Private Attributes

std::unique_ptr< PFCPositionCalculatorBase_allCellsPosCalc
 
const bool _clusterTimeResFromSeed
 
std::unique_ptr< PFCPositionCalculatorBase_convergencePosCalc
 
const bool _excludeOtherSeeds
 
const std::unordered_map< std::string, int > _layerMap
 
const unsigned _maxIterations
 
const double _maxNSigmaTime
 
const double _minChi2Prob
 
const double _minFracTot
 
std::unordered_map< int, double > _recHitEnergyNorms
 
const double _showerSigma2
 
const double _stoppingTolerance
 
std::unique_ptr< CaloRecHitResolutionProvider_timeResolutionCalcBarrel
 
std::unique_ptr< CaloRecHitResolutionProvider_timeResolutionCalcEndcap
 
const double _timeSigma_eb
 
const double _timeSigma_ee
 

Additional Inherited Members

- Public Types inherited from PFClusterBuilderBase
typedef PFCPositionCalculatorBase PosCalc
 
- Protected Attributes inherited from PFClusterBuilderBase
const float _minFractionToKeep
 
unsigned _nClustersFound
 
unsigned _nSeeds
 
std::unique_ptr< PosCalc_positionCalc
 

Detailed Description

Definition at line 11 of file PFlow2DClusterizerWithTime.h.

Member Typedef Documentation

◆ B2DGPF

Definition at line 12 of file PFlow2DClusterizerWithTime.h.

Constructor & Destructor Documentation

◆ PFlow2DClusterizerWithTime() [1/2]

PFlow2DClusterizerWithTime::PFlow2DClusterizerWithTime ( const edm::ParameterSet conf)

Definition at line 26 of file PFlow2DClusterizerWithTime.cc.

27  : PFClusterBuilderBase(conf),
28  _maxIterations(conf.getParameter<unsigned>("maxIterations")),
29  _stoppingTolerance(conf.getParameter<double>("stoppingTolerance")),
30  _showerSigma2(std::pow(conf.getParameter<double>("showerSigma"), 2.0)),
31  _timeSigma_eb(std::pow(conf.getParameter<double>("timeSigmaEB"), 2.0)),
32  _timeSigma_ee(std::pow(conf.getParameter<double>("timeSigmaEE"), 2.0)),
33  _excludeOtherSeeds(conf.getParameter<bool>("excludeOtherSeeds")),
34  _minFracTot(conf.getParameter<double>("minFracTot")),
35  _maxNSigmaTime(std::pow(conf.getParameter<double>("maxNSigmaTime"), 2.0)),
36  _minChi2Prob(conf.getParameter<double>("minChi2Prob")),
37  _clusterTimeResFromSeed(conf.getParameter<bool>("clusterTimeResFromSeed")),
38 
39  _layerMap({{"PS2", (int)PFLayer::PS2},
40  {"PS1", (int)PFLayer::PS1},
41  {"ECAL_ENDCAP", (int)PFLayer::ECAL_ENDCAP},
42  {"ECAL_BARREL", (int)PFLayer::ECAL_BARREL},
43  {"NONE", (int)PFLayer::NONE},
44  {"HCAL_BARREL1", (int)PFLayer::HCAL_BARREL1},
45  {"HCAL_BARREL2_RING0", (int)PFLayer::HCAL_BARREL2},
46  {"HCAL_BARREL2_RING1", 100 * (int)PFLayer::HCAL_BARREL2},
47  {"HCAL_ENDCAP", (int)PFLayer::HCAL_ENDCAP},
48  {"HF_EM", (int)PFLayer::HF_EM},
49  {"HF_HAD", (int)PFLayer::HF_HAD}}) {
50  const std::vector<edm::ParameterSet>& thresholds = conf.getParameterSetVector("recHitEnergyNorms");
51  for (const auto& pset : thresholds) {
52  const std::string& det = pset.getParameter<std::string>("detector");
53  const double& rhE_norm = pset.getParameter<double>("recHitEnergyNorm");
54  auto entry = _layerMap.find(det);
55  if (entry == _layerMap.end()) {
56  throw cms::Exception("InvalidDetectorLayer") << "Detector layer : " << det << " is not in the list of recognized"
57  << " detector layers!";
58  }
59  _recHitEnergyNorms.emplace(_layerMap.find(det)->second, rhE_norm);
60  }
61 
62  if (conf.exists("allCellsPositionCalc")) {
63  const edm::ParameterSet& acConf = conf.getParameterSet("allCellsPositionCalc");
64  const std::string& algoac = acConf.getParameter<std::string>("algoName");
65  _allCellsPosCalc = PFCPositionCalculatorFactory::get()->create(algoac, acConf);
66  }
67  // if necessary a third pos calc for convergence testing
68  if (conf.exists("positionCalcForConvergence")) {
69  const edm::ParameterSet& convConf = conf.getParameterSet("positionCalcForConvergence");
70  const std::string& algoconv = convConf.getParameter<std::string>("algoName");
71  _convergencePosCalc = PFCPositionCalculatorFactory::get()->create(algoconv, convConf);
72  }
73  if (conf.exists("timeResolutionCalcBarrel")) {
74  const edm::ParameterSet& timeResConf = conf.getParameterSet("timeResolutionCalcBarrel");
75  _timeResolutionCalcBarrel = std::make_unique<CaloRecHitResolutionProvider>(timeResConf);
76  }
77  if (conf.exists("timeResolutionCalcEndcap")) {
78  const edm::ParameterSet& timeResConf = conf.getParameterSet("timeResolutionCalcEndcap");
79  _timeResolutionCalcEndcap = std::make_unique<CaloRecHitResolutionProvider>(timeResConf);
80  }
81 }

References PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PFLayer::HCAL_ENDCAP, PFLayer::HF_EM, PFLayer::HF_HAD, createfilelist::int, PFLayer::NONE, PFLayer::PS1, and PFLayer::PS2.

◆ ~PFlow2DClusterizerWithTime()

PFlow2DClusterizerWithTime::~PFlow2DClusterizerWithTime ( )
overridedefault

◆ PFlow2DClusterizerWithTime() [2/2]

PFlow2DClusterizerWithTime::PFlow2DClusterizerWithTime ( const B2DGPF )
delete

Member Function Documentation

◆ buildClusters()

void PFlow2DClusterizerWithTime::buildClusters ( const reco::PFClusterCollection input,
const std::vector< bool > &  seedable,
reco::PFClusterCollection outclus 
)
overridevirtual

Implements PFClusterBuilderBase.

Definition at line 83 of file PFlow2DClusterizerWithTime.cc.

85  {
86  reco::PFClusterCollection clustersInTopo;
87  for (const auto& topocluster : input) {
88  clustersInTopo.clear();
89  seedPFClustersFromTopo(topocluster, seedable, clustersInTopo);
90  const unsigned tolScal = std::pow(std::max(1.0, clustersInTopo.size() - 1.0), 2.0);
91  growPFClusters(topocluster, seedable, tolScal, 0, tolScal, clustersInTopo);
92  // step added by Josh Bendavid, removes low-fraction clusters
93  // did not impact position resolution with fraction cut of 1e-7
94  // decreases the size of each pf cluster considerably
95  prunePFClusters(clustersInTopo);
96  // recalculate the positions of the pruned clusters
97  if (_convergencePosCalc) {
98  // if defined, use the special position calculation for convergence tests
99  _convergencePosCalc->calculateAndSetPositions(clustersInTopo);
100  } else {
101  if (clustersInTopo.size() == 1 && _allCellsPosCalc) {
102  _allCellsPosCalc->calculateAndSetPosition(clustersInTopo.back());
103  } else {
104  _positionCalc->calculateAndSetPositions(clustersInTopo);
105  }
106  }
107  for (auto& clusterout : clustersInTopo) {
108  output.insert(output.end(), std::move(clusterout));
109  }
110  }
111 }

References _allCellsPosCalc, _convergencePosCalc, PFClusterBuilderBase::_positionCalc, growPFClusters(), input, SiStripPI::max, eostools::move(), convertSQLitetoXML_cfg::output, funct::pow(), prunePFClusters(), and seedPFClustersFromTopo().

◆ clusterTimeResolution()

void PFlow2DClusterizerWithTime::clusterTimeResolution ( reco::PFCluster cluster,
double &  res 
) const
private

Definition at line 291 of file PFlow2DClusterizerWithTime.cc.

291  {
292  double sumTimeSigma2 = 0.;
293  double sumSigma2 = 0.;
294 
295  for (auto& rhf : cluster.recHitFractions()) {
296  const reco::PFRecHit& rh = *(rhf.recHitRef());
297  const double rhf_f = rhf.fraction();
298 
299  if (rhf_f == 0.)
300  continue;
301 
302  bool isBarrel = (rh.layer() == PFLayer::HCAL_BARREL1 || rh.layer() == PFLayer::HCAL_BARREL2 ||
303  rh.layer() == PFLayer::ECAL_BARREL);
304  double res2 = 10000.;
305  if (isBarrel)
306  res2 = _timeResolutionCalcBarrel->timeResolution2(rh.energy());
307  else
308  res2 = _timeResolutionCalcEndcap->timeResolution2(rh.energy());
309 
310  sumTimeSigma2 += rhf_f * rh.time() / res2;
311  sumSigma2 += rhf_f / res2;
312  }
313  if (sumSigma2 > 0.) {
314  clusterRes2 = 1. / sumSigma2;
315  cluster.setTime(sumTimeSigma2 / sumSigma2);
316  cluster.setTimeError(std::sqrt(float(clusterRes2)));
317  } else {
318  clusterRes2 = 999999.;
319  }
320 }

References _timeResolutionCalcBarrel, _timeResolutionCalcEndcap, PFLayer::ECAL_BARREL, reco::PFRecHit::energy(), PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PixelPluginsPhase0_cfi::isBarrel, reco::PFRecHit::layer(), reco::PFCluster::recHitFractions(), reco::PFCluster::setTime(), reco::PFCluster::setTimeError(), mathSSE::sqrt(), and reco::PFRecHit::time().

Referenced by growPFClusters().

◆ clusterTimeResolutionFromSeed()

void PFlow2DClusterizerWithTime::clusterTimeResolutionFromSeed ( reco::PFCluster cluster,
double &  res 
) const
private

Definition at line 274 of file PFlow2DClusterizerWithTime.cc.

274  {
275  clusterRes2 = 10000.;
276  for (auto& rhf : cluster.recHitFractions()) {
277  const reco::PFRecHit& rh = *(rhf.recHitRef());
278  if (rh.detId() == cluster.seed()) {
279  cluster.setTime(rh.time());
280  bool isBarrel = (rh.layer() == PFLayer::HCAL_BARREL1 || rh.layer() == PFLayer::HCAL_BARREL2 ||
281  rh.layer() == PFLayer::ECAL_BARREL);
282  if (isBarrel)
283  clusterRes2 = _timeResolutionCalcBarrel->timeResolution2(rh.energy());
284  else
285  clusterRes2 = _timeResolutionCalcEndcap->timeResolution2(rh.energy());
286  cluster.setTimeError(std::sqrt(float(clusterRes2)));
287  }
288  }
289 }

References _timeResolutionCalcBarrel, _timeResolutionCalcEndcap, reco::PFRecHit::detId(), PFLayer::ECAL_BARREL, reco::PFRecHit::energy(), PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PixelPluginsPhase0_cfi::isBarrel, reco::PFRecHit::layer(), reco::PFCluster::recHitFractions(), reco::CaloCluster::seed(), reco::PFCluster::setTime(), reco::PFCluster::setTimeError(), mathSSE::sqrt(), and reco::PFRecHit::time().

Referenced by growPFClusters().

◆ dist2Time()

double PFlow2DClusterizerWithTime::dist2Time ( const reco::PFCluster cluster,
const reco::PFRecHitRef refhit,
int  cell_layer,
double  prev_timeres2 
) const
private

Definition at line 322 of file PFlow2DClusterizerWithTime.cc.

325  {
326  const double deltaT = cluster.time() - refhit->time();
327  const double t2 = deltaT * deltaT;
328  double res2 = 100.;
329 
330  if (cell_layer == PFLayer::HCAL_BARREL1 || cell_layer == PFLayer::HCAL_BARREL2 ||
331  cell_layer == PFLayer::ECAL_BARREL) {
333  const double resCluster2 = prev_timeres2;
334  res2 = resCluster2 + _timeResolutionCalcBarrel->timeResolution2(refhit->energy());
335  } else {
336  return t2 / _timeSigma_eb;
337  }
338  } else if (cell_layer == PFLayer::HCAL_ENDCAP || cell_layer == PFLayer::HF_EM || cell_layer == PFLayer::HF_HAD ||
339  cell_layer == PFLayer::ECAL_ENDCAP) {
341  const double resCluster2 = prev_timeres2;
342  res2 = resCluster2 + _timeResolutionCalcEndcap->timeResolution2(refhit->energy());
343  } else {
344  return t2 / _timeSigma_ee;
345  }
346  }
347 
348  double distTime2 = t2 / res2;
349  if (distTime2 > _maxNSigmaTime)
350  return 999.; // reject hit
351 
352  return distTime2;
353 }

References _maxNSigmaTime, _timeResolutionCalcBarrel, _timeResolutionCalcEndcap, _timeSigma_eb, _timeSigma_ee, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PFLayer::HCAL_ENDCAP, PFLayer::HF_EM, PFLayer::HF_HAD, RandomServiceHelper::t2, and reco::PFCluster::time().

Referenced by growPFClusters().

◆ growPFClusters()

void PFlow2DClusterizerWithTime::growPFClusters ( const reco::PFCluster topo,
const std::vector< bool > &  seedable,
const unsigned  toleranceScaling,
const unsigned  iter,
double  dist,
reco::PFClusterCollection clusters 
) const
private

Definition at line 132 of file PFlow2DClusterizerWithTime.cc.

137  {
138  if (iter >= _maxIterations) {
139  LOGDRESSED("PFlow2DClusterizerWithTime:growAndStabilizePFClusters")
140  << "reached " << _maxIterations << " iterations, terminated position "
141  << "fit with diff = " << diff;
142  }
143  if (iter >= _maxIterations || diff <= _stoppingTolerance * toleranceScaling)
144  return;
145  // reset the rechits in this cluster, keeping the previous position
146  std::vector<reco::PFCluster::REPPoint> clus_prev_pos;
147  // also calculate and keep the previous time resolution
148  std::vector<double> clus_prev_timeres2;
149 
150  for (auto& cluster : clusters) {
151  const reco::PFCluster::REPPoint& repp = cluster.positionREP();
152  clus_prev_pos.emplace_back(repp.rho(), repp.eta(), repp.phi());
153  if (_convergencePosCalc) {
154  if (clusters.size() == 1 && _allCellsPosCalc) {
155  _allCellsPosCalc->calculateAndSetPosition(cluster);
156  } else {
157  _positionCalc->calculateAndSetPosition(cluster);
158  }
159  }
160  double resCluster2;
162  clusterTimeResolutionFromSeed(cluster, resCluster2);
163  else
164  clusterTimeResolution(cluster, resCluster2);
165  clus_prev_timeres2.push_back(resCluster2);
166  cluster.resetHitsAndFractions();
167  }
168  // loop over topo cluster and grow current PFCluster hypothesis
169  std::vector<double> dist2, frac;
170 
171  // Store chi2 values and nhits to calculate chi2 prob. inline
172  std::vector<double> clus_chi2;
173  std::vector<size_t> clus_chi2_nhits;
174 
175  double fractot = 0;
176  for (const reco::PFRecHitFraction& rhf : topo.recHitFractions()) {
177  const reco::PFRecHitRef& refhit = rhf.recHitRef();
178  int cell_layer = (int)refhit->layer();
179  if (cell_layer == PFLayer::HCAL_BARREL2 && std::abs(refhit->positionREP().eta()) > 0.34) {
180  cell_layer *= 100;
181  }
182  const double recHitEnergyNorm = _recHitEnergyNorms.find(cell_layer)->second;
183  math::XYZPoint topocellpos_xyz(refhit->position());
184  dist2.clear();
185  frac.clear();
186  fractot = 0;
187 
188  // add rechits to clusters, calculating fraction based on distance
189  // need position in vector to get cluster time resolution
190  for (size_t iCluster = 0; iCluster < clusters.size(); ++iCluster) {
191  reco::PFCluster& cluster = clusters[iCluster];
192  const math::XYZPoint& clusterpos_xyz = cluster.position();
193  const math::XYZVector deltav = clusterpos_xyz - topocellpos_xyz;
194  double d2 = deltav.Mag2() / _showerSigma2;
195 
196  double d2time = dist2Time(cluster, refhit, cell_layer, clus_prev_timeres2[iCluster]);
197  d2 += d2time;
198 
199  if (_minChi2Prob > 0. && !passChi2Prob(iCluster, d2time, clus_chi2, clus_chi2_nhits))
200  d2 = 999.;
201 
202  dist2.emplace_back(d2);
203 
204  if (d2 > 100) {
205  LOGDRESSED("PFlow2DClusterizerWithTime:growAndStabilizePFClusters")
206  << "Warning! :: pfcluster-topocell distance is too large! d= " << d2;
207  }
208  // fraction assignment logic
209  double fraction;
210  if (refhit->detId() == cluster.seed() && _excludeOtherSeeds) {
211  fraction = 1.0;
212  } else if (seedable[refhit.key()] && _excludeOtherSeeds) {
213  fraction = 0.0;
214  } else {
215  fraction = cluster.energy() / recHitEnergyNorm * vdt::fast_expf(-0.5 * d2);
216  }
217  fractot += fraction;
218  frac.emplace_back(fraction);
219  }
220  for (unsigned i = 0; i < clusters.size(); ++i) {
221  if (fractot > _minFracTot || (refhit->detId() == clusters[i].seed() && fractot > 0.0)) {
222  frac[i] /= fractot;
223  } else {
224  continue;
225  }
226  // if the fraction has been set to 0, the cell
227  // is now added to the cluster - careful ! (PJ, 19/07/08)
228  // BUT KEEP ONLY CLOSE CELLS OTHERWISE MEMORY JUST EXPLOSES
229  // (PJ, 15/09/08 <- similar to what existed before the
230  // previous bug fix, but keeps the close seeds inside,
231  // even if their fraction was set to zero.)
232  // Also add a protection to keep the seed in the cluster
233  // when the latter gets far from the former. These cases
234  // (about 1% of the clusters) need to be studied, as
235  // they create fake photons, in general.
236  // (PJ, 16/09/08)
237  if (dist2[i] < 100.0 || frac[i] > 0.9999) {
238  clusters[i].addRecHitFraction(reco::PFRecHitFraction(refhit, frac[i]));
239  }
240  }
241  }
242  // recalculate positions and calculate convergence parameter
243  double diff2 = 0.0;
244  for (unsigned i = 0; i < clusters.size(); ++i) {
245  if (_convergencePosCalc) {
246  _convergencePosCalc->calculateAndSetPosition(clusters[i]);
247  } else {
248  if (clusters.size() == 1 && _allCellsPosCalc) {
249  _allCellsPosCalc->calculateAndSetPosition(clusters[i]);
250  } else {
251  _positionCalc->calculateAndSetPosition(clusters[i]);
252  }
253  }
254  const double delta2 = reco::deltaR2(clusters[i].positionREP(), clus_prev_pos[i]);
255  if (delta2 > diff2)
256  diff2 = delta2;
257  }
258  diff = std::sqrt(diff2);
259  dist2.clear();
260  frac.clear();
261  clus_prev_pos.clear(); // avoid badness
262  clus_chi2.clear();
263  clus_chi2_nhits.clear();
264  clus_prev_timeres2.clear();
265  growPFClusters(topo, seedable, toleranceScaling, iter + 1, diff, clusters);
266 }

References _allCellsPosCalc, _clusterTimeResFromSeed, _convergencePosCalc, _excludeOtherSeeds, _maxIterations, _minChi2Prob, _minFracTot, PFClusterBuilderBase::_positionCalc, _recHitEnergyNorms, _showerSigma2, _stoppingTolerance, funct::abs(), bsc_activity_cfg::clusters, clusterTimeResolution(), clusterTimeResolutionFromSeed(), reco::deltaR2(), change_name::diff, dist2Time(), reco::PFCluster::energy(), myMath::fast_expf(), cropTnPTrees::frac, HLT_2018_cff::fraction, PFLayer::HCAL_BARREL2, mps_fire::i, createfilelist::int, edm::Ref< C, T, F >::key(), LOGDRESSED, passChi2Prob(), reco::CaloCluster::position(), HLT_2018_cff::recHitEnergyNorm, reco::PFCluster::recHitFractions(), reco::CaloCluster::seed(), and mathSSE::sqrt().

Referenced by buildClusters().

◆ operator=()

B2DGPF& PFlow2DClusterizerWithTime::operator= ( const B2DGPF )
delete

◆ passChi2Prob()

bool PFlow2DClusterizerWithTime::passChi2Prob ( size_t  iCluster,
double  dist2,
std::vector< double > &  clus_chi2,
std::vector< size_t > &  clus_chi2_nhits 
) const
private

Definition at line 355 of file PFlow2DClusterizerWithTime.cc.

358  {
359  if (iCluster >= clus_chi2.size()) { // first hit
360  clus_chi2.push_back(dist2);
361  clus_chi2_nhits.push_back(1);
362  return true;
363  } else {
364  double chi2 = clus_chi2[iCluster];
365  size_t nhitsCluster = clus_chi2_nhits[iCluster];
366  chi2 += dist2;
367  if (TMath::Prob(chi2, nhitsCluster) >= _minChi2Prob) {
368  clus_chi2[iCluster] = chi2;
369  clus_chi2_nhits[iCluster] = nhitsCluster + 1;
370  return true;
371  }
372  }
373  return false;
374 }

References _minChi2Prob, and hltPixelTracks_cff::chi2.

Referenced by growPFClusters().

◆ prunePFClusters()

void PFlow2DClusterizerWithTime::prunePFClusters ( reco::PFClusterCollection clusters) const
private

Definition at line 268 of file PFlow2DClusterizerWithTime.cc.

268  {
269  for (auto& cluster : clusters) {
270  cluster.pruneUsing([&](const reco::PFRecHitFraction& rhf) { return rhf.fraction() > _minFractionToKeep; });
271  }
272 }

References PFClusterBuilderBase::_minFractionToKeep, bsc_activity_cfg::clusters, and reco::PFRecHitFraction::fraction().

Referenced by buildClusters().

◆ seedPFClustersFromTopo()

void PFlow2DClusterizerWithTime::seedPFClustersFromTopo ( const reco::PFCluster topo,
const std::vector< bool > &  seedable,
reco::PFClusterCollection initialPFClusters 
) const
private

Definition at line 113 of file PFlow2DClusterizerWithTime.cc.

115  {
116  const auto& recHitFractions = topo.recHitFractions();
117  for (const auto& rhf : recHitFractions) {
118  if (!seedable[rhf.recHitRef().key()])
119  continue;
120  initialPFClusters.push_back(reco::PFCluster());
121  reco::PFCluster& current = initialPFClusters.back();
122  current.addRecHitFraction(rhf);
123  current.setSeed(rhf.recHitRef()->detId());
124  if (_convergencePosCalc) {
125  _convergencePosCalc->calculateAndSetPosition(current);
126  } else {
127  _positionCalc->calculateAndSetPosition(current);
128  }
129  }
130 }

References _convergencePosCalc, PFClusterBuilderBase::_positionCalc, reco::PFCluster::addRecHitFraction(), reco::PFCluster::recHitFractions(), and reco::CaloCluster::setSeed().

Referenced by buildClusters().

◆ update()

void PFlow2DClusterizerWithTime::update ( const edm::EventSetup es)
inlineoverridevirtual

Member Data Documentation

◆ _allCellsPosCalc

std::unique_ptr<PFCPositionCalculatorBase> PFlow2DClusterizerWithTime::_allCellsPosCalc
private

Definition at line 47 of file PFlow2DClusterizerWithTime.h.

Referenced by buildClusters(), growPFClusters(), and update().

◆ _clusterTimeResFromSeed

const bool PFlow2DClusterizerWithTime::_clusterTimeResFromSeed
private

Definition at line 43 of file PFlow2DClusterizerWithTime.h.

Referenced by growPFClusters().

◆ _convergencePosCalc

std::unique_ptr<PFCPositionCalculatorBase> PFlow2DClusterizerWithTime::_convergencePosCalc
private

◆ _excludeOtherSeeds

const bool PFlow2DClusterizerWithTime::_excludeOtherSeeds
private

Definition at line 39 of file PFlow2DClusterizerWithTime.h.

Referenced by growPFClusters().

◆ _layerMap

const std::unordered_map<std::string, int> PFlow2DClusterizerWithTime::_layerMap
private

Definition at line 45 of file PFlow2DClusterizerWithTime.h.

◆ _maxIterations

const unsigned PFlow2DClusterizerWithTime::_maxIterations
private

Definition at line 34 of file PFlow2DClusterizerWithTime.h.

Referenced by growPFClusters().

◆ _maxNSigmaTime

const double PFlow2DClusterizerWithTime::_maxNSigmaTime
private

Definition at line 41 of file PFlow2DClusterizerWithTime.h.

Referenced by dist2Time().

◆ _minChi2Prob

const double PFlow2DClusterizerWithTime::_minChi2Prob
private

Definition at line 42 of file PFlow2DClusterizerWithTime.h.

Referenced by growPFClusters(), and passChi2Prob().

◆ _minFracTot

const double PFlow2DClusterizerWithTime::_minFracTot
private

Definition at line 40 of file PFlow2DClusterizerWithTime.h.

Referenced by growPFClusters().

◆ _recHitEnergyNorms

std::unordered_map<int, double> PFlow2DClusterizerWithTime::_recHitEnergyNorms
private

Definition at line 46 of file PFlow2DClusterizerWithTime.h.

Referenced by growPFClusters().

◆ _showerSigma2

const double PFlow2DClusterizerWithTime::_showerSigma2
private

Definition at line 36 of file PFlow2DClusterizerWithTime.h.

Referenced by growPFClusters().

◆ _stoppingTolerance

const double PFlow2DClusterizerWithTime::_stoppingTolerance
private

Definition at line 35 of file PFlow2DClusterizerWithTime.h.

Referenced by growPFClusters().

◆ _timeResolutionCalcBarrel

std::unique_ptr<CaloRecHitResolutionProvider> PFlow2DClusterizerWithTime::_timeResolutionCalcBarrel
private

◆ _timeResolutionCalcEndcap

std::unique_ptr<CaloRecHitResolutionProvider> PFlow2DClusterizerWithTime::_timeResolutionCalcEndcap
private

◆ _timeSigma_eb

const double PFlow2DClusterizerWithTime::_timeSigma_eb
private

Definition at line 37 of file PFlow2DClusterizerWithTime.h.

Referenced by dist2Time().

◆ _timeSigma_ee

const double PFlow2DClusterizerWithTime::_timeSigma_ee
private

Definition at line 38 of file PFlow2DClusterizerWithTime.h.

Referenced by dist2Time().

reco::PFClusterCollection
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
PFlow2DClusterizerWithTime::_timeSigma_ee
const double _timeSigma_ee
Definition: PFlow2DClusterizerWithTime.h:38
change_name.diff
diff
Definition: change_name.py:13
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
reco::CaloCluster::setSeed
void setSeed(const DetId &id)
Definition: CaloCluster.h:146
reco::PFRecHitFraction::fraction
double fraction() const
Definition: PFRecHitFraction.h:30
mps_fire.i
i
Definition: mps_fire.py:355
reco::PFCluster::setTime
void setTime(float time, float timeError=0)
Definition: PFCluster.h:88
input
static const std::string input
Definition: EdmProvDump.cc:48
particleFlowZeroSuppressionECAL_cff.thresholds
thresholds
Definition: particleFlowZeroSuppressionECAL_cff.py:31
PFlow2DClusterizerWithTime::clusterTimeResolution
void clusterTimeResolution(reco::PFCluster &cluster, double &res) const
Definition: PFlow2DClusterizerWithTime.cc:291
reco::PFRecHitFraction
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
Definition: PFRecHitFraction.h:18
reco::PFRecHit::energy
float energy() const
rechit energy
Definition: PFRecHit.h:99
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
mps_splice.entry
entry
Definition: mps_splice.py:68
cropTnPTrees.frac
frac
Definition: cropTnPTrees.py:18
PFlow2DClusterizerWithTime::_allCellsPosCalc
std::unique_ptr< PFCPositionCalculatorBase > _allCellsPosCalc
Definition: PFlow2DClusterizerWithTime.h:47
PFLayer::HCAL_ENDCAP
Definition: PFLayer.h:37
reco::PFCluster::recHitFractions
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
Definition: PFCluster.h:69
reco::PFCluster::time
float time() const
Definition: PFCluster.h:81
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
edm::Ref< PFRecHitCollection >
PFlow2DClusterizerWithTime::_excludeOtherSeeds
const bool _excludeOtherSeeds
Definition: PFlow2DClusterizerWithTime.h:39
PFLayer::ECAL_BARREL
Definition: PFLayer.h:33
HLT_2018_cff.recHitEnergyNorm
recHitEnergyNorm
Definition: HLT_2018_cff.py:11887
reco::PFCluster::energy
double energy() const
cluster energy
Definition: PFCluster.h:78
myMath::fast_expf
float fast_expf(float x)
Definition: EcalUncalibRecHitRatioMethodAlgo.h:27
PFLayer::PS1
Definition: PFLayer.h:31
PFLayer::HCAL_BARREL2
Definition: PFLayer.h:36
PFLayer::HF_EM
Definition: PFLayer.h:38
PFlow2DClusterizerWithTime::growPFClusters
void growPFClusters(const reco::PFCluster &, const std::vector< bool > &, const unsigned toleranceScaling, const unsigned iter, double dist, reco::PFClusterCollection &) const
Definition: PFlow2DClusterizerWithTime.cc:132
PFlow2DClusterizerWithTime::_maxNSigmaTime
const double _maxNSigmaTime
Definition: PFlow2DClusterizerWithTime.h:41
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
PFLayer::HCAL_BARREL1
Definition: PFLayer.h:35
PFlow2DClusterizerWithTime::_showerSigma2
const double _showerSigma2
Definition: PFlow2DClusterizerWithTime.h:36
PFlow2DClusterizerWithTime::_timeSigma_eb
const double _timeSigma_eb
Definition: PFlow2DClusterizerWithTime.h:37
PFLayer::NONE
Definition: PFLayer.h:34
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
PFLayer::HF_HAD
Definition: PFLayer.h:39
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
PFlow2DClusterizerWithTime::_minFracTot
const double _minFracTot
Definition: PFlow2DClusterizerWithTime.h:40
edm::ParameterSet
Definition: ParameterSet.h:36
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
PFlow2DClusterizerWithTime::_convergencePosCalc
std::unique_ptr< PFCPositionCalculatorBase > _convergencePosCalc
Definition: PFlow2DClusterizerWithTime.h:48
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PFlow2DClusterizerWithTime::_stoppingTolerance
const double _stoppingTolerance
Definition: PFlow2DClusterizerWithTime.h:35
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
PFlow2DClusterizerWithTime::_timeResolutionCalcEndcap
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcEndcap
Definition: PFlow2DClusterizerWithTime.h:51
PFlow2DClusterizerWithTime::passChi2Prob
bool passChi2Prob(size_t iCluster, double dist2, std::vector< double > &clus_chi2, std::vector< size_t > &clus_chi2_nhits) const
Definition: PFlow2DClusterizerWithTime.cc:355
createfilelist.int
int
Definition: createfilelist.py:10
PFlow2DClusterizerWithTime::clusterTimeResolutionFromSeed
void clusterTimeResolutionFromSeed(reco::PFCluster &cluster, double &res) const
Definition: PFlow2DClusterizerWithTime.cc:274
PFlow2DClusterizerWithTime::_recHitEnergyNorms
std::unordered_map< int, double > _recHitEnergyNorms
Definition: PFlow2DClusterizerWithTime.h:46
get
#define get
reco::CaloCluster::seed
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:219
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
reco::PFRecHit::time
float time() const
timing for cleaned hits
Definition: PFRecHit.h:102
reco::PFCluster::addRecHitFraction
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:77
reco::PFRecHit::detId
unsigned detId() const
rechit detId
Definition: PFRecHit.h:93
PFlow2DClusterizerWithTime::seedPFClustersFromTopo
void seedPFClustersFromTopo(const reco::PFCluster &, const std::vector< bool > &, reco::PFClusterCollection &) const
Definition: PFlow2DClusterizerWithTime.cc:113
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
PFlow2DClusterizerWithTime::_clusterTimeResFromSeed
const bool _clusterTimeResFromSeed
Definition: PFlow2DClusterizerWithTime.h:43
PFlow2DClusterizerWithTime::dist2Time
double dist2Time(const reco::PFCluster &, const reco::PFRecHitRef &, int cell_layer, double prev_timeres2) const
Definition: PFlow2DClusterizerWithTime.cc:322
eostools.move
def move(src, dest)
Definition: eostools.py:511
PFClusterBuilderBase::PFClusterBuilderBase
PFClusterBuilderBase(const edm::ParameterSet &conf)
Definition: PFClusterBuilderBase.h:23
Exception
Definition: hltDiff.cc:246
PFlow2DClusterizerWithTime::_maxIterations
const unsigned _maxIterations
Definition: PFlow2DClusterizerWithTime.h:34
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:46
reco::PFCluster::setTimeError
void setTimeError(float timeError)
Definition: PFCluster.h:92
PFlow2DClusterizerWithTime::_timeResolutionCalcBarrel
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcBarrel
Definition: PFlow2DClusterizerWithTime.h:50
reco::PFRecHit
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
edm::ParameterSet::getParameterSetVector
VParameterSet const & getParameterSetVector(std::string const &name) const
Definition: ParameterSet.cc:2153
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
reco::PFRecHit::layer
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:96
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::PFCluster::REPPoint
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:52
LOGDRESSED
#define LOGDRESSED(x)
Definition: PFlow2DClusterizerWithTime.cc:23
PFClusterBuilderBase::_positionCalc
std::unique_ptr< PosCalc > _positionCalc
Definition: PFClusterBuilderBase.h:57
PFClusterBuilderBase::_minFractionToKeep
const float _minFractionToKeep
Definition: PFClusterBuilderBase.h:56
PFLayer::ECAL_ENDCAP
Definition: PFLayer.h:32
PFLayer::PS2
Definition: PFLayer.h:30
PFlow2DClusterizerWithTime::prunePFClusters
void prunePFClusters(reco::PFClusterCollection &) const
Definition: PFlow2DClusterizerWithTime.cc:268
HLT_2018_cff.fraction
fraction
Definition: HLT_2018_cff.py:51317
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2121
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
PFlow2DClusterizerWithTime::_layerMap
const std::unordered_map< std::string, int > _layerMap
Definition: PFlow2DClusterizerWithTime.h:45
PFlow2DClusterizerWithTime::_minChi2Prob
const double _minChi2Prob
Definition: PFlow2DClusterizerWithTime.h:42