CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, BgData
AbsBgFunctor
 
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::auto_ptr< AbsBgFunctorfftjet_BgFunctor_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::ClusteringTreeSparsifier
< fftjet::Peak, long > > 
fftjet_ClusteringTreeSparsifier_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::AbsDistanceCalculator
< fftjet::Peak > > 
fftjet_DistanceCalculator_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::Functor1< double,
double > > 
fftjet_Function_parser (const edm::ParameterSet &ps)
 
std::auto_ptr< fftjet::Grid2d
< Real > > 
fftjet_Grid2d_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::Functor2< double,
fftjet::RecombinedJet
< VectorLike >
, fftjet::RecombinedJet
< VectorLike > > > 
fftjet_JetDistance_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::Functor1< double,
fftjet::RecombinedJet
< VectorLike > > > 
fftjet_JetFunctor_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::JetMagnitudeMapper2d
< fftjet::RecombinedJet
< VectorLike > > > 
fftjet_JetMagnitudeMapper2d_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::LinearInterpolator1d > 
fftjet_LinearInterpolator1d_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::LinearInterpolator2d > 
fftjet_LinearInterpolator2d_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjetcms::LinInterpolatedTable1D
fftjet_LinInterpolatedTable1D_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::ScaleSpaceKernel > 
fftjet_MembershipFunction_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::Functor1< double,
fftjet::Peak > > 
fftjet_PeakFunctor_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::JetMagnitudeMapper2d
< fftjet::Peak > > 
fftjet_PeakMagnitudeMapper2d_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< fftjet::Functor1< bool,
fftjet::Peak > > 
fftjet_PeakSelector_parser (const edm::ParameterSet &ps)
 
std::auto_ptr
< AbsPileupCalculator
fftjet_PileupCalculator_parser (const edm::ParameterSet &ps)
 
std::auto_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

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

Definition at line 38 of file fftjetTypedefs.h.

typedef double fftjetcms::BgData

Definition at line 34 of file fftjetTypedefs.h.

typedef fftw_complex fftjetcms::Complex

Definition at line 22 of file fftjetTypedefs.h.

typedef fftjet::FFTWDoubleEngine fftjetcms::MyFFTEngine

Definition at line 23 of file fftjetTypedefs.h.

typedef double fftjetcms::Real

Definition at line 21 of file fftjetTypedefs.h.

Definition at line 30 of file fftjetTypedefs.h.

Definition at line 26 of file fftjetTypedefs.h.

Enumeration Type Documentation

Enumerator
BASICJET 
GENJET 
CALOJET 
PFJET 
TRACKJET 
JPTJET 

Definition at line 7 of file JetType.h.

Function Documentation

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

Definition at line 57 of file gridConverters.h.

References i.

Referenced by FFTJetPileupProcessor::mixExtraGrid().

59  {
60  assert(to);
61  assert(from.nEta() == to->nEta());
62  assert(from.nPhi() == to->nPhi());
63  const unsigned len = from.nEta()*from.nPhi();
64  const F1* fromData = from.data();
65  F2* toData = const_cast<F2*>(to->data());
66  for (unsigned i=0; i<len; ++i)
67  toData[i] += fromData[i];
68  }
int i
Definition: DBlmapReader.cc:9
math::XYZTLorentzVector fftjetcms::adjustForPileup ( const math::XYZTLorentzVector jet,
const math::XYZTLorentzVector pileup,
bool  subtractPileupAs4Vec 
)

Definition at line 4 of file adjustForPileup.cc.

References alignCSCRings::e, and metsig::jet.

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

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

Definition at line 82 of file gridConverters.h.

References copy_Grid2d_data().

84  {
85  fftjet::Grid2d<double>* to = new fftjet::Grid2d<double>(
86  grid.nEta(), grid.etaMin(), grid.etaMax(),
87  grid.nPhi(), grid.phiBin0Edge(), grid.title());
88  copy_Grid2d_data(to, grid);
89  return to;
90  }
void copy_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
template<typename Numeric >
fftjet::Grid2d< float > * fftjetcms::convert_Grid2d_to_float ( const fftjet::Grid2d< Numeric > &  grid)

Definition at line 71 of file gridConverters.h.

References copy_Grid2d_data().

Referenced by FFTJetPatRecoProducer::produce().

73  {
74  fftjet::Grid2d<float>* to = new fftjet::Grid2d<float>(
75  grid.nEta(), grid.etaMin(), grid.etaMax(),
76  grid.nPhi(), grid.phiBin0Edge(), grid.title());
77  copy_Grid2d_data(to, grid);
78  return to;
79  }
void copy_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
template<typename F1 , typename F2 >
void fftjetcms::copy_Grid2d_data ( fftjet::Grid2d< F2 > *  to,
const fftjet::Grid2d< F1 > &  from 
)

Definition at line 43 of file gridConverters.h.

References i.

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

45  {
46  assert(to);
47  assert(from.nEta() == to->nEta());
48  assert(from.nPhi() == to->nPhi());
49  const unsigned len = from.nEta()*from.nPhi();
50  const F1* fromData = from.data();
51  F2* toData = const_cast<F2*>(to->data());
52  for (unsigned i=0; i<len; ++i)
53  toData[i] = fromData[i];
54  }
int i
Definition: DBlmapReader.cc:9
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 297 of file clusteringTreeConverters.h.

References edm::hlt::Exception, i, recoMuon::in, dttmaxenums::L, n, AlCaHLTBitMon_ParallelJobs::p, and pileupReCalc_HLTpaths::scale.

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

302  {
303  typedef fftjet::AbsClusteringTree<fftjet::Peak,long> DenseTree;
304  typedef reco::PattRecoPeak<Real> StoredPeak;
305  typedef reco::PattRecoNode<StoredPeak> StoredNode;
306  typedef reco::PattRecoTree<Real,StoredPeak> StoredTree;
307 
308  if (in.isSparse())
309  throw cms::Exception("FFTJetBadConfig")
310  << "can't restore dense clustering tree"
311  << " from sparsely stored record" << std::endl;
312 
313  assert(out);
314  out->clear();
315 
316  const std::vector<StoredNode>& nodes(in.getNodes());
317  const unsigned n = nodes.size();
318  double hessian[3] = {0., 0., 0.};
319 
320  const std::vector<Real>& scales (in.getScales());
321  unsigned int scnum = 0;
322  std::vector<fftjet::Peak> clusters;
323  const unsigned scsize1 = scales.size();
324  unsigned scsize2 = scaleSetIfNotAdaptive ? scaleSetIfNotAdaptive->size() : 0;
325  if (scsize2 && completeEventScale) ++scsize2;
326  const unsigned scsize = (scsize1==0?scsize2:scsize1);
327 
328  if (scsize == 0)
329  throw cms::Exception("FFTJetBadConfig")
330  << " No scales passed to the function densePeakTreeFromStorable()"
331  << std::endl;
332 
333  // to check whether the largest level equals the size of scale vector
334  const double* sc_not_ad = scsize2 ? &(*scaleSetIfNotAdaptive)[0] : 0;
335 
336  unsigned templevel = n ? nodes[0].originalLevel() : 1;
337  for (unsigned i=0; i<n; ++i)
338  {
339  const StoredNode& snode(nodes[i]);
340  const StoredPeak& p(snode.getCluster());
341  p.hessian(hessian);
342 
343  const unsigned levelNumber = snode.originalLevel();
344 
345  if (templevel != levelNumber)
346  {
347  if (scnum >= scsize)
348  throw cms::Exception("FFTJetBadConfig")
349  << "bad scales, please check the scales"
350  << std::endl;
351  const double scale = ( (scsize1==0) ? sc_not_ad[scnum] : scales[scnum] );
352  out->insert(scale, clusters, 0L);
353  clusters.clear();
354  templevel = levelNumber;
355  ++scnum;
356  }
357 
358  fftjet::Peak apeak(p.eta(), p.phi(), p.magnitude(),
359  hessian, p.driftSpeed(),
360  p.magSpeed(), p.lifetime(),
361  p.scale(), p.nearestNeighborDistance(),
362  1.0, 0.0, 0.0,
363  p.clusterRadius(), p.clusterSeparation());
364  clusters.push_back(apeak);
365 
366  if (i==(n-1) && levelNumber!=scsize)
367  throw cms::Exception("FFTJetBadConfig")
368  << "bad scales, please check the scales"
369  << std::endl;
370  }
371 
372  const double scale = scsize1 ? scales[scnum] : completeEventScale ?
373  completeEventScale : sc_not_ad[scnum];
374  out->insert(scale, clusters, 0L);
375  }
int i
Definition: DBlmapReader.cc:9
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:17
bool isSparse() const
Definition: PattRecoTree.h:27
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:19
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:17
const std::vector< Node > & getNodes() const
Definition: PattRecoTree.h:28
const std::vector< ScaleType > & getScales() const
Definition: PattRecoTree.h:29
tuple out
Definition: dbtoconf.py:99
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 219 of file clusteringTreeConverters.h.

References i, and dbtoconf::out.

Referenced by FFTJetPatRecoProducer::buildDenseProduct().

223  {
224  typedef fftjet::AbsClusteringTree<fftjet::Peak,long> DenseTree;
225  typedef reco::PattRecoPeak<Real> StoredPeak;
226  typedef reco::PattRecoNode<StoredPeak> StoredNode;
227  typedef reco::PattRecoTree<Real,StoredPeak> StoredTree;
228 
229 
230  assert(out);
231  out->clear();
232  out->setSparse(false);
233 
234 
235  const unsigned nLevels = in.nLevels();
236  double hessian[3] = {0., 0., 0.};
237 
238 
239  // Do not write out the meaningless top node
240  out->reserveNodes(in.nClusters() - 1);
241 
242 
243  for (unsigned i=1; i<nLevels; ++i)
244  {
245 
246  const unsigned int nclus = in.nClusters(i);
247  DenseTree::NodeId id(i,0);
248  for (;id.second<nclus; ++id.second)
249  {
250 
251 
252  const fftjet::Peak& peak(in.getCluster(id));
253  peak.hessian(hessian);
254  StoredNode sn(StoredPeak(peak.eta(),
255  peak.phi(),
256  peak.magnitude(),
257  hessian,
258  peak.driftSpeed(),
259  peak.magSpeed(),
260  peak.lifetime(),
261  peak.scale(),
262  peak.nearestNeighborDistance(),
263  peak.clusterRadius(),
264  peak.clusterSeparation()),
265  i,
266  0,
267  0);
268 
269  out->addNode(sn);
270 
271  }
272 
273  }
274 
275 
276  // Do we want to write out the scales? We will use the following
277  // convention: if the tree is using an adaptive algorithm, the scales
278  // will be written out. If not, they are not going to change from
279  // event to event. In this case the scales would waste disk space
280  // for no particularly good reason, so they will not be written out.
281  if (writeOutScaleInfo)
282  {
283  // Do not write out the meaningless top-level scale
284  const unsigned nScales = in.nLevels();
285 
286  out->reserveScales(nScales - 1);
287 
288  for (unsigned i=1; i<nScales; ++i)
289  out->addScale(in.getScale(i));
290 
291  }
292  }
void reserveNodes(const unsigned n)
Definition: PattRecoTree.h:38
int i
Definition: DBlmapReader.cc:9
void setSparse(const bool b)
Definition: PattRecoTree.h:33
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:17
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:19
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:17
void addScale(const double s)
Definition: PattRecoTree.h:41
void reserveScales(const unsigned n)
Definition: PattRecoTree.h:39
void addNode(const Node &node)
Definition: PattRecoTree.h:40
std::auto_ptr< AbsBgFunctor > fftjetcms::fftjet_BgFunctor_parser ( const edm::ParameterSet ps)

Definition at line 396 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_bgMembershipFunction().

397 {
398  const std::string bg_Membership_type = ps.getParameter<std::string>(
399  "Class");
400 
401  if (!bg_Membership_type.compare("GaussianNoiseMembershipFcn"))
402  {
403  const double minWeight = ps.getParameter<double>("minWeight");
404  const double prior = ps.getParameter<double>("prior");
405  return std::auto_ptr<AbsBgFunctor>(
406  new fftjet::GaussianNoiseMembershipFcn(minWeight,prior));
407  }
408 
409  return std::auto_ptr<AbsBgFunctor>(NULL);
410 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
dictionary prior
std::auto_ptr< fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > > fftjetcms::fftjet_ClusteringTreeSparsifier_parser ( const edm::ParameterSet ps)

Definition at line 468 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetPatRecoProducer::FFTJetPatRecoProducer().

469 {
470  typedef std::auto_ptr<fftjet::ClusteringTreeSparsifier<fftjet::Peak,long> > return_type;
471 
472  const int maxLevelNumber = ps.getParameter<int>("maxLevelNumber");
473  const unsigned filterMask = ps.getParameter<unsigned>("filterMask");
474  const std::vector<double> userScalesV =
475  ps.getParameter<std::vector<double> >("userScales");
476  const unsigned nUserScales = userScalesV.size();
477  const double* userScales = nUserScales ? &userScalesV[0] : NULL;
478 
479  return return_type(
480  new fftjet::ClusteringTreeSparsifier<fftjet::Peak,long>(
481  maxLevelNumber,
482  filterMask,
483  userScales,
484  nUserScales
485  )
486  );
487 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
std::auto_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjetcms::fftjet_DistanceCalculator_parser ( const edm::ParameterSet ps)

Definition at line 491 of file FFTJetParameterParser.cc.

References data, fftjet_LinearInterpolator1d_parser(), edm::ParameterSet::getParameter(), i, n, NULL, and AlCaHLTBitMon_QueryRunRegistry::string.

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

492 {
493  typedef std::auto_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak> > return_type;
494 
495  const std::string calc_type = ps.getParameter<std::string>("Class");
496 
497  if (!calc_type.compare("PeakEtaPhiDistance"))
498  {
499  const double etaToPhiBandwidthRatio = ps.getParameter<double>(
500  "etaToPhiBandwidthRatio");
501  return return_type(new fftjet::PeakEtaPhiDistance(etaToPhiBandwidthRatio));
502  }
503 
504  if (!calc_type.compare("PeakEtaDependentDistance"))
505  {
506  std::auto_ptr<fftjet::LinearInterpolator1d> interp =
508  ps.getParameter<edm::ParameterSet>("Interpolator"));
509  const fftjet::LinearInterpolator1d* ip = interp.get();
510  if (ip == NULL)
511  return return_type(NULL);
512 
513  // Check that the interpolator is always positive
514  const unsigned n = ip->nx();
515  const double* data = ip->getData();
516  for (unsigned i=0; i<n; ++i)
517  if (data[i] <= 0.0)
518  return return_type(NULL);
519  if (ip->fLow() <= 0.0 || ip->fHigh() <= 0.0)
520  return return_type(NULL);
521 
522  return return_type(new fftjet::PeakEtaDependentDistance(*ip));
523  }
524 
525  return return_type(NULL);
526 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
std::auto_ptr< fftjet::LinearInterpolator1d > fftjet_LinearInterpolator1d_parser(const edm::ParameterSet &ps)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::auto_ptr< fftjet::Functor1< double, double > > fftjetcms::fftjet_Function_parser ( const edm::ParameterSet ps)

Definition at line 901 of file FFTJetParameterParser.cc.

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

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

902 {
903  typedef std::auto_ptr<fftjet::Functor1<double,double> > return_type;
904 
905  const std::string fcn_type = ps.getParameter<std::string>("Class");
906 
907  if (!fcn_type.compare("LinearInterpolator1d"))
908  {
909  std::auto_ptr<fftjet::LinearInterpolator1d> p =
911  fftjet::LinearInterpolator1d* ptr = p.get();
912  if (ptr)
913  {
914  p.release();
915  return return_type(ptr);
916  }
917  }
918 
919  if (!fcn_type.compare("LinInterpolatedTable1D"))
920  {
921  std::auto_ptr<fftjetcms::LinInterpolatedTable1D> p =
923  fftjetcms::LinInterpolatedTable1D* ptr = p.get();
924  if (ptr)
925  {
926  p.release();
927  return return_type(ptr);
928  }
929  }
930 
931  if (!fcn_type.compare("Polynomial"))
932  {
933  std::vector<double> coeffs;
934  for (unsigned i=0; ; ++i)
935  {
936  std::ostringstream s;
937  s << 'c' << i;
938  if (ps.exists(s.str()))
939  coeffs.push_back(ps.getParameter<double>(s.str()));
940  else
941  break;
942  }
943  return return_type(new Polynomial(coeffs));
944  }
945 
946  return return_type(NULL);
947 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< fftjetcms::LinInterpolatedTable1D > fftjet_LinInterpolatedTable1D_parser(const edm::ParameterSet &ps)
bool exists(std::string const &parameterName) const
checks if a parameter exists
#define NULL
Definition: scimark2.h:8
std::auto_ptr< fftjet::LinearInterpolator1d > fftjet_LinearInterpolator1d_parser(const edm::ParameterSet &ps)
std::auto_ptr< fftjet::Grid2d< Real > > fftjetcms::fftjet_Grid2d_parser ( const edm::ParameterSet ps)

Definition at line 124 of file FFTJetParameterParser.cc.

References data, jptDQMConfig_cff::etaMax, jptDQMConfig_cff::etaMin, edm::hlt::Exception, edm::ParameterSet::exists(), mergeVDriftHistosByStation::file, g, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), recoMuon::in, NULL, SiPixelLorentzAngle_cfi::read, AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

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

125 {
126  typedef std::auto_ptr<fftjet::Grid2d<Real> > return_type;
127  fftjet::Grid2d<Real> *g = 0;
128 
129  // Check if the grid should be read from file
130  if (ps.exists("file"))
131  {
132  const std::string file = ps.getParameter<std::string>("file");
133  std::ifstream in(file.c_str(),
134  std::ios_base::in | std::ios_base::binary);
135  if (!in.is_open())
136  throw cms::Exception("FFTJetBadConfig")
137  << "Failed to open file " << file << std::endl;
139  if (g == 0)
140  throw cms::Exception("FFTJetBadConfig")
141  << "Failed to read file " << file << std::endl;
142  }
143  else
144  {
145  const unsigned nEtaBins = ps.getParameter<unsigned>("nEtaBins");
146  const Real etaMin = ps.getParameter<Real>("etaMin");
147  const Real etaMax = ps.getParameter<Real>("etaMax");
148  const unsigned nPhiBins = ps.getParameter<unsigned>("nPhiBins");
149  const Real phiBin0Edge = ps.getParameter<Real>("phiBin0Edge");
151  "title", "");
152 
153  if (nEtaBins == 0 || nPhiBins == 0 || etaMin >= etaMax)
154  return return_type(NULL);
155 
156  g = new fftjet::Grid2d<Real>(
157  nEtaBins,
158  etaMin,
159  etaMax,
160  nPhiBins,
161  phiBin0Edge,
162  title.c_str()
163  );
164 
165  // Check if the grid data is provided
166  if (ps.exists("data"))
167  {
168  const std::vector<Real>& data =
169  ps.getParameter<std::vector<Real> >("data");
170  if (data.size() == nEtaBins*nPhiBins)
171  g->blockSet(&data[0], nEtaBins, nPhiBins);
172  else
173  {
174  delete g;
175  g = 0;
176  }
177  }
178  }
179 
180  return return_type(g);
181 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
#define NULL
Definition: scimark2.h:8
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
double Real
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::auto_ptr< fftjet::Functor2< double, fftjet::RecombinedJet< VectorLike >, fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetDistance_parser ( const edm::ParameterSet ps)

Definition at line 876 of file FFTJetParameterParser.cc.

References edm::ParameterSet::getParameter(), make_param, NULL, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FFTJetProducer::parse_jetDistanceCalc().

877 {
878  typedef std::auto_ptr<fftjet::Functor2<
879  double,
880  fftjet::RecombinedJet<VectorLike>,
881  fftjet::RecombinedJet<VectorLike> > > return_type;
882 
883  const std::string distance_type = ps.getParameter<std::string>(
884  "Class");
885 
886  if (!distance_type.compare("JetConvergenceDistance"))
887  {
888  make_param(double, etaToPhiBandwidthRatio);
889  make_param(double, relativePtBandwidth);
890 
891  if (etaToPhiBandwidthRatio > 0.0 && relativePtBandwidth > 0.0)
892  return return_type(new JetConvergenceDistance(
893  etaToPhiBandwidthRatio, relativePtBandwidth));
894  }
895 
896  return return_type(NULL);
897 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
#define make_param(type, varname)
std::auto_ptr< fftjet::Functor1< double, fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetFunctor_parser ( const edm::ParameterSet ps)

Definition at line 743 of file FFTJetParameterParser.cc.

References python.connectstrParser::f1, python.connectstrParser::f2, fcn(), fftjet_Function_parser(), edm::ParameterSet::getParameter(), NULL, parse_jet_member_function(), query::result, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

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

744 {
745  typedef fftjet::Functor1<double,RecoFFTJet> ptr_type;
746  typedef std::auto_ptr<ptr_type> return_type;
747 
748  const std::string property_type = ps.getParameter<std::string>("Class");
749 
750  if (!property_type.compare("Log"))
751  {
752  return_type wrapped = fftjet_JetFunctor_parser(
753  ps.getParameter<edm::ParameterSet>("function"));
754  fftjet::Functor1<double,RecoFFTJet>* wr = wrapped.get();
755  if (wr)
756  {
757  return_type result = return_type(
758  new fftjet::LogProperty<RecoFFTJet>(wr, true));
759  wrapped.release();
760  return result;
761  }
762  }
763 
764  if (!property_type.compare("JetEtaDependent"))
765  {
766  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
768  ps.getParameter<edm::ParameterSet>("function"));
769  fftjet::Functor1<double,double>* f1 = fcn1.get();
770  if (f1)
771  {
772  return_type result = return_type(new JetEtaDependent(f1, true));
773  fcn1.release();
774  return result;
775  }
776  }
777 
778  if (!property_type.compare("JetProperty"))
779  {
780  const std::string member = ps.getParameter<std::string>("member");
781  fftjet::JetProperty<RecoFFTJet>::JetMemberFunction fcn;
782  if (parse_jet_member_function(member.c_str(), &fcn))
783  return return_type(
784  new fftjet::JetProperty<RecoFFTJet>(fcn));
785  else
786  return return_type(NULL);
787  }
788 
789  if (!property_type.compare("ConstDouble"))
790  {
791  const double value = ps.getParameter<double>("value");
792  return return_type(new ConstDouble<RecoFFTJet>(value));
793  }
794 
795  if (!property_type.compare("ProportionalToScale"))
796  {
797  const double value = ps.getParameter<double>("value");
798  return return_type(
800  }
801 
802  if (!property_type.compare("MultiplyByConst"))
803  {
804  const double factor = ps.getParameter<double>("factor");
805  return_type function = fftjet_JetFunctor_parser(
806  ps.getParameter<edm::ParameterSet>("function"));
807  ptr_type* ptr = function.get();
808  if (ptr)
809  {
810  return_type result = return_type(
811  new MultiplyByConst<RecoFFTJet>(factor, ptr, true));
812  function.release();
813  return result;
814  }
815  }
816 
817  if (!property_type.compare("CompositeFunctor"))
818  {
819  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
821  ps.getParameter<edm::ParameterSet>("function1"));
822  return_type fcn2 = fftjet_JetFunctor_parser(
823  ps.getParameter<edm::ParameterSet>("function2"));
824  fftjet::Functor1<double,double>* f1 = fcn1.get();
825  ptr_type* f2 = fcn2.get();
826  if (f1 && f2)
827  {
828  return_type result = return_type(
829  new CompositeFunctor<RecoFFTJet>(f1, f2, true));
830  fcn1.release();
831  fcn2.release();
832  return result;
833  }
834  }
835 
836  if (!property_type.compare("ProductFunctor"))
837  {
838  return_type fcn1 = fftjet_JetFunctor_parser(
839  ps.getParameter<edm::ParameterSet>("function1"));
840  return_type fcn2 = fftjet_JetFunctor_parser(
841  ps.getParameter<edm::ParameterSet>("function2"));
842  ptr_type* f1 = fcn1.get();
843  ptr_type* f2 = fcn2.get();
844  if (f1 && f2)
845  {
846  return_type result = return_type(
847  new ProductFunctor<RecoFFTJet>(f1, f2, true));
848  fcn1.release();
849  fcn2.release();
850  return result;
851  }
852  }
853 
854  if (!property_type.compare("MagnitudeDependent"))
855  {
856  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
858  ps.getParameter<edm::ParameterSet>("function"));
859  fftjet::Functor1<double,double>* f1 = fcn1.get();
860  if (f1)
861  {
862  return_type result = return_type(
863  new MagnitudeDependent<RecoFFTJet>(f1, true));
864  fcn1.release();
865  return result;
866  }
867  }
868 
869  return return_type(NULL);
870 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
std::auto_ptr< fftjet::Functor1< double, double > > fftjet_Function_parser(const edm::ParameterSet &ps)
tuple result
Definition: query.py:137
void fcn(int &, double *, double &, double *, int)
static bool parse_jet_member_function(const char *fname, fftjet::JetProperty< RecoFFTJet >::JetMemberFunction *f)
std::auto_ptr< fftjet::Functor1< double, fftjet::RecombinedJet< VectorLike > > > fftjet_JetFunctor_parser(const edm::ParameterSet &ps)
std::auto_ptr< fftjet::JetMagnitudeMapper2d< fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetMagnitudeMapper2d_parser ( const edm::ParameterSet ps)

Definition at line 1014 of file FFTJetParameterParser.cc.

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

1015 {
1016  std::auto_ptr<fftjet::LinearInterpolator2d> responseCurve =
1018  ps.getParameter<edm::ParameterSet>("responseCurve"));
1019 
1020  const double minPredictor = ps.getParameter<double>("minPredictor");
1021  const double maxPredictor = ps.getParameter<double>("maxPredictor");
1022  const unsigned nPredPoints = ps.getParameter<unsigned>("nPredPoints");
1023  const double maxMagnitude = ps.getParameter<double>("maxMagnitude");
1024  const unsigned nMagPoints = ps.getParameter<unsigned>("nMagPoints");
1025 
1026  return (std::auto_ptr<fftjet::JetMagnitudeMapper2d<RecoFFTJet> >
1027  (new fftjet::JetMagnitudeMapper2d<RecoFFTJet>(
1028  *responseCurve,
1030  true,minPredictor,maxPredictor,nPredPoints,
1031  maxMagnitude,nMagPoints)));
1032 }
T getParameter(std::string const &) const
std::auto_ptr< fftjet::LinearInterpolator2d > fftjet_LinearInterpolator2d_parser(const edm::ParameterSet &ps)
std::auto_ptr< fftjet::LinearInterpolator1d > fftjetcms::fftjet_LinearInterpolator1d_parser ( const edm::ParameterSet ps)

Definition at line 551 of file FFTJetParameterParser.cc.

References data, edm::ParameterSet::getParameter(), NULL, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

Referenced by fftjet_DistanceCalculator_parser(), and fftjet_Function_parser().

552 {
553  const double xmin = ps.getParameter<double>("xmin");
554  const double xmax = ps.getParameter<double>("xmax");
555  const double flow = ps.getParameter<double>("flow");
556  const double fhigh = ps.getParameter<double>("fhigh");
557  const std::vector<double> data(
558  ps.getParameter<std::vector<double> >("data"));
559  if (data.empty())
560  return std::auto_ptr<fftjet::LinearInterpolator1d>(NULL);
561  else
562  return std::auto_ptr<fftjet::LinearInterpolator1d>(
563  new fftjet::LinearInterpolator1d(
564  &data[0], data.size(), xmin, xmax, flow, fhigh));
565 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::auto_ptr< fftjet::LinearInterpolator2d > fftjetcms::fftjet_LinearInterpolator2d_parser ( const edm::ParameterSet ps)

Definition at line 569 of file FFTJetParameterParser.cc.

References edm::hlt::Exception, mergeVDriftHistosByStation::file, edm::ParameterSet::getParameter(), recoMuon::in, SiPixelLorentzAngle_cfi::read, and AlCaHLTBitMon_QueryRunRegistry::string.

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

570 {
571  const std::string file = ps.getParameter<std::string>("file");
572  std::ifstream in(file.c_str(),
573  std::ios_base::in | std::ios_base::binary);
574  if (!in.is_open())
575  throw cms::Exception("FFTJetBadConfig")
576  << "Failed to open file " << file << std::endl;
577  fftjet::LinearInterpolator2d* ip = fftjet::LinearInterpolator2d::read(in);
578  if (!ip)
579  throw cms::Exception("FFTJetBadConfig")
580  << "Failed to read file " << file << std::endl;
581  return std::auto_ptr<fftjet::LinearInterpolator2d>(ip);
582 }
T getParameter(std::string const &) const
std::auto_ptr< fftjetcms::LinInterpolatedTable1D > fftjetcms::fftjet_LinInterpolatedTable1D_parser ( const edm::ParameterSet ps)

Definition at line 530 of file FFTJetParameterParser.cc.

References data, edm::ParameterSet::getParameter(), NULL, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

Referenced by fftjet_Function_parser().

531 {
532  const double xmin = ps.getParameter<double>("xmin");
533  const double xmax = ps.getParameter<double>("xmax");
534  const bool leftExtrapolationLinear =
535  ps.getParameter<bool>("leftExtrapolationLinear");
536  const bool rightExtrapolationLinear =
537  ps.getParameter<bool>("rightExtrapolationLinear");
538  const std::vector<double> data(
539  ps.getParameter<std::vector<double> >("data"));
540  if (data.empty())
541  return std::auto_ptr<fftjetcms::LinInterpolatedTable1D>(NULL);
542  else
543  return std::auto_ptr<fftjetcms::LinInterpolatedTable1D>(
545  &data[0], data.size(), xmin, xmax,
546  leftExtrapolationLinear, rightExtrapolationLinear));
547 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::auto_ptr< fftjet::ScaleSpaceKernel > fftjetcms::fftjet_MembershipFunction_parser ( const edm::ParameterSet ps)

Definition at line 260 of file FFTJetParameterParser.cc.

References data, edm::hlt::Exception, mergeVDriftHistosByStation::file, edm::ParameterSet::getParameter(), recoMuon::in, make_param, NULL, SiPixelLorentzAngle_cfi::read, AlCaHLTBitMon_QueryRunRegistry::string, SiStripMonitorClusterAlca_cfi::xmax, SiStripMonitorClusterAlca_cfi::xmin, SiStripMonitorClusterAlca_cfi::ymax, and SiStripMonitorClusterAlca_cfi::ymin.

Referenced by FFTJetProducer::parse_jetMembershipFunction().

261 {
262  typedef std::auto_ptr<fftjet::ScaleSpaceKernel> return_type;
263 
264  const std::string MembershipFunction_type = ps.getParameter<std::string>(
265  "Class");
266 
267  // Parse special cases first
268  if (!MembershipFunction_type.compare("InterpolatedMembershipFcn"))
269  {
270  // This is a kernel defined by a 4d (sparsified) lookup table.
271  // Here, it is simply loaded from a file using a built-in
272  // method from fftjet. Note that the table representation
273  // must be native binary (this will not work on platforms with
274  // different endianity of floating point standard).
275  const std::string file = ps.getParameter<std::string>("file");
276  std::ifstream in(file.c_str(),
277  std::ios_base::in | std::ios_base::binary);
278  if (!in.is_open())
279  throw cms::Exception("FFTJetBadConfig")
280  << "Failed to open file " << file << std::endl;
282  }
283 
284  if (!MembershipFunction_type.compare("Composite"))
285  {
286  throw cms::Exception("FFTJetBadConfig")
287  << "Parsing of CompositeKernel objects is not implemented yet"
288  << std::endl;
289  }
290 
291  if (!MembershipFunction_type.compare("MagneticSmearing"))
292  {
293  // This kernel represents smearing of a jet in phi
294  // in a magnetic field. The meaning of the parameters
295  // is explained in the comments in the MagneticSmearingKernel.hh
296  // header file of the fftjet package.
297  make_param(std::vector<double>, fragmentationData);
298  make_param(double, numeratorConst);
299  make_param(double, charge1Fraction);
300  make_param(double, charge2Fraction);
301  make_param(unsigned, samplesPerBin);
302 
303  if (fragmentationData.empty())
304  throw cms::Exception("FFTJetBadConfig")
305  << "Fragmentation function data not defined for "
306  "MagneticSmearingKernel" << std::endl;
307  if (samplesPerBin < 1U)
308  throw cms::Exception("FFTJetBadConfig")
309  << "Bad number of samples per bin in "
310  "MagneticSmearingKernel" << std::endl;
311 
312  fftjet::LinearInterpolator1d* fragmentationFunction =
313  new fftjet::LinearInterpolator1d(
314  &fragmentationData[0], fragmentationData.size(), 0.0, 1.0);
315 
316  return return_type(
317  new fftjet::MagneticSmearingKernel<fftjet::LinearInterpolator1d>(
318  fragmentationFunction, numeratorConst,
319  charge1Fraction, charge2Fraction,
320  samplesPerBin, true));
321  }
322 
323  if (!MembershipFunction_type.compare("Interpolated"))
324  {
325  // This is a kernel defined by a histogram-like 2d lookup table
326  make_param(double, sx);
327  make_param(double, sy);
328  make_param(int, scalePower);
329  make_param(unsigned, nxbins);
330  make_param(double, xmin);
331  make_param(double, xmax);
332  make_param(unsigned, nybins);
333  make_param(double, ymin);
334  make_param(double, ymax);
335  make_param(std::vector<double>, data);
336 
337  if (data.size() != nxbins*nybins)
338  throw cms::Exception("FFTJetBadConfig")
339  << "Bad number of data points for Interpolated kernel"
340  << std::endl;
341 
342  return return_type(new fftjet::InterpolatedKernel(
343  sx, sy, scalePower,
344  &data[0], nxbins, xmin, xmax,
345  nybins, ymin, ymax));
346  }
347 
348  if (!MembershipFunction_type.compare("Interpolated3d"))
349  {
350  // This is a kernel defined by a histogram-like 3d lookup table
351  make_param(std::vector<double>, data);
352  make_param(std::vector<double>, scales);
353  make_param(bool, useLogSpaceForScale);
354  make_param(unsigned, nxbins);
355  make_param(double, xmin);
356  make_param(double, xmax);
357  make_param(unsigned, nybins);
358  make_param(double, ymin);
359  make_param(double, ymax);
360 
361  if (data.size() != nxbins*nybins*scales.size())
362  throw cms::Exception("FFTJetBadConfig")
363  << "Bad number of data points for Interpolated3d kernel"
364  << std::endl;
365 
366  return return_type(new fftjet::InterpolatedKernel3d(
367  &data[0], scales, useLogSpaceForScale,
368  nxbins, xmin, xmax, nybins, ymin, ymax));
369  }
370 
371  // This is not a special kernel. Try one of the classes
372  // in the kernel factory provided by FFTJet.
373  fftjet::DefaultKernel2dFactory factory;
374  if (factory[MembershipFunction_type] == NULL) {
375  return return_type(NULL);
376  }
377 
378  make_param(double, sx);
379  make_param(double, sy);
380  make_param(int, scalePower);
381  make_param(std::vector<double>, kernelParameters);
382 
383  const int n_expected = factory[MembershipFunction_type]->nParameters();
384  if (n_expected >= 0)
385  if (static_cast<unsigned>(n_expected) != kernelParameters.size())
386  throw cms::Exception("FFTJetBadConfig")
387  << "Bad number of kernel parameters" << std::endl;
388 
389  return std::auto_ptr<fftjet::ScaleSpaceKernel>(
390  factory[MembershipFunction_type]->create(
391  sx, sy, scalePower, kernelParameters));
392 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
#define make_param(type, varname)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjetcms::fftjet_PeakFunctor_parser ( const edm::ParameterSet ps)

Definition at line 586 of file FFTJetParameterParser.cc.

References python.connectstrParser::f1, python.connectstrParser::f2, fcn(), fftjet_Function_parser(), edm::ParameterSet::getParameter(), NULL, parse_peak_member_function(), query::result, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

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

587 {
588  typedef fftjet::Functor1<double,fftjet::Peak> ptr_type;
589  typedef std::auto_ptr<ptr_type> return_type;
590 
591  const std::string property_type = ps.getParameter<std::string>("Class");
592 
593  if (!property_type.compare("Log"))
594  {
595  return_type wrapped = fftjet_PeakFunctor_parser(
596  ps.getParameter<edm::ParameterSet>("function"));
597  ptr_type* wr = wrapped.get();
598  if (wr)
599  {
600  return_type result = return_type(
601  new fftjet::LogProperty<fftjet::Peak>(wr, true));
602  wrapped.release();
603  return result;
604  }
605  }
606 
607  if (!property_type.compare("PeakProperty"))
608  {
609  const std::string member = ps.getParameter<std::string>("member");
610  fftjet::JetProperty<fftjet::Peak>::JetMemberFunction fcn;
611  if (parse_peak_member_function(member.c_str(), &fcn))
612  return return_type(
613  new fftjet::JetProperty<fftjet::Peak>(fcn));
614  else
615  return return_type(NULL);
616  }
617 
618  if (!property_type.compare("MinusScaledLaplacian"))
619  {
620  const double sx = ps.getParameter<double>("sx");
621  const double sy = ps.getParameter<double>("sx");
622  return return_type(
623  new fftjet::MinusScaledLaplacian<fftjet::Peak>(sx, sy));
624  }
625 
626  if (!property_type.compare("ScaledHessianDet"))
627  {
628  return return_type(
629  new fftjet::ScaledHessianDet<fftjet::Peak>());
630  }
631 
632  if (!property_type.compare("ScaledMagnitude"))
633  {
634  return return_type(
635  new fftjet::ScaledMagnitude<fftjet::Peak>());
636  }
637 
638  if (!property_type.compare("ScaledMagnitude2"))
639  {
640  return return_type(
641  new fftjet::ScaledMagnitude2<fftjet::Peak>());
642  }
643 
644  if (!property_type.compare("ConstDouble"))
645  {
646  const double value = ps.getParameter<double>("value");
647  return return_type(new ConstDouble<fftjet::Peak>(value));
648  }
649 
650  if (!property_type.compare("ProportionalToScale"))
651  {
652  const double value = ps.getParameter<double>("value");
653  return return_type(
655  }
656 
657  if (!property_type.compare("MultiplyByConst"))
658  {
659  const double factor = ps.getParameter<double>("factor");
660  return_type function = fftjet_PeakFunctor_parser(
661  ps.getParameter<edm::ParameterSet>("function"));
662  ptr_type* ptr = function.get();
663  if (ptr)
664  {
665  return_type result = return_type(
666  new MultiplyByConst<fftjet::Peak>(factor, ptr, true));
667  function.release();
668  return result;
669  }
670  }
671 
672  if (!property_type.compare("CompositeFunctor"))
673  {
674  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
676  ps.getParameter<edm::ParameterSet>("function1"));
677  return_type fcn2 = fftjet_PeakFunctor_parser(
678  ps.getParameter<edm::ParameterSet>("function2"));
679  fftjet::Functor1<double,double>* f1 = fcn1.get();
680  ptr_type* f2 = fcn2.get();
681  if (f1 && f2)
682  {
683  return_type result = return_type(
684  new CompositeFunctor<fftjet::Peak>(f1, f2, true));
685  fcn1.release();
686  fcn2.release();
687  return result;
688  }
689  }
690 
691  if (!property_type.compare("ProductFunctor"))
692  {
693  return_type fcn1 = fftjet_PeakFunctor_parser(
694  ps.getParameter<edm::ParameterSet>("function1"));
695  return_type fcn2 = fftjet_PeakFunctor_parser(
696  ps.getParameter<edm::ParameterSet>("function2"));
697  ptr_type* f1 = fcn1.get();
698  ptr_type* f2 = fcn2.get();
699  if (f1 && f2)
700  {
701  return_type result = return_type(
702  new ProductFunctor<fftjet::Peak>(f1, f2, true));
703  fcn1.release();
704  fcn2.release();
705  return result;
706  }
707  }
708 
709  if (!property_type.compare("MagnitudeDependent"))
710  {
711  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
713  ps.getParameter<edm::ParameterSet>("function"));
714  fftjet::Functor1<double,double>* f1 = fcn1.get();
715  if (f1)
716  {
717  return_type result = return_type(
718  new MagnitudeDependent<fftjet::Peak>(f1, true));
719  fcn1.release();
720  return result;
721  }
722  }
723 
724  if (!property_type.compare("PeakEtaDependent"))
725  {
726  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
728  ps.getParameter<edm::ParameterSet>("function"));
729  fftjet::Functor1<double,double>* f1 = fcn1.get();
730  if (f1)
731  {
732  return_type result = return_type(new PeakEtaDependent(f1, true));
733  fcn1.release();
734  return result;
735  }
736  }
737 
738  return return_type(NULL);
739 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
std::auto_ptr< fftjet::Functor1< double, double > > fftjet_Function_parser(const edm::ParameterSet &ps)
static bool parse_peak_member_function(const char *fname, fftjet::JetProperty< fftjet::Peak >::JetMemberFunction *f)
tuple result
Definition: query.py:137
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjet_PeakFunctor_parser(const edm::ParameterSet &ps)
void fcn(int &, double *, double &, double *, int)
std::auto_ptr< fftjet::JetMagnitudeMapper2d< fftjet::Peak > > fftjetcms::fftjet_PeakMagnitudeMapper2d_parser ( const edm::ParameterSet ps)

Definition at line 992 of file FFTJetParameterParser.cc.

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

993 {
994  std::auto_ptr<fftjet::LinearInterpolator2d> responseCurve =
996  ps.getParameter<edm::ParameterSet>("responseCurve"));
997 
998  const double minPredictor = ps.getParameter<double>("minPredictor");
999  const double maxPredictor = ps.getParameter<double>("maxPredictor");
1000  const unsigned nPredPoints = ps.getParameter<unsigned>("nPredPoints");
1001  const double maxMagnitude = ps.getParameter<double>("maxMagnitude");
1002  const unsigned nMagPoints = ps.getParameter<unsigned>("nMagPoints");
1003 
1004  return (std::auto_ptr<fftjet::JetMagnitudeMapper2d<fftjet::Peak> >
1005  (new fftjet::JetMagnitudeMapper2d<fftjet::Peak>(
1006  *responseCurve,
1008  true,minPredictor,maxPredictor,nPredPoints,
1009  maxMagnitude,nMagPoints)));
1010 }
T getParameter(std::string const &) const
std::auto_ptr< fftjet::LinearInterpolator2d > fftjet_LinearInterpolator2d_parser(const edm::ParameterSet &ps)
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjetcms::fftjet_PeakSelector_parser ( const edm::ParameterSet ps)

Definition at line 185 of file FFTJetParameterParser.cc.

References a, b, data, mergeVDriftHistosByStation::file, edm::ParameterSet::getParameter(), recoMuon::in, fftjetcms::EtaAndPtDependentPeakSelector::isValid(), make_param, NULL, AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, SiStripMonitorClusterAlca_cfi::xmax, SiStripMonitorClusterAlca_cfi::xmin, SiStripMonitorClusterAlca_cfi::ymax, and SiStripMonitorClusterAlca_cfi::ymin.

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

186 {
187  typedef std::auto_ptr<fftjet::Functor1<bool,fftjet::Peak> > return_type;
188 
189  const std::string peakselector_type = ps.getParameter<std::string>(
190  "Class");
191 
192  if (!peakselector_type.compare("AllPeaksPass"))
193  {
194  return return_type(new fftjet::AllPeaksPass());
195  }
196 
197  if (!peakselector_type.compare("EtaAndPtDependentPeakSelector"))
198  {
199  const std::string file = ps.getParameter<std::string>("file");
200  std::ifstream in(file.c_str(),
201  std::ios_base::in | std::ios_base::binary);
202  if (!in.is_open())
203  throw cms::Exception("FFTJetBadConfig")
204  << "Failed to open file " << file << std::endl;
207  if (!ptr->isValid())
208  throw cms::Exception("FFTJetBadConfig")
209  << "Failed to read file " << file << std::endl;
210  return return_type(ptr);
211  }
212 
213  if (!peakselector_type.compare("EtaAndPtLookupPeakSelector"))
214  {
215  make_param(unsigned, nx);
216  make_param(unsigned, ny);
217  make_param(double, xmin);
218  make_param(double, xmax);
219  make_param(double, ymin);
220  make_param(double, ymax);
221  make_param(std::vector<double>, data);
222 
223  if (xmin >= xmax || ymin >= ymax || !nx || !ny || data.size() != nx*ny)
224  throw cms::Exception("FFTJetBadConfig")
225  << "Failed to configure EtaAndPtLookupPeakSelector" << std::endl;
226 
227  return return_type(new EtaAndPtLookupPeakSelector(
228  nx, xmin, xmax, ny, ymin, ymax, data));
229  }
230 
231  if (!peakselector_type.compare("SimplePeakSelector"))
232  {
233  const double magCut = ps.getParameter<double>("magCut");
234  const double driftSpeedCut = ps.getParameter<double>("driftSpeedCut");
235  const double magSpeedCut = ps.getParameter<double>("magSpeedCut");
236  const double lifeTimeCut = ps.getParameter<double>("lifeTimeCut");
237  const double NNDCut = ps.getParameter<double>("NNDCut");
238  const double etaCut = ps.getParameter<double>("etaCut");
239 
240  return return_type(new fftjet::SimplePeakSelector(
241  magCut, driftSpeedCut ,magSpeedCut, lifeTimeCut, NNDCut, etaCut));
242  }
243 
244  if (!peakselector_type.compare("ScalePowerPeakSelector"))
245  {
246  const double a = ps.getParameter<double>("a");
247  const double p = ps.getParameter<double>("p");
248  const double b = ps.getParameter<double>("b");
249  const double etaCut = ps.getParameter<double>("etaCut");
250 
251  return return_type(new fftjet::ScalePowerPeakSelector(
252  a, p, b, etaCut));
253  }
254 
255  return return_type(NULL);
256 }
T getParameter(std::string const &) const
#define NULL
Definition: scimark2.h:8
#define make_param(type, varname)
double b
Definition: hdecay.h:120
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
double a
Definition: hdecay.h:121
std::auto_ptr< AbsPileupCalculator > fftjetcms::fftjet_PileupCalculator_parser ( const edm::ParameterSet ps)

Definition at line 951 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_pileupDensityCalc().

952 {
953  typedef std::auto_ptr<AbsPileupCalculator> return_type;
954 
955  const std::string fcn_type = ps.getParameter<std::string>("Class");
956 
957  if (!fcn_type.compare("EtaDependentPileup"))
958  {
959  std::auto_ptr<fftjet::LinearInterpolator2d> interp =
961  ps.getParameter<edm::ParameterSet>("Interpolator2d"));
962  const double inputRhoFactor = ps.getParameter<double>("inputRhoFactor");
963  const double outputRhoFactor = ps.getParameter<double>("outputRhoFactor");
964 
965  const fftjet::LinearInterpolator2d* ip = interp.get();
966  if (ip)
967  return return_type(new EtaDependentPileup(
968  *ip, inputRhoFactor, outputRhoFactor));
969  else
970  return return_type(NULL);
971  }
972 
973  if (!fcn_type.compare("PileupGrid2d"))
974  {
975  std::auto_ptr<fftjet::Grid2d<Real> > grid =
977  ps.getParameter<edm::ParameterSet>("Grid2d"));
978  const double rhoFactor = ps.getParameter<double>("rhoFactor");
979 
980  const fftjet::Grid2d<Real>* g = grid.get();
981  if (g)
982  return return_type(new PileupGrid2d(*g, rhoFactor));
983  else
984  return return_type(NULL);
985  }
986 
987  return return_type(NULL);
988 }
T getParameter(std::string const &) const
std::auto_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser(const edm::ParameterSet &ps)
#define NULL
Definition: scimark2.h:8
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
std::auto_ptr< fftjet::LinearInterpolator2d > fftjet_LinearInterpolator2d_parser(const edm::ParameterSet &ps)
std::auto_ptr< std::vector< double > > fftjetcms::fftjet_ScaleSet_parser ( const edm::ParameterSet ps)

Definition at line 414 of file FFTJetParameterParser.cc.

References className(), edm::ParameterSet::getParameter(), i, j, NULL, and AlCaHLTBitMon_QueryRunRegistry::string.

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

415 {
416  typedef std::auto_ptr<std::vector<double> > return_type;
417 
418  const std::string className = ps.getParameter<std::string>("Class");
419 
420  if (!className.compare("EquidistantInLinearSpace") ||
421  !className.compare("EquidistantInLogSpace"))
422  {
423  const double minScale = ps.getParameter<double>("minScale");
424  const double maxScale = ps.getParameter<double>("maxScale");
425  const unsigned nScales = ps.getParameter<unsigned>("nScales");
426 
427  if (minScale <= 0.0 || maxScale <= 0.0 ||
428  nScales == 0 || minScale == maxScale)
429  return return_type(NULL);
430 
431  // Can't return pointers to EquidistantInLinearSpace
432  // or EquidistantInLogSpace directly because std::vector
433  // destructor is not virtual.
434  if (!className.compare("EquidistantInLinearSpace"))
435  return return_type(new std::vector<double>(
436  fftjet::EquidistantInLinearSpace(
437  minScale, maxScale, nScales)));
438  else
439  return return_type(new std::vector<double>(
440  fftjet::EquidistantInLogSpace(
441  minScale, maxScale, nScales)));
442  }
443 
444  if (!className.compare("UserSet"))
445  {
446  return_type scales(new std::vector<double>(
447  ps.getParameter<std::vector<double> >("scales")));
448 
449  // Verify that all scales are positive and unique
450  const unsigned nscales = scales->size();
451  for (unsigned i=0; i<nscales; ++i)
452  if ((*scales)[i] <= 0.0)
453  return return_type(NULL);
454 
455  for (unsigned i=1; i<nscales; ++i)
456  for (unsigned j=0; j<i; ++j)
457  if ((*scales)[i] == (*scales)[j])
458  return return_type(NULL);
459 
460  return scales;
461  }
462 
463  return return_type(NULL);
464 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
int j
Definition: DBlmapReader.cc:9
std::string className(const T &t)
Definition: ClassName.h:30
template<class Real >
fftjet::RecombinedJet< VectorLike > fftjetcms::jetFromStorable ( const reco::FFTJet< Real > &  jet)

Definition at line 61 of file jetConverters.h.

References reco::FFTJet< Real >::f_centroidEta(), reco::FFTJet< Real >::f_centroidPhi(), reco::FFTJet< Real >::f_code(), reco::FFTJet< Real >::f_convergenceDistance(), reco::FFTJet< Real >::f_etaPhiCorr(), reco::FFTJet< Real >::f_etaWidth(), reco::FFTJet< Real >::f_etSum(), reco::FFTJet< Real >::f_fuzziness(), reco::FFTJet< Real >::f_membershipFactor(), reco::FFTJet< Real >::f_ncells(), reco::FFTJet< Real >::f_phiWidth(), reco::FFTJet< Real >::f_pileup(), reco::FFTJet< Real >::f_precluster(), reco::FFTJet< Real >::f_recoScale(), reco::FFTJet< Real >::f_recoScaleRatio(), reco::FFTJet< Real >::f_status(), reco::FFTJet< Real >::f_vec(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by FFTJetProducer::genJetPreclusters().

63  {
64  typedef reco::PattRecoPeak<Real> StoredPeak;
65  typedef fftjet::RecombinedJet<VectorLike> RecoFFTJet;
66 
67  double hessian[3] = {0., 0., 0.};
68  const StoredPeak& p(jet.f_precluster());
69  p.hessian(hessian);
70  const double pileupPt = jet.f_pileup().Pt();
71 
72  return RecoFFTJet(fftjet::Peak(p.eta(), p.phi(), p.magnitude(),
73  hessian, p.driftSpeed(),
74  p.magSpeed(), p.lifetime(),
75  p.scale(), p.nearestNeighborDistance(),
76  jet.f_membershipFactor(),
77  jet.f_recoScale(),
78  jet.f_recoScaleRatio(),
79  p.clusterRadius(),
80  p.clusterSeparation(), jet.f_code(),
81  jet.f_status()),
82  jet.f_vec(), jet.f_ncells(), jet.f_etSum(),
83  jet.f_centroidEta(), jet.f_centroidPhi(),
84  jet.f_etaWidth(), jet.f_phiWidth(),
85  jet.f_etaPhiCorr(), jet.f_fuzziness(),
86  pileupPt, 0.0, jet.f_convergenceDistance());
87  }
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:17
Real f_convergenceDistance() const
Definition: FFTJet.h:73
int f_status() const
Definition: FFTJet.h:78
Real f_centroidPhi() const
Definition: FFTJet.h:68
int f_code() const
Definition: FFTJet.h:77
Real f_membershipFactor() const
Definition: FFTJet.h:76
fftjet::RecombinedJet< VectorLike > RecoFFTJet
Real f_etSum() const
Definition: FFTJet.h:66
Real f_phiWidth() const
Definition: FFTJet.h:70
Real f_centroidEta() const
Definition: FFTJet.h:67
Real f_recoScale() const
Definition: FFTJet.h:74
Real f_ncells() const
Definition: FFTJet.h:65
const math::XYZTLorentzVector & f_vec() const
Definition: FFTJet.h:63
const PattRecoPeak< Real > & f_precluster() const
Definition: FFTJet.h:62
Real f_etaWidth() const
Definition: FFTJet.h:69
Real f_etaPhiCorr() const
Definition: FFTJet.h:71
const math::XYZTLorentzVector & f_pileup() const
Definition: FFTJet.h:64
Real f_recoScaleRatio() const
Definition: FFTJet.h:75
Real f_fuzziness() const
Definition: FFTJet.h:72
template<class Real >
reco::FFTJet< Real > fftjetcms::jetToStorable ( const fftjet::RecombinedJet< VectorLike > &  jet)

Definition at line 29 of file jetConverters.h.

References reco::PattRecoPeak< Real >::hessian().

31  {
32  typedef reco::PattRecoPeak<Real> StoredPeak;
33 
34  double hessian[3] = {0., 0., 0.};
35  const fftjet::Peak& peak(jet.precluster());
36  peak.hessian(hessian);
37 
38  return reco::FFTJet<Real>(StoredPeak(peak.eta(),
39  peak.phi(),
40  peak.magnitude(),
41  hessian,
42  peak.driftSpeed(),
43  peak.magSpeed(),
44  peak.lifetime(),
45  peak.scale(),
46  peak.nearestNeighborDistance(),
47  peak.clusterRadius(),
48  peak.clusterSeparation()),
49  jet.vec(), jet.ncells(), jet.etSum(),
50  jet.centroidEta(), jet.centroidPhi(),
51  jet.etaWidth(), jet.phiWidth(),
52  jet.etaPhiCorr(), jet.fuzziness(),
53  jet.convergenceDistance(),
54  jet.recoScale(), jet.recoScaleRatio(),
55  jet.membershipFactor(),
56  jet.code(), jet.status());
57  }
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:17
Storage class for jets reconstructed by FFTJet package.
Definition: FFTJet.h:20
void hessian(double hessianArray[3]) const
Definition: PattRecoPeak.h:68
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 41 of file matchOneToOne.h.

References fftjetcms::Private::matchOneToOne_MatchInfo::distance, i, fftjetcms::Private::matchOneToOne_MatchInfo::i1, fftjetcms::Private::matchOneToOne_MatchInfo::i2, m, and python.multivaluedict::sort().

Referenced by FFTJetProducer::removeFakePreclusters().

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

Definition at line 5 of file JetType.cc.

References BASICJET, CALOJET, edm::hlt::Exception, GENJET, JPTJET, PFJET, and TRACKJET.

6  {
7  if (!name.compare("BasicJet"))
8  return BASICJET;
9  else if (!name.compare("GenJet"))
10  return GENJET;
11  else if (!name.compare("CaloJet"))
12  return CALOJET;
13  else if (!name.compare("PFJet"))
14  return PFJET;
15  else if (!name.compare("TrackJet"))
16  return TRACKJET;
17  else if (!name.compare("JPTJet"))
18  return JPTJET;
19  else
20  throw cms::Exception("FFTJetBadConfig")
21  << "In parseJetType: unsupported jet type specification \""
22  << name << "\"\n";
23  }
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 139 of file clusteringTreeConverters.h.

References edm::hlt::Exception, i, recoMuon::in, n, python.Node::node, and AlCaHLTBitMon_ParallelJobs::p.

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

144  {
145  typedef fftjet::SparseClusteringTree<fftjet::Peak,long> SparseTree;
146  typedef reco::PattRecoPeak<Real> StoredPeak;
147  typedef reco::PattRecoNode<StoredPeak> StoredNode;
148  typedef reco::PattRecoTree<Real,StoredPeak> StoredTree;
149 
150  if (!in.isSparse())
151  throw cms::Exception("FFTJetBadConfig")
152  << "can't restore sparse clustering tree"
153  << " from densely stored record" << std::endl;
154 
155  assert(out);
156  out->clear();
157 
158  const std::vector<StoredNode>& nodes(in.getNodes());
159  const unsigned n = nodes.size();
160  out->reserveNodes(n + 1U);
161 
162  double hessian[3] = {0., 0., 0.};
163 
164  for (unsigned i=0; i<n; ++i)
165  {
166  const StoredNode& snode(nodes[i]);
167  const StoredPeak& p(snode.getCluster());
168  p.hessian(hessian);
169  const SparseTree::Node node(
170  fftjet::Peak(p.eta(), p.phi(), p.magnitude(),
171  hessian, p.driftSpeed(),
172  p.magSpeed(), p.lifetime(),
173  p.scale(), p.nearestNeighborDistance(),
174  1.0, 0.0, 0.0,
175  p.clusterRadius(), p.clusterSeparation()),
176  snode.originalLevel(),
177  snode.mask());
178  out->addNode(node, snode.parent());
179  }
180 
181  const std::vector<Real>& storedScales(in.getScales());
182  if (!storedScales.empty())
183  {
184  const unsigned nsc = storedScales.size();
185  out->reserveScales(nsc + 1U);
186  out->addScale(DBL_MAX);
187  const Real* scales = &storedScales[0];
188  for (unsigned i=0; i<nsc; ++i)
189  out->addScale(scales[i]);
190  }
191  else if (scaleSetIfNotAdaptive && !scaleSetIfNotAdaptive->empty())
192  {
193  const unsigned nsc = scaleSetIfNotAdaptive->size();
194  // There may be the "complete event" scale added at the end.
195  // Reserve a sufficient number of scales to take this into
196  // account.
197  if (completeEventScale)
198  out->reserveScales(nsc + 2U);
199  else
200  out->reserveScales(nsc + 1U);
201  out->addScale(DBL_MAX);
202  const double* scales = &(*scaleSetIfNotAdaptive)[0];
203  for (unsigned i=0; i<nsc; ++i)
204  out->addScale(scales[i]);
205  if (completeEventScale)
206  out->addScale(completeEventScale);
207  }
208  else
209  {
210  throw cms::Exception("FFTJetBadConfig")
211  << "can't restore sparse clustering tree scales"
212  << std::endl;
213  }
214  }
int i
Definition: DBlmapReader.cc:9
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:17
bool isSparse() const
Definition: PattRecoTree.h:27
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:19
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:17
tuple node
Definition: Node.py:50
const std::vector< Node > & getNodes() const
Definition: PattRecoTree.h:28
const std::vector< ScaleType > & getScales() const
Definition: PattRecoTree.h:29
tuple out
Definition: dbtoconf.py:99
double Real
edm::TrieNode< PDet > Node
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 79 of file clusteringTreeConverters.h.

References i, python.Node::node, and diffTreeTool::tree.

Referenced by FFTJetPatRecoProducer::buildSparseProduct().

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