CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FFTJetProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FFTJetProducers
4 // Class: FFTJetProducer
5 //
13 //
14 // Original Author: Igor Volobouev
15 // Created: Sun Jun 20 14:32:36 CDT 2010
16 // $Id: FFTJetProducer.cc,v 1.16 2012/11/21 03:13:26 igv Exp $
17 //
18 //
19 
20 #include <iostream>
21 #include <fstream>
22 #include <functional>
23 #include <algorithm>
24 
25 // Header for this class
27 
28 // Additional FFTJet headers
29 #include "fftjet/VectorRecombinationAlgFactory.hh"
30 #include "fftjet/RecombinationAlgFactory.hh"
31 
32 // Framework include files
35 
36 // Data formats
48 
50 
56 
58 
60 
61 // Loader for the lookup tables
63 
64 
65 #define make_param(type, varname) const \
66  type & varname (ps.getParameter< type >( #varname ))
67 
68 #define init_param(type, varname) varname (ps.getParameter< type >( #varname ))
69 
70 // A generic switch statement based on jet type.
71 // Defining it in a single place avoids potential errors
72 // in case another jet type is introduced in the future.
73 //
74 // JPTJet is omitted for now: there is no reco::writeSpecific method
75 // for it (see header JetSpecific.h in the JetProducers package)
76 //
77 #define jet_type_switch(method, arg1, arg2) do {\
78  switch (jetType)\
79  {\
80  case CALOJET:\
81  method <reco::CaloJet> ( arg1 , arg2 );\
82  break;\
83  case PFJET:\
84  method <reco::PFJet> ( arg1 , arg2 );\
85  break;\
86  case GENJET:\
87  method <reco::GenJet> ( arg1 , arg2 );\
88  break;\
89  case TRACKJET:\
90  method <reco::TrackJet> ( arg1 , arg2 );\
91  break;\
92  case BASICJET:\
93  method <reco::BasicJet> ( arg1 , arg2 );\
94  break;\
95  default:\
96  assert(!"ERROR in FFTJetProducer : invalid jet type."\
97  " This is a bug. Please report.");\
98  }\
99 } while(0);
100 
101 namespace {
102  struct LocalSortByPt
103  {
104  template<class Jet>
105  inline bool operator()(const Jet& l, const Jet& r) const
106  {return l.pt() > r.pt();}
107  };
108 }
109 
110 using namespace fftjetcms;
111 
113  const std::string& name)
114 {
115  if (!name.compare("fixed"))
116  return FIXED;
117  else if (!name.compare("maximallyStable"))
118  return MAXIMALLY_STABLE;
119  else if (!name.compare("globallyAdaptive"))
120  return GLOBALLY_ADAPTIVE;
121  else if (!name.compare("locallyAdaptive"))
122  return LOCALLY_ADAPTIVE;
123  else if (!name.compare("fromGenJets"))
124  return FROM_GENJETS;
125  else
126  throw cms::Exception("FFTJetBadConfig")
127  << "Invalid resolution specification \""
128  << name << "\"" << std::endl;
129 }
130 
131 
132 template <typename T>
134  const std::string& alias, const std::string& tag)
135 {
136  produces<std::vector<reco::FFTAnyJet<T> > >(tag).setBranchAlias(alias);
137 }
138 
139 //
140 // constructors and destructor
141 //
143  : FFTJetInterface(ps),
144  myConfiguration(ps),
145  init_param(edm::InputTag, treeLabel),
146  init_param(bool, useGriddedAlgorithm),
147  init_param(bool, reuseExistingGrid),
148  init_param(unsigned, maxIterations),
149  init_param(unsigned, nJetsRequiredToConverge),
150  init_param(double, convergenceDistance),
151  init_param(bool, assignConstituents),
152  init_param(bool, resumConstituents),
153  init_param(bool, calculatePileup),
154  init_param(bool, subtractPileup),
155  init_param(bool, subtractPileupAs4Vec),
156  init_param(edm::InputTag, pileupLabel),
157  init_param(double, fixedScale),
158  init_param(double, minStableScale),
159  init_param(double, maxStableScale),
160  init_param(double, stabilityAlpha),
161  init_param(double, noiseLevel),
162  init_param(unsigned, nClustersRequested),
163  init_param(double, gridScanMaxEta),
164  init_param(std::string, recombinationAlgorithm),
165  init_param(bool, isCrisp),
166  init_param(double, unlikelyBgWeight),
167  init_param(double, recombinationDataCutoff),
168  init_param(edm::InputTag, genJetsLabel),
169  init_param(unsigned, maxInitialPreclusters),
170  resolution(parse_resolution(ps.getParameter<std::string>("resolution"))),
171  init_param(std::string, pileupTableRecord),
172  init_param(std::string, pileupTableName),
173  init_param(std::string, pileupTableCategory),
174  init_param(bool, loadPileupFromDB),
175 
176  minLevel(0),
177  maxLevel(0),
178  usedLevel(0),
179  unused(0.0),
180  iterationsPerformed(1U),
181  constituents(200)
182 {
183  // Check that the settings make sense
185  throw cms::Exception("FFTJetBadConfig")
186  << "Can't resum constituents if they are not assigned"
187  << std::endl;
188 
189  produces<reco::FFTJetProducerSummary>(outputLabel);
191  "alias", outputLabel));
193 
194  // Build the set of pattern recognition scales.
195  // This is needed in order to read the clustering tree
196  // from the event record.
198  ps.getParameter<edm::ParameterSet>("InitialScales"));
199  checkConfig(iniScales, "invalid set of scales");
200  std::sort(iniScales->begin(), iniScales->end(), std::greater<double>());
201 
202  // Most of the configuration has to be performed inside
203  // the "beginJob" method. This is because chaining of the
204  // parsers between this base class and the derived classes
205  // can not work from the constructor of the base class.
206 }
207 
208 
210 {
211 }
212 
213 //
214 // member functions
215 //
216 template<class Real>
218 {
220 
221  // Get the input
223  iEvent.getByLabel(treeLabel, input);
224 
225  if (!input->isSparse())
226  throw cms::Exception("FFTJetBadConfig")
227  << "The stored clustering tree is not sparse" << std::endl;
228 
231  sparseTree.sortNodes();
232 }
233 
234 
236  const SparseTree& /* tree */,
237  edm::Event& iEvent, const edm::EventSetup& /* iSetup */,
238  const fftjet::Functor1<bool,fftjet::Peak>& peakSelect,
239  std::vector<fftjet::Peak>* preclusters)
240 {
241  typedef reco::FFTAnyJet<reco::GenJet> InputJet;
242  typedef std::vector<InputJet> InputCollection;
243 
245  iEvent.getByLabel(genJetsLabel, input);
246 
247  const unsigned sz = input->size();
248  preclusters->reserve(sz);
249  for (unsigned i=0; i<sz; ++i)
250  {
251  const RecoFFTJet& jet(jetFromStorable((*input)[i].getFFTSpecific()));
252  fftjet::Peak p(jet.precluster());
253  const double scale(p.scale());
254  p.setEtaPhi(jet.vec().Eta(), jet.vec().Phi());
255  p.setMagnitude(jet.vec().Pt()/scale/scale);
256  p.setStatus(resolution);
257  if (peakSelect(p))
258  preclusters->push_back(p);
259  }
260 }
261 
262 
264  const SparseTree& tree,
265  const fftjet::Functor1<bool,fftjet::Peak>& peakSelect,
266  std::vector<fftjet::Peak>* preclusters)
267 {
268  nodes.clear();
269  selectTreeNodes(tree, peakSelect, &nodes);
270 
271  // Fill out the vector of preclusters using the tree node ids
272  const unsigned nNodes = nodes.size();
273  const SparseTree::NodeId* pnodes = nNodes ? &nodes[0] : 0;
274  preclusters->reserve(nNodes);
275  for (unsigned i=0; i<nNodes; ++i)
276  preclusters->push_back(
277  sparseTree.uncheckedNode(pnodes[i]).getCluster());
278 
279  // Remember the node id in the precluster and set
280  // the status word to indicate the resolution scheme used
281  fftjet::Peak* clusters = nNodes ? &(*preclusters)[0] : 0;
282  for (unsigned i=0; i<nNodes; ++i)
283  {
284  clusters[i].setCode(pnodes[i]);
285  clusters[i].setStatus(resolution);
286  }
287 }
288 
289 
291  const SparseTree& tree,
292  const fftjet::Functor1<bool,fftjet::Peak>& peakSelect,
293  std::vector<SparseTree::NodeId>* mynodes)
294 {
295  minLevel = maxLevel = usedLevel = 0;
296 
297  // Get the tree nodes which pass the cuts
298  // (according to the selected resolution strategy)
299  switch (resolution)
300  {
301  case FIXED:
302  {
303  usedLevel = tree.getLevel(fixedScale);
304  tree.getPassingNodes(usedLevel, peakSelect, mynodes);
305  }
306  break;
307 
308  case MAXIMALLY_STABLE:
309  {
310  const unsigned minStartingLevel = maxStableScale > 0.0 ?
311  tree.getLevel(maxStableScale) : 0;
312  const unsigned maxStartingLevel = minStableScale > 0.0 ?
313  tree.getLevel(minStableScale) : UINT_MAX;
314 
315  if (tree.stableClusterCount(
316  peakSelect, &minLevel, &maxLevel, stabilityAlpha,
317  minStartingLevel, maxStartingLevel))
318  {
319  usedLevel = (minLevel + maxLevel)/2;
320  tree.getPassingNodes(usedLevel, peakSelect, mynodes);
321  }
322  }
323  break;
324 
325  case GLOBALLY_ADAPTIVE:
326  {
327  const bool stable = tree.clusterCountLevels(
328  nClustersRequested, peakSelect, &minLevel, &maxLevel);
329  if (minLevel || maxLevel)
330  {
331  usedLevel = (minLevel + maxLevel)/2;
332  if (!stable)
333  {
334  const int maxlev = tree.maxStoredLevel();
335  bool levelFound = false;
336  for (int delta=0; delta<=maxlev && !levelFound; ++delta)
337  for (int ifac=1; ifac>-2 && !levelFound; ifac-=2)
338  {
339  const int level = usedLevel + ifac*delta;
340  if (level > 0 && level <= maxlev)
341  if (occupancy[level] == nClustersRequested)
342  {
343  usedLevel = level;
344  levelFound = true;
345  }
346  }
347  assert(levelFound);
348  }
349  }
350  else
351  {
352  // Can't find that exact number of preclusters.
353  // Try to get the next best thing.
354  usedLevel = 1;
355  const unsigned occ1 = occupancy[1];
356  if (nClustersRequested >= occ1)
357  {
358  const unsigned maxlev = tree.maxStoredLevel();
359  if (nClustersRequested > occupancy[maxlev])
360  usedLevel = maxlev;
361  else
362  {
363  // It would be nice to use "lower_bound" here,
364  // but the occupancy is not necessarily monotonous.
365  unsigned bestDelta = nClustersRequested > occ1 ?
366  nClustersRequested - occ1 : occ1 - nClustersRequested;
367  for (unsigned level=2; level<=maxlev; ++level)
368  {
369  const unsigned n = occupancy[level];
370  const unsigned d = nClustersRequested > n ?
371  nClustersRequested - n : n - nClustersRequested;
372  if (d < bestDelta)
373  {
374  bestDelta = d;
375  usedLevel = level;
376  }
377  }
378  }
379  }
380  }
381  tree.getPassingNodes(usedLevel, peakSelect, mynodes);
382  }
383  break;
384 
385  case LOCALLY_ADAPTIVE:
386  {
387  usedLevel = tree.getLevel(fixedScale);
388  tree.getMagS2OptimalNodes(peakSelect, nClustersRequested,
389  usedLevel, mynodes, &thresholds);
390  }
391  break;
392 
393  default:
394  assert(!"ERROR in FFTJetProducer::selectTreeNodes : "
395  "should never get here! This is a bug. Please report.");
396  }
397 }
398 
399 
401 {
402  const unsigned nClus = preclusters.size();
403  if (nClus)
404  {
405  fftjet::Peak* clus = &preclusters[0];
406  fftjet::Functor1<double,fftjet::Peak>&
407  scaleCalc(*recoScaleCalcPeak);
408  fftjet::Functor1<double,fftjet::Peak>&
409  ratioCalc(*recoScaleRatioCalcPeak);
410  fftjet::Functor1<double,fftjet::Peak>&
411  factorCalc(*memberFactorCalcPeak);
412 
413  for (unsigned i=0; i<nClus; ++i)
414  {
415  clus[i].setRecoScale(scaleCalc(clus[i]));
416  clus[i].setRecoScaleRatio(ratioCalc(clus[i]));
417  clus[i].setMembershipFactor(factorCalc(clus[i]));
418  }
419  }
420 }
421 
422 
424 {
425  int minBin = energyFlow->getEtaBin(-gridScanMaxEta);
426  if (minBin < 0)
427  minBin = 0;
428  int maxBin = energyFlow->getEtaBin(gridScanMaxEta) + 1;
429  if (maxBin < 0)
430  maxBin = 0;
431 
432  fftjet::DefaultRecombinationAlgFactory<
433  Real,VectorLike,BgData,VBuilder> factory;
434  if (factory[recombinationAlgorithm] == NULL)
435  throw cms::Exception("FFTJetBadConfig")
436  << "Invalid grid recombination algorithm \""
437  << recombinationAlgorithm << "\"" << std::endl;
438  gridAlg = std::auto_ptr<GridAlg>(
439  factory[recombinationAlgorithm]->create(
440  jetMembershipFunction.get(),
441  bgMembershipFunction.get(),
443  isCrisp, false, assignConstituents, minBin, maxBin));
444 }
445 
446 
448  const edm::Event& iEvent, const edm::InputTag& label,
449  std::auto_ptr<fftjet::Grid2d<fftjetcms::Real> >& flow)
450 {
452  iEvent.getByLabel(label, input);
453 
454  // Make sure that the grid is compatible with the stored one
455  bool rebuildGrid = flow.get() == NULL;
456  if (!rebuildGrid)
457  rebuildGrid =
458  !(flow->nEta() == input->nEtaBins() &&
459  flow->nPhi() == input->nPhiBins() &&
460  flow->etaMin() == input->etaMin() &&
461  flow->etaMax() == input->etaMax() &&
462  flow->phiBin0Edge() == input->phiBin0Edge());
463  if (rebuildGrid)
464  {
465  // We should not get here very often...
466  flow = std::auto_ptr<fftjet::Grid2d<Real> >(
467  new fftjet::Grid2d<Real>(
468  input->nEtaBins(), input->etaMin(), input->etaMax(),
469  input->nPhiBins(), input->phiBin0Edge(), input->title()));
470  }
471  flow->blockSet(input->data(), input->nEtaBins(), input->nPhiBins());
472  return rebuildGrid;
473 }
474 
475 
476 bool FFTJetProducer::checkConvergence(const std::vector<RecoFFTJet>& previous,
477  std::vector<RecoFFTJet>& nextSet)
478 {
479  fftjet::Functor2<double,RecoFFTJet,RecoFFTJet>&
480  distanceCalc(*jetDistanceCalc);
481 
482  const unsigned nJets = previous.size();
483  if (nJets != nextSet.size())
484  return false;
485 
486  const RecoFFTJet* prev = &previous[0];
487  RecoFFTJet* next = &nextSet[0];
488 
489  // Calculate convergence distances for all jets
490  bool converged = true;
491  for (unsigned i=0; i<nJets; ++i)
492  {
493  const double d = distanceCalc(prev[i], next[i]);
494  next[i].setConvergenceDistance(d);
495  if (i < nJetsRequiredToConverge && d > convergenceDistance)
496  converged = false;
497  }
498 
499  return converged;
500 }
501 
502 
504 {
505  fftjet::Functor1<double,RecoFFTJet>& scaleCalc(*recoScaleCalcJet);
506  fftjet::Functor1<double,RecoFFTJet>& ratioCalc(*recoScaleRatioCalcJet);
507  fftjet::Functor1<double,RecoFFTJet>& factorCalc(*memberFactorCalcJet);
508 
509  unsigned nJets = recoJets.size();
510  unsigned iterNum = 1U;
511  bool converged = false;
512  for (; iterNum<maxIterations && !converged; ++iterNum)
513  {
514  // Recreate the vector of preclusters using the jets
515  const RecoFFTJet* jets = &recoJets[0];
516  iterPreclusters.clear();
517  iterPreclusters.reserve(nJets);
518  for (unsigned i=0; i<nJets; ++i)
519  {
520  const RecoFFTJet& jet(jets[i]);
521  fftjet::Peak p(jet.precluster());
522  p.setEtaPhi(jet.vec().Eta(), jet.vec().Phi());
523  p.setRecoScale(scaleCalc(jet));
524  p.setRecoScaleRatio(ratioCalc(jet));
525  p.setMembershipFactor(factorCalc(jet));
526  iterPreclusters.push_back(p);
527  }
528 
529  // Run the algorithm
530  int status = 0;
532  status = gridAlg->run(iterPreclusters, *energyFlow,
533  &noiseLevel, 1U, 1U,
535  else
536  status = recoAlg->run(iterPreclusters, eventData, &noiseLevel, 1U,
538  if (status)
539  throw cms::Exception("FFTJetInterface")
540  << "FFTJet algorithm failed" << std::endl;
541 
542  // As it turns out, it is possible, in very rare cases,
543  // to have iterJets.size() != nJets at this point
544 
545  // Figure out if the iterations have converged
546  converged = checkConvergence(recoJets, iterJets);
547 
548  // Prepare for the next cycle
549  iterJets.swap(recoJets);
550  nJets = recoJets.size();
551  }
552 
553  // Check that we have the correct number of preclusters
554  if (preclusters.size() != nJets)
555  {
556  assert(nJets < preclusters.size());
558  assert(preclusters.size() == nJets);
559  }
560 
561  // Plug in the original precluster coordinates into the result
562  RecoFFTJet* jets = &recoJets[0];
563  for (unsigned i=0; i<nJets; ++i)
564  {
565  const fftjet::Peak& oldp(preclusters[i]);
566  jets[i].setPeakEtaPhi(oldp.eta(), oldp.phi());
567  }
568 
569  // If we have converged on the last cycle, the result
570  // would be indistinguishable from no convergence.
571  // Because of this, raise the counter by one to indicate
572  // the case when the convergence is not achieved.
573  if (!converged)
574  ++iterNum;
575 
576  return iterNum;
577 }
578 
579 
581 {
582  const unsigned nJets = recoJets.size();
583  const unsigned* clusterMask = gridAlg->getClusterMask();
584  const int nEta = gridAlg->getLastNEta();
585  const int nPhi = gridAlg->getLastNPhi();
586  const fftjet::Grid2d<Real>& g(*energyFlow);
587 
588  const unsigned nInputs = eventData.size();
589  const VectorLike* inp = nInputs ? &eventData[0] : 0;
590  const unsigned* candIdx = nInputs ? &candidateIndex[0] : 0;
591  for (unsigned i=0; i<nInputs; ++i)
592  {
593  const VectorLike& item(inp[i]);
594  const int iPhi = g.getPhiBin(item.Phi());
595  const int iEta = g.getEtaBin(item.Eta());
596  const unsigned mask = iEta >= 0 && iEta < nEta ?
597  clusterMask[iEta*nPhi + iPhi] : 0;
598  assert(mask <= nJets);
599  constituents[mask].push_back(inputCollection->ptrAt(candIdx[i]));
600  }
601 }
602 
603 
605 {
606  const unsigned nJets = recoJets.size();
607  const unsigned* clusterMask = recoAlg->getClusterMask();
608  const unsigned maskLength = recoAlg->getLastNData();
609  assert(maskLength == eventData.size());
610 
611  const unsigned* candIdx = maskLength ? &candidateIndex[0] : 0;
612  for (unsigned i=0; i<maskLength; ++i)
613  {
614  // In FFTJet, the mask value of 0 corresponds to unclustered
615  // energy. We will do the same here. Jet numbers are therefore
616  // shifted by 1 wrt constituents vector, and constituents[1]
617  // corresponds to jet number 0.
618  const unsigned mask = clusterMask[i];
619  assert(mask <= nJets);
620  constituents[mask].push_back(inputCollection->ptrAt(candIdx[i]));
621  }
622 }
623 
624 
625 // The following code more or less coincides with the similar method
626 // implemented in VirtualJetProducer
627 template <typename T>
629  const edm::EventSetup& iSetup)
630 {
631  using namespace reco;
632 
633  typedef FFTAnyJet<T> OutputJet;
634  typedef std::vector<OutputJet> OutputCollection;
635 
636  // Area of a single eta-phi cell for jet area calculations.
637  // Set it to 0 in case the module configuration does not allow
638  // us to calculate jet areas reliably.
639  double cellArea = useGriddedAlgorithm &&
641  energyFlow->etaBinWidth() * energyFlow->phiBinWidth() : 0.0;
642 
643  if (calculatePileup)
644  cellArea = pileupEnergyFlow->etaBinWidth() *
645  pileupEnergyFlow->phiBinWidth();
646 
647  // allocate output jet collection
648  std::auto_ptr<OutputCollection> jets(new OutputCollection());
649  const unsigned nJets = recoJets.size();
650  jets->reserve(nJets);
651 
652  bool sorted = true;
653  double previousPt = DBL_MAX;
654  for (unsigned ijet=0; ijet<nJets; ++ijet)
655  {
656  RecoFFTJet& myjet(recoJets[ijet]);
657 
658  // Check if we should resum jet constituents
659  VectorLike jet4vec(myjet.vec());
660  if (resumConstituents)
661  {
662  VectorLike sum(0.0, 0.0, 0.0, 0.0);
663  const unsigned nCon = constituents[ijet+1].size();
664  const reco::CandidatePtr* cn = nCon ? &constituents[ijet+1][0] : 0;
665  for (unsigned i=0; i<nCon; ++i)
666  sum += cn[i]->p4();
667  jet4vec = sum;
668  setJetStatusBit(&myjet, CONSTITUENTS_RESUMMED, true);
669  }
670 
671  // Subtract the pile-up
673  {
674  jet4vec = adjustForPileup(jet4vec, pileup[ijet],
678  else
679  setJetStatusBit(&myjet, PILEUP_SUBTRACTED_PT, true);
680  }
681 
682  // Write the specifics to the jet (simultaneously sets 4-vector,
683  // vertex, constituents). These are overridden functions that will
684  // call the appropriate specific code.
685  T jet;
686  writeSpecific(jet, jet4vec, vertexUsed(),
687  constituents[ijet+1], iSetup);
688 
689  // calcuate the jet area
690  double ncells = myjet.ncells();
691  if (calculatePileup)
692  {
693  ncells = cellCountsVec[ijet];
694  setJetStatusBit(&myjet, PILEUP_CALCULATED, true);
695  }
696  jet.setJetArea(cellArea*ncells);
697 
698  // add jet to the list
699  FFTJet<float> fj(jetToStorable<float>(myjet));
700  fj.setFourVec(jet4vec);
701  if (calculatePileup)
702  {
703  fj.setPileup(pileup[ijet]);
704  fj.setNCells(ncells);
705  }
706  jets->push_back(OutputJet(jet, fj));
707 
708  // Check whether the sequence remains sorted by pt
709  const double pt = jet.pt();
710  if (pt > previousPt)
711  sorted = false;
712  previousPt = pt;
713  }
714 
715  // Sort the collection
716  if (!sorted)
717  std::sort(jets->begin(), jets->end(), LocalSortByPt());
718 
719  // put the collection into the event
720  iEvent.put(jets, outputLabel);
721 }
722 
723 
725  const unsigned nPreclustersFound)
726 {
727  // Write recombined jets
728  jet_type_switch(writeJets, ev, iSetup);
729 
730  // Check if we should resum unclustered energy constituents
731  VectorLike unclusE(unclustered);
732  if (resumConstituents)
733  {
734  VectorLike sum(0.0, 0.0, 0.0, 0.0);
735  const unsigned nCon = constituents[0].size();
736  const reco::CandidatePtr* cn = nCon ? &constituents[0][0] : 0;
737  for (unsigned i=0; i<nCon; ++i)
738  sum += cn[i]->p4();
739  unclusE = sum;
740  }
741 
742  // Write the jet reconstruction summary
743  const double minScale = minLevel ? sparseTree.getScale(minLevel) : 0.0;
744  const double maxScale = maxLevel ? sparseTree.getScale(maxLevel) : 0.0;
745  const double scaleUsed = usedLevel ? sparseTree.getScale(usedLevel) : 0.0;
746 
747  std::auto_ptr<reco::FFTJetProducerSummary> summary(
749  thresholds, occupancy, unclusE,
750  constituents[0], unused,
751  minScale, maxScale, scaleUsed,
752  nPreclustersFound, iterationsPerformed,
753  iterationsPerformed == 1U ||
755  ev.put(summary, outputLabel);
756 }
757 
758 
759 // ------------ method called to for each event ------------
761  const edm::EventSetup& iSetup)
762 {
763  // Load the clustering tree made by FFTJetPatRecoProducer
765  loadSparseTreeData<float>(iEvent);
766  else
767  loadSparseTreeData<double>(iEvent);
768 
769  // Do we need to load the candidate collection?
771  loadInputCollection(iEvent);
772 
773  // Do we need to have discretized energy flow?
775  {
776  if (reuseExistingGrid)
777  {
778  if (loadEnergyFlow(iEvent, treeLabel, energyFlow))
779  buildGridAlg();
780  }
781  else
783  }
784 
785  // Calculate cluster occupancy as a function of level number
786  sparseTree.occupancyInScaleSpace(*peakSelector, &occupancy);
787 
788  // Select the preclusters using the requested resolution scheme
789  preclusters.clear();
790  if (resolution == FROM_GENJETS)
791  genJetPreclusters(sparseTree, iEvent, iSetup,
793  else
795  if (preclusters.size() > maxInitialPreclusters)
796  {
797  std::sort(preclusters.begin(), preclusters.end(), std::greater<fftjet::Peak>());
799  }
800 
801  // Prepare to run the jet recombination procedure
803 
804  // Assign membership functions to preclusters. If this function
805  // is not overriden in a derived class, default algorithm membership
806  // function will be used for every cluster.
808 
809  // Count the preclusters going in
810  unsigned nPreclustersFound = 0U;
811  const unsigned npre = preclusters.size();
812  for (unsigned i=0; i<npre; ++i)
813  if (preclusters[i].membershipFactor() > 0.0)
814  ++nPreclustersFound;
815 
816  // Run the recombination algorithm once
817  int status = 0;
819  status = gridAlg->run(preclusters, *energyFlow,
820  &noiseLevel, 1U, 1U,
822  else
823  status = recoAlg->run(preclusters, eventData, &noiseLevel, 1U,
825  if (status)
826  throw cms::Exception("FFTJetInterface")
827  << "FFTJet algorithm failed (first iteration)" << std::endl;
828 
829  // If requested, iterate the jet recombination procedure
830  if (maxIterations > 1U && !recoJets.empty())
831  {
832  // It is possible to have a smaller number of jets than we had
833  // preclusters. Fake preclusters are possible, but for a good
834  // choice of pattern recognition kernel their presence should
835  // be infrequent. However, any fake preclusters will throw the
836  // iterative reconstruction off balance. Deal with the problem now.
837  const unsigned nJets = recoJets.size();
838  if (preclusters.size() != nJets)
839  {
840  assert(nJets < preclusters.size());
842  }
844  }
845  else
846  iterationsPerformed = 1U;
847 
848  // Determine jet constituents. FFTJet returns a map
849  // of constituents which is inverse to what we need here.
850  const unsigned nJets = recoJets.size();
851  if (constituents.size() <= nJets)
852  constituents.resize(nJets + 1U);
853  if (assignConstituents)
854  {
855  for (unsigned i=0; i<=nJets; ++i)
856  constituents[i].clear();
859  else
861  }
862 
863  // Figure out the pile-up
864  if (calculatePileup)
865  {
866  if (loadPileupFromDB)
867  determinePileupDensityFromDB(iEvent, iSetup,
869  else
872  determinePileup();
873  assert(pileup.size() == recoJets.size());
874  }
875 
876  // Write out the results
877  saveResults(iEvent, iSetup, nPreclustersFound);
878 }
879 
880 
881 std::auto_ptr<fftjet::Functor1<bool,fftjet::Peak> >
883 {
885  ps.getParameter<edm::ParameterSet>("PeakSelectorConfiguration"));
886 }
887 
888 
889 // Parser for the jet membership function
890 std::auto_ptr<fftjet::ScaleSpaceKernel>
892 {
894  ps.getParameter<edm::ParameterSet>("jetMembershipFunction"));
895 }
896 
897 
898 // Parser for the background membership function
899 std::auto_ptr<AbsBgFunctor>
901 {
903  ps.getParameter<edm::ParameterSet>("bgMembershipFunction"));
904 }
905 
906 
907 // Calculator for the recombination scale
908 std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> >
910 {
912  ps.getParameter<edm::ParameterSet>("recoScaleCalcPeak"));
913 }
914 
915 
916 // Pile-up density calculator
917 std::auto_ptr<fftjetcms::AbsPileupCalculator>
919 {
921  ps.getParameter<edm::ParameterSet>("pileupDensityCalc"));
922 }
923 
924 
925 // Calculator for the recombination scale ratio
926 std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> >
928 {
930  ps.getParameter<edm::ParameterSet>("recoScaleRatioCalcPeak"));
931 }
932 
933 
934 // Calculator for the membership function factor
935 std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> >
937 {
939  ps.getParameter<edm::ParameterSet>("memberFactorCalcPeak"));
940 }
941 
942 
943 std::auto_ptr<fftjet::Functor1<double,FFTJetProducer::RecoFFTJet> >
945 {
947  ps.getParameter<edm::ParameterSet>("recoScaleCalcJet"));
948 }
949 
950 
951 std::auto_ptr<fftjet::Functor1<double,FFTJetProducer::RecoFFTJet> >
953 {
955  ps.getParameter<edm::ParameterSet>("recoScaleRatioCalcJet"));
956 }
957 
958 
959 std::auto_ptr<fftjet::Functor1<double,FFTJetProducer::RecoFFTJet> >
961 {
963  ps.getParameter<edm::ParameterSet>("memberFactorCalcJet"));
964 }
965 
966 
967 std::auto_ptr<fftjet::Functor2<
970 {
972  ps.getParameter<edm::ParameterSet>("jetDistanceCalc"));
973 }
974 
975 
976 void FFTJetProducer::assignMembershipFunctions(std::vector<fftjet::Peak>*)
977 {
978 }
979 
980 
981 // ------------ method called once each job just before starting event loop
983 {
985 
986  // Parse the peak selector definition
988  checkConfig(peakSelector, "invalid peak selector");
989 
991  checkConfig(jetMembershipFunction, "invalid jet membership function");
992 
994  checkConfig(bgMembershipFunction, "invalid noise membership function");
995 
996  // Build the energy recombination algorithm
997  if (!useGriddedAlgorithm)
998  {
999  fftjet::DefaultVectorRecombinationAlgFactory<
1000  VectorLike,BgData,VBuilder> factory;
1001  if (factory[recombinationAlgorithm] == NULL)
1002  throw cms::Exception("FFTJetBadConfig")
1003  << "Invalid vector recombination algorithm \""
1004  << recombinationAlgorithm << "\"" << std::endl;
1005  recoAlg = std::auto_ptr<RecoAlg>(
1006  factory[recombinationAlgorithm]->create(
1007  jetMembershipFunction.get(),
1008  &VectorLike::Et, &VectorLike::Eta, &VectorLike::Phi,
1009  bgMembershipFunction.get(),
1011  }
1012  else if (!reuseExistingGrid)
1013  {
1015  ps.getParameter<edm::ParameterSet>("GridConfiguration"));
1016  checkConfig(energyFlow, "invalid discretization grid");
1017  buildGridAlg();
1018  }
1019 
1020  // Create the grid subsequently used for pile-up subtraction
1021  if (calculatePileup)
1022  {
1024  ps.getParameter<edm::ParameterSet>("PileupGridConfiguration"));
1025  checkConfig(pileupEnergyFlow, "invalid pileup density grid");
1026 
1027  if (!loadPileupFromDB)
1028  {
1030  checkConfig(pileupDensityCalc, "invalid pile-up density calculator");
1031  }
1032  }
1033 
1034  // Parse the calculator of the recombination scale
1036  checkConfig(recoScaleCalcPeak, "invalid spec for the "
1037  "reconstruction scale calculator from peaks");
1038 
1039  // Parse the calculator of the recombination scale ratio
1041  checkConfig(recoScaleRatioCalcPeak, "invalid spec for the "
1042  "reconstruction scale ratio calculator from peaks");
1043 
1044  // Calculator for the membership function factor
1046  checkConfig(memberFactorCalcPeak, "invalid spec for the "
1047  "membership function factor calculator from peaks");
1048 
1049  if (maxIterations > 1)
1050  {
1051  // We are going to run iteratively. Make required objects.
1053  checkConfig(recoScaleCalcJet, "invalid spec for the "
1054  "reconstruction scale calculator from jets");
1055 
1057  checkConfig(recoScaleRatioCalcJet, "invalid spec for the "
1058  "reconstruction scale ratio calculator from jets");
1059 
1061  checkConfig(memberFactorCalcJet, "invalid spec for the "
1062  "membership function factor calculator from jets");
1063 
1065  checkConfig(memberFactorCalcJet, "invalid spec for the "
1066  "jet distance calculator");
1067  }
1068 }
1069 
1070 
1072 {
1073  // There are two possible reasons for fake preclusters:
1074  // 1. Membership factor was set to 0
1075  // 2. Genuine problem with pattern recognition
1076  //
1077  // Anyway, we need to match jets to preclusters and keep
1078  // only those preclusters that have been matched
1079  //
1080  std::vector<int> matchTable;
1081  const unsigned nmatched = matchOneToOne(
1082  recoJets, preclusters, JetToPeakDistance(), &matchTable);
1083 
1084  // Ensure that all jets have been matched.
1085  // If not, we must have a bug somewhere.
1086  assert(nmatched == recoJets.size());
1087 
1088  // Collect all matched preclusters
1089  iterPreclusters.clear();
1090  iterPreclusters.reserve(nmatched);
1091  for (unsigned i=0; i<nmatched; ++i)
1092  iterPreclusters.push_back(preclusters[matchTable[i]]);
1094 }
1095 
1096 
1098  const int mask, const bool value)
1099 {
1100  int status = jet->status();
1101  if (value)
1102  status |= mask;
1103  else
1104  status &= ~mask;
1105  jet->setStatus(status);
1106 }
1107 
1108 
1110  const edm::Event& iEvent, const edm::InputTag& label,
1111  std::auto_ptr<fftjet::Grid2d<fftjetcms::Real> >& density)
1112 {
1114  iEvent.getByLabel(label, summary);
1115 
1116  const reco::FFTJetPileupSummary& s(*summary);
1117  const AbsPileupCalculator& calc(*pileupDensityCalc);
1118  const bool phiDependent = calc.isPhiDependent();
1119 
1120  fftjet::Grid2d<Real>& g(*density);
1121  const unsigned nEta = g.nEta();
1122  const unsigned nPhi = g.nPhi();
1123 
1124  for (unsigned ieta=0; ieta<nEta; ++ieta)
1125  {
1126  const double eta(g.etaBinCenter(ieta));
1127 
1128  if (phiDependent)
1129  {
1130  for (unsigned iphi=0; iphi<nPhi; ++iphi)
1131  {
1132  const double phi(g.phiBinCenter(iphi));
1133  g.uncheckedSetBin(ieta, iphi, calc(eta, phi, s));
1134  }
1135  }
1136  else
1137  {
1138  const double pil = calc(eta, 0.0, s);
1139  for (unsigned iphi=0; iphi<nPhi; ++iphi)
1140  g.uncheckedSetBin(ieta, iphi, pil);
1141  }
1142  }
1143 }
1144 
1145 
1147  const edm::Event& iEvent, const edm::EventSetup& iSetup,
1148  const edm::InputTag& label,
1149  std::auto_ptr<fftjet::Grid2d<fftjetcms::Real> >& density)
1150 {
1153  iSetup, pileupTableRecord, h);
1154  boost::shared_ptr<npstat::StorableMultivariateFunctor> f =
1156 
1158  iEvent.getByLabel(label, summary);
1159 
1160  const float rho = summary->pileupRho();
1161  const bool phiDependent = f->minDim() == 3U;
1162 
1163  fftjet::Grid2d<Real>& g(*density);
1164  const unsigned nEta = g.nEta();
1165  const unsigned nPhi = g.nPhi();
1166 
1167  double functorArg[3] = {0.0, 0.0, 0.0};
1168  if (phiDependent)
1169  functorArg[2] = rho;
1170  else
1171  functorArg[1] = rho;
1172 
1173  for (unsigned ieta=0; ieta<nEta; ++ieta)
1174  {
1175  const double eta(g.etaBinCenter(ieta));
1176  functorArg[0] = eta;
1177 
1178  if (phiDependent)
1179  {
1180  for (unsigned iphi=0; iphi<nPhi; ++iphi)
1181  {
1182  functorArg[1] = g.phiBinCenter(iphi);
1183  g.uncheckedSetBin(ieta, iphi, (*f)(functorArg, 3U));
1184  }
1185  }
1186  else
1187  {
1188  const double pil = (*f)(functorArg, 2U);
1189  for (unsigned iphi=0; iphi<nPhi; ++iphi)
1190  g.uncheckedSetBin(ieta, iphi, pil);
1191  }
1192  }
1193 }
1194 
1195 
1197 {
1198  // This function works with crisp clustering only
1199  if (!isCrisp)
1200  assert(!"Pile-up subtraction for fuzzy clustering "
1201  "is not implemented yet");
1202 
1203  // Clear the pileup vector
1204  const unsigned nJets = recoJets.size();
1205  pileup.resize(nJets);
1206  if (nJets == 0)
1207  return;
1208  const VectorLike zero;
1209  for (unsigned i=0; i<nJets; ++i)
1210  pileup[i] = zero;
1211 
1212  // Pileup energy flow grid
1213  const fftjet::Grid2d<Real>& g(*pileupEnergyFlow);
1214  const unsigned nEta = g.nEta();
1215  const unsigned nPhi = g.nPhi();
1216  const double cellArea = g.etaBinWidth() * g.phiBinWidth();
1217 
1218  // Various calculators
1219  fftjet::Functor1<double,RecoFFTJet>& scaleCalc(*recoScaleCalcJet);
1220  fftjet::Functor1<double,RecoFFTJet>& ratioCalc(*recoScaleRatioCalcJet);
1221  fftjet::Functor1<double,RecoFFTJet>& factorCalc(*memberFactorCalcJet);
1222 
1223  // Make sure we have enough memory
1224  memFcns2dVec.resize(nJets);
1225  fftjet::AbsKernel2d** memFcns2d = &memFcns2dVec[0];
1226 
1227  doubleBuf.resize(nJets*4U + nJets*nPhi);
1228  double* recoScales = &doubleBuf[0];
1229  double* recoScaleRatios = recoScales + nJets;
1230  double* memFactors = recoScaleRatios + nJets;
1231  double* dEta = memFactors + nJets;
1232  double* dPhiBuf = dEta + nJets;
1233 
1234  cellCountsVec.resize(nJets);
1235  unsigned* cellCounts = &cellCountsVec[0];
1236 
1237  // Go over jets and collect the necessary info
1238  for (unsigned ijet=0; ijet<nJets; ++ijet)
1239  {
1240  const RecoFFTJet& jet(recoJets[ijet]);
1241  const fftjet::Peak& peak(jet.precluster());
1242 
1243  // Make sure we are using 2-d membership functions.
1244  // Pile-up subtraction scheme for 3-d functions should be different.
1245  fftjet::AbsMembershipFunction* m3d =
1246  dynamic_cast<fftjet::AbsMembershipFunction*>(
1247  peak.membershipFunction());
1248  if (m3d == 0)
1249  m3d = dynamic_cast<fftjet::AbsMembershipFunction*>(
1250  jetMembershipFunction.get());
1251  if (m3d)
1252  {
1253  assert(!"Pile-up subtraction for 3-d membership functions "
1254  "is not implemented yet");
1255  }
1256  else
1257  {
1258  fftjet::AbsKernel2d* m2d =
1259  dynamic_cast<fftjet::AbsKernel2d*>(
1260  peak.membershipFunction());
1261  if (m2d == 0)
1262  m2d = dynamic_cast<fftjet::AbsKernel2d*>(
1263  jetMembershipFunction.get());
1264  assert(m2d);
1265  memFcns2d[ijet] = m2d;
1266  }
1267  recoScales[ijet] = scaleCalc(jet);
1268  recoScaleRatios[ijet] = ratioCalc(jet);
1269  memFactors[ijet] = factorCalc(jet);
1270  cellCounts[ijet] = 0U;
1271 
1272  const double jetPhi = jet.vec().Phi();
1273  for (unsigned iphi=0; iphi<nPhi; ++iphi)
1274  {
1275  double dphi = g.phiBinCenter(iphi) - jetPhi;
1276  while (dphi > M_PI)
1277  dphi -= (2.0*M_PI);
1278  while (dphi < -M_PI)
1279  dphi += (2.0*M_PI);
1280  dPhiBuf[iphi*nJets+ijet] = dphi;
1281  }
1282  }
1283 
1284  // Go over all grid points and integrate
1285  // the pile-up energy density
1286  VBuilder vMaker;
1287  for (unsigned ieta=0; ieta<nEta; ++ieta)
1288  {
1289  const double eta(g.etaBinCenter(ieta));
1290  const Real* databuf = g.data() + ieta*nPhi;
1291 
1292  // Figure out dEta for each jet
1293  for (unsigned ijet=0; ijet<nJets; ++ijet)
1294  dEta[ijet] = eta - recoJets[ijet].vec().Eta();
1295 
1296  for (unsigned iphi=0; iphi<nPhi; ++iphi)
1297  {
1298  double maxW(0.0);
1299  unsigned maxWJet(nJets);
1300  const double* dPhi = dPhiBuf + iphi*nJets;
1301 
1302  for (unsigned ijet=0; ijet<nJets; ++ijet)
1303  {
1304  if (recoScaleRatios[ijet] > 0.0)
1305  memFcns2d[ijet]->setScaleRatio(recoScaleRatios[ijet]);
1306  const double f = memFactors[ijet]*
1307  (*memFcns2d[ijet])(dEta[ijet], dPhi[ijet],
1308  recoScales[ijet]);
1309  if (f > maxW)
1310  {
1311  maxW = f;
1312  maxWJet = ijet;
1313  }
1314  }
1315 
1316  if (maxWJet < nJets)
1317  {
1318  pileup[maxWJet] += vMaker(cellArea*databuf[iphi],
1319  eta, g.phiBinCenter(iphi));
1320  cellCounts[maxWJet]++;
1321  }
1322  }
1323  }
1324 }
1325 
1326 
1327 // ------------ method called once each job just after ending the event loop
1329 {
1330 }
1331 
1332 
1333 //define this as a plug-in
std::vector< std::vector< reco::CandidatePtr > > constituents
dbl * delta
Definition: mlp_gen.cc:36
virtual ~FFTJetProducer()
unsigned matchOneToOne(const std::vector< T1 > &v1, const std::vector< T2 > &v2, const DistanceCalculator &calc, std::vector< int > *matchFrom1To2, const double maxMatchingDistance=1.0e300)
Definition: matchOneToOne.h:41
T getParameter(std::string const &) const
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > pileupEnergyFlow
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
std::auto_ptr< RecoAlg > recoAlg
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > memberFactorCalcPeak
unsigned iterationsPerformed
std::vector< ProtoJet > OutputCollection
Definition: JetRecoTypes.h:63
virtual void beginJob()
const bool useGriddedAlgorithm
std::vector< fftjetcms::VectorLike > pileup
edm::Handle< reco::CandidateView > inputCollection
static Resolution parse_resolution(const std::string &name)
const bool resumConstituents
void selectTreeNodes(const SparseTree &tree, const fftjet::Functor1< bool, fftjet::Peak > &peakSelect, std::vector< SparseTree::NodeId > *nodes)
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:19
const double gridScanMaxEta
void saveResults(edm::Event &iEvent, const edm::EventSetup &, unsigned nPreclustersFound)
std::auto_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser(const edm::ParameterSet &ps)
virtual std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > parse_recoScaleRatioCalcPeak(const edm::ParameterSet &)
std::auto_ptr< GridAlg > gridAlg
std::auto_ptr< fftjetcms::AbsPileupCalculator > pileupDensityCalc
virtual void assignMembershipFunctions(std::vector< fftjet::Peak > *preclusters)
const reco::Particle::Point & vertexUsed() const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void loadInputCollection(const edm::Event &)
virtual std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > parse_peakSelector(const edm::ParameterSet &)
virtual std::auto_ptr< fftjetcms::AbsPileupCalculator > parse_pileupDensityCalc(const edm::ParameterSet &ps)
std::vector< InputItem > InputCollection
Definition: JetRecoTypes.h:62
virtual void determinePileupDensityFromDB(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::InputTag &label, std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > &density)
double BgData
const std::string recombinationAlgorithm
static const int stable
Definition: TopGenEvent.h:11
Definition: DDAxes.h:10
const double fixedScale
Data processing summary generated by FFTJetProducer.
virtual std::auto_ptr< fftjetcms::AbsBgFunctor > parse_bgMembershipFunction(const edm::ParameterSet &)
const bool subtractPileupAs4Vec
fftjet::RecombinedJet< VectorLike > jetFromStorable(const reco::FFTJet< Real > &jet)
Definition: jetConverters.h:61
#define NULL
Definition: scimark2.h:8
std::auto_ptr< fftjet::ScaleSpaceKernel > fftjet_MembershipFunction_parser(const edm::ParameterSet &ps)
void checkConfig(const Ptr &ptr, const char *message)
const double unlikelyBgWeight
void makeProduces(const std::string &alias, const std::string &tag)
const bool subtractPileup
Resolution resolution
std::auto_ptr< AbsPileupCalculator > fftjet_PileupCalculator_parser(const edm::ParameterSet &ps)
std::vector< double > doubleBuf
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > recoScaleCalcPeak
std::vector< fftjet::AbsKernel2d * > memFcns2dVec
std::vector< RecoFFTJet > recoJets
const bool isCrisp
T eta() const
const double recombinationDataCutoff
Summary info for pile-up determined by Gaussian filtering.
std::vector< unsigned > occupancy
const double minStableScale
const double maxStableScale
#define init_param(type, varname)
std::vector< fftjet::Peak > preclusters
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
void determineVectorConstituents()
virtual std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > parse_memberFactorCalcPeak(const edm::ParameterSet &)
void loadSparseTreeData(const edm::Event &)
std::auto_ptr< fftjetcms::AbsBgFunctor > bgMembershipFunction
const bool reuseExistingGrid
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjet_PeakSelector_parser(const edm::ParameterSet &ps)
const unsigned nClustersRequested
virtual void produce(edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:243
std::vector< unsigned > candidateIndex
std::auto_ptr< fftjet::Functor2< double, fftjet::RecombinedJet< VectorLike >, fftjet::RecombinedJet< VectorLike > > > fftjet_JetDistance_parser(const edm::ParameterSet &ps)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
std::auto_ptr< std::vector< double > > iniScales
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
math::XYZTLorentzVector VectorLike
unsigned usedLevel
virtual void determinePileupDensityFromConfig(const edm::Event &iEvent, const edm::InputTag &label, std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > &density)
double p4[4]
Definition: TauolaWrapper.h:92
std::auto_ptr< fftjet::Functor1< double, RecoFFTJet > > memberFactorCalcJet
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:168
virtual std::auto_ptr< fftjet::Functor1< double, RecoFFTJet > > parse_recoScaleCalcJet(const edm::ParameterSet &)
vector< PseudoJet > jets
Implements inheritance relationships for FFTJet jets.
Definition: FFTAnyJet.h:17
const double noiseLevel
static void setJetStatusBit(RecoFFTJet *jet, int mask, bool value)
std::vector< RecoFFTJet > iterJets
double f[11][100]
fftjet::SparseClusteringTree< fftjet::Peak, long > SparseTree
std::vector< unsigned > cellCountsVec
std::string pileupTableRecord
std::string pileupTableName
std::vector< double > thresholds
virtual std::auto_ptr< fftjet::Functor2< double, RecoFFTJet, RecoFFTJet > > parse_jetDistanceCalc(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
virtual void endJob()
unsigned iterateJetReconstruction()
void setNCells(const double nc)
Definition: FFTJet.h:85
const bool calculatePileup
const bool assignConstituents
bool storeInSinglePrecision() const
void setPileup(const math::XYZTLorentzVector &p)
Definition: FFTJet.h:81
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjet_PeakFunctor_parser(const edm::ParameterSet &ps)
bool checkConvergence(const std::vector< RecoFFTJet > &previousIterResult, std::vector< RecoFFTJet > &thisIterResult)
const edm::InputTag treeLabel
virtual void selectPreclusters(const SparseTree &tree, const fftjet::Functor1< bool, fftjet::Peak > &peakSelector, std::vector< fftjet::Peak > *preclusters)
double Real
void sparsePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::SparseClusteringTree< fftjet::Peak, long > *out)
#define M_PI
Definition: BFit3D.cc:3
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
const edm::InputTag genJetsLabel
const edm::ParameterSet myConfiguration
fftjet::RecombinedJet< fftjetcms::VectorLike > RecoFFTJet
const double stabilityAlpha
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > recoScaleRatioCalcPeak
virtual std::auto_ptr< fftjet::Functor1< double, RecoFFTJet > > parse_memberFactorCalcJet(const edm::ParameterSet &)
const unsigned maxInitialPreclusters
std::string pileupTableCategory
SparseTree sparseTree
virtual std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > parse_recoScaleCalcPeak(const edm::ParameterSet &)
void setFourVec(const math::XYZTLorentzVector &p)
Definition: FFTJet.h:82
std::vector< SparseTree::NodeId > nodes
void determineGriddedConstituents()
const double convergenceDistance
void writeJets(edm::Event &iEvent, const edm::EventSetup &)
virtual std::auto_ptr< fftjet::ScaleSpaceKernel > parse_jetMembershipFunction(const edm::ParameterSet &)
virtual std::auto_ptr< fftjet::Functor1< double, RecoFFTJet > > parse_recoScaleRatioCalcJet(const edm::ParameterSet &)
std::auto_ptr< fftjet::Functor1< double, RecoFFTJet > > recoScaleRatioCalcJet
const edm::InputTag pileupLabel
tuple level
Definition: testEve_cfg.py:34
#define jet_type_switch(method, arg1, arg2)
virtual void genJetPreclusters(const SparseTree &tree, edm::Event &, const edm::EventSetup &, const fftjet::Functor1< bool, fftjet::Peak > &peakSelector, std::vector< fftjet::Peak > *preclusters)
static bool loadEnergyFlow(const edm::Event &iEvent, const edm::InputTag &label, std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > &flow)
tuple status
Definition: ntuplemaker.py:245
virtual bool isPhiDependent() const =0
std::auto_ptr< AbsBgFunctor > fftjet_BgFunctor_parser(const edm::ParameterSet &ps)
long double T
static const Mapper & instance()
std::vector< fftjetcms::VectorLike > eventData
const std::string outputLabel
math::XYZTLorentzVector adjustForPileup(const math::XYZTLorentzVector &jet, const math::XYZTLorentzVector &pileup, bool subtractPileupAs4Vec)
fftjetcms::VectorLike unclustered
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > peakSelector
std::vector< fftjet::Peak > iterPreclusters
std::auto_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)
std::auto_ptr< fftjet::Functor2< double, RecoFFTJet, RecoFFTJet > > jetDistanceCalc
std::auto_ptr< fftjet::ScaleSpaceKernel > jetMembershipFunction
std::auto_ptr< fftjet::Functor1< double, fftjet::RecombinedJet< VectorLike > > > fftjet_JetFunctor_parser(const edm::ParameterSet &ps)
void writeSpecific(reco::CaloJet &jet, reco::Particle::LorentzVector const &p4, reco::Particle::Point const &point, std::vector< reco::CandidatePtr > const &constituents, edm::EventSetup const &c)
Definition: JetSpecific.cc:41
void removeFakePreclusters()
const unsigned maxIterations
std::auto_ptr< fftjet::Functor1< double, RecoFFTJet > > recoScaleCalcJet
void prepareRecombinationScales()
Definition: DDAxes.h:10