#include <RecoJets/FFTJetProducers/plugins/FFTJetProducer.h>
Public Types | |
typedef fftjet::RecombinedJet < fftjetcms::VectorLike > | RecoFFTJet |
enum | Resolution { FIXED = 0, MAXIMALLY_STABLE, GLOBALLY_ADAPTIVE, LOCALLY_ADAPTIVE } |
typedef fftjet::SparseClusteringTree < fftjet::Peak, long > | SparseTree |
enum | StatusBits { RESOLUTION = 0xff, CONSTITUENTS_RESUMMED = 0x100, PILEUP_CALCULATED = 0x200, PILEUP_SUBTRACTED_4VEC = 0x400, PILEUP_SUBTRACTED_PT = 0x800 } |
Public Member Functions | |
FFTJetProducer (const edm::ParameterSet &) | |
virtual | ~FFTJetProducer () |
Static Public Member Functions | |
static Resolution | parse_resolution (const std::string &name) |
Protected Member Functions | |
virtual void | assignMembershipFunctions (std::vector< fftjet::Peak > *preclusters) |
virtual void | beginJob () |
virtual void | endJob () |
virtual std::auto_ptr < fftjetcms::AbsBgFunctor > | parse_bgMembershipFunction (const edm::ParameterSet &) |
virtual std::auto_ptr < fftjet::Functor2< double, RecoFFTJet, RecoFFTJet > > | parse_jetDistanceCalc (const edm::ParameterSet &) |
virtual std::auto_ptr < fftjet::ScaleSpaceKernel > | parse_jetMembershipFunction (const edm::ParameterSet &) |
virtual std::auto_ptr < fftjet::Functor1< double, RecoFFTJet > > | parse_memberFactorCalcJet (const edm::ParameterSet &) |
virtual std::auto_ptr < fftjet::Functor1< double, fftjet::Peak > > | parse_memberFactorCalcPeak (const edm::ParameterSet &) |
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) |
virtual std::auto_ptr < fftjet::Functor1< double, RecoFFTJet > > | parse_recoScaleCalcJet (const edm::ParameterSet &) |
virtual std::auto_ptr < fftjet::Functor1< double, fftjet::Peak > > | parse_recoScaleCalcPeak (const edm::ParameterSet &) |
virtual std::auto_ptr < fftjet::Functor1< double, RecoFFTJet > > | parse_recoScaleRatioCalcJet (const edm::ParameterSet &) |
virtual std::auto_ptr < fftjet::Functor1< double, fftjet::Peak > > | parse_recoScaleRatioCalcPeak (const edm::ParameterSet &) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
virtual void | selectPreclusters (const SparseTree &tree, const fftjet::Functor1< bool, fftjet::Peak > &peakSelector, std::vector< fftjet::Peak > *preclusters) |
void | selectTreeNodes (const SparseTree &tree, const fftjet::Functor1< bool, fftjet::Peak > &peakSelect, std::vector< SparseTree::NodeId > *nodes) |
Private Types | |
typedef fftjet::AbsRecombinationAlg < fftjetcms::Real, fftjetcms::VectorLike, fftjetcms::BgData > | GridAlg |
typedef fftjet::AbsVectorRecombinationAlg < fftjetcms::VectorLike, fftjetcms::BgData > | RecoAlg |
Private Member Functions | |
void | buildGridAlg () |
bool | checkConvergence (const std::vector< RecoFFTJet > &previousIterResult, std::vector< RecoFFTJet > &thisIterResult) |
void | determineGriddedConstituents () |
void | determinePileup () |
virtual void | determinePileupDensity (const edm::Event &iEvent, const edm::InputTag &label, std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > &density) |
void | determineVectorConstituents () |
FFTJetProducer (const FFTJetProducer &) | |
FFTJetProducer () | |
unsigned | iterateJetReconstruction () |
template<class Real > | |
void | loadSparseTreeData (const edm::Event &) |
template<typename Jet > | |
void | makeProduces (const std::string &alias, const std::string &tag) |
FFTJetProducer & | operator= (const FFTJetProducer &) |
void | prepareRecombinationScales () |
void | removeFakePreclusters () |
void | saveResults (edm::Event &iEvent, const edm::EventSetup &, unsigned nPreclustersFound) |
template<typename Jet > | |
void | writeJets (edm::Event &iEvent, const edm::EventSetup &) |
Static Private Member Functions | |
static bool | loadEnergyFlow (const edm::Event &iEvent, const edm::InputTag &label, std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > &flow) |
static void | setJetStatusBit (RecoFFTJet *jet, int mask, bool value) |
Private Attributes | |
const bool | assignConstituents |
std::auto_ptr < fftjetcms::AbsBgFunctor > | bgMembershipFunction |
const bool | calculatePileup |
std::vector< unsigned > | cellCountsVec |
std::vector< std::vector < reco::CandidatePtr > > | constituents |
const double | convergenceDistance |
std::vector< double > | doubleBuf |
const double | fixedScale |
std::auto_ptr< GridAlg > | gridAlg |
const double | gridScanMaxEta |
std::auto_ptr< std::vector < double > > | iniScales |
const bool | isCrisp |
unsigned | iterationsPerformed |
std::vector< RecoFFTJet > | iterJets |
std::vector< fftjet::Peak > | iterPreclusters |
std::auto_ptr < fftjet::Functor2< double, RecoFFTJet, RecoFFTJet > > | jetDistanceCalc |
std::auto_ptr < fftjet::ScaleSpaceKernel > | jetMembershipFunction |
const unsigned | maxIterations |
unsigned | maxLevel |
const double | maxStableScale |
std::auto_ptr < fftjet::Functor1< double, RecoFFTJet > > | memberFactorCalcJet |
std::auto_ptr < fftjet::Functor1< double, fftjet::Peak > > | memberFactorCalcPeak |
std::vector < fftjet::AbsKernel2d * > | memFcns2dVec |
unsigned | minLevel |
const double | minStableScale |
const edm::ParameterSet | myConfiguration |
const unsigned | nClustersRequested |
const unsigned | nJetsRequiredToConverge |
std::vector< SparseTree::NodeId > | nodes |
const double | noiseLevel |
std::vector< unsigned > | occupancy |
std::auto_ptr < fftjet::Functor1< bool, fftjet::Peak > > | peakSelector |
std::vector < fftjetcms::VectorLike > | pileup |
std::auto_ptr < fftjetcms::AbsPileupCalculator > | pileupDensityCalc |
std::auto_ptr< fftjet::Grid2d < fftjetcms::Real > > | pileupEnergyFlow |
const edm::InputTag | pileupLabel |
std::vector< fftjet::Peak > | preclusters |
std::auto_ptr< RecoAlg > | recoAlg |
std::vector< RecoFFTJet > | recoJets |
const std::string | recombinationAlgorithm |
const double | recombinationDataCutoff |
std::auto_ptr < fftjet::Functor1< double, RecoFFTJet > > | recoScaleCalcJet |
std::auto_ptr < fftjet::Functor1< double, fftjet::Peak > > | recoScaleCalcPeak |
std::auto_ptr < fftjet::Functor1< double, RecoFFTJet > > | recoScaleRatioCalcJet |
std::auto_ptr < fftjet::Functor1< double, fftjet::Peak > > | recoScaleRatioCalcPeak |
Resolution | resolution |
const bool | resumConstituents |
const bool | reuseExistingGrid |
SparseTree | sparseTree |
const double | stabilityAlpha |
const bool | subtractPileup |
const bool | subtractPileupAs4Vec |
std::vector< double > | thresholds |
const edm::InputTag | treeLabel |
fftjetcms::VectorLike | unclustered |
const double | unlikelyBgWeight |
double | unused |
unsigned | usedLevel |
const bool | useGriddedAlgorithm |
Description: makes jets using FFTJet clustering tree
Implementation: [Notes on implementation]
Description: makes jets using FFTJet clustering tree
Implementation: If you want to change the jet algorithm functionality (for example, by providing your own jet membership function), derive from this class and override the appropriate parser method (for example, parse_jetMembershipFunction). At the end of your own parser, don't forget to call the parser of the base class in order to get the default behavior when your special configuration is not provided (this is known as the "chain-of-responsibility" design pattern). If you also need to override "beginJob" and/or "produce" methods, the first thing to do in your method is to call the corresponding method of this base.
Definition at line 58 of file FFTJetProducer.h.
typedef fftjet::AbsRecombinationAlg< fftjetcms::Real,fftjetcms::VectorLike,fftjetcms::BgData> FFTJetProducer::GridAlg [private] |
Definition at line 165 of file FFTJetProducer.h.
typedef fftjet::AbsVectorRecombinationAlg< fftjetcms::VectorLike,fftjetcms::BgData> FFTJetProducer::RecoAlg [private] |
Definition at line 163 of file FFTJetProducer.h.
typedef fftjet::RecombinedJet<fftjetcms::VectorLike> FFTJetProducer::RecoFFTJet |
Definition at line 62 of file FFTJetProducer.h.
typedef fftjet::SparseClusteringTree<fftjet::Peak,long> FFTJetProducer::SparseTree |
Definition at line 63 of file FFTJetProducer.h.
Definition at line 75 of file FFTJetProducer.h.
{ FIXED = 0, MAXIMALLY_STABLE, GLOBALLY_ADAPTIVE, LOCALLY_ADAPTIVE };
RESOLUTION | |
CONSTITUENTS_RESUMMED | |
PILEUP_CALCULATED | |
PILEUP_SUBTRACTED_4VEC | |
PILEUP_SUBTRACTED_PT |
Definition at line 66 of file FFTJetProducer.h.
{ RESOLUTION = 0xff, CONSTITUENTS_RESUMMED = 0x100, PILEUP_CALCULATED = 0x200, PILEUP_SUBTRACTED_4VEC = 0x400, PILEUP_SUBTRACTED_PT = 0x800 };
FFTJetProducer::FFTJetProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 126 of file FFTJetProducer.cc.
References assignConstituents, fftjetcms::FFTJetInterface::checkConfig(), Exception, fftjetcms::fftjet_ScaleSet_parser(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), iniScales, jet_type_switch, makeProduces(), fftjetcms::FFTJetInterface::outputLabel, resumConstituents, and python::multivaluedict::sort().
: FFTJetInterface(ps), myConfiguration(ps), init_param(edm::InputTag, treeLabel), init_param(bool, useGriddedAlgorithm), init_param(bool, reuseExistingGrid), init_param(unsigned, maxIterations), init_param(unsigned, nJetsRequiredToConverge), init_param(double, convergenceDistance), init_param(bool, assignConstituents), init_param(bool, resumConstituents), init_param(bool, calculatePileup), init_param(bool, subtractPileup), init_param(bool, subtractPileupAs4Vec), init_param(edm::InputTag, pileupLabel), init_param(double, fixedScale), init_param(double, minStableScale), init_param(double, maxStableScale), init_param(double, stabilityAlpha), init_param(double, noiseLevel), init_param(unsigned, nClustersRequested), init_param(double, gridScanMaxEta), init_param(std::string, recombinationAlgorithm), init_param(bool, isCrisp), init_param(double, unlikelyBgWeight), init_param(double, recombinationDataCutoff), resolution(parse_resolution(ps.getParameter<std::string>("resolution"))), minLevel(0), maxLevel(0), usedLevel(0), unused(0.0), iterationsPerformed(1U), constituents(200) { // Check that the settings make sense if (resumConstituents && !assignConstituents) throw cms::Exception("FFTJetBadConfig") << "Can't resum constituents if they are not assigned" << std::endl; produces<reco::FFTJetProducerSummary>(outputLabel); const std::string alias(ps.getUntrackedParameter<std::string>( "alias", outputLabel)); jet_type_switch(makeProduces, alias, outputLabel); // Build the set of pattern recognition scales. // This is needed in order to read the clustering tree // from the event record. iniScales = fftjet_ScaleSet_parser( ps.getParameter<edm::ParameterSet>("InitialScales")); checkConfig(iniScales, "invalid set of scales"); std::sort(iniScales->begin(), iniScales->end(), std::greater<double>()); // Most of the configuration has to be performed inside // the "beginJob" method. This is because chaining of the // parsers between this base class and the derived classes // can not work from the constructor of the base class. }
FFTJetProducer::~FFTJetProducer | ( | ) | [virtual] |
Definition at line 187 of file FFTJetProducer.cc.
{ }
FFTJetProducer::FFTJetProducer | ( | ) | [private] |
FFTJetProducer::FFTJetProducer | ( | const FFTJetProducer & | ) | [private] |
void FFTJetProducer::assignMembershipFunctions | ( | std::vector< fftjet::Peak > * | preclusters | ) | [protected, virtual] |
void FFTJetProducer::beginJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 915 of file FFTJetProducer.cc.
References assignConstituents, bgMembershipFunction, buildGridAlg(), calculatePileup, fftjetcms::FFTJetInterface::checkConfig(), fftjetcms::FFTJetInterface::energyFlow, reco::tau::disc::Eta(), Exception, fftjetcms::fftjet_Grid2d_parser(), edm::ParameterSet::getParameter(), isCrisp, jetDistanceCalc, jetMembershipFunction, maxIterations, memberFactorCalcJet, memberFactorCalcPeak, myConfiguration, NULL, parse_bgMembershipFunction(), parse_jetDistanceCalc(), parse_jetMembershipFunction(), parse_memberFactorCalcJet(), parse_memberFactorCalcPeak(), parse_peakSelector(), parse_pileupDensityCalc(), parse_recoScaleCalcJet(), parse_recoScaleCalcPeak(), parse_recoScaleRatioCalcJet(), parse_recoScaleRatioCalcPeak(), peakSelector, colinearityKinematic::Phi, pileupDensityCalc, pileupEnergyFlow, recoAlg, recombinationAlgorithm, recoScaleCalcJet, recoScaleCalcPeak, recoScaleRatioCalcJet, recoScaleRatioCalcPeak, reuseExistingGrid, unlikelyBgWeight, and useGriddedAlgorithm.
{ const edm::ParameterSet& ps(myConfiguration); // Parse the peak selector definition peakSelector = parse_peakSelector(ps); checkConfig(peakSelector, "invalid peak selector"); jetMembershipFunction = parse_jetMembershipFunction(ps); checkConfig(jetMembershipFunction, "invalid jet membership function"); bgMembershipFunction = parse_bgMembershipFunction(ps); checkConfig(bgMembershipFunction, "invalid noise membership function"); // Build the energy recombination algorithm if (!useGriddedAlgorithm) { fftjet::DefaultVectorRecombinationAlgFactory< VectorLike,BgData,VBuilder> factory; if (factory[recombinationAlgorithm] == NULL) throw cms::Exception("FFTJetBadConfig") << "Invalid vector recombination algorithm \"" << recombinationAlgorithm << "\"" << std::endl; recoAlg = std::auto_ptr<RecoAlg>( factory[recombinationAlgorithm]->create( jetMembershipFunction.get(), &VectorLike::Et, &VectorLike::Eta, &VectorLike::Phi, bgMembershipFunction.get(), unlikelyBgWeight, isCrisp, false, assignConstituents)); } else if (!reuseExistingGrid) { energyFlow = fftjet_Grid2d_parser( ps.getParameter<edm::ParameterSet>("GridConfiguration")); checkConfig(energyFlow, "invalid discretization grid"); buildGridAlg(); } // Create the grid subsequently used for pile-up subtraction if (calculatePileup) { pileupEnergyFlow = fftjet_Grid2d_parser( ps.getParameter<edm::ParameterSet>("PileupGridConfiguration")); checkConfig(pileupEnergyFlow, "invalid pileup density grid"); pileupDensityCalc = parse_pileupDensityCalc(ps); checkConfig(pileupDensityCalc, "invalid pile-up density calculator"); } // Parse the calculator of the recombination scale recoScaleCalcPeak = parse_recoScaleCalcPeak(ps); checkConfig(recoScaleCalcPeak, "invalid spec for the " "reconstruction scale calculator from peaks"); // Parse the calculator of the recombination scale ratio recoScaleRatioCalcPeak = parse_recoScaleRatioCalcPeak(ps); checkConfig(recoScaleRatioCalcPeak, "invalid spec for the " "reconstruction scale ratio calculator from peaks"); // Calculator for the membership function factor memberFactorCalcPeak = parse_memberFactorCalcPeak(ps); checkConfig(memberFactorCalcPeak, "invalid spec for the " "membership function factor calculator from peaks"); if (maxIterations > 1) { // We are going to run iteratively. Make required objects. recoScaleCalcJet = parse_recoScaleCalcJet(ps); checkConfig(recoScaleCalcJet, "invalid spec for the " "reconstruction scale calculator from jets"); recoScaleRatioCalcJet = parse_recoScaleRatioCalcJet(ps); checkConfig(recoScaleRatioCalcJet, "invalid spec for the " "reconstruction scale ratio calculator from jets"); memberFactorCalcJet = parse_memberFactorCalcJet(ps); checkConfig(memberFactorCalcJet, "invalid spec for the " "membership function factor calculator from jets"); jetDistanceCalc = parse_jetDistanceCalc(ps); checkConfig(memberFactorCalcJet, "invalid spec for the " "jet distance calculator"); } }
void FFTJetProducer::buildGridAlg | ( | ) | [private] |
Definition at line 373 of file FFTJetProducer.cc.
References assignConstituents, bgMembershipFunction, fftjetcms::FFTJetInterface::energyFlow, Exception, gridAlg, gridScanMaxEta, isCrisp, jetMembershipFunction, NULL, recombinationAlgorithm, recombinationDataCutoff, and unlikelyBgWeight.
Referenced by beginJob(), and produce().
{ int minBin = energyFlow->getEtaBin(-gridScanMaxEta); if (minBin < 0) minBin = 0; int maxBin = energyFlow->getEtaBin(gridScanMaxEta) + 1; if (maxBin < 0) maxBin = 0; fftjet::DefaultRecombinationAlgFactory< Real,VectorLike,BgData,VBuilder> factory; if (factory[recombinationAlgorithm] == NULL) throw cms::Exception("FFTJetBadConfig") << "Invalid grid recombination algorithm \"" << recombinationAlgorithm << "\"" << std::endl; gridAlg = std::auto_ptr<GridAlg>( factory[recombinationAlgorithm]->create( jetMembershipFunction.get(), bgMembershipFunction.get(), unlikelyBgWeight, recombinationDataCutoff, isCrisp, false, assignConstituents, minBin, maxBin)); }
bool FFTJetProducer::checkConvergence | ( | const std::vector< RecoFFTJet > & | previousIterResult, |
std::vector< RecoFFTJet > & | thisIterResult | ||
) | [private] |
Definition at line 426 of file FFTJetProducer.cc.
References convergenceDistance, i, and jetDistanceCalc.
Referenced by iterateJetReconstruction().
{ fftjet::Functor2<double,RecoFFTJet,RecoFFTJet>& distanceCalc(*jetDistanceCalc); const unsigned nJets = previous.size(); if (nJets != nextSet.size()) return false; const RecoFFTJet* prev = &previous[0]; RecoFFTJet* next = &nextSet[0]; // Calculate convergence distances for all jets bool converged = true; for (unsigned i=0; i<nJets; ++i) { const double d = distanceCalc(prev[i], next[i]); next[i].setConvergenceDistance(d); if (i < nJetsRequiredToConverge && d > convergenceDistance) converged = false; } return converged; }
void FFTJetProducer::determineGriddedConstituents | ( | ) | [private] |
Definition at line 530 of file FFTJetProducer.cc.
References fftjetcms::FFTJetInterface::candidateIndex, constituents, fftjetcms::FFTJetInterface::energyFlow, fftjetcms::FFTJetInterface::eventData, g, gridAlg, i, fftjetcms::FFTJetInterface::inputCollection, and recoJets.
Referenced by produce().
{ const unsigned nJets = recoJets.size(); const unsigned* clusterMask = gridAlg->getClusterMask(); const int nEta = gridAlg->getLastNEta(); const int nPhi = gridAlg->getLastNPhi(); const fftjet::Grid2d<Real>& g(*energyFlow); const unsigned nInputs = eventData.size(); const VectorLike* inp = nInputs ? &eventData[0] : 0; const unsigned* candIdx = nInputs ? &candidateIndex[0] : 0; for (unsigned i=0; i<nInputs; ++i) { const VectorLike& item(inp[i]); const int iPhi = g.getPhiBin(item.Phi()); const int iEta = g.getEtaBin(item.Eta()); const unsigned mask = iEta >= 0 && iEta < nEta ? clusterMask[iEta*nPhi + iPhi] : 0; assert(mask <= nJets); constituents[mask].push_back(inputCollection->ptrAt(candIdx[i])); } }
void FFTJetProducer::determinePileup | ( | ) | [private] |
Definition at line 1076 of file FFTJetProducer.cc.
References cellCountsVec, doubleBuf, dPhi(), eta(), f, g, i, isCrisp, metsig::jet, jetMembershipFunction, reco::btau::jetPhi, M_PI, memberFactorCalcJet, memFcns2dVec, pileup, pileupEnergyFlow, recoJets, recoScaleCalcJet, recoScaleRatioCalcJet, and zero.
Referenced by produce().
{ // This function works with crisp clustering only if (!isCrisp) assert(!"Pile-up subtraction for fuzzy clustering " "is not implemented yet"); // Clear the pileup vector const unsigned nJets = recoJets.size(); pileup.resize(nJets); if (nJets == 0) return; const VectorLike zero; for (unsigned i=0; i<nJets; ++i) pileup[i] = zero; // Pileup energy flow grid const fftjet::Grid2d<Real>& g(*pileupEnergyFlow); const unsigned nEta = g.nEta(); const unsigned nPhi = g.nPhi(); const double cellArea = g.etaBinWidth() * g.phiBinWidth(); // Various calculators fftjet::Functor1<double,RecoFFTJet>& scaleCalc(*recoScaleCalcJet); fftjet::Functor1<double,RecoFFTJet>& ratioCalc(*recoScaleRatioCalcJet); fftjet::Functor1<double,RecoFFTJet>& factorCalc(*memberFactorCalcJet); // Make sure we have enough memory memFcns2dVec.resize(nJets); fftjet::AbsKernel2d** memFcns2d = &memFcns2dVec[0]; doubleBuf.resize(nJets*4U + nJets*nPhi); double* recoScales = &doubleBuf[0]; double* recoScaleRatios = recoScales + nJets; double* memFactors = recoScaleRatios + nJets; double* dEta = memFactors + nJets; double* dPhiBuf = dEta + nJets; cellCountsVec.resize(nJets); unsigned* cellCounts = &cellCountsVec[0]; // Go over jets and collect the necessary info for (unsigned ijet=0; ijet<nJets; ++ijet) { const RecoFFTJet& jet(recoJets[ijet]); const fftjet::Peak& peak(jet.precluster()); // Make sure we are using 2-d membership functions. // Pile-up subtraction scheme for 3-d functions should be different. fftjet::AbsMembershipFunction* m3d = dynamic_cast<fftjet::AbsMembershipFunction*>( peak.membershipFunction()); if (m3d == 0) m3d = dynamic_cast<fftjet::AbsMembershipFunction*>( jetMembershipFunction.get()); if (m3d) { assert(!"Pile-up subtraction for 3-d membership functions " "is not implemented yet"); } else { fftjet::AbsKernel2d* m2d = dynamic_cast<fftjet::AbsKernel2d*>( peak.membershipFunction()); if (m2d == 0) m2d = dynamic_cast<fftjet::AbsKernel2d*>( jetMembershipFunction.get()); assert(m2d); memFcns2d[ijet] = m2d; } recoScales[ijet] = scaleCalc(jet); recoScaleRatios[ijet] = ratioCalc(jet); memFactors[ijet] = factorCalc(jet); cellCounts[ijet] = 0U; const double jetPhi = jet.vec().Phi(); for (unsigned iphi=0; iphi<nPhi; ++iphi) { double dphi = g.phiBinCenter(iphi) - jetPhi; while (dphi > M_PI) dphi -= (2.0*M_PI); while (dphi < -M_PI) dphi += (2.0*M_PI); dPhiBuf[iphi*nJets+ijet] = dphi; } } // Go over all grid points and integrate // the pile-up energy density VBuilder vMaker; for (unsigned ieta=0; ieta<nEta; ++ieta) { const double eta(g.etaBinCenter(ieta)); const Real* databuf = g.data() + ieta*nPhi; // Figure out dEta for each jet for (unsigned ijet=0; ijet<nJets; ++ijet) dEta[ijet] = eta - recoJets[ijet].vec().Eta(); for (unsigned iphi=0; iphi<nPhi; ++iphi) { double maxW(0.0); unsigned maxWJet(nJets); const double* dPhi = dPhiBuf + iphi*nJets; for (unsigned ijet=0; ijet<nJets; ++ijet) { if (recoScaleRatios[ijet] > 0.0) memFcns2d[ijet]->setScaleRatio(recoScaleRatios[ijet]); const double f = memFactors[ijet]* (*memFcns2d[ijet])(dEta[ijet], dPhi[ijet], recoScales[ijet]); if (f > maxW) { maxW = f; maxWJet = ijet; } } if (maxWJet < nJets) { pileup[maxWJet] += vMaker(cellArea*databuf[iphi], eta, g.phiBinCenter(iphi)); cellCounts[maxWJet]++; } } } }
void FFTJetProducer::determinePileupDensity | ( | const edm::Event & | iEvent, |
const edm::InputTag & | label, | ||
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > & | density | ||
) | [private, virtual] |
Definition at line 1039 of file FFTJetProducer.cc.
References eta(), g, edm::Event::getByLabel(), fftjetcms::AbsPileupCalculator::isPhiDependent(), phi, pileupDensityCalc, alignCSCRings::s, and summarizeEdmComparisonLogfiles::summary.
Referenced by produce().
{ edm::Handle<reco::FFTJetPileupSummary> summary; iEvent.getByLabel(label, summary); const reco::FFTJetPileupSummary& s(*summary); const AbsPileupCalculator& calc(*pileupDensityCalc); const bool phiDependent = calc.isPhiDependent(); fftjet::Grid2d<Real>& g(*density); const unsigned nEta = g.nEta(); const unsigned nPhi = g.nPhi(); for (unsigned ieta=0; ieta<nEta; ++ieta) { const double eta(g.etaBinCenter(ieta)); if (phiDependent) { for (unsigned iphi=0; iphi<nPhi; ++iphi) { const double phi(g.phiBinCenter(iphi)); g.uncheckedSetBin(ieta, iphi, calc(eta, phi, s)); } } else { const double pil = calc(eta, 0.0, s); for (unsigned iphi=0; iphi<nPhi; ++iphi) g.uncheckedSetBin(ieta, iphi, pil); } } }
void FFTJetProducer::determineVectorConstituents | ( | ) | [private] |
Definition at line 554 of file FFTJetProducer.cc.
References fftjetcms::FFTJetInterface::candidateIndex, constituents, fftjetcms::FFTJetInterface::eventData, i, fftjetcms::FFTJetInterface::inputCollection, recoAlg, and recoJets.
Referenced by produce().
{ const unsigned nJets = recoJets.size(); const unsigned* clusterMask = recoAlg->getClusterMask(); const unsigned maskLength = recoAlg->getLastNData(); assert(maskLength == eventData.size()); const unsigned* candIdx = maskLength ? &candidateIndex[0] : 0; for (unsigned i=0; i<maskLength; ++i) { // In FFTJet, the mask value of 0 corresponds to unclustered // energy. We will do the same here. Jet numbers are therefore // shifted by 1 wrt constituents vector, and constituents[1] // corresponds to jet number 0. const unsigned mask = clusterMask[i]; assert(mask <= nJets); constituents[mask].push_back(inputCollection->ptrAt(candIdx[i])); } }
void FFTJetProducer::endJob | ( | void | ) | [protected, virtual] |
unsigned FFTJetProducer::iterateJetReconstruction | ( | ) | [private] |
Definition at line 453 of file FFTJetProducer.cc.
References checkConvergence(), fftjetcms::FFTJetInterface::energyFlow, fftjetcms::FFTJetInterface::eventData, Exception, gridAlg, i, iterJets, iterPreclusters, metsig::jet, analyzePatCleaning_cfg::jets, maxIterations, memberFactorCalcJet, noiseLevel, AlCaHLTBitMon_ParallelJobs::p, preclusters, recoAlg, recoJets, recoScaleCalcJet, recoScaleRatioCalcJet, removeFakePreclusters(), ntuplemaker::status, unclustered, unused, and useGriddedAlgorithm.
Referenced by produce().
{ fftjet::Functor1<double,RecoFFTJet>& scaleCalc(*recoScaleCalcJet); fftjet::Functor1<double,RecoFFTJet>& ratioCalc(*recoScaleRatioCalcJet); fftjet::Functor1<double,RecoFFTJet>& factorCalc(*memberFactorCalcJet); unsigned nJets = recoJets.size(); unsigned iterNum = 1U; bool converged = false; for (; iterNum<maxIterations && !converged; ++iterNum) { // Recreate the vector of preclusters using the jets const RecoFFTJet* jets = &recoJets[0]; iterPreclusters.clear(); iterPreclusters.reserve(nJets); for (unsigned i=0; i<nJets; ++i) { const RecoFFTJet& jet(jets[i]); fftjet::Peak p(jet.precluster()); p.setEtaPhi(jet.vec().Eta(), jet.vec().Phi()); p.setRecoScale(scaleCalc(jet)); p.setRecoScaleRatio(ratioCalc(jet)); p.setMembershipFactor(factorCalc(jet)); iterPreclusters.push_back(p); } // Run the algorithm int status = 0; if (useGriddedAlgorithm) status = gridAlg->run(iterPreclusters, *energyFlow, &noiseLevel, 1U, 1U, &iterJets, &unclustered, &unused); else status = recoAlg->run(iterPreclusters, eventData, &noiseLevel, 1U, &iterJets, &unclustered, &unused); if (status) throw cms::Exception("FFTJetInterface") << "FFTJet algorithm failed" << std::endl; // As it turns out, it is possible, in very rare cases, // to have iterJets.size() != nJets at this point // Figure out if the iterations have converged converged = checkConvergence(recoJets, iterJets); // Prepare for the next cycle iterJets.swap(recoJets); nJets = recoJets.size(); } // Check that we have the correct number of preclusters if (preclusters.size() != nJets) { assert(nJets < preclusters.size()); removeFakePreclusters(); assert(preclusters.size() == nJets); } // Plug in the original precluster coordinates into the result RecoFFTJet* jets = &recoJets[0]; for (unsigned i=0; i<nJets; ++i) { const fftjet::Peak& oldp(preclusters[i]); jets[i].setPeakEtaPhi(oldp.eta(), oldp.phi()); } // If we have converged on the last cycle, the result // would be indistinguishable from no convergence. // Because of this, raise the counter by one to indicate // the case when the convergence is not achieved. if (!converged) ++iterNum; return iterNum; }
bool FFTJetProducer::loadEnergyFlow | ( | const edm::Event & | iEvent, |
const edm::InputTag & | label, | ||
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > & | flow | ||
) | [static, private] |
Definition at line 397 of file FFTJetProducer.cc.
References edm::Event::getByLabel(), collect_tpl::input, and NULL.
Referenced by produce().
{ edm::Handle<reco::DiscretizedEnergyFlow> input; iEvent.getByLabel(label, input); // Make sure that the grid is compatible with the stored one bool rebuildGrid = flow.get() == NULL; if (!rebuildGrid) rebuildGrid = !(flow->nEta() == input->nEtaBins() && flow->nPhi() == input->nPhiBins() && flow->etaMin() == input->etaMin() && flow->etaMax() == input->etaMax() && flow->phiBin0Edge() == input->phiBin0Edge()); if (rebuildGrid) { // We should not get here very often... flow = std::auto_ptr<fftjet::Grid2d<Real> >( new fftjet::Grid2d<Real>( input->nEtaBins(), input->etaMin(), input->etaMax(), input->nPhiBins(), input->phiBin0Edge(), input->title())); } flow->blockSet(input->data(), input->nEtaBins(), input->nPhiBins()); return rebuildGrid; }
void FFTJetProducer::loadSparseTreeData | ( | const edm::Event & | iEvent | ) | [private] |
Definition at line 195 of file FFTJetProducer.cc.
References edm::Event::getByLabel(), fftjetcms::FFTJetInterface::getEventScale(), iniScales, collect_tpl::input, fftjetcms::sparsePeakTreeFromStorable(), sparseTree, and treeLabel.
{ typedef reco::PattRecoTree<Real,reco::PattRecoPeak<Real> > StoredTree; // Get the input edm::Handle<StoredTree> input; iEvent.getByLabel(treeLabel, input); if (!input->isSparse()) throw cms::Exception("FFTJetBadConfig") << "The stored clustering tree is not sparse" << std::endl; sparsePeakTreeFromStorable(*input, iniScales.get(), getEventScale(), &sparseTree); sparseTree.sortNodes(); }
void FFTJetProducer::makeProduces | ( | const std::string & | alias, |
const std::string & | tag | ||
) | [private] |
Definition at line 117 of file FFTJetProducer.cc.
References GlobalPosition_Frontier_DevDB_cff::tag.
Referenced by FFTJetProducer().
{ produces<std::vector<reco::FFTAnyJet<T> > >(tag).setBranchAlias(alias); }
FFTJetProducer& FFTJetProducer::operator= | ( | const FFTJetProducer & | ) | [private] |
std::auto_ptr< AbsBgFunctor > FFTJetProducer::parse_bgMembershipFunction | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 833 of file FFTJetProducer.cc.
References fftjetcms::fftjet_BgFunctor_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_BgFunctor_parser( ps.getParameter<edm::ParameterSet>("bgMembershipFunction")); }
std::auto_ptr< fftjet::Functor2< double, FFTJetProducer::RecoFFTJet, FFTJetProducer::RecoFFTJet > > FFTJetProducer::parse_jetDistanceCalc | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 902 of file FFTJetProducer.cc.
References fftjetcms::fftjet_JetDistance_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_JetDistance_parser( ps.getParameter<edm::ParameterSet>("jetDistanceCalc")); }
std::auto_ptr< fftjet::ScaleSpaceKernel > FFTJetProducer::parse_jetMembershipFunction | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 824 of file FFTJetProducer.cc.
References fftjetcms::fftjet_MembershipFunction_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_MembershipFunction_parser( ps.getParameter<edm::ParameterSet>("jetMembershipFunction")); }
std::auto_ptr< fftjet::Functor1< double, FFTJetProducer::RecoFFTJet > > FFTJetProducer::parse_memberFactorCalcJet | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 893 of file FFTJetProducer.cc.
References fftjetcms::fftjet_JetFunctor_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_JetFunctor_parser( ps.getParameter<edm::ParameterSet>("memberFactorCalcJet")); }
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > FFTJetProducer::parse_memberFactorCalcPeak | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 869 of file FFTJetProducer.cc.
References fftjetcms::fftjet_PeakFunctor_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_PeakFunctor_parser( ps.getParameter<edm::ParameterSet>("memberFactorCalcPeak")); }
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > FFTJetProducer::parse_peakSelector | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 815 of file FFTJetProducer.cc.
References fftjetcms::fftjet_PeakSelector_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_PeakSelector_parser( ps.getParameter<edm::ParameterSet>("PeakSelectorConfiguration")); }
std::auto_ptr< fftjetcms::AbsPileupCalculator > FFTJetProducer::parse_pileupDensityCalc | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 851 of file FFTJetProducer.cc.
References fftjetcms::fftjet_PileupCalculator_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_PileupCalculator_parser( ps.getParameter<edm::ParameterSet>("pileupDensityCalc")); }
std::auto_ptr< fftjet::Functor1< double, FFTJetProducer::RecoFFTJet > > FFTJetProducer::parse_recoScaleCalcJet | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 877 of file FFTJetProducer.cc.
References fftjetcms::fftjet_JetFunctor_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_JetFunctor_parser( ps.getParameter<edm::ParameterSet>("recoScaleCalcJet")); }
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > FFTJetProducer::parse_recoScaleCalcPeak | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 842 of file FFTJetProducer.cc.
References fftjetcms::fftjet_PeakFunctor_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_PeakFunctor_parser( ps.getParameter<edm::ParameterSet>("recoScaleCalcPeak")); }
std::auto_ptr< fftjet::Functor1< double, FFTJetProducer::RecoFFTJet > > FFTJetProducer::parse_recoScaleRatioCalcJet | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 885 of file FFTJetProducer.cc.
References fftjetcms::fftjet_JetFunctor_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_JetFunctor_parser( ps.getParameter<edm::ParameterSet>("recoScaleRatioCalcJet")); }
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > FFTJetProducer::parse_recoScaleRatioCalcPeak | ( | const edm::ParameterSet & | ps | ) | [protected, virtual] |
Definition at line 860 of file FFTJetProducer.cc.
References fftjetcms::fftjet_PeakFunctor_parser(), and edm::ParameterSet::getParameter().
Referenced by beginJob().
{ return fftjet_PeakFunctor_parser( ps.getParameter<edm::ParameterSet>("recoScaleRatioCalcPeak")); }
FFTJetProducer::Resolution FFTJetProducer::parse_resolution | ( | const std::string & | name | ) | [static] |
Definition at line 98 of file FFTJetProducer.cc.
References Exception.
{ if (!name.compare("fixed")) return FIXED; else if (!name.compare("maximallyStable")) return MAXIMALLY_STABLE; else if (!name.compare("globallyAdaptive")) return GLOBALLY_ADAPTIVE; else if (!name.compare("locallyAdaptive")) return LOCALLY_ADAPTIVE; else throw cms::Exception("FFTJetBadConfig") << "Invalid resolution specification \"" << name << "\"" << std::endl; }
void FFTJetProducer::prepareRecombinationScales | ( | ) | [private] |
Definition at line 350 of file FFTJetProducer.cc.
References i, memberFactorCalcPeak, preclusters, recoScaleCalcPeak, and recoScaleRatioCalcPeak.
Referenced by produce().
{ const unsigned nClus = preclusters.size(); if (nClus) { fftjet::Peak* clus = &preclusters[0]; fftjet::Functor1<double,fftjet::Peak>& scaleCalc(*recoScaleCalcPeak); fftjet::Functor1<double,fftjet::Peak>& ratioCalc(*recoScaleRatioCalcPeak); fftjet::Functor1<double,fftjet::Peak>& factorCalc(*memberFactorCalcPeak); for (unsigned i=0; i<nClus; ++i) { clus[i].setRecoScale(scaleCalc(clus[i])); clus[i].setRecoScaleRatio(ratioCalc(clus[i])); clus[i].setMembershipFactor(factorCalc(clus[i])); } } }
void FFTJetProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
Implements edm::EDProducer.
Definition at line 707 of file FFTJetProducer.cc.
References assignConstituents, assignMembershipFunctions(), buildGridAlg(), calculatePileup, hitfit::clear(), constituents, determineGriddedConstituents(), determinePileup(), determinePileupDensity(), determineVectorConstituents(), fftjetcms::FFTJetInterface::discretizeEnergyFlow(), fftjetcms::FFTJetInterface::energyFlow, fftjetcms::FFTJetInterface::eventData, Exception, gridAlg, i, iEvent, iterateJetReconstruction(), iterationsPerformed, loadEnergyFlow(), fftjetcms::FFTJetInterface::loadInputCollection(), maxIterations, noiseLevel, occupancy, peakSelector, pileup, pileupEnergyFlow, pileupLabel, preclusters, prepareRecombinationScales(), recoAlg, recoJets, removeFakePreclusters(), reuseExistingGrid, saveResults(), selectPreclusters(), sparseTree, ntuplemaker::status, fftjetcms::FFTJetInterface::storeInSinglePrecision(), treeLabel, unclustered, unused, and useGriddedAlgorithm.
{ // Load the clustering tree made by FFTJetPatRecoProducer if (storeInSinglePrecision()) loadSparseTreeData<float>(iEvent); else loadSparseTreeData<double>(iEvent); // Do we need to load the candidate collection? if (assignConstituents || !(useGriddedAlgorithm && reuseExistingGrid)) loadInputCollection(iEvent); // Do we need to have discretized energy flow? if (useGriddedAlgorithm) { if (reuseExistingGrid) { if (loadEnergyFlow(iEvent, treeLabel, energyFlow)) buildGridAlg(); } else discretizeEnergyFlow(); } // Calculate cluster occupancy as a function of level number sparseTree.occupancyInScaleSpace(*peakSelector, &occupancy); // Select the preclusters using the requested resolution scheme preclusters.clear(); selectPreclusters(sparseTree, *peakSelector, &preclusters); // Prepare to run the jet recombination procedure prepareRecombinationScales(); // Assign membership functions to preclusters. If this function // is not overriden in a derived class, default algorithm membership // function will be used for every cluster. assignMembershipFunctions(&preclusters); // Count the preclusters going in unsigned nPreclustersFound = 0U; const unsigned npre = preclusters.size(); for (unsigned i=0; i<npre; ++i) if (preclusters[i].membershipFactor() > 0.0) ++nPreclustersFound; // Run the recombination algorithm once int status = 0; if (useGriddedAlgorithm) status = gridAlg->run(preclusters, *energyFlow, &noiseLevel, 1U, 1U, &recoJets, &unclustered, &unused); else status = recoAlg->run(preclusters, eventData, &noiseLevel, 1U, &recoJets, &unclustered, &unused); if (status) throw cms::Exception("FFTJetInterface") << "FFTJet algorithm failed (first iteration)" << std::endl; // If requested, iterate the jet recombination procedure if (maxIterations > 1U && !recoJets.empty()) { // It is possible to have a smaller number of jets than we had // preclusters. Fake preclusters are possible, but for a good // choice of pattern recognition kernel their presence should // be infrequent. However, any fake preclusters will throw the // iterative reconstruction off balance. Deal with the problem now. const unsigned nJets = recoJets.size(); if (preclusters.size() != nJets) { assert(nJets < preclusters.size()); removeFakePreclusters(); } iterationsPerformed = iterateJetReconstruction(); } else iterationsPerformed = 1U; // Determine jet constituents. FFTJet returns a map // of constituents which is inverse to what we need here. const unsigned nJets = recoJets.size(); if (constituents.size() <= nJets) constituents.resize(nJets + 1U); if (assignConstituents) { for (unsigned i=0; i<=nJets; ++i) constituents[i].clear(); if (useGriddedAlgorithm) determineGriddedConstituents(); else determineVectorConstituents(); } // Figure out the pile-up if (calculatePileup) { determinePileupDensity(iEvent, pileupLabel, pileupEnergyFlow); determinePileup(); assert(pileup.size() == recoJets.size()); } // Write out the results saveResults(iEvent, iSetup, nPreclustersFound); }
void FFTJetProducer::removeFakePreclusters | ( | ) | [private] |
Definition at line 1001 of file FFTJetProducer.cc.
References i, iterPreclusters, fftjetcms::matchOneToOne(), preclusters, and recoJets.
Referenced by iterateJetReconstruction(), and produce().
{ // There are two possible reasons for fake preclusters: // 1. Membership factor was set to 0 // 2. Genuine problem with pattern recognition // // Anyway, we need to match jets to preclusters and keep // only those preclusters that have been matched // std::vector<int> matchTable; const unsigned nmatched = matchOneToOne( recoJets, preclusters, JetToPeakDistance(), &matchTable); // Ensure that all jets have been matched. // If not, we must have a bug somewhere. assert(nmatched == recoJets.size()); // Collect all matched preclusters iterPreclusters.clear(); iterPreclusters.reserve(nmatched); for (unsigned i=0; i<nmatched; ++i) iterPreclusters.push_back(preclusters[matchTable[i]]); iterPreclusters.swap(preclusters); }
void FFTJetProducer::saveResults | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup, | ||
unsigned | nPreclustersFound | ||
) | [private] |
Definition at line 212 of file SideBandSubtraction.cc.
References dtNoiseDBValidation_cfg::cerr, i, combine::key, NULL, VarParsing::obj, convertSQLitetoXML_cfg::output, and stringify().
Referenced by produce().
{ //saves the ephemeral stuff to a root file for future //use/modification (ie everything printed by printResults()) TFile output(outname.c_str(),"UPDATE"); //open the output file, //create it if it doesn't //exist //Since keys are only available from files on disk, we need to write //out a new file. If the file already existed, then we opened to //update, and are writing nothing new. output.Write(); TString dirname; TIter nextkey(output.GetListOfKeys()); TKey *key; TDirectory* curDir=NULL; while((key=(TKey*)nextkey.Next())) { if(key==NULL) break; TObject *obj = key->ReadObj(); if(obj->IsA()->InheritsFrom("TDirectory")) dirname=obj->GetName(); } if(dirname=="") { //we didn't find any directories so, we'll make a new one curDir = output.mkdir("run0","Run 0"); output.cd("run0"); } else { //manipulate last dir string, make a new one, and get ready to fill dirname.Remove(0,3); Int_t run_num = dirname.Atoi(); run_num++; dirname = "run" + stringify(run_num); curDir = output.mkdir(dirname.Data(),("Run "+stringify(run_num)).c_str()); output.cd(dirname.Data()); } if(curDir==NULL) curDir = output.GetDirectory("",kTRUE,""); //these should all be the same size, but to be pedantic we'll loop //over each one individually, also, we need to associate them with //the directory because by default they "float" in memory to avoid //conflicts with other root files the user has open. If they want to //write to those files, they need to close their file, pass the name //here, and then let us work. for(unsigned int i=0; i < SideBandHistos.size(); ++i) { SideBandHistos[i].SetDirectory(curDir); SideBandHistos[i].Write(); } for(unsigned int i=0; i < RawHistos.size(); ++i) { RawHistos[i].SetDirectory(curDir); RawHistos[i].Write(); } for(unsigned int i=0; i < SBSHistos.size(); ++i) { SBSHistos[i].SetDirectory(curDir); SBSHistos[i].Write(); } if(Data!=NULL && ModelPDF!=NULL && BackgroundPDF!=NULL && SeparationVariable!=NULL) { RooPlot *sep_varFrame = SeparationVariable->frame(); Data->plotOn(sep_varFrame); ModelPDF->plotOn(sep_varFrame); BackgroundPDF->plotOn(sep_varFrame); sep_varFrame->Write(); } else cerr <<"ERROR: saveResults, did not save RooPlot of data and fit\n"; output.Write(); }
void FFTJetProducer::selectPreclusters | ( | const SparseTree & | tree, |
const fftjet::Functor1< bool, fftjet::Peak > & | peakSelector, | ||
std::vector< fftjet::Peak > * | preclusters | ||
) | [protected, virtual] |
Definition at line 213 of file FFTJetProducer.cc.
References i, nodes, resolution, selectTreeNodes(), and sparseTree.
Referenced by produce().
{ nodes.clear(); selectTreeNodes(tree, peakSelector, &nodes); // Fill out the vector of preclusters using the tree node ids const unsigned nNodes = nodes.size(); const SparseTree::NodeId* pnodes = nNodes ? &nodes[0] : 0; preclusters->reserve(nNodes); for (unsigned i=0; i<nNodes; ++i) preclusters->push_back( sparseTree.uncheckedNode(pnodes[i]).getCluster()); // Remember the node id in the precluster and set // the status word to indicate the resolution scheme used fftjet::Peak* clusters = nNodes ? &(*preclusters)[0] : 0; for (unsigned i=0; i<nNodes; ++i) { clusters[i].setCode(pnodes[i]); clusters[i].setStatus(resolution); } }
void FFTJetProducer::selectTreeNodes | ( | const SparseTree & | tree, |
const fftjet::Functor1< bool, fftjet::Peak > & | peakSelect, | ||
std::vector< SparseTree::NodeId > * | nodes | ||
) | [protected] |
Definition at line 240 of file FFTJetProducer.cc.
References delta, FIXED, fixedScale, GLOBALLY_ADAPTIVE, testEve_cfg::level, LOCALLY_ADAPTIVE, MAXIMALLY_STABLE, maxLevel, maxStableScale, minLevel, minStableScale, n, nClustersRequested, occupancy, resolution, stabilityAlpha, TopDecayID::stable, thresholds, and usedLevel.
Referenced by selectPreclusters().
{ minLevel = maxLevel = usedLevel = 0; // Get the tree nodes which pass the cuts // (according to the selected resolution strategy) switch (resolution) { case FIXED: { usedLevel = tree.getLevel(fixedScale); tree.getPassingNodes(usedLevel, peakSelect, mynodes); } break; case MAXIMALLY_STABLE: { const unsigned minStartingLevel = maxStableScale > 0.0 ? tree.getLevel(maxStableScale) : 0; const unsigned maxStartingLevel = minStableScale > 0.0 ? tree.getLevel(minStableScale) : UINT_MAX; if (tree.stableClusterCount( peakSelect, &minLevel, &maxLevel, stabilityAlpha, minStartingLevel, maxStartingLevel)) { usedLevel = (minLevel + maxLevel)/2; tree.getPassingNodes(usedLevel, peakSelect, mynodes); } } break; case GLOBALLY_ADAPTIVE: { const bool stable = tree.clusterCountLevels( nClustersRequested, peakSelect, &minLevel, &maxLevel); if (minLevel || maxLevel) { usedLevel = (minLevel + maxLevel)/2; if (!stable) { const int maxlev = tree.maxStoredLevel(); bool levelFound = false; for (int delta=0; delta<=maxlev && !levelFound; ++delta) for (int ifac=1; ifac>-2 && !levelFound; ifac-=2) { const int level = usedLevel + ifac*delta; if (level > 0 && level <= maxlev) if (occupancy[level] == nClustersRequested) { usedLevel = level; levelFound = true; } } assert(levelFound); } } else { // Can't find that exact number of preclusters. // Try to get the next best thing. usedLevel = 1; const unsigned occ1 = occupancy[1]; if (nClustersRequested >= occ1) { const unsigned maxlev = tree.maxStoredLevel(); if (nClustersRequested > occupancy[maxlev]) usedLevel = maxlev; else { // It would be nice to use "lower_bound" here, // but the occupancy is not necessarily monotonous. unsigned bestDelta = nClustersRequested > occ1 ? nClustersRequested - occ1 : occ1 - nClustersRequested; for (unsigned level=2; level<=maxlev; ++level) { const unsigned n = occupancy[level]; const unsigned d = nClustersRequested > n ? nClustersRequested - n : n - nClustersRequested; if (d < bestDelta) { bestDelta = d; usedLevel = level; } } } } } tree.getPassingNodes(usedLevel, peakSelect, mynodes); } break; case LOCALLY_ADAPTIVE: { usedLevel = tree.getLevel(fixedScale); tree.getMagS2OptimalNodes(peakSelect, nClustersRequested, usedLevel, mynodes, &thresholds); } break; default: assert(!"ERROR in FFTJetProducer::selectTreeNodes : " "should never get here! This is a bug. Please report."); } }
void FFTJetProducer::setJetStatusBit | ( | RecoFFTJet * | jet, |
int | mask, | ||
bool | value | ||
) | [static, private] |
Definition at line 1027 of file FFTJetProducer.cc.
References ntuplemaker::status.
Referenced by writeJets().
void FFTJetProducer::writeJets | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private] |
Definition at line 578 of file FFTJetProducer.cc.
References calculatePileup, cellCountsVec, constituents, CONSTITUENTS_RESUMMED, fftjetcms::FFTJetInterface::energyFlow, i, metsig::jet, analyzePatCleaning_cfg::jets, fftjetcms::FFTJetInterface::outputLabel, p4, pileup, PILEUP_CALCULATED, PILEUP_SUBTRACTED_4VEC, PILEUP_SUBTRACTED_PT, pileupEnergyFlow, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, recoJets, recombinationDataCutoff, resumConstituents, reco::FFTJet< Real >::setFourVec(), setJetStatusBit(), reco::FFTJet< Real >::setNCells(), reco::FFTJet< Real >::setPileup(), subtractPileup, subtractPileupAs4Vec, useGriddedAlgorithm, fftjetcms::FFTJetInterface::vertexUsed(), and reco::writeSpecific().
{ using namespace reco; typedef FFTAnyJet<T> OutputJet; typedef std::vector<OutputJet> OutputCollection; // Area of a single eta-phi cell for jet area calculations. // Set it to 0 in case the module configuration does not allow // us to calculate jet areas reliably. double cellArea = useGriddedAlgorithm && recombinationDataCutoff < 0.0 ? energyFlow->etaBinWidth() * energyFlow->phiBinWidth() : 0.0; if (calculatePileup) cellArea = pileupEnergyFlow->etaBinWidth() * pileupEnergyFlow->phiBinWidth(); // allocate output jet collection std::auto_ptr<OutputCollection> jets(new OutputCollection()); const unsigned nJets = recoJets.size(); jets->reserve(nJets); for (unsigned ijet=0; ijet<nJets; ++ijet) { RecoFFTJet& myjet(recoJets[ijet]); // Check if we should resum jet constituents VectorLike jet4vec(myjet.vec()); if (resumConstituents) { VectorLike sum(0.0, 0.0, 0.0, 0.0); const unsigned nCon = constituents[ijet+1].size(); const reco::CandidatePtr* cn = nCon ? &constituents[ijet+1][0] : 0; for (unsigned i=0; i<nCon; ++i) sum += cn[i]->p4(); jet4vec = sum; setJetStatusBit(&myjet, CONSTITUENTS_RESUMMED, true); } // Subtract the pile-up if (calculatePileup && subtractPileup) { if (subtractPileupAs4Vec) { jet4vec -= pileup[ijet]; setJetStatusBit(&myjet, PILEUP_SUBTRACTED_4VEC, true); } else { const double pt = jet4vec.Pt(); if (pt > 0.0) { const double pileupPt = pileup[ijet].Pt(); jet4vec *= ((pt - pileupPt)/pt); } setJetStatusBit(&myjet, PILEUP_SUBTRACTED_PT, true); } } // Write the specifics to the jet (simultaneously sets 4-vector, // vertex, constituents). These are overridden functions that will // call the appropriate specific code. T jet; writeSpecific(jet, jet4vec, vertexUsed(), constituents[ijet+1], iSetup); // calcuate the jet area double ncells = myjet.ncells(); if (calculatePileup) { ncells = cellCountsVec[ijet]; setJetStatusBit(&myjet, PILEUP_CALCULATED, true); } jet.setJetArea(cellArea*ncells); // add jet to the list FFTJet<float> fj(jetToStorable<float>(myjet)); fj.setFourVec(jet4vec); if (calculatePileup) { fj.setPileup(pileup[ijet]); fj.setNCells(ncells); } jets->push_back(OutputJet(jet, fj)); } // put the collection into the event iEvent.put(jets, outputLabel); }
const bool FFTJetProducer::assignConstituents [private] |
Definition at line 246 of file FFTJetProducer.h.
Referenced by beginJob(), buildGridAlg(), FFTJetProducer(), and produce().
std::auto_ptr<fftjetcms::AbsBgFunctor> FFTJetProducer::bgMembershipFunction [private] |
Definition at line 307 of file FFTJetProducer.h.
Referenced by beginJob(), and buildGridAlg().
const bool FFTJetProducer::calculatePileup [private] |
Definition at line 255 of file FFTJetProducer.h.
Referenced by beginJob(), produce(), and writeJets().
std::vector<unsigned> FFTJetProducer::cellCountsVec [private] |
Definition at line 374 of file FFTJetProducer.h.
Referenced by determinePileup(), and writeJets().
std::vector<std::vector<reco::CandidatePtr> > FFTJetProducer::constituents [private] |
Definition at line 357 of file FFTJetProducer.h.
Referenced by determineGriddedConstituents(), determineVectorConstituents(), produce(), and writeJets().
const double FFTJetProducer::convergenceDistance [private] |
Definition at line 243 of file FFTJetProducer.h.
Referenced by checkConvergence().
std::vector<double> FFTJetProducer::doubleBuf [private] |
Definition at line 373 of file FFTJetProducer.h.
Referenced by determinePileup().
const double FFTJetProducer::fixedScale [private] |
Definition at line 264 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
std::auto_ptr<GridAlg> FFTJetProducer::gridAlg [private] |
Definition at line 305 of file FFTJetProducer.h.
Referenced by buildGridAlg(), determineGriddedConstituents(), iterateJetReconstruction(), and produce().
const double FFTJetProducer::gridScanMaxEta [private] |
Definition at line 281 of file FFTJetProducer.h.
Referenced by buildGridAlg().
std::auto_ptr<std::vector<double> > FFTJetProducer::iniScales [private] |
Definition at line 295 of file FFTJetProducer.h.
Referenced by FFTJetProducer(), and loadSparseTreeData().
const bool FFTJetProducer::isCrisp [private] |
Definition at line 285 of file FFTJetProducer.h.
Referenced by beginJob(), buildGridAlg(), and determinePileup().
unsigned FFTJetProducer::iterationsPerformed [private] |
Definition at line 354 of file FFTJetProducer.h.
Referenced by produce().
std::vector<RecoFFTJet> FFTJetProducer::iterJets [private] |
Definition at line 353 of file FFTJetProducer.h.
Referenced by iterateJetReconstruction().
std::vector<fftjet::Peak> FFTJetProducer::iterPreclusters [private] |
Definition at line 352 of file FFTJetProducer.h.
Referenced by iterateJetReconstruction(), and removeFakePreclusters().
std::auto_ptr<fftjet::Functor2<double,RecoFFTJet,RecoFFTJet> > FFTJetProducer::jetDistanceCalc [private] |
Definition at line 327 of file FFTJetProducer.h.
Referenced by beginJob(), and checkConvergence().
std::auto_ptr<fftjet::ScaleSpaceKernel> FFTJetProducer::jetMembershipFunction [private] |
Definition at line 306 of file FFTJetProducer.h.
Referenced by beginJob(), buildGridAlg(), and determinePileup().
const unsigned FFTJetProducer::maxIterations [private] |
Definition at line 239 of file FFTJetProducer.h.
Referenced by beginJob(), iterateJetReconstruction(), and produce().
unsigned FFTJetProducer::maxLevel [private] |
Definition at line 345 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
const double FFTJetProducer::maxStableScale [private] |
Definition at line 268 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> > FFTJetProducer::memberFactorCalcJet [private] |
Definition at line 322 of file FFTJetProducer.h.
Referenced by beginJob(), determinePileup(), and iterateJetReconstruction().
std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> > FFTJetProducer::memberFactorCalcPeak [private] |
Definition at line 317 of file FFTJetProducer.h.
Referenced by beginJob(), and prepareRecombinationScales().
std::vector<fftjet::AbsKernel2d*> FFTJetProducer::memFcns2dVec [private] |
Definition at line 372 of file FFTJetProducer.h.
Referenced by determinePileup().
unsigned FFTJetProducer::minLevel [private] |
Definition at line 345 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
const double FFTJetProducer::minStableScale [private] |
Definition at line 267 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
const edm::ParameterSet FFTJetProducer::myConfiguration [private] |
Definition at line 225 of file FFTJetProducer.h.
Referenced by beginJob().
const unsigned FFTJetProducer::nClustersRequested [private] |
Definition at line 278 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
const unsigned FFTJetProducer::nJetsRequiredToConverge [private] |
Definition at line 242 of file FFTJetProducer.h.
std::vector<SparseTree::NodeId> FFTJetProducer::nodes [private] |
Definition at line 330 of file FFTJetProducer.h.
Referenced by selectPreclusters().
const double FFTJetProducer::noiseLevel [private] |
Definition at line 275 of file FFTJetProducer.h.
Referenced by iterateJetReconstruction(), and produce().
std::vector<unsigned> FFTJetProducer::occupancy [private] |
Definition at line 339 of file FFTJetProducer.h.
Referenced by produce(), and selectTreeNodes().
std::auto_ptr<fftjet::Functor1<bool,fftjet::Peak> > FFTJetProducer::peakSelector [private] |
Definition at line 301 of file FFTJetProducer.h.
Referenced by beginJob(), and produce().
std::vector<fftjetcms::VectorLike> FFTJetProducer::pileup [private] |
Definition at line 361 of file FFTJetProducer.h.
Referenced by determinePileup(), produce(), and writeJets().
std::auto_ptr<fftjetcms::AbsPileupCalculator> FFTJetProducer::pileupDensityCalc [private] |
Definition at line 369 of file FFTJetProducer.h.
Referenced by beginJob(), and determinePileupDensity().
std::auto_ptr<fftjet::Grid2d<fftjetcms::Real> > FFTJetProducer::pileupEnergyFlow [private] |
Definition at line 366 of file FFTJetProducer.h.
Referenced by beginJob(), determinePileup(), produce(), and writeJets().
const edm::InputTag FFTJetProducer::pileupLabel [private] |
Definition at line 261 of file FFTJetProducer.h.
Referenced by produce().
std::vector<fftjet::Peak> FFTJetProducer::preclusters [private] |
Definition at line 333 of file FFTJetProducer.h.
Referenced by iterateJetReconstruction(), prepareRecombinationScales(), produce(), and removeFakePreclusters().
std::auto_ptr<RecoAlg> FFTJetProducer::recoAlg [private] |
Definition at line 304 of file FFTJetProducer.h.
Referenced by beginJob(), determineVectorConstituents(), iterateJetReconstruction(), and produce().
std::vector<RecoFFTJet> FFTJetProducer::recoJets [private] |
Definition at line 336 of file FFTJetProducer.h.
Referenced by determineGriddedConstituents(), determinePileup(), determineVectorConstituents(), iterateJetReconstruction(), produce(), removeFakePreclusters(), and writeJets().
const std::string FFTJetProducer::recombinationAlgorithm [private] |
Definition at line 284 of file FFTJetProducer.h.
Referenced by beginJob(), and buildGridAlg().
const double FFTJetProducer::recombinationDataCutoff [private] |
Definition at line 287 of file FFTJetProducer.h.
Referenced by buildGridAlg(), and writeJets().
std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> > FFTJetProducer::recoScaleCalcJet [private] |
Definition at line 320 of file FFTJetProducer.h.
Referenced by beginJob(), determinePileup(), and iterateJetReconstruction().
std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> > FFTJetProducer::recoScaleCalcPeak [private] |
Definition at line 310 of file FFTJetProducer.h.
Referenced by beginJob(), and prepareRecombinationScales().
std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> > FFTJetProducer::recoScaleRatioCalcJet [private] |
Definition at line 321 of file FFTJetProducer.h.
Referenced by beginJob(), determinePileup(), and iterateJetReconstruction().
std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> > FFTJetProducer::recoScaleRatioCalcPeak [private] |
Definition at line 314 of file FFTJetProducer.h.
Referenced by beginJob(), and prepareRecombinationScales().
Resolution FFTJetProducer::resolution [private] |
Definition at line 292 of file FFTJetProducer.h.
Referenced by selectPreclusters(), and selectTreeNodes().
const bool FFTJetProducer::resumConstituents [private] |
Definition at line 251 of file FFTJetProducer.h.
Referenced by FFTJetProducer(), and writeJets().
const bool FFTJetProducer::reuseExistingGrid [private] |
Definition at line 236 of file FFTJetProducer.h.
Referenced by beginJob(), and produce().
SparseTree FFTJetProducer::sparseTree [private] |
Definition at line 298 of file FFTJetProducer.h.
Referenced by loadSparseTreeData(), produce(), and selectPreclusters().
const double FFTJetProducer::stabilityAlpha [private] |
Definition at line 271 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
const bool FFTJetProducer::subtractPileup [private] |
Definition at line 256 of file FFTJetProducer.h.
Referenced by writeJets().
const bool FFTJetProducer::subtractPileupAs4Vec [private] |
Definition at line 257 of file FFTJetProducer.h.
Referenced by writeJets().
std::vector<double> FFTJetProducer::thresholds [private] |
Definition at line 342 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
const edm::InputTag FFTJetProducer::treeLabel [private] |
Definition at line 228 of file FFTJetProducer.h.
Referenced by loadSparseTreeData(), and produce().
Definition at line 348 of file FFTJetProducer.h.
Referenced by iterateJetReconstruction(), and produce().
const double FFTJetProducer::unlikelyBgWeight [private] |
Definition at line 286 of file FFTJetProducer.h.
Referenced by beginJob(), and buildGridAlg().
double FFTJetProducer::unused [private] |
Definition at line 349 of file FFTJetProducer.h.
Referenced by iterateJetReconstruction(), and produce().
unsigned FFTJetProducer::usedLevel [private] |
Definition at line 345 of file FFTJetProducer.h.
Referenced by selectTreeNodes().
const bool FFTJetProducer::useGriddedAlgorithm [private] |
Definition at line 232 of file FFTJetProducer.h.
Referenced by beginJob(), iterateJetReconstruction(), produce(), and writeJets().