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