CMS 3D CMS Logo

Namespaces | Classes | Typedefs | Enumerations | Functions
fftjetcms Namespace Reference

Namespaces

 Private
 

Classes

struct  AbsPileupCalculator
 
class  CompositeFunctor
 
class  ConstDouble
 
struct  EnergyEtaP4Builder
 
class  EtaAndPtDependentPeakSelector
 
class  EtaAndPtLookupPeakSelector
 
class  EtaDependentPileup
 
class  FFTJetInterface
 
struct  JetAbsEta
 
class  JetConvergenceDistance
 
class  JetEtaDependent
 
class  JetToPeakDistance
 
class  LinInterpolatedTable1D
 
class  LookupTable2d
 
class  MagnitudeDependent
 
class  MultiplyByConst
 
struct  PeakAbsEta
 
class  PeakEtaDependent
 
class  PeakEtaMagSsqDependent
 
class  PileupGrid2d
 
class  Polynomial
 
class  ProductFunctor
 
class  ProportionalToScale
 
struct  PtEtaP4Builder
 

Typedefs

typedef fftjet::Functor2< double, double, BgDataAbsBgFunctor
 
typedef double BgData
 
typedef fftw_complex Complex
 
typedef fftjet::FFTWDoubleEngine MyFFTEngine
 
typedef double Real
 
typedef PtEtaP4Builder VBuilder
 
typedef math::XYZTLorentzVector VectorLike
 

Enumerations

enum  JetType {
  BASICJET = 0, GENJET, CALOJET, PFJET,
  TRACKJET, JPTJET
}
 

Functions

template<typename F1 , typename F2 >
void add_Grid2d_data (fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
 
math::XYZTLorentzVector adjustForPileup (const math::XYZTLorentzVector &jet, const math::XYZTLorentzVector &pileup, bool subtractPileupAs4Vec)
 
template<typename Numeric >
fftjet::Grid2d< double > * convert_Grid2d_to_double (const fftjet::Grid2d< Numeric > &grid)
 
template<typename Numeric >
fftjet::Grid2d< float > * convert_Grid2d_to_float (const fftjet::Grid2d< Numeric > &grid)
 
template<typename F1 , typename F2 >
void copy_Grid2d_data (fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
 
template<class Real >
void densePeakTreeFromStorable (const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::AbsClusteringTree< fftjet::Peak, long > *out)
 
template<class Real >
void densePeakTreeToStorable (const fftjet::AbsClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
 
std::unique_ptr< AbsBgFunctorfftjet_BgFunctor_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > > fftjet_ClusteringTreeSparsifier_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjet_DistanceCalculator_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::Functor1< double, double > > fftjet_Function_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::Functor2< double, fftjet::RecombinedJet< VectorLike >, fftjet::RecombinedJet< VectorLike > > > fftjet_JetDistance_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::Functor1< double, fftjet::RecombinedJet< VectorLike > > > fftjet_JetFunctor_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::JetMagnitudeMapper2d< fftjet::RecombinedJet< VectorLike > > > fftjet_JetMagnitudeMapper2d_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::LinearInterpolator1d > fftjet_LinearInterpolator1d_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::LinearInterpolator2d > fftjet_LinearInterpolator2d_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjetcms::LinInterpolatedTable1Dfftjet_LinInterpolatedTable1D_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::ScaleSpaceKernel > fftjet_MembershipFunction_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjet_PeakFunctor_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::JetMagnitudeMapper2d< fftjet::Peak > > fftjet_PeakMagnitudeMapper2d_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjet_PeakSelector_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< AbsPileupCalculatorfftjet_PileupCalculator_parser (const edm::ParameterSet &ps)
 
std::unique_ptr< std::vector< double > > fftjet_ScaleSet_parser (const edm::ParameterSet &ps)
 
template<class Real >
fftjet::RecombinedJet< VectorLikejetFromStorable (const reco::FFTJet< Real > &jet)
 
template<class Real >
reco::FFTJet< RealjetToStorable (const fftjet::RecombinedJet< VectorLike > &jet)
 
template<class T1 , class T2 , class DistanceCalculator >
unsigned matchOneToOne (const std::vector< T1 > &v1, const std::vector< T2 > &v2, const DistanceCalculator &calc, std::vector< int > *matchFrom1To2, const double maxMatchingDistance=1.0e300)
 
JetType parseJetType (const std::string &name)
 
template<class Real >
void sparsePeakTreeFromStorable (const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::SparseClusteringTree< fftjet::Peak, long > *out)
 
template<class Real >
void sparsePeakTreeToStorable (const fftjet::SparseClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
 

Typedef Documentation

◆ AbsBgFunctor

typedef fftjet::Functor2<double, double, BgData> fftjetcms::AbsBgFunctor

Definition at line 38 of file fftjetTypedefs.h.

◆ BgData

typedef double fftjetcms::BgData

Definition at line 34 of file fftjetTypedefs.h.

◆ Complex

typedef fftw_complex fftjetcms::Complex

Definition at line 22 of file fftjetTypedefs.h.

◆ MyFFTEngine

typedef fftjet::FFTWDoubleEngine fftjetcms::MyFFTEngine

Definition at line 23 of file fftjetTypedefs.h.

◆ Real

typedef double fftjetcms::Real

Definition at line 21 of file fftjetTypedefs.h.

◆ VBuilder

Definition at line 30 of file fftjetTypedefs.h.

◆ VectorLike

Definition at line 26 of file fftjetTypedefs.h.

Enumeration Type Documentation

◆ JetType

Enumerator
BASICJET 
GENJET 
CALOJET 
PFJET 
TRACKJET 
JPTJET 

Definition at line 7 of file JetType.h.

Function Documentation

◆ add_Grid2d_data()

template<typename F1 , typename F2 >
void fftjetcms::add_Grid2d_data ( fftjet::Grid2d< F2 > *  to,
const fftjet::Grid2d< F1 > &  from 
)

Definition at line 51 of file gridConverters.h.

References cms::cuda::assert(), and mps_fire::i.

Referenced by FFTJetPileupProcessor::mixExtraGrid().

51  {
52  assert(to);
53  assert(from.nEta() == to->nEta());
54  assert(from.nPhi() == to->nPhi());
55  const unsigned len = from.nEta() * from.nPhi();
56  const F1* fromData = from.data();
57  F2* toData = const_cast<F2*>(to->data());
58  for (unsigned i = 0; i < len; ++i)
59  toData[i] += fromData[i];
60  }
assert(be >=bs)

◆ adjustForPileup()

math::XYZTLorentzVector fftjetcms::adjustForPileup ( const math::XYZTLorentzVector jet,
const math::XYZTLorentzVector pileup,
bool  subtractPileupAs4Vec 
)

Definition at line 4 of file adjustForPileup.cc.

References MillePedeFileConverter_cfg::e, metsig::jet, mixOne_premix_on_sim_cfi::pileup, DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, and fftjetproducer_cfi::subtractPileupAs4Vec.

Referenced by FFTJetCorrectionProducer::performPileupSubtraction(), and FFTJetProducer::writeJets().

6  {
7  const double pt = jet.Pt();
8  if (pt > 0.0) {
9  const double pileupPt = pileup.Pt();
10  const double ptFactor = (pt - pileupPt) / pt;
11  if (ptFactor <= 0.0)
12  return math::XYZTLorentzVector();
13  else if (subtractPileupAs4Vec) {
14  const math::XYZTLorentzVector subtracted(jet - pileup);
15  const double e = subtracted.E();
16  if (e <= 0.0)
17  return math::XYZTLorentzVector();
18  else {
19  // Avoid negative jet masses
20  const double px = subtracted.Px();
21  const double py = subtracted.Py();
22  const double pz = subtracted.Pz();
23  if (e * e < px * px + py * py + pz * pz)
24  // It is not clear what is the best thing to do here.
25  // For now, revert to Pt scaling.
26  return jet * ptFactor;
27  else
28  return subtracted;
29  }
30  } else
31  return jet * ptFactor;
32  } else
33  return jet;
34  }
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29

◆ convert_Grid2d_to_double()

template<typename Numeric >
fftjet::Grid2d< double > * fftjetcms::convert_Grid2d_to_double ( const fftjet::Grid2d< Numeric > &  grid)

Definition at line 71 of file gridConverters.h.

References copy_Grid2d_data(), and getRunAppsInfo::grid.

71  {
72  fftjet::Grid2d<double>* to = new fftjet::Grid2d<double>(
73  grid.nEta(), grid.etaMin(), grid.etaMax(), grid.nPhi(), grid.phiBin0Edge(), grid.title());
75  return to;
76  }
void copy_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)

◆ convert_Grid2d_to_float()

template<typename Numeric >
fftjet::Grid2d< float > * fftjetcms::convert_Grid2d_to_float ( const fftjet::Grid2d< Numeric > &  grid)

Definition at line 63 of file gridConverters.h.

References copy_Grid2d_data(), and getRunAppsInfo::grid.

Referenced by FFTJetPatRecoProducer::produce().

63  {
64  fftjet::Grid2d<float>* to = new fftjet::Grid2d<float>(
65  grid.nEta(), grid.etaMin(), grid.etaMax(), grid.nPhi(), grid.phiBin0Edge(), grid.title());
67  return to;
68  }
void copy_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)

◆ copy_Grid2d_data()

template<typename F1 , typename F2 >
void fftjetcms::copy_Grid2d_data ( fftjet::Grid2d< F2 > *  to,
const fftjet::Grid2d< F1 > &  from 
)

Definition at line 39 of file gridConverters.h.

References cms::cuda::assert(), and mps_fire::i.

Referenced by convert_Grid2d_to_double(), convert_Grid2d_to_float(), and FFTJetPatRecoProducer::produce().

39  {
40  assert(to);
41  assert(from.nEta() == to->nEta());
42  assert(from.nPhi() == to->nPhi());
43  const unsigned len = from.nEta() * from.nPhi();
44  const F1* fromData = from.data();
45  F2* toData = const_cast<F2*>(to->data());
46  for (unsigned i = 0; i < len; ++i)
47  toData[i] = fromData[i];
48  }
assert(be >=bs)

◆ densePeakTreeFromStorable()

template<class Real >
void fftjetcms::densePeakTreeFromStorable ( const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &  in,
const std::vector< double > *  scaleSetIfNotAdaptive,
double  completeEventScale,
fftjet::AbsClusteringTree< fftjet::Peak, long > *  out 
)

Definition at line 271 of file clusteringTreeConverters.h.

References cms::cuda::assert(), bsc_activity_cfg::clusters, fftjetdijetfilter_cfi::completeEventScale, Exception, mps_fire::i, recoMuon::in, dttmaxenums::L, dqmiodumpmetadata::n, class-composition::nodes, MillePedeFileConverter_cfg::out, AlCaHLTBitMon_ParallelJobs::p, and L1EGammaClusterEmuProducer_cfi::scale.

Referenced by FFTJetPatRecoProducer::buildDenseProduct(), FFTJetDijetFilter::filter(), and FFTJetTreeDump::processTreeData().

274  {
275  typedef fftjet::AbsClusteringTree<fftjet::Peak, long> DenseTree;
276  typedef reco::PattRecoPeak<Real> StoredPeak;
277  typedef reco::PattRecoNode<StoredPeak> StoredNode;
278  typedef reco::PattRecoTree<Real, StoredPeak> StoredTree;
279 
280  if (in.isSparse())
281  throw cms::Exception("FFTJetBadConfig") << "can't restore dense clustering tree"
282  << " from sparsely stored record" << std::endl;
283 
284  assert(out);
285  out->clear();
286 
287  const std::vector<StoredNode>& nodes(in.getNodes());
288  const unsigned n = nodes.size();
289  double hessian[3] = {0., 0., 0.};
290 
291  const std::vector<Real>& scales(in.getScales());
292  unsigned int scnum = 0;
293  std::vector<fftjet::Peak> clusters;
294  const unsigned scsize1 = scales.size();
295  unsigned scsize2 = scaleSetIfNotAdaptive ? scaleSetIfNotAdaptive->size() : 0;
296  if (scsize2 && completeEventScale)
297  ++scsize2;
298  const unsigned scsize = (scsize1 == 0 ? scsize2 : scsize1);
299 
300  if (scsize == 0)
301  throw cms::Exception("FFTJetBadConfig")
302  << " No scales passed to the function densePeakTreeFromStorable()" << std::endl;
303 
304  // to check whether the largest level equals the size of scale vector
305  const double* sc_not_ad = scsize2 ? &(*scaleSetIfNotAdaptive)[0] : nullptr;
306 
307  unsigned templevel = n ? nodes[0].originalLevel() : 1;
308  for (unsigned i = 0; i < n; ++i) {
309  const StoredNode& snode(nodes[i]);
310  const StoredPeak& p(snode.getCluster());
311  p.hessian(hessian);
312 
313  const unsigned levelNumber = snode.originalLevel();
314 
315  if (templevel != levelNumber) {
316  if (scnum >= scsize)
317  throw cms::Exception("FFTJetBadConfig") << "bad scales, please check the scales" << std::endl;
318  const double scale = ((scsize1 == 0) ? sc_not_ad[scnum] : scales[scnum]);
319  out->insert(scale, clusters, 0L);
320  clusters.clear();
321  templevel = levelNumber;
322  ++scnum;
323  }
324 
325  fftjet::Peak apeak(p.eta(),
326  p.phi(),
327  p.magnitude(),
328  hessian,
329  p.driftSpeed(),
330  p.magSpeed(),
331  p.lifetime(),
332  p.scale(),
333  p.nearestNeighborDistance(),
334  1.0,
335  0.0,
336  0.0,
337  p.clusterRadius(),
338  p.clusterSeparation());
339  apeak.setSplitTime(p.splitTime());
340  apeak.setMergeTime(p.mergeTime());
341  clusters.push_back(apeak);
342 
343  if (i == (n - 1) && levelNumber != scsize)
344  throw cms::Exception("FFTJetBadConfig") << "bad scales, please check the scales" << std::endl;
345  }
346 
347  const double scale = scsize1 ? scales[scnum] : completeEventScale ? completeEventScale : sc_not_ad[scnum];
348  out->insert(scale, clusters, 0L);
349  }
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:16
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:20
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
assert(be >=bs)

◆ densePeakTreeToStorable()

template<class Real >
void fftjetcms::densePeakTreeToStorable ( const fftjet::AbsClusteringTree< fftjet::Peak, long > &  in,
bool  writeOutScaleInfo,
reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *  out 
)

Definition at line 210 of file clusteringTreeConverters.h.

References cms::cuda::assert(), mps_fire::i, triggerObjects_cff::id, recoMuon::in, fftjetcommon_cfi::nScales, and MillePedeFileConverter_cfg::out.

Referenced by FFTJetPatRecoProducer::buildDenseProduct().

212  {
213  typedef fftjet::AbsClusteringTree<fftjet::Peak, long> DenseTree;
214  typedef reco::PattRecoPeak<Real> StoredPeak;
215  typedef reco::PattRecoNode<StoredPeak> StoredNode;
216  typedef reco::PattRecoTree<Real, StoredPeak> StoredTree;
217 
218  assert(out);
219  out->clear();
220  out->setSparse(false);
221 
222  const unsigned nLevels = in.nLevels();
223  double hessian[3] = {0., 0., 0.};
224 
225  // Do not write out the meaningless top node
226  out->reserveNodes(in.nClusters() - 1);
227 
228  for (unsigned i = 1; i < nLevels; ++i) {
229  const unsigned int nclus = in.nClusters(i);
230  DenseTree::NodeId id(i, 0);
231  for (; id.second < nclus; ++id.second) {
232  const fftjet::Peak& peak(in.getCluster(id));
233  peak.hessian(hessian);
234  StoredNode sn(StoredPeak(peak.eta(),
235  peak.phi(),
236  peak.magnitude(),
237  hessian,
238  peak.driftSpeed(),
239  peak.magSpeed(),
240  peak.lifetime(),
241  peak.scale(),
242  peak.nearestNeighborDistance(),
243  peak.clusterRadius(),
244  peak.clusterSeparation(),
245  peak.splitTime(),
246  peak.mergeTime()),
247  i,
248  0,
249  0);
250  out->addNode(sn);
251  }
252  }
253 
254  // Do we want to write out the scales? We will use the following
255  // convention: if the tree is using an adaptive algorithm, the scales
256  // will be written out. If not, they are not going to change from
257  // event to event. In this case the scales would waste disk space
258  // for no particularly good reason, so they will not be written out.
259  if (writeOutScaleInfo) {
260  // Do not write out the meaningless top-level scale
261  const unsigned nScales = in.nLevels();
262  out->reserveScales(nScales - 1);
263  for (unsigned i = 1; i < nScales; ++i)
264  out->addScale(in.getScale(i));
265  }
266  }
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:16
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:20
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
assert(be >=bs)

◆ fftjet_BgFunctor_parser()

std::unique_ptr< AbsBgFunctor > fftjetcms::fftjet_BgFunctor_parser ( const edm::ParameterSet ps)

Definition at line 338 of file FFTJetParameterParser.cc.

References edm::ParameterSet::getParameter(), fftjetcommon_cfi::minWeight, bookConverter::prior, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FFTJetProducer::parse_bgMembershipFunction().

338  {
339  const std::string bg_Membership_type = ps.getParameter<std::string>("Class");
340 
341  if (!bg_Membership_type.compare("GaussianNoiseMembershipFcn")) {
342  const double minWeight = ps.getParameter<double>("minWeight");
343  const double prior = ps.getParameter<double>("prior");
344  return std::unique_ptr<AbsBgFunctor>(new fftjet::GaussianNoiseMembershipFcn(minWeight, prior));
345  }
346 
347  return std::unique_ptr<AbsBgFunctor>(nullptr);
348  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ fftjet_ClusteringTreeSparsifier_parser()

std::unique_ptr< fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > > fftjetcms::fftjet_ClusteringTreeSparsifier_parser ( const edm::ParameterSet ps)

Definition at line 392 of file FFTJetParameterParser.cc.

References fftjetpatrecoproducer_cfi::filterMask, edm::ParameterSet::getParameter(), fftjetpatrecoproducer_cfi::maxLevelNumber, and fftjetpatrecoproducer_cfi::userScales.

Referenced by FFTJetPatRecoProducer::FFTJetPatRecoProducer().

393  {
394  const int maxLevelNumber = ps.getParameter<int>("maxLevelNumber");
395  const unsigned filterMask = ps.getParameter<unsigned>("filterMask");
396  const std::vector<double> userScalesV = ps.getParameter<std::vector<double>>("userScales");
397  const unsigned nUserScales = userScalesV.size();
398  const double* userScales = nUserScales ? &userScalesV[0] : nullptr;
399 
400  return std::make_unique<fftjet::ClusteringTreeSparsifier<fftjet::Peak, long>>(
401  maxLevelNumber, filterMask, userScales, nUserScales);
402  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ fftjet_DistanceCalculator_parser()

std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjetcms::fftjet_DistanceCalculator_parser ( const edm::ParameterSet ps)

Definition at line 404 of file FFTJetParameterParser.cc.

References data, fftjetcommon_cfi::etaToPhiBandwidthRatio, fftjet_LinearInterpolator1d_parser(), edm::ParameterSet::getParameter(), mps_fire::i, dqmiodumpmetadata::n, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FFTJetDijetFilter::FFTJetDijetFilter(), FFTJetPatRecoProducer::FFTJetPatRecoProducer(), and FFTJetTreeDump::FFTJetTreeDump().

405  {
406  typedef std::unique_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak>> return_type;
407 
408  const std::string calc_type = ps.getParameter<std::string>("Class");
409 
410  if (!calc_type.compare("PeakEtaPhiDistance")) {
411  const double etaToPhiBandwidthRatio = ps.getParameter<double>("etaToPhiBandwidthRatio");
412  return return_type(new fftjet::PeakEtaPhiDistance(etaToPhiBandwidthRatio));
413  }
414 
415  if (!calc_type.compare("PeakEtaDependentDistance")) {
416  std::unique_ptr<fftjet::LinearInterpolator1d> interp =
418  const fftjet::LinearInterpolator1d* ip = interp.get();
419  if (ip == nullptr)
420  return return_type(nullptr);
421 
422  // Check that the interpolator is always positive
423  const unsigned n = ip->nx();
424  const double* data = ip->getData();
425  for (unsigned i = 0; i < n; ++i)
426  if (data[i] <= 0.0)
427  return return_type(nullptr);
428  if (ip->fLow() <= 0.0 || ip->fHigh() <= 0.0)
429  return return_type(nullptr);
430 
431  return return_type(new fftjet::PeakEtaDependentDistance(*ip));
432  }
433 
434  return return_type(nullptr);
435  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
std::unique_ptr< fftjet::LinearInterpolator1d > fftjet_LinearInterpolator1d_parser(const edm::ParameterSet &ps)

◆ fftjet_Function_parser()

std::unique_ptr< fftjet::Functor1< double, double > > fftjetcms::fftjet_Function_parser ( const edm::ParameterSet ps)

Definition at line 707 of file FFTJetParameterParser.cc.

References edm::ParameterSet::exists(), fftjet_LinearInterpolator1d_parser(), fftjet_LinInterpolatedTable1D_parser(), edm::ParameterSet::getParameter(), mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fftjet_JetFunctor_parser(), fftjet_PeakFunctor_parser(), and FFTJetPileupEstimator::FFTJetPileupEstimator().

707  {
708  typedef std::unique_ptr<fftjet::Functor1<double, double>> return_type;
709 
710  const std::string fcn_type = ps.getParameter<std::string>("Class");
711 
712  if (!fcn_type.compare("LinearInterpolator1d")) {
713  std::unique_ptr<fftjet::LinearInterpolator1d> p = fftjet_LinearInterpolator1d_parser(ps);
714  fftjet::LinearInterpolator1d* ptr = p.get();
715  if (ptr) {
716  p.release();
717  return return_type(ptr);
718  }
719  }
720 
721  if (!fcn_type.compare("LinInterpolatedTable1D")) {
722  std::unique_ptr<fftjetcms::LinInterpolatedTable1D> p = fftjet_LinInterpolatedTable1D_parser(ps);
724  if (ptr) {
725  p.release();
726  return return_type(ptr);
727  }
728  }
729 
730  if (!fcn_type.compare("Polynomial")) {
731  std::vector<double> coeffs;
732  for (unsigned i = 0;; ++i) {
733  std::ostringstream s;
734  s << 'c' << i;
735  if (ps.exists(s.str()))
736  coeffs.push_back(ps.getParameter<double>(s.str()));
737  else
738  break;
739  }
740  return return_type(new Polynomial(coeffs));
741  }
742 
743  return return_type(nullptr);
744  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::unique_ptr< fftjetcms::LinInterpolatedTable1D > fftjet_LinInterpolatedTable1D_parser(const edm::ParameterSet &ps)
std::unique_ptr< fftjet::LinearInterpolator1d > fftjet_LinearInterpolator1d_parser(const edm::ParameterSet &ps)

◆ fftjet_Grid2d_parser()

std::unique_ptr< fftjet::Grid2d< Real > > fftjetcms::fftjet_Grid2d_parser ( const edm::ParameterSet ps)

Definition at line 125 of file FFTJetParameterParser.cc.

References data, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, Exception, edm::ParameterSet::exists(), geometryDiff::file, g, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), recoMuon::in, L1TMuonDQMOffline_cfi::nEtaBins, ecaldqm::binning::nPhiBins, fftjetcommon_cfi::phiBin0Edge, fileinputsource_cfi::read, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

Referenced by FFTJetProducer::beginJob(), fftjet_PileupCalculator_parser(), FFTJetEFlowSmoother::FFTJetEFlowSmoother(), FFTJetPatRecoProducer::FFTJetPatRecoProducer(), and FFTJetPileupProcessor::FFTJetPileupProcessor().

125  {
126  typedef std::unique_ptr<fftjet::Grid2d<Real>> return_type;
127  fftjet::Grid2d<Real>* g = nullptr;
128 
129  // Check if the grid should be read from file
130  if (ps.exists("file")) {
131  const std::string file = ps.getParameter<std::string>("file");
132  std::ifstream in(file.c_str(), std::ios_base::in | std::ios_base::binary);
133  if (!in.is_open())
134  throw cms::Exception("FFTJetBadConfig") << "Failed to open file " << file << std::endl;
136  if (g == nullptr)
137  throw cms::Exception("FFTJetBadConfig") << "Failed to read file " << file << std::endl;
138  } else {
139  const unsigned nEtaBins = ps.getParameter<unsigned>("nEtaBins");
140  const Real etaMin = ps.getParameter<Real>("etaMin");
141  const Real etaMax = ps.getParameter<Real>("etaMax");
142  const unsigned nPhiBins = ps.getParameter<unsigned>("nPhiBins");
143  const Real phiBin0Edge = ps.getParameter<Real>("phiBin0Edge");
144  const std::string& title = ps.getUntrackedParameter<std::string>("title", "");
145 
146  if (nEtaBins == 0 || nPhiBins == 0 || etaMin >= etaMax)
147  return return_type(nullptr);
148 
149  g = new fftjet::Grid2d<Real>(nEtaBins, etaMin, etaMax, nPhiBins, phiBin0Edge, title.c_str());
150 
151  // Check if the grid data is provided
152  if (ps.exists("data")) {
153  const std::vector<Real>& data = ps.getParameter<std::vector<Real>>("data");
154  if (data.size() == nEtaBins * nPhiBins)
155  g->blockSet(&data[0], nEtaBins, nPhiBins);
156  else {
157  delete g;
158  g = nullptr;
159  }
160  }
161  }
162 
163  return return_type(g);
164  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool exists(std::string const &parameterName) const
checks if a parameter exists
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
T getUntrackedParameter(std::string const &, T const &) const
double Real
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ fftjet_JetDistance_parser()

std::unique_ptr< fftjet::Functor2< double, fftjet::RecombinedJet< VectorLike >, fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetDistance_parser ( const edm::ParameterSet ps)

Definition at line 689 of file FFTJetParameterParser.cc.

References fftjetcommon_cfi::etaToPhiBandwidthRatio, edm::ParameterSet::getParameter(), make_param, fftjetcommon_cfi::relativePtBandwidth, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FFTJetProducer::parse_jetDistanceCalc().

689  {
690  typedef std::unique_ptr<
691  fftjet::Functor2<double, fftjet::RecombinedJet<VectorLike>, fftjet::RecombinedJet<VectorLike>>>
692  return_type;
693 
694  const std::string distance_type = ps.getParameter<std::string>("Class");
695 
696  if (!distance_type.compare("JetConvergenceDistance")) {
699 
700  if (etaToPhiBandwidthRatio > 0.0 && relativePtBandwidth > 0.0)
702  }
703 
704  return return_type(nullptr);
705  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
#define make_param(type, varname)

◆ fftjet_JetFunctor_parser()

std::unique_ptr< fftjet::Functor1< double, fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetFunctor_parser ( const edm::ParameterSet ps)

Definition at line 589 of file FFTJetParameterParser.cc.

References DeadROC_duringRun::f1, DeadROC_duringRun::f2, DQMScaleToClient_cfi::factor, fcn(), fftjet_Function_parser(), edm::ParameterSet::getParameter(), parse_jet_member_function(), mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FFTJetProducer::parse_memberFactorCalcJet(), FFTJetProducer::parse_recoScaleCalcJet(), and FFTJetProducer::parse_recoScaleRatioCalcJet().

590  {
591  typedef fftjet::Functor1<double, RecoFFTJet> ptr_type;
592  typedef std::unique_ptr<ptr_type> return_type;
593 
594  const std::string property_type = ps.getParameter<std::string>("Class");
595 
596  if (!property_type.compare("Log")) {
597  return_type wrapped = fftjet_JetFunctor_parser(ps.getParameter<edm::ParameterSet>("function"));
598  fftjet::Functor1<double, RecoFFTJet>* wr = wrapped.get();
599  if (wr) {
600  return_type result = return_type(new fftjet::LogProperty<RecoFFTJet>(wr, true));
601  wrapped.release();
602  return result;
603  }
604  }
605 
606  if (!property_type.compare("JetEtaDependent")) {
607  std::unique_ptr<fftjet::Functor1<double, double>> fcn1 =
609  fftjet::Functor1<double, double>* f1 = fcn1.get();
610  if (f1) {
611  return_type result = return_type(new JetEtaDependent(f1, true));
612  fcn1.release();
613  return result;
614  }
615  }
616 
617  if (!property_type.compare("JetProperty")) {
618  const std::string member = ps.getParameter<std::string>("member");
619  fftjet::JetProperty<RecoFFTJet>::JetMemberFunction fcn;
620  if (parse_jet_member_function(member.c_str(), &fcn))
621  return return_type(new fftjet::JetProperty<RecoFFTJet>(fcn));
622  else
623  return return_type(nullptr);
624  }
625 
626  if (!property_type.compare("ConstDouble")) {
627  const double value = ps.getParameter<double>("value");
628  return return_type(new ConstDouble<RecoFFTJet>(value));
629  }
630 
631  if (!property_type.compare("ProportionalToScale")) {
632  const double value = ps.getParameter<double>("value");
633  return return_type(new ProportionalToScale<RecoFFTJet>(value));
634  }
635 
636  if (!property_type.compare("MultiplyByConst")) {
637  const double factor = ps.getParameter<double>("factor");
638  return_type function = fftjet_JetFunctor_parser(ps.getParameter<edm::ParameterSet>("function"));
639  ptr_type* ptr = function.get();
640  if (ptr) {
641  return_type result = return_type(new MultiplyByConst<RecoFFTJet>(factor, ptr, true));
642  function.release();
643  return result;
644  }
645  }
646 
647  if (!property_type.compare("CompositeFunctor")) {
648  std::unique_ptr<fftjet::Functor1<double, double>> fcn1 =
650  return_type fcn2 = fftjet_JetFunctor_parser(ps.getParameter<edm::ParameterSet>("function2"));
651  fftjet::Functor1<double, double>* f1 = fcn1.get();
652  ptr_type* f2 = fcn2.get();
653  if (f1 && f2) {
654  return_type result = return_type(new CompositeFunctor<RecoFFTJet>(f1, f2, true));
655  fcn1.release();
656  fcn2.release();
657  return result;
658  }
659  }
660 
661  if (!property_type.compare("ProductFunctor")) {
662  return_type fcn1 = fftjet_JetFunctor_parser(ps.getParameter<edm::ParameterSet>("function1"));
663  return_type fcn2 = fftjet_JetFunctor_parser(ps.getParameter<edm::ParameterSet>("function2"));
664  ptr_type* f1 = fcn1.get();
665  ptr_type* f2 = fcn2.get();
666  if (f1 && f2) {
667  return_type result = return_type(new ProductFunctor<RecoFFTJet>(f1, f2, true));
668  fcn1.release();
669  fcn2.release();
670  return result;
671  }
672  }
673 
674  if (!property_type.compare("MagnitudeDependent")) {
675  std::unique_ptr<fftjet::Functor1<double, double>> fcn1 =
677  fftjet::Functor1<double, double>* f1 = fcn1.get();
678  if (f1) {
679  return_type result = return_type(new MagnitudeDependent<RecoFFTJet>(f1, true));
680  fcn1.release();
681  return result;
682  }
683  }
684 
685  return return_type(nullptr);
686  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< fftjet::Functor1< double, fftjet::RecombinedJet< VectorLike > > > fftjet_JetFunctor_parser(const edm::ParameterSet &ps)
Definition: value.py:1
std::unique_ptr< fftjet::Functor1< double, double > > fftjet_Function_parser(const edm::ParameterSet &ps)
void fcn(int &, double *, double &, double *, int)
static bool parse_jet_member_function(const char *fname, fftjet::JetProperty< RecoFFTJet >::JetMemberFunction *f)

◆ fftjet_JetMagnitudeMapper2d_parser()

std::unique_ptr< fftjet::JetMagnitudeMapper2d< fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetMagnitudeMapper2d_parser ( const edm::ParameterSet ps)

Definition at line 799 of file FFTJetParameterParser.cc.

References fftjet_LinearInterpolator2d_parser(), and edm::ParameterSet::getParameter().

800  {
801  std::unique_ptr<fftjet::LinearInterpolator2d> responseCurve =
803 
804  const double minPredictor = ps.getParameter<double>("minPredictor");
805  const double maxPredictor = ps.getParameter<double>("maxPredictor");
806  const unsigned nPredPoints = ps.getParameter<unsigned>("nPredPoints");
807  const double maxMagnitude = ps.getParameter<double>("maxMagnitude");
808  const unsigned nMagPoints = ps.getParameter<unsigned>("nMagPoints");
809 
810  return (std::make_unique<fftjet::JetMagnitudeMapper2d<RecoFFTJet>>(*responseCurve,
812  true,
813  minPredictor,
814  maxPredictor,
815  nPredPoints,
816  maxMagnitude,
817  nMagPoints));
818  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< fftjet::LinearInterpolator2d > fftjet_LinearInterpolator2d_parser(const edm::ParameterSet &ps)

◆ fftjet_LinearInterpolator1d_parser()

std::unique_ptr< fftjet::LinearInterpolator1d > fftjetcms::fftjet_LinearInterpolator1d_parser ( const edm::ParameterSet ps)

Definition at line 450 of file FFTJetParameterParser.cc.

References data, fftjetcommon_cfi::fhigh, fftjetcommon_cfi::flow, edm::ParameterSet::getParameter(), TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by fftjet_DistanceCalculator_parser(), and fftjet_Function_parser().

450  {
451  const double xmin = ps.getParameter<double>("xmin");
452  const double xmax = ps.getParameter<double>("xmax");
453  const double flow = ps.getParameter<double>("flow");
454  const double fhigh = ps.getParameter<double>("fhigh");
455  const std::vector<double> data(ps.getParameter<std::vector<double>>("data"));
456  if (data.empty())
457  return std::unique_ptr<fftjet::LinearInterpolator1d>(nullptr);
458  else
459  return std::make_unique<fftjet::LinearInterpolator1d>(&data[0], data.size(), xmin, xmax, flow, fhigh);
460  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ fftjet_LinearInterpolator2d_parser()

std::unique_ptr< fftjet::LinearInterpolator2d > fftjetcms::fftjet_LinearInterpolator2d_parser ( const edm::ParameterSet ps)

Definition at line 462 of file FFTJetParameterParser.cc.

References Exception, geometryDiff::file, edm::ParameterSet::getParameter(), recoMuon::in, fileinputsource_cfi::read, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fftjet_JetMagnitudeMapper2d_parser(), fftjet_PeakMagnitudeMapper2d_parser(), and fftjet_PileupCalculator_parser().

462  {
463  const std::string file = ps.getParameter<std::string>("file");
464  std::ifstream in(file.c_str(), std::ios_base::in | std::ios_base::binary);
465  if (!in.is_open())
466  throw cms::Exception("FFTJetBadConfig") << "Failed to open file " << file << std::endl;
467  fftjet::LinearInterpolator2d* ip = fftjet::LinearInterpolator2d::read(in);
468  if (!ip)
469  throw cms::Exception("FFTJetBadConfig") << "Failed to read file " << file << std::endl;
470  return std::unique_ptr<fftjet::LinearInterpolator2d>(ip);
471  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ fftjet_LinInterpolatedTable1D_parser()

std::unique_ptr< fftjetcms::LinInterpolatedTable1D > fftjetcms::fftjet_LinInterpolatedTable1D_parser ( const edm::ParameterSet ps)

Definition at line 437 of file FFTJetParameterParser.cc.

References data, edm::ParameterSet::getParameter(), mixed_calib_calo_ttbar_result::leftExtrapolationLinear, mixed_calib_calo_ttbar_result::rightExtrapolationLinear, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by fftjet_Function_parser().

437  {
438  const double xmin = ps.getParameter<double>("xmin");
439  const double xmax = ps.getParameter<double>("xmax");
440  const bool leftExtrapolationLinear = ps.getParameter<bool>("leftExtrapolationLinear");
441  const bool rightExtrapolationLinear = ps.getParameter<bool>("rightExtrapolationLinear");
442  const std::vector<double> data(ps.getParameter<std::vector<double>>("data"));
443  if (data.empty())
444  return std::unique_ptr<fftjetcms::LinInterpolatedTable1D>(nullptr);
445  else
446  return std::make_unique<fftjetcms::LinInterpolatedTable1D>(
448  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ fftjet_MembershipFunction_parser()

std::unique_ptr< fftjet::ScaleSpaceKernel > fftjetcms::fftjet_MembershipFunction_parser ( const edm::ParameterSet ps)

Definition at line 227 of file FFTJetParameterParser.cc.

References data, Exception, geometryDiff::file, edm::ParameterSet::getParameter(), recoMuon::in, fftjetcommon_cfi::kernelParameters, make_param, fileinputsource_cfi::read, fftjetcommon_cfi::scalePower, AlCaHLTBitMon_QueryRunRegistry::string, fftjetcommon_cfi::sx, fftjetcommon_cfi::sy, mitigatedMETSequence_cff::U, TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

Referenced by FFTJetProducer::parse_jetMembershipFunction().

227  {
228  typedef std::unique_ptr<fftjet::ScaleSpaceKernel> return_type;
229 
230  const std::string MembershipFunction_type = ps.getParameter<std::string>("Class");
231 
232  // Parse special cases first
233  if (!MembershipFunction_type.compare("InterpolatedMembershipFcn")) {
234  // This is a kernel defined by a 4d (sparsified) lookup table.
235  // Here, it is simply loaded from a file using a built-in
236  // method from fftjet. Note that the table representation
237  // must be native binary (this will not work on platforms with
238  // different endianity of floating point standard).
239  const std::string file = ps.getParameter<std::string>("file");
240  std::ifstream in(file.c_str(), std::ios_base::in | std::ios_base::binary);
241  if (!in.is_open())
242  throw cms::Exception("FFTJetBadConfig") << "Failed to open file " << file << std::endl;
244  }
245 
246  if (!MembershipFunction_type.compare("Composite")) {
247  throw cms::Exception("FFTJetBadConfig")
248  << "Parsing of CompositeKernel objects is not implemented yet" << std::endl;
249  }
250 
251  if (!MembershipFunction_type.compare("MagneticSmearing")) {
252  // This kernel represents smearing of a jet in phi
253  // in a magnetic field. The meaning of the parameters
254  // is explained in the comments in the MagneticSmearingKernel.hh
255  // header file of the fftjet package.
256  make_param(std::vector<double>, fragmentationData);
257  make_param(double, numeratorConst);
258  make_param(double, charge1Fraction);
259  make_param(double, charge2Fraction);
260  make_param(unsigned, samplesPerBin);
261 
262  if (fragmentationData.empty())
263  throw cms::Exception("FFTJetBadConfig") << "Fragmentation function data not defined for "
264  "MagneticSmearingKernel"
265  << std::endl;
266  if (samplesPerBin < 1U)
267  throw cms::Exception("FFTJetBadConfig") << "Bad number of samples per bin in "
268  "MagneticSmearingKernel"
269  << std::endl;
270 
271  fftjet::LinearInterpolator1d* fragmentationFunction =
272  new fftjet::LinearInterpolator1d(&fragmentationData[0], fragmentationData.size(), 0.0, 1.0);
273 
274  return return_type(new fftjet::MagneticSmearingKernel<fftjet::LinearInterpolator1d>(
275  fragmentationFunction, numeratorConst, charge1Fraction, charge2Fraction, samplesPerBin, true));
276  }
277 
278  if (!MembershipFunction_type.compare("Interpolated")) {
279  // This is a kernel defined by a histogram-like 2d lookup table
280  make_param(double, sx);
281  make_param(double, sy);
282  make_param(int, scalePower);
283  make_param(unsigned, nxbins);
284  make_param(double, xmin);
285  make_param(double, xmax);
286  make_param(unsigned, nybins);
287  make_param(double, ymin);
288  make_param(double, ymax);
289  make_param(std::vector<double>, data);
290 
291  if (data.size() != nxbins * nybins)
292  throw cms::Exception("FFTJetBadConfig") << "Bad number of data points for Interpolated kernel" << std::endl;
293 
294  return return_type(
295  new fftjet::InterpolatedKernel(sx, sy, scalePower, &data[0], nxbins, xmin, xmax, nybins, ymin, ymax));
296  }
297 
298  if (!MembershipFunction_type.compare("Interpolated3d")) {
299  // This is a kernel defined by a histogram-like 3d lookup table
300  make_param(std::vector<double>, data);
301  make_param(std::vector<double>, scales);
302  make_param(bool, useLogSpaceForScale);
303  make_param(unsigned, nxbins);
304  make_param(double, xmin);
305  make_param(double, xmax);
306  make_param(unsigned, nybins);
307  make_param(double, ymin);
308  make_param(double, ymax);
309 
310  if (data.size() != nxbins * nybins * scales.size())
311  throw cms::Exception("FFTJetBadConfig") << "Bad number of data points for Interpolated3d kernel" << std::endl;
312 
313  return return_type(new fftjet::InterpolatedKernel3d(
314  &data[0], scales, useLogSpaceForScale, nxbins, xmin, xmax, nybins, ymin, ymax));
315  }
316 
317  // This is not a special kernel. Try one of the classes
318  // in the kernel factory provided by FFTJet.
319  fftjet::DefaultKernel2dFactory factory;
320  if (factory[MembershipFunction_type] == nullptr) {
321  return return_type(nullptr);
322  }
323 
324  make_param(double, sx);
325  make_param(double, sy);
326  make_param(int, scalePower);
327  make_param(std::vector<double>, kernelParameters);
328 
329  const int n_expected = factory[MembershipFunction_type]->nParameters();
330  if (n_expected >= 0)
331  if (static_cast<unsigned>(n_expected) != kernelParameters.size())
332  throw cms::Exception("FFTJetBadConfig") << "Bad number of kernel parameters" << std::endl;
333 
334  return std::unique_ptr<fftjet::ScaleSpaceKernel>(
335  factory[MembershipFunction_type]->create(sx, sy, scalePower, kernelParameters));
336  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define make_param(type, varname)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ fftjet_PeakFunctor_parser()

std::unique_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjetcms::fftjet_PeakFunctor_parser ( const edm::ParameterSet ps)

Definition at line 473 of file FFTJetParameterParser.cc.

References DeadROC_duringRun::f1, DeadROC_duringRun::f2, DQMScaleToClient_cfi::factor, fcn(), fftjet_Function_parser(), edm::ParameterSet::getParameter(), parse_peak_member_function(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, fftjetcommon_cfi::sx, and fftjetcommon_cfi::sy.

Referenced by FFTJetTreeDump::FFTJetTreeDump(), FFTJetProducer::parse_memberFactorCalcPeak(), FFTJetProducer::parse_recoScaleCalcPeak(), and FFTJetProducer::parse_recoScaleRatioCalcPeak().

473  {
474  typedef fftjet::Functor1<double, fftjet::Peak> ptr_type;
475  typedef std::unique_ptr<ptr_type> return_type;
476 
477  const std::string property_type = ps.getParameter<std::string>("Class");
478 
479  if (!property_type.compare("Log")) {
480  return_type wrapped = fftjet_PeakFunctor_parser(ps.getParameter<edm::ParameterSet>("function"));
481  ptr_type* wr = wrapped.get();
482  if (wr) {
483  return_type result = return_type(new fftjet::LogProperty<fftjet::Peak>(wr, true));
484  wrapped.release();
485  return result;
486  }
487  }
488 
489  if (!property_type.compare("PeakProperty")) {
490  const std::string member = ps.getParameter<std::string>("member");
491  fftjet::JetProperty<fftjet::Peak>::JetMemberFunction fcn;
492  if (parse_peak_member_function(member.c_str(), &fcn))
493  return return_type(new fftjet::JetProperty<fftjet::Peak>(fcn));
494  else
495  return return_type(nullptr);
496  }
497 
498  if (!property_type.compare("MinusScaledLaplacian")) {
499  const double sx = ps.getParameter<double>("sx");
500  const double sy = ps.getParameter<double>("sx");
501  return return_type(new fftjet::MinusScaledLaplacian<fftjet::Peak>(sx, sy));
502  }
503 
504  if (!property_type.compare("ScaledHessianDet")) {
505  return return_type(new fftjet::ScaledHessianDet<fftjet::Peak>());
506  }
507 
508  if (!property_type.compare("ScaledMagnitude")) {
509  return return_type(new fftjet::ScaledMagnitude<fftjet::Peak>());
510  }
511 
512  if (!property_type.compare("ScaledMagnitude2")) {
513  return return_type(new fftjet::ScaledMagnitude2<fftjet::Peak>());
514  }
515 
516  if (!property_type.compare("ConstDouble")) {
517  const double value = ps.getParameter<double>("value");
518  return return_type(new ConstDouble<fftjet::Peak>(value));
519  }
520 
521  if (!property_type.compare("ProportionalToScale")) {
522  const double value = ps.getParameter<double>("value");
523  return return_type(new ProportionalToScale<fftjet::Peak>(value));
524  }
525 
526  if (!property_type.compare("MultiplyByConst")) {
527  const double factor = ps.getParameter<double>("factor");
528  return_type function = fftjet_PeakFunctor_parser(ps.getParameter<edm::ParameterSet>("function"));
529  ptr_type* ptr = function.get();
530  if (ptr) {
531  return_type result = return_type(new MultiplyByConst<fftjet::Peak>(factor, ptr, true));
532  function.release();
533  return result;
534  }
535  }
536 
537  if (!property_type.compare("CompositeFunctor")) {
538  std::unique_ptr<fftjet::Functor1<double, double>> fcn1 =
540  return_type fcn2 = fftjet_PeakFunctor_parser(ps.getParameter<edm::ParameterSet>("function2"));
541  fftjet::Functor1<double, double>* f1 = fcn1.get();
542  ptr_type* f2 = fcn2.get();
543  if (f1 && f2) {
544  return_type result = return_type(new CompositeFunctor<fftjet::Peak>(f1, f2, true));
545  fcn1.release();
546  fcn2.release();
547  return result;
548  }
549  }
550 
551  if (!property_type.compare("ProductFunctor")) {
552  return_type fcn1 = fftjet_PeakFunctor_parser(ps.getParameter<edm::ParameterSet>("function1"));
553  return_type fcn2 = fftjet_PeakFunctor_parser(ps.getParameter<edm::ParameterSet>("function2"));
554  ptr_type* f1 = fcn1.get();
555  ptr_type* f2 = fcn2.get();
556  if (f1 && f2) {
557  return_type result = return_type(new ProductFunctor<fftjet::Peak>(f1, f2, true));
558  fcn1.release();
559  fcn2.release();
560  return result;
561  }
562  }
563 
564  if (!property_type.compare("MagnitudeDependent")) {
565  std::unique_ptr<fftjet::Functor1<double, double>> fcn1 =
567  fftjet::Functor1<double, double>* f1 = fcn1.get();
568  if (f1) {
569  return_type result = return_type(new MagnitudeDependent<fftjet::Peak>(f1, true));
570  fcn1.release();
571  return result;
572  }
573  }
574 
575  if (!property_type.compare("PeakEtaDependent")) {
576  std::unique_ptr<fftjet::Functor1<double, double>> fcn1 =
578  fftjet::Functor1<double, double>* f1 = fcn1.get();
579  if (f1) {
580  return_type result = return_type(new PeakEtaDependent(f1, true));
581  fcn1.release();
582  return result;
583  }
584  }
585 
586  return return_type(nullptr);
587  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjet_PeakFunctor_parser(const edm::ParameterSet &ps)
static bool parse_peak_member_function(const char *fname, fftjet::JetProperty< fftjet::Peak >::JetMemberFunction *f)
Definition: value.py:1
std::unique_ptr< fftjet::Functor1< double, double > > fftjet_Function_parser(const edm::ParameterSet &ps)
void fcn(int &, double *, double &, double *, int)

◆ fftjet_PeakMagnitudeMapper2d_parser()

std::unique_ptr< fftjet::JetMagnitudeMapper2d< fftjet::Peak > > fftjetcms::fftjet_PeakMagnitudeMapper2d_parser ( const edm::ParameterSet ps)

Definition at line 778 of file FFTJetParameterParser.cc.

References fftjet_LinearInterpolator2d_parser(), and edm::ParameterSet::getParameter().

779  {
780  std::unique_ptr<fftjet::LinearInterpolator2d> responseCurve =
782 
783  const double minPredictor = ps.getParameter<double>("minPredictor");
784  const double maxPredictor = ps.getParameter<double>("maxPredictor");
785  const unsigned nPredPoints = ps.getParameter<unsigned>("nPredPoints");
786  const double maxMagnitude = ps.getParameter<double>("maxMagnitude");
787  const unsigned nMagPoints = ps.getParameter<unsigned>("nMagPoints");
788 
789  return (std::make_unique<fftjet::JetMagnitudeMapper2d<fftjet::Peak>>(*responseCurve,
791  true,
792  minPredictor,
793  maxPredictor,
794  nPredPoints,
795  maxMagnitude,
796  nMagPoints));
797  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< fftjet::LinearInterpolator2d > fftjet_LinearInterpolator2d_parser(const edm::ParameterSet &ps)

◆ fftjet_PeakSelector_parser()

std::unique_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjetcms::fftjet_PeakSelector_parser ( const edm::ParameterSet ps)

Definition at line 166 of file FFTJetParameterParser.cc.

References a, b, data, fftjetproducer_cfi::driftSpeedCut, fftjetproducer_cfi::etaCut, geometryDiff::file, edm::ParameterSet::getParameter(), recoMuon::in, fftjetcms::EtaAndPtDependentPeakSelector::isValid(), fftjetproducer_cfi::lifeTimeCut, fftjetproducer_cfi::magCut, fftjetproducer_cfi::magSpeedCut, make_param, fftjetproducer_cfi::mergeTimeCut, fftjetproducer_cfi::NNDCut, AlCaHLTBitMon_ParallelJobs::p, fftjetproducer_cfi::splitTimeCut, AlCaHLTBitMon_QueryRunRegistry::string, TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

Referenced by FFTJetPatRecoProducer::FFTJetPatRecoProducer(), and FFTJetProducer::parse_peakSelector().

166  {
167  typedef std::unique_ptr<fftjet::Functor1<bool, fftjet::Peak>> return_type;
168 
169  const std::string peakselector_type = ps.getParameter<std::string>("Class");
170 
171  if (!peakselector_type.compare("AllPeaksPass")) {
172  return return_type(new fftjet::AllPeaksPass());
173  }
174 
175  if (!peakselector_type.compare("EtaAndPtDependentPeakSelector")) {
176  const std::string file = ps.getParameter<std::string>("file");
177  std::ifstream in(file.c_str(), std::ios_base::in | std::ios_base::binary);
178  if (!in.is_open())
179  throw cms::Exception("FFTJetBadConfig") << "Failed to open file " << file << std::endl;
181  if (!ptr->isValid())
182  throw cms::Exception("FFTJetBadConfig") << "Failed to read file " << file << std::endl;
183  return return_type(ptr);
184  }
185 
186  if (!peakselector_type.compare("EtaAndPtLookupPeakSelector")) {
187  make_param(unsigned, nx);
188  make_param(unsigned, ny);
189  make_param(double, xmin);
190  make_param(double, xmax);
191  make_param(double, ymin);
192  make_param(double, ymax);
193  make_param(std::vector<double>, data);
194 
195  if (xmin >= xmax || ymin >= ymax || !nx || !ny || data.size() != nx * ny)
196  throw cms::Exception("FFTJetBadConfig") << "Failed to configure EtaAndPtLookupPeakSelector" << std::endl;
197 
198  return return_type(new EtaAndPtLookupPeakSelector(nx, xmin, xmax, ny, ymin, ymax, data));
199  }
200 
201  if (!peakselector_type.compare("SimplePeakSelector")) {
202  const double magCut = ps.getParameter<double>("magCut");
203  const double driftSpeedCut = ps.getParameter<double>("driftSpeedCut");
204  const double magSpeedCut = ps.getParameter<double>("magSpeedCut");
205  const double lifeTimeCut = ps.getParameter<double>("lifeTimeCut");
206  const double NNDCut = ps.getParameter<double>("NNDCut");
207  const double etaCut = ps.getParameter<double>("etaCut");
208  const double splitTimeCut = ps.getParameter<double>("splitTimeCut");
209  const double mergeTimeCut = ps.getParameter<double>("mergeTimeCut");
210 
211  return return_type(new fftjet::SimplePeakSelector(
213  }
214 
215  if (!peakselector_type.compare("ScalePowerPeakSelector")) {
216  const double a = ps.getParameter<double>("a");
217  const double p = ps.getParameter<double>("p");
218  const double b = ps.getParameter<double>("b");
219  const double etaCut = ps.getParameter<double>("etaCut");
220 
221  return return_type(new fftjet::ScalePowerPeakSelector(a, p, b, etaCut));
222  }
223 
224  return return_type(nullptr);
225  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define make_param(type, varname)
double b
Definition: hdecay.h:118
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
double a
Definition: hdecay.h:119

◆ fftjet_PileupCalculator_parser()

std::unique_ptr< AbsPileupCalculator > fftjetcms::fftjet_PileupCalculator_parser ( const edm::ParameterSet ps)

Definition at line 746 of file FFTJetParameterParser.cc.

References fftjet_Grid2d_parser(), fftjet_LinearInterpolator2d_parser(), g, edm::ParameterSet::getParameter(), getRunAppsInfo::grid, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FFTJetProducer::parse_pileupDensityCalc().

746  {
747  typedef std::unique_ptr<AbsPileupCalculator> return_type;
748 
749  const std::string fcn_type = ps.getParameter<std::string>("Class");
750 
751  if (!fcn_type.compare("EtaDependentPileup")) {
752  std::unique_ptr<fftjet::LinearInterpolator2d> interp =
754  const double inputRhoFactor = ps.getParameter<double>("inputRhoFactor");
755  const double outputRhoFactor = ps.getParameter<double>("outputRhoFactor");
756 
757  const fftjet::LinearInterpolator2d* ip = interp.get();
758  if (ip)
759  return return_type(new EtaDependentPileup(*ip, inputRhoFactor, outputRhoFactor));
760  else
761  return return_type(nullptr);
762  }
763 
764  if (!fcn_type.compare("PileupGrid2d")) {
765  std::unique_ptr<fftjet::Grid2d<Real>> grid = fftjet_Grid2d_parser(ps.getParameter<edm::ParameterSet>("Grid2d"));
766  const double rhoFactor = ps.getParameter<double>("rhoFactor");
767 
768  const fftjet::Grid2d<Real>* g = grid.get();
769  if (g)
770  return return_type(new PileupGrid2d(*g, rhoFactor));
771  else
772  return return_type(nullptr);
773  }
774 
775  return return_type(nullptr);
776  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< fftjet::LinearInterpolator2d > fftjet_LinearInterpolator2d_parser(const edm::ParameterSet &ps)
std::unique_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser(const edm::ParameterSet &ps)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4

◆ fftjet_ScaleSet_parser()

std::unique_ptr< std::vector< double > > fftjetcms::fftjet_ScaleSet_parser ( const edm::ParameterSet ps)

Definition at line 350 of file FFTJetParameterParser.cc.

References className(), edm::ParameterSet::getParameter(), mps_fire::i, dqmiolumiharvest::j, fftjetcommon_cfi::maxScale, fftjetcommon_cfi::minScale, fftjetcommon_cfi::nScales, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FFTJetDijetFilter::FFTJetDijetFilter(), FFTJetEFlowSmoother::FFTJetEFlowSmoother(), FFTJetPatRecoProducer::FFTJetPatRecoProducer(), FFTJetProducer::FFTJetProducer(), and FFTJetTreeDump::FFTJetTreeDump().

350  {
351  typedef std::unique_ptr<std::vector<double>> return_type;
352 
353  const std::string className = ps.getParameter<std::string>("Class");
354 
355  if (!className.compare("EquidistantInLinearSpace") || !className.compare("EquidistantInLogSpace")) {
356  const double minScale = ps.getParameter<double>("minScale");
357  const double maxScale = ps.getParameter<double>("maxScale");
358  const unsigned nScales = ps.getParameter<unsigned>("nScales");
359 
360  if (minScale <= 0.0 || maxScale <= 0.0 || nScales == 0 || minScale == maxScale)
361  return return_type(nullptr);
362 
363  // Can't return pointers to EquidistantInLinearSpace
364  // or EquidistantInLogSpace directly because std::vector
365  // destructor is not virtual.
366  if (!className.compare("EquidistantInLinearSpace"))
367  return std::make_unique<std::vector<double>>(fftjet::EquidistantInLinearSpace(minScale, maxScale, nScales));
368  else
369  return std::make_unique<std::vector<double>>(fftjet::EquidistantInLogSpace(minScale, maxScale, nScales));
370  }
371 
372  if (!className.compare("UserSet")) {
373  return_type scales(new std::vector<double>(ps.getParameter<std::vector<double>>("scales")));
374 
375  // Verify that all scales are positive and unique
376  const unsigned nscales = scales->size();
377  for (unsigned i = 0; i < nscales; ++i)
378  if ((*scales)[i] <= 0.0)
379  return return_type(nullptr);
380 
381  for (unsigned i = 1; i < nscales; ++i)
382  for (unsigned j = 0; j < i; ++j)
383  if ((*scales)[i] == (*scales)[j])
384  return return_type(nullptr);
385 
386  return scales;
387  }
388 
389  return return_type(nullptr);
390  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string className(const T &t)
Definition: ClassName.h:31

◆ jetFromStorable()

template<class Real >
fftjet::RecombinedJet< VectorLike > fftjetcms::jetFromStorable ( const reco::FFTJet< Real > &  jet)

Definition at line 65 of file jetConverters.h.

References metsig::jet, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by FFTJetProducer::genJetPreclusters().

65  {
66  typedef reco::PattRecoPeak<Real> StoredPeak;
67  typedef fftjet::RecombinedJet<VectorLike> RecoFFTJet;
68 
69  double hessian[3] = {0., 0., 0.};
70  const StoredPeak& p(jet.f_precluster());
71  p.hessian(hessian);
72  const double pileupPt = jet.f_pileup().Pt();
73 
74  fftjet::Peak peak(p.eta(),
75  p.phi(),
76  p.magnitude(),
77  hessian,
78  p.driftSpeed(),
79  p.magSpeed(),
80  p.lifetime(),
81  p.scale(),
82  p.nearestNeighborDistance(),
83  jet.f_membershipFactor(),
84  jet.f_recoScale(),
85  jet.f_recoScaleRatio(),
86  p.clusterRadius(),
87  p.clusterSeparation(),
88  jet.f_code(),
89  jet.f_status());
90  peak.setSplitTime(p.splitTime());
91  peak.setMergeTime(p.mergeTime());
92 
93  return RecoFFTJet(peak,
94  jet.f_vec(),
95  jet.f_ncells(),
96  jet.f_etSum(),
97  jet.f_centroidEta(),
98  jet.f_centroidPhi(),
99  jet.f_etaWidth(),
100  jet.f_phiWidth(),
101  jet.f_etaPhiCorr(),
102  jet.f_fuzziness(),
103  pileupPt,
104  0.0,
105  jet.f_convergenceDistance());
106  }
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
fftjet::RecombinedJet< VectorLike > RecoFFTJet

◆ jetToStorable()

template<class Real >
reco::FFTJet< Real > fftjetcms::jetToStorable ( const fftjet::RecombinedJet< VectorLike > &  jet)

Definition at line 27 of file jetConverters.h.

References reco::PattRecoPeak< Real >::hessian(), and metsig::jet.

27  {
28  typedef reco::PattRecoPeak<Real> StoredPeak;
29 
30  double hessian[3] = {0., 0., 0.};
31  const fftjet::Peak& peak(jet.precluster());
32  peak.hessian(hessian);
33 
34  return reco::FFTJet<Real>(StoredPeak(peak.eta(),
35  peak.phi(),
36  peak.magnitude(),
37  hessian,
38  peak.driftSpeed(),
39  peak.magSpeed(),
40  peak.lifetime(),
41  peak.scale(),
42  peak.nearestNeighborDistance(),
43  peak.clusterRadius(),
44  peak.clusterSeparation(),
45  peak.splitTime(),
46  peak.mergeTime()),
47  jet.vec(),
48  jet.ncells(),
49  jet.etSum(),
50  jet.centroidEta(),
51  jet.centroidPhi(),
52  jet.etaWidth(),
53  jet.phiWidth(),
54  jet.etaPhiCorr(),
55  jet.fuzziness(),
56  jet.convergenceDistance(),
57  jet.recoScale(),
58  jet.recoScaleRatio(),
59  jet.membershipFactor(),
60  jet.code(),
61  jet.status());
62  }
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
Storage class for jets reconstructed by FFTJet package.
Definition: FFTJet.h:19
void hessian(double hessianArray[3]) const
Definition: PattRecoPeak.h:78

◆ matchOneToOne()

template<class T1 , class T2 , class DistanceCalculator >
unsigned fftjetcms::matchOneToOne ( const std::vector< T1 > &  v1,
const std::vector< T2 > &  v2,
const DistanceCalculator &  calc,
std::vector< int > *  matchFrom1To2,
const double  maxMatchingDistance = 1.0e300 
)

Definition at line 38 of file matchOneToOne.h.

References mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, visualization-live-secondInstance_cfg::m, and jetUpdater_cfi::sort.

Referenced by FFTJetProducer::removeFakePreclusters().

42  {
43  unsigned nused = 0;
44  matchFrom1To2->clear();
45 
46  const unsigned n1 = v1.size();
47  if (n1) {
48  matchFrom1To2->reserve(n1);
49  for (unsigned i1 = 0; i1 < n1; ++i1)
50  matchFrom1To2->push_back(-1);
51 
52  const unsigned n2 = v2.size();
53  if (n2) {
54  const unsigned nmatches = n1 * n2;
55  std::vector<Private::matchOneToOne_MatchInfo> distanceTable(nmatches);
56  std::vector<int> taken2(n2);
57 
58  for (unsigned i2 = 0; i2 < n2; ++i2)
59  taken2[i2] = 0;
60 
61  Private::matchOneToOne_MatchInfo* m;
62  for (unsigned i1 = 0; i1 < n1; ++i1)
63  for (unsigned i2 = 0; i2 < n2; ++i2) {
64  m = &distanceTable[i1 * n2 + i2];
65  m->distance = calc(v1[i1], v2[i2]);
66  m->i1 = i1;
67  m->i2 = i2;
68  }
69 
70  std::sort(distanceTable.begin(), distanceTable.end());
71  for (unsigned i = 0; i < nmatches && nused < n1 && nused < n2; ++i) {
72  m = &distanceTable[i];
73  if (m->distance > maxMatchingDistance)
74  break;
75  if ((*matchFrom1To2)[m->i1] < 0 && !taken2[m->i2]) {
76  (*matchFrom1To2)[m->i1] = static_cast<int>(m->i2);
77  taken2[m->i2] = 1;
78  ++nused;
79  }
80  }
81  }
82  }
83 
84  return nused;
85  }

◆ parseJetType()

JetType fftjetcms::parseJetType ( const std::string &  name)

Definition at line 5 of file JetType.cc.

References BASICJET, CALOJET, Exception, GENJET, JPTJET, Skims_PA_cff::name, PFJET, and TRACKJET.

5  {
6  if (!name.compare("BasicJet"))
7  return BASICJET;
8  else if (!name.compare("GenJet"))
9  return GENJET;
10  else if (!name.compare("CaloJet"))
11  return CALOJET;
12  else if (!name.compare("PFJet"))
13  return PFJET;
14  else if (!name.compare("TrackJet"))
15  return TRACKJET;
16  else if (!name.compare("JPTJet"))
17  return JPTJET;
18  else
19  throw cms::Exception("FFTJetBadConfig")
20  << "In parseJetType: unsupported jet type specification \"" << name << "\"\n";
21  }

◆ sparsePeakTreeFromStorable()

template<class Real >
void fftjetcms::sparsePeakTreeFromStorable ( const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &  in,
const std::vector< double > *  scaleSetIfNotAdaptive,
double  completeEventScale,
fftjet::SparseClusteringTree< fftjet::Peak, long > *  out 
)

Definition at line 133 of file clusteringTreeConverters.h.

References cms::cuda::assert(), fftjetdijetfilter_cfi::completeEventScale, Exception, mps_fire::i, recoMuon::in, dqmiodumpmetadata::n, class-composition::nodes, MillePedeFileConverter_cfg::out, AlCaHLTBitMon_ParallelJobs::p, and mitigatedMETSequence_cff::U.

Referenced by FFTJetPatRecoProducer::buildSparseProduct(), FFTJetDijetFilter::filter(), FFTJetProducer::loadSparseTreeData(), and FFTJetTreeDump::processTreeData().

136  {
137  typedef fftjet::SparseClusteringTree<fftjet::Peak, long> SparseTree;
138  typedef reco::PattRecoPeak<Real> StoredPeak;
139  typedef reco::PattRecoNode<StoredPeak> StoredNode;
140  typedef reco::PattRecoTree<Real, StoredPeak> StoredTree;
141 
142  if (!in.isSparse())
143  throw cms::Exception("FFTJetBadConfig") << "can't restore sparse clustering tree"
144  << " from densely stored record" << std::endl;
145 
146  assert(out);
147  out->clear();
148 
149  const std::vector<StoredNode>& nodes(in.getNodes());
150  const unsigned n = nodes.size();
151  out->reserveNodes(n + 1U);
152 
153  double hessian[3] = {0., 0., 0.};
154 
155  for (unsigned i = 0; i < n; ++i) {
156  const StoredNode& snode(nodes[i]);
157  const StoredPeak& p(snode.getCluster());
158  p.hessian(hessian);
159  fftjet::Peak peak(p.eta(),
160  p.phi(),
161  p.magnitude(),
162  hessian,
163  p.driftSpeed(),
164  p.magSpeed(),
165  p.lifetime(),
166  p.scale(),
167  p.nearestNeighborDistance(),
168  1.0,
169  0.0,
170  0.0,
171  p.clusterRadius(),
172  p.clusterSeparation());
173  peak.setSplitTime(p.splitTime());
174  peak.setMergeTime(p.mergeTime());
175  const SparseTree::Node node(peak, snode.originalLevel(), snode.mask());
176  out->addNode(node, snode.parent());
177  }
178 
179  const std::vector<Real>& storedScales(in.getScales());
180  if (!storedScales.empty()) {
181  const unsigned nsc = storedScales.size();
182  out->reserveScales(nsc + 1U);
183  out->addScale(DBL_MAX);
184  const Real* scales = &storedScales[0];
185  for (unsigned i = 0; i < nsc; ++i)
186  out->addScale(scales[i]);
187  } else if (scaleSetIfNotAdaptive && !scaleSetIfNotAdaptive->empty()) {
188  const unsigned nsc = scaleSetIfNotAdaptive->size();
189  // There may be the "complete event" scale added at the end.
190  // Reserve a sufficient number of scales to take this into
191  // account.
192  if (completeEventScale)
193  out->reserveScales(nsc + 2U);
194  else
195  out->reserveScales(nsc + 1U);
196  out->addScale(DBL_MAX);
197  const double* scales = &(*scaleSetIfNotAdaptive)[0];
198  for (unsigned i = 0; i < nsc; ++i)
199  out->addScale(scales[i]);
200  if (completeEventScale)
201  out->addScale(completeEventScale);
202  } else {
203  throw cms::Exception("FFTJetBadConfig") << "can't restore sparse clustering tree scales" << std::endl;
204  }
205  }
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:16
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:20
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
TGeoNode Node
assert(be >=bs)
double Real

◆ sparsePeakTreeToStorable()

template<class Real >
void fftjetcms::sparsePeakTreeToStorable ( const fftjet::SparseClusteringTree< fftjet::Peak, long > &  in,
bool  writeOutScaleInfo,
reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *  out 
)

Definition at line 75 of file clusteringTreeConverters.h.

References cms::cuda::assert(), mps_fire::i, and fftjetcommon_cfi::nScales.

Referenced by FFTJetPatRecoProducer::buildSparseProduct().

77  {
78  typedef fftjet::SparseClusteringTree<fftjet::Peak, long> SparseTree;
79  typedef reco::PattRecoPeak<Real> StoredPeak;
80  typedef reco::PattRecoNode<StoredPeak> StoredNode;
81  typedef reco::PattRecoTree<Real, StoredPeak> StoredTree;
82 
83  assert(tree);
84 
85  tree->clear();
86  tree->setSparse(true);
87 
88  const unsigned nNodes = sparseTree.size();
89  double hessian[3] = {0., 0., 0.};
90 
91  // Do not write out the meaningless top node
92  tree->reserveNodes(nNodes - 1);
93  for (unsigned i = 1; i < nNodes; ++i) {
94  const SparseTree::Node& node(sparseTree.getNode(i));
95  const fftjet::Peak& peak(node.getCluster());
96  peak.hessian(hessian);
97  StoredNode sn(StoredPeak(peak.eta(),
98  peak.phi(),
99  peak.magnitude(),
100  hessian,
101  peak.driftSpeed(),
102  peak.magSpeed(),
103  peak.lifetime(),
104  peak.scale(),
105  peak.nearestNeighborDistance(),
106  peak.clusterRadius(),
107  peak.clusterSeparation(),
108  peak.splitTime(),
109  peak.mergeTime()),
110  node.originalLevel(),
111  node.mask(),
112  node.parent());
113  tree->addNode(sn);
114  }
115 
116  // Do we want to write out the scales? We will use the following
117  // convention: if the tree is using an adaptive algorithm, the scales
118  // will be written out. If not, they are not going to change from
119  // event to event. In this case the scales would waste disk space
120  // for no particularly good reason, so they will not be written out.
121  if (writeOutScaleInfo) {
122  // Do not write out the meaningless top-level scale
123  const unsigned nScales = sparseTree.nLevels();
124  tree->reserveScales(nScales - 1);
125  for (unsigned i = 1; i < nScales; ++i)
126  tree->addScale(sparseTree.getScale(i));
127  }
128  }
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:16
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:20
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
TGeoNode Node
assert(be >=bs)
Definition: tree.py:1