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, metsig::jet, and EnergyCorrector::pt.

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:29
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());
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());
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 288 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().

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

References i, and dbtoconf::out.

Referenced by FFTJetPatRecoProducer::buildDenseProduct().

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

Definition at line 407 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_bgMembershipFunction().

408 {
409  const std::string bg_Membership_type = ps.getParameter<std::string>(
410  "Class");
411 
412  if (!bg_Membership_type.compare("GaussianNoiseMembershipFcn"))
413  {
414  const double minWeight = ps.getParameter<double>("minWeight");
415  const double prior = ps.getParameter<double>("prior");
416  return std::auto_ptr<AbsBgFunctor>(
417  new fftjet::GaussianNoiseMembershipFcn(minWeight,prior));
418  }
419 
420  return std::auto_ptr<AbsBgFunctor>(NULL);
421 }
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 479 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetPatRecoProducer::FFTJetPatRecoProducer().

480 {
481  typedef std::auto_ptr<fftjet::ClusteringTreeSparsifier<fftjet::Peak,long> > return_type;
482 
483  const int maxLevelNumber = ps.getParameter<int>("maxLevelNumber");
484  const unsigned filterMask = ps.getParameter<unsigned>("filterMask");
485  const std::vector<double> userScalesV =
486  ps.getParameter<std::vector<double> >("userScales");
487  const unsigned nUserScales = userScalesV.size();
488  const double* userScales = nUserScales ? &userScalesV[0] : NULL;
489 
490  return return_type(
491  new fftjet::ClusteringTreeSparsifier<fftjet::Peak,long>(
492  maxLevelNumber,
493  filterMask,
494  userScales,
495  nUserScales
496  )
497  );
498 }
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 502 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().

503 {
504  typedef std::auto_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak> > return_type;
505 
506  const std::string calc_type = ps.getParameter<std::string>("Class");
507 
508  if (!calc_type.compare("PeakEtaPhiDistance"))
509  {
510  const double etaToPhiBandwidthRatio = ps.getParameter<double>(
511  "etaToPhiBandwidthRatio");
512  return return_type(new fftjet::PeakEtaPhiDistance(etaToPhiBandwidthRatio));
513  }
514 
515  if (!calc_type.compare("PeakEtaDependentDistance"))
516  {
517  std::auto_ptr<fftjet::LinearInterpolator1d> interp =
519  ps.getParameter<edm::ParameterSet>("Interpolator"));
520  const fftjet::LinearInterpolator1d* ip = interp.get();
521  if (ip == NULL)
522  return return_type(NULL);
523 
524  // Check that the interpolator is always positive
525  const unsigned n = ip->nx();
526  const double* data = ip->getData();
527  for (unsigned i=0; i<n; ++i)
528  if (data[i] <= 0.0)
529  return return_type(NULL);
530  if (ip->fLow() <= 0.0 || ip->fHigh() <= 0.0)
531  return return_type(NULL);
532 
533  return return_type(new fftjet::PeakEtaDependentDistance(*ip));
534  }
535 
536  return return_type(NULL);
537 }
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 912 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().

913 {
914  typedef std::auto_ptr<fftjet::Functor1<double,double> > return_type;
915 
916  const std::string fcn_type = ps.getParameter<std::string>("Class");
917 
918  if (!fcn_type.compare("LinearInterpolator1d"))
919  {
920  std::auto_ptr<fftjet::LinearInterpolator1d> p =
922  fftjet::LinearInterpolator1d* ptr = p.get();
923  if (ptr)
924  {
925  p.release();
926  return return_type(ptr);
927  }
928  }
929 
930  if (!fcn_type.compare("LinInterpolatedTable1D"))
931  {
932  std::auto_ptr<fftjetcms::LinInterpolatedTable1D> p =
934  fftjetcms::LinInterpolatedTable1D* ptr = p.get();
935  if (ptr)
936  {
937  p.release();
938  return return_type(ptr);
939  }
940  }
941 
942  if (!fcn_type.compare("Polynomial"))
943  {
944  std::vector<double> coeffs;
945  for (unsigned i=0; ; ++i)
946  {
947  std::ostringstream s;
948  s << 'c' << i;
949  if (ps.exists(s.str()))
950  coeffs.push_back(ps.getParameter<double>(s.str()));
951  else
952  break;
953  }
954  return return_type(new Polynomial(coeffs));
955  }
956 
957  return return_type(NULL);
958 }
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 132 of file FFTJetParameterParser.cc.

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

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

133 {
134  typedef std::auto_ptr<fftjet::Grid2d<Real> > return_type;
135  fftjet::Grid2d<Real> *g = 0;
136 
137  // Check if the grid should be read from file
138  if (ps.exists("file"))
139  {
140  const std::string file = ps.getParameter<std::string>("file");
141  std::ifstream in(file.c_str(),
142  std::ios_base::in | std::ios_base::binary);
143  if (!in.is_open())
144  throw cms::Exception("FFTJetBadConfig")
145  << "Failed to open file " << file << std::endl;
147  if (g == 0)
148  throw cms::Exception("FFTJetBadConfig")
149  << "Failed to read file " << file << std::endl;
150  }
151  else
152  {
153  const unsigned nEtaBins = ps.getParameter<unsigned>("nEtaBins");
154  const Real etaMin = ps.getParameter<Real>("etaMin");
155  const Real etaMax = ps.getParameter<Real>("etaMax");
156  const unsigned nPhiBins = ps.getParameter<unsigned>("nPhiBins");
157  const Real phiBin0Edge = ps.getParameter<Real>("phiBin0Edge");
159  "title", "");
160 
161  if (nEtaBins == 0 || nPhiBins == 0 || etaMin >= etaMax)
162  return return_type(NULL);
163 
164  g = new fftjet::Grid2d<Real>(
165  nEtaBins,
166  etaMin,
167  etaMax,
168  nPhiBins,
169  phiBin0Edge,
170  title.c_str()
171  );
172 
173  // Check if the grid data is provided
174  if (ps.exists("data"))
175  {
176  const std::vector<Real>& data =
177  ps.getParameter<std::vector<Real> >("data");
178  if (data.size() == nEtaBins*nPhiBins)
179  g->blockSet(&data[0], nEtaBins, nPhiBins);
180  else
181  {
182  delete g;
183  g = 0;
184  }
185  }
186  }
187 
188  return return_type(g);
189 }
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 887 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_jetDistanceCalc().

888 {
889  typedef std::auto_ptr<fftjet::Functor2<
890  double,
891  fftjet::RecombinedJet<VectorLike>,
892  fftjet::RecombinedJet<VectorLike> > > return_type;
893 
894  const std::string distance_type = ps.getParameter<std::string>(
895  "Class");
896 
897  if (!distance_type.compare("JetConvergenceDistance"))
898  {
899  make_param(double, etaToPhiBandwidthRatio);
900  make_param(double, relativePtBandwidth);
901 
902  if (etaToPhiBandwidthRatio > 0.0 && relativePtBandwidth > 0.0)
903  return return_type(new JetConvergenceDistance(
904  etaToPhiBandwidthRatio, relativePtBandwidth));
905  }
906 
907  return return_type(NULL);
908 }
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 754 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().

755 {
756  typedef fftjet::Functor1<double,RecoFFTJet> ptr_type;
757  typedef std::auto_ptr<ptr_type> return_type;
758 
759  const std::string property_type = ps.getParameter<std::string>("Class");
760 
761  if (!property_type.compare("Log"))
762  {
763  return_type wrapped = fftjet_JetFunctor_parser(
764  ps.getParameter<edm::ParameterSet>("function"));
765  fftjet::Functor1<double,RecoFFTJet>* wr = wrapped.get();
766  if (wr)
767  {
768  return_type result = return_type(
769  new fftjet::LogProperty<RecoFFTJet>(wr, true));
770  wrapped.release();
771  return result;
772  }
773  }
774 
775  if (!property_type.compare("JetEtaDependent"))
776  {
777  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
779  ps.getParameter<edm::ParameterSet>("function"));
780  fftjet::Functor1<double,double>* f1 = fcn1.get();
781  if (f1)
782  {
783  return_type result = return_type(new JetEtaDependent(f1, true));
784  fcn1.release();
785  return result;
786  }
787  }
788 
789  if (!property_type.compare("JetProperty"))
790  {
791  const std::string member = ps.getParameter<std::string>("member");
792  fftjet::JetProperty<RecoFFTJet>::JetMemberFunction fcn;
793  if (parse_jet_member_function(member.c_str(), &fcn))
794  return return_type(
795  new fftjet::JetProperty<RecoFFTJet>(fcn));
796  else
797  return return_type(NULL);
798  }
799 
800  if (!property_type.compare("ConstDouble"))
801  {
802  const double value = ps.getParameter<double>("value");
803  return return_type(new ConstDouble<RecoFFTJet>(value));
804  }
805 
806  if (!property_type.compare("ProportionalToScale"))
807  {
808  const double value = ps.getParameter<double>("value");
809  return return_type(
811  }
812 
813  if (!property_type.compare("MultiplyByConst"))
814  {
815  const double factor = ps.getParameter<double>("factor");
816  return_type function = fftjet_JetFunctor_parser(
817  ps.getParameter<edm::ParameterSet>("function"));
818  ptr_type* ptr = function.get();
819  if (ptr)
820  {
821  return_type result = return_type(
822  new MultiplyByConst<RecoFFTJet>(factor, ptr, true));
823  function.release();
824  return result;
825  }
826  }
827 
828  if (!property_type.compare("CompositeFunctor"))
829  {
830  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
832  ps.getParameter<edm::ParameterSet>("function1"));
833  return_type fcn2 = fftjet_JetFunctor_parser(
834  ps.getParameter<edm::ParameterSet>("function2"));
835  fftjet::Functor1<double,double>* f1 = fcn1.get();
836  ptr_type* f2 = fcn2.get();
837  if (f1 && f2)
838  {
839  return_type result = return_type(
840  new CompositeFunctor<RecoFFTJet>(f1, f2, true));
841  fcn1.release();
842  fcn2.release();
843  return result;
844  }
845  }
846 
847  if (!property_type.compare("ProductFunctor"))
848  {
849  return_type fcn1 = fftjet_JetFunctor_parser(
850  ps.getParameter<edm::ParameterSet>("function1"));
851  return_type fcn2 = fftjet_JetFunctor_parser(
852  ps.getParameter<edm::ParameterSet>("function2"));
853  ptr_type* f1 = fcn1.get();
854  ptr_type* f2 = fcn2.get();
855  if (f1 && f2)
856  {
857  return_type result = return_type(
858  new ProductFunctor<RecoFFTJet>(f1, f2, true));
859  fcn1.release();
860  fcn2.release();
861  return result;
862  }
863  }
864 
865  if (!property_type.compare("MagnitudeDependent"))
866  {
867  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
869  ps.getParameter<edm::ParameterSet>("function"));
870  fftjet::Functor1<double,double>* f1 = fcn1.get();
871  if (f1)
872  {
873  return_type result = return_type(
874  new MagnitudeDependent<RecoFFTJet>(f1, true));
875  fcn1.release();
876  return result;
877  }
878  }
879 
880  return return_type(NULL);
881 }
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 1025 of file FFTJetParameterParser.cc.

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

1026 {
1027  std::auto_ptr<fftjet::LinearInterpolator2d> responseCurve =
1029  ps.getParameter<edm::ParameterSet>("responseCurve"));
1030 
1031  const double minPredictor = ps.getParameter<double>("minPredictor");
1032  const double maxPredictor = ps.getParameter<double>("maxPredictor");
1033  const unsigned nPredPoints = ps.getParameter<unsigned>("nPredPoints");
1034  const double maxMagnitude = ps.getParameter<double>("maxMagnitude");
1035  const unsigned nMagPoints = ps.getParameter<unsigned>("nMagPoints");
1036 
1037  return (std::auto_ptr<fftjet::JetMagnitudeMapper2d<RecoFFTJet> >
1038  (new fftjet::JetMagnitudeMapper2d<RecoFFTJet>(
1039  *responseCurve,
1041  true,minPredictor,maxPredictor,nPredPoints,
1042  maxMagnitude,nMagPoints)));
1043 }
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 562 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().

563 {
564  const double xmin = ps.getParameter<double>("xmin");
565  const double xmax = ps.getParameter<double>("xmax");
566  const double flow = ps.getParameter<double>("flow");
567  const double fhigh = ps.getParameter<double>("fhigh");
568  const std::vector<double> data(
569  ps.getParameter<std::vector<double> >("data"));
570  if (data.empty())
571  return std::auto_ptr<fftjet::LinearInterpolator1d>(NULL);
572  else
573  return std::auto_ptr<fftjet::LinearInterpolator1d>(
574  new fftjet::LinearInterpolator1d(
575  &data[0], data.size(), xmin, xmax, flow, fhigh));
576 }
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 580 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().

581 {
582  const std::string file = ps.getParameter<std::string>("file");
583  std::ifstream in(file.c_str(),
584  std::ios_base::in | std::ios_base::binary);
585  if (!in.is_open())
586  throw cms::Exception("FFTJetBadConfig")
587  << "Failed to open file " << file << std::endl;
588  fftjet::LinearInterpolator2d* ip = fftjet::LinearInterpolator2d::read(in);
589  if (!ip)
590  throw cms::Exception("FFTJetBadConfig")
591  << "Failed to read file " << file << std::endl;
592  return std::auto_ptr<fftjet::LinearInterpolator2d>(ip);
593 }
T getParameter(std::string const &) const
std::auto_ptr< fftjetcms::LinInterpolatedTable1D > fftjetcms::fftjet_LinInterpolatedTable1D_parser ( const edm::ParameterSet ps)

Definition at line 541 of file FFTJetParameterParser.cc.

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

Referenced by fftjet_Function_parser().

542 {
543  const double xmin = ps.getParameter<double>("xmin");
544  const double xmax = ps.getParameter<double>("xmax");
545  const bool leftExtrapolationLinear =
546  ps.getParameter<bool>("leftExtrapolationLinear");
547  const bool rightExtrapolationLinear =
548  ps.getParameter<bool>("rightExtrapolationLinear");
549  const std::vector<double> data(
550  ps.getParameter<std::vector<double> >("data"));
551  if (data.empty())
552  return std::auto_ptr<fftjetcms::LinInterpolatedTable1D>(NULL);
553  else
554  return std::auto_ptr<fftjetcms::LinInterpolatedTable1D>(
556  &data[0], data.size(), xmin, xmax,
557  leftExtrapolationLinear, rightExtrapolationLinear));
558 }
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 271 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().

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

598 {
599  typedef fftjet::Functor1<double,fftjet::Peak> ptr_type;
600  typedef std::auto_ptr<ptr_type> return_type;
601 
602  const std::string property_type = ps.getParameter<std::string>("Class");
603 
604  if (!property_type.compare("Log"))
605  {
606  return_type wrapped = fftjet_PeakFunctor_parser(
607  ps.getParameter<edm::ParameterSet>("function"));
608  ptr_type* wr = wrapped.get();
609  if (wr)
610  {
611  return_type result = return_type(
612  new fftjet::LogProperty<fftjet::Peak>(wr, true));
613  wrapped.release();
614  return result;
615  }
616  }
617 
618  if (!property_type.compare("PeakProperty"))
619  {
620  const std::string member = ps.getParameter<std::string>("member");
621  fftjet::JetProperty<fftjet::Peak>::JetMemberFunction fcn;
622  if (parse_peak_member_function(member.c_str(), &fcn))
623  return return_type(
624  new fftjet::JetProperty<fftjet::Peak>(fcn));
625  else
626  return return_type(NULL);
627  }
628 
629  if (!property_type.compare("MinusScaledLaplacian"))
630  {
631  const double sx = ps.getParameter<double>("sx");
632  const double sy = ps.getParameter<double>("sx");
633  return return_type(
634  new fftjet::MinusScaledLaplacian<fftjet::Peak>(sx, sy));
635  }
636 
637  if (!property_type.compare("ScaledHessianDet"))
638  {
639  return return_type(
640  new fftjet::ScaledHessianDet<fftjet::Peak>());
641  }
642 
643  if (!property_type.compare("ScaledMagnitude"))
644  {
645  return return_type(
646  new fftjet::ScaledMagnitude<fftjet::Peak>());
647  }
648 
649  if (!property_type.compare("ScaledMagnitude2"))
650  {
651  return return_type(
652  new fftjet::ScaledMagnitude2<fftjet::Peak>());
653  }
654 
655  if (!property_type.compare("ConstDouble"))
656  {
657  const double value = ps.getParameter<double>("value");
658  return return_type(new ConstDouble<fftjet::Peak>(value));
659  }
660 
661  if (!property_type.compare("ProportionalToScale"))
662  {
663  const double value = ps.getParameter<double>("value");
664  return return_type(
666  }
667 
668  if (!property_type.compare("MultiplyByConst"))
669  {
670  const double factor = ps.getParameter<double>("factor");
671  return_type function = fftjet_PeakFunctor_parser(
672  ps.getParameter<edm::ParameterSet>("function"));
673  ptr_type* ptr = function.get();
674  if (ptr)
675  {
676  return_type result = return_type(
677  new MultiplyByConst<fftjet::Peak>(factor, ptr, true));
678  function.release();
679  return result;
680  }
681  }
682 
683  if (!property_type.compare("CompositeFunctor"))
684  {
685  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
687  ps.getParameter<edm::ParameterSet>("function1"));
688  return_type fcn2 = fftjet_PeakFunctor_parser(
689  ps.getParameter<edm::ParameterSet>("function2"));
690  fftjet::Functor1<double,double>* f1 = fcn1.get();
691  ptr_type* f2 = fcn2.get();
692  if (f1 && f2)
693  {
694  return_type result = return_type(
695  new CompositeFunctor<fftjet::Peak>(f1, f2, true));
696  fcn1.release();
697  fcn2.release();
698  return result;
699  }
700  }
701 
702  if (!property_type.compare("ProductFunctor"))
703  {
704  return_type fcn1 = fftjet_PeakFunctor_parser(
705  ps.getParameter<edm::ParameterSet>("function1"));
706  return_type fcn2 = fftjet_PeakFunctor_parser(
707  ps.getParameter<edm::ParameterSet>("function2"));
708  ptr_type* f1 = fcn1.get();
709  ptr_type* f2 = fcn2.get();
710  if (f1 && f2)
711  {
712  return_type result = return_type(
713  new ProductFunctor<fftjet::Peak>(f1, f2, true));
714  fcn1.release();
715  fcn2.release();
716  return result;
717  }
718  }
719 
720  if (!property_type.compare("MagnitudeDependent"))
721  {
722  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
724  ps.getParameter<edm::ParameterSet>("function"));
725  fftjet::Functor1<double,double>* f1 = fcn1.get();
726  if (f1)
727  {
728  return_type result = return_type(
729  new MagnitudeDependent<fftjet::Peak>(f1, true));
730  fcn1.release();
731  return result;
732  }
733  }
734 
735  if (!property_type.compare("PeakEtaDependent"))
736  {
737  std::auto_ptr<fftjet::Functor1<double,double> > fcn1 =
739  ps.getParameter<edm::ParameterSet>("function"));
740  fftjet::Functor1<double,double>* f1 = fcn1.get();
741  if (f1)
742  {
743  return_type result = return_type(new PeakEtaDependent(f1, true));
744  fcn1.release();
745  return result;
746  }
747  }
748 
749  return return_type(NULL);
750 }
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 1003 of file FFTJetParameterParser.cc.

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

1004 {
1005  std::auto_ptr<fftjet::LinearInterpolator2d> responseCurve =
1007  ps.getParameter<edm::ParameterSet>("responseCurve"));
1008 
1009  const double minPredictor = ps.getParameter<double>("minPredictor");
1010  const double maxPredictor = ps.getParameter<double>("maxPredictor");
1011  const unsigned nPredPoints = ps.getParameter<unsigned>("nPredPoints");
1012  const double maxMagnitude = ps.getParameter<double>("maxMagnitude");
1013  const unsigned nMagPoints = ps.getParameter<unsigned>("nMagPoints");
1014 
1015  return (std::auto_ptr<fftjet::JetMagnitudeMapper2d<fftjet::Peak> >
1016  (new fftjet::JetMagnitudeMapper2d<fftjet::Peak>(
1017  *responseCurve,
1019  true,minPredictor,maxPredictor,nPredPoints,
1020  maxMagnitude,nMagPoints)));
1021 }
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 193 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().

194 {
195  typedef std::auto_ptr<fftjet::Functor1<bool,fftjet::Peak> > return_type;
196 
197  const std::string peakselector_type = ps.getParameter<std::string>(
198  "Class");
199 
200  if (!peakselector_type.compare("AllPeaksPass"))
201  {
202  return return_type(new fftjet::AllPeaksPass());
203  }
204 
205  if (!peakselector_type.compare("EtaAndPtDependentPeakSelector"))
206  {
207  const std::string file = ps.getParameter<std::string>("file");
208  std::ifstream in(file.c_str(),
209  std::ios_base::in | std::ios_base::binary);
210  if (!in.is_open())
211  throw cms::Exception("FFTJetBadConfig")
212  << "Failed to open file " << file << std::endl;
215  if (!ptr->isValid())
216  throw cms::Exception("FFTJetBadConfig")
217  << "Failed to read file " << file << std::endl;
218  return return_type(ptr);
219  }
220 
221  if (!peakselector_type.compare("EtaAndPtLookupPeakSelector"))
222  {
223  make_param(unsigned, nx);
224  make_param(unsigned, ny);
225  make_param(double, xmin);
226  make_param(double, xmax);
227  make_param(double, ymin);
228  make_param(double, ymax);
229  make_param(std::vector<double>, data);
230 
231  if (xmin >= xmax || ymin >= ymax || !nx || !ny || data.size() != nx*ny)
232  throw cms::Exception("FFTJetBadConfig")
233  << "Failed to configure EtaAndPtLookupPeakSelector" << std::endl;
234 
235  return return_type(new EtaAndPtLookupPeakSelector(
236  nx, xmin, xmax, ny, ymin, ymax, data));
237  }
238 
239  if (!peakselector_type.compare("SimplePeakSelector"))
240  {
241  const double magCut = ps.getParameter<double>("magCut");
242  const double driftSpeedCut = ps.getParameter<double>("driftSpeedCut");
243  const double magSpeedCut = ps.getParameter<double>("magSpeedCut");
244  const double lifeTimeCut = ps.getParameter<double>("lifeTimeCut");
245  const double NNDCut = ps.getParameter<double>("NNDCut");
246  const double etaCut = ps.getParameter<double>("etaCut");
247  const double splitTimeCut = ps.getParameter<double>("splitTimeCut");
248  const double mergeTimeCut = ps.getParameter<double>("mergeTimeCut");
249 
250  return return_type(new fftjet::SimplePeakSelector(
251  magCut, driftSpeedCut, magSpeedCut, lifeTimeCut, NNDCut,
252  etaCut, splitTimeCut, mergeTimeCut));
253  }
254 
255  if (!peakselector_type.compare("ScalePowerPeakSelector"))
256  {
257  const double a = ps.getParameter<double>("a");
258  const double p = ps.getParameter<double>("p");
259  const double b = ps.getParameter<double>("b");
260  const double etaCut = ps.getParameter<double>("etaCut");
261 
262  return return_type(new fftjet::ScalePowerPeakSelector(
263  a, p, b, etaCut));
264  }
265 
266  return return_type(NULL);
267 }
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 962 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_pileupDensityCalc().

963 {
964  typedef std::auto_ptr<AbsPileupCalculator> return_type;
965 
966  const std::string fcn_type = ps.getParameter<std::string>("Class");
967 
968  if (!fcn_type.compare("EtaDependentPileup"))
969  {
970  std::auto_ptr<fftjet::LinearInterpolator2d> interp =
972  ps.getParameter<edm::ParameterSet>("Interpolator2d"));
973  const double inputRhoFactor = ps.getParameter<double>("inputRhoFactor");
974  const double outputRhoFactor = ps.getParameter<double>("outputRhoFactor");
975 
976  const fftjet::LinearInterpolator2d* ip = interp.get();
977  if (ip)
978  return return_type(new EtaDependentPileup(
979  *ip, inputRhoFactor, outputRhoFactor));
980  else
981  return return_type(NULL);
982  }
983 
984  if (!fcn_type.compare("PileupGrid2d"))
985  {
986  std::auto_ptr<fftjet::Grid2d<Real> > grid =
988  ps.getParameter<edm::ParameterSet>("Grid2d"));
989  const double rhoFactor = ps.getParameter<double>("rhoFactor");
990 
991  const fftjet::Grid2d<Real>* g = grid.get();
992  if (g)
993  return return_type(new PileupGrid2d(*g, rhoFactor));
994  else
995  return return_type(NULL);
996  }
997 
998  return return_type(NULL);
999 }
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 425 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().

426 {
427  typedef std::auto_ptr<std::vector<double> > return_type;
428 
429  const std::string className = ps.getParameter<std::string>("Class");
430 
431  if (!className.compare("EquidistantInLinearSpace") ||
432  !className.compare("EquidistantInLogSpace"))
433  {
434  const double minScale = ps.getParameter<double>("minScale");
435  const double maxScale = ps.getParameter<double>("maxScale");
436  const unsigned nScales = ps.getParameter<unsigned>("nScales");
437 
438  if (minScale <= 0.0 || maxScale <= 0.0 ||
439  nScales == 0 || minScale == maxScale)
440  return return_type(NULL);
441 
442  // Can't return pointers to EquidistantInLinearSpace
443  // or EquidistantInLogSpace directly because std::vector
444  // destructor is not virtual.
445  if (!className.compare("EquidistantInLinearSpace"))
446  return return_type(new std::vector<double>(
447  fftjet::EquidistantInLinearSpace(
448  minScale, maxScale, nScales)));
449  else
450  return return_type(new std::vector<double>(
451  fftjet::EquidistantInLogSpace(
452  minScale, maxScale, nScales)));
453  }
454 
455  if (!className.compare("UserSet"))
456  {
457  return_type scales(new std::vector<double>(
458  ps.getParameter<std::vector<double> >("scales")));
459 
460  // Verify that all scales are positive and unique
461  const unsigned nscales = scales->size();
462  for (unsigned i=0; i<nscales; ++i)
463  if ((*scales)[i] <= 0.0)
464  return return_type(NULL);
465 
466  for (unsigned i=1; i<nscales; ++i)
467  for (unsigned j=0; j<i; ++j)
468  if ((*scales)[i] == (*scales)[j])
469  return return_type(NULL);
470 
471  return scales;
472  }
473 
474  return return_type(NULL);
475 }
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 63 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().

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(), p.phi(), p.magnitude(),
75  hessian, p.driftSpeed(),
76  p.magSpeed(), p.lifetime(),
77  p.scale(), p.nearestNeighborDistance(),
78  jet.f_membershipFactor(),
79  jet.f_recoScale(),
80  jet.f_recoScaleRatio(),
81  p.clusterRadius(),
82  p.clusterSeparation(), jet.f_code(),
83  jet.f_status());
84  peak.setSplitTime(p.splitTime());
85  peak.setMergeTime(p.mergeTime());
86 
87  return RecoFFTJet(peak, jet.f_vec(), jet.f_ncells(), jet.f_etSum(),
88  jet.f_centroidEta(), jet.f_centroidPhi(),
89  jet.f_etaWidth(), jet.f_phiWidth(),
90  jet.f_etaPhiCorr(), jet.f_fuzziness(),
91  pileupPt, 0.0, jet.f_convergenceDistance());
92  }
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
Real f_convergenceDistance() const
Definition: FFTJet.h:72
int f_status() const
Definition: FFTJet.h:77
Real f_centroidPhi() const
Definition: FFTJet.h:67
int f_code() const
Definition: FFTJet.h:76
Real f_membershipFactor() const
Definition: FFTJet.h:75
fftjet::RecombinedJet< VectorLike > RecoFFTJet
Real f_etSum() const
Definition: FFTJet.h:65
Real f_phiWidth() const
Definition: FFTJet.h:69
Real f_centroidEta() const
Definition: FFTJet.h:66
Real f_recoScale() const
Definition: FFTJet.h:73
Real f_ncells() const
Definition: FFTJet.h:64
const math::XYZTLorentzVector & f_vec() const
Definition: FFTJet.h:62
const PattRecoPeak< Real > & f_precluster() const
Definition: FFTJet.h:61
Real f_etaWidth() const
Definition: FFTJet.h:68
Real f_etaPhiCorr() const
Definition: FFTJet.h:70
const math::XYZTLorentzVector & f_pileup() const
Definition: FFTJet.h:63
Real f_recoScaleRatio() const
Definition: FFTJet.h:74
Real f_fuzziness() const
Definition: FFTJet.h:71
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  peak.splitTime(),
50  peak.mergeTime()),
51  jet.vec(), jet.ncells(), jet.etSum(),
52  jet.centroidEta(), jet.centroidPhi(),
53  jet.etaWidth(), jet.phiWidth(),
54  jet.etaPhiCorr(), jet.fuzziness(),
55  jet.convergenceDistance(),
56  jet.recoScale(), jet.recoScaleRatio(),
57  jet.membershipFactor(),
58  jet.code(), jet.status());
59  }
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:74
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 141 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().

146  {
147  typedef fftjet::SparseClusteringTree<fftjet::Peak,long> SparseTree;
148  typedef reco::PattRecoPeak<Real> StoredPeak;
149  typedef reco::PattRecoNode<StoredPeak> StoredNode;
150  typedef reco::PattRecoTree<Real,StoredPeak> StoredTree;
151 
152  if (!in.isSparse())
153  throw cms::Exception("FFTJetBadConfig")
154  << "can't restore sparse clustering tree"
155  << " from densely stored record" << std::endl;
156 
157  assert(out);
158  out->clear();
159 
160  const std::vector<StoredNode>& nodes(in.getNodes());
161  const unsigned n = nodes.size();
162  out->reserveNodes(n + 1U);
163 
164  double hessian[3] = {0., 0., 0.};
165 
166  for (unsigned i=0; i<n; ++i)
167  {
168  const StoredNode& snode(nodes[i]);
169  const StoredPeak& p(snode.getCluster());
170  p.hessian(hessian);
171  fftjet::Peak peak(p.eta(), p.phi(), p.magnitude(),
172  hessian, p.driftSpeed(),
173  p.magSpeed(), p.lifetime(),
174  p.scale(), p.nearestNeighborDistance(),
175  1.0, 0.0, 0.0,
176  p.clusterRadius(), p.clusterSeparation());
177  peak.setSplitTime(p.splitTime());
178  peak.setMergeTime(p.mergeTime());
179  const SparseTree::Node node(peak, snode.originalLevel(),
180  snode.mask());
181  out->addNode(node, snode.parent());
182  }
183 
184  const std::vector<Real>& storedScales(in.getScales());
185  if (!storedScales.empty())
186  {
187  const unsigned nsc = storedScales.size();
188  out->reserveScales(nsc + 1U);
189  out->addScale(DBL_MAX);
190  const Real* scales = &storedScales[0];
191  for (unsigned i=0; i<nsc; ++i)
192  out->addScale(scales[i]);
193  }
194  else if (scaleSetIfNotAdaptive && !scaleSetIfNotAdaptive->empty())
195  {
196  const unsigned nsc = scaleSetIfNotAdaptive->size();
197  // There may be the "complete event" scale added at the end.
198  // Reserve a sufficient number of scales to take this into
199  // account.
200  if (completeEventScale)
201  out->reserveScales(nsc + 2U);
202  else
203  out->reserveScales(nsc + 1U);
204  out->addScale(DBL_MAX);
205  const double* scales = &(*scaleSetIfNotAdaptive)[0];
206  for (unsigned i=0; i<nsc; ++i)
207  out->addScale(scales[i]);
208  if (completeEventScale)
209  out->addScale(completeEventScale);
210  }
211  else
212  {
213  throw cms::Exception("FFTJetBadConfig")
214  << "can't restore sparse clustering tree scales"
215  << std::endl;
216  }
217  }
int i
Definition: DBlmapReader.cc:9
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:16
bool isSparse() const
Definition: PattRecoTree.h:26
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:18
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
tuple node
Definition: Node.py:50
const std::vector< Node > & getNodes() const
Definition: PattRecoTree.h:27
const std::vector< ScaleType > & getScales() const
Definition: PattRecoTree.h:28
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 MainPageGenerator::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  peak.splitTime(),
116  peak.mergeTime()),
117  node.originalLevel(),
118  node.mask(),
119  node.parent());
120  tree->addNode(sn);
121  }
122 
123  // Do we want to write out the scales? We will use the following
124  // convention: if the tree is using an adaptive algorithm, the scales
125  // will be written out. If not, they are not going to change from
126  // event to event. In this case the scales would waste disk space
127  // for no particularly good reason, so they will not be written out.
128  if (writeOutScaleInfo)
129  {
130  // Do not write out the meaningless top-level scale
131  const unsigned nScales = sparseTree.nLevels();
132  tree->reserveScales(nScales - 1);
133  for (unsigned i=1; i<nScales; ++i)
134  tree->addScale(sparseTree.getScale(i));
135  }
136  }
int i
Definition: DBlmapReader.cc:9
Tree nodes for storing FFTJet preclusters.
Definition: PattRecoNode.h:16
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:18
Preclusters from FFTJet pattern recognition stage.
Definition: PattRecoPeak.h:16
tuple node
Definition: Node.py:50
edm::TrieNode< PDet > Node