CMS 3D CMS Logo

Namespaces | Classes | Typedefs | Enumerations | Functions

fftjetcms Namespace Reference

Namespaces

namespace  Private

Classes

struct  AbsPileupCalculator
class  CompositeFunctor
class  ConstDouble
struct  EnergyEtaP4Builder
class  EtaAndPtDependentPeakSelector
class  EtaAndPtLookupPeakSelector
class  EtaDependentPileup
class  FFTJetInterface
struct  JetAbsEta
class  JetConvergenceDistance
class  JetEtaDependent
class  JetToPeakDistance
class  LinInterpolatedTable1D
class  LookupTable2d
class  MagnitudeDependent
class  MultiplyByConst
struct  PeakAbsEta
class  PeakEtaDependent
class  PeakEtaMagSsqDependent
class  PileupGrid2d
class  Polynomial
class  ProductFunctor
class  ProportionalToScale
struct  PtEtaP4Builder

Typedefs

typedef fftjet::Functor2
< double, double, BgData
AbsBgFunctor
typedef double BgData
typedef fftw_complex Complex
typedef fftjet::FFTWDoubleEngine MyFFTEngine
typedef double Real
typedef PtEtaP4Builder VBuilder
typedef math::XYZTLorentzVector VectorLike

Enumerations

enum  JetType {
  BASICJET = 0, GENJET, CALOJET, PFJET,
  TRACKJET, JPTJET
}

Functions

template<typename F1 , typename F2 >
void add_Grid2d_data (fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
math::XYZTLorentzVector adjustForPileup (const math::XYZTLorentzVector &jet, const math::XYZTLorentzVector &pileup, bool subtractPileupAs4Vec)
template<typename Numeric >
fftjet::Grid2d< double > * convert_Grid2d_to_double (const fftjet::Grid2d< Numeric > &grid)
template<typename Numeric >
fftjet::Grid2d< float > * convert_Grid2d_to_float (const fftjet::Grid2d< Numeric > &grid)
template<typename F1 , typename F2 >
void copy_Grid2d_data (fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
template<class Real >
void densePeakTreeFromStorable (const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::AbsClusteringTree< fftjet::Peak, long > *out)
template<class Real >
void densePeakTreeToStorable (const fftjet::AbsClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
std::auto_ptr< AbsBgFunctorfftjet_BgFunctor_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::ClusteringTreeSparsifier
< fftjet::Peak, long > > 
fftjet_ClusteringTreeSparsifier_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::AbsDistanceCalculator
< fftjet::Peak > > 
fftjet_DistanceCalculator_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::Functor1< double,
double > > 
fftjet_Function_parser (const edm::ParameterSet &ps)
std::auto_ptr< fftjet::Grid2d
< Real > > 
fftjet_Grid2d_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::Functor2< double,
fftjet::RecombinedJet
< VectorLike >
, fftjet::RecombinedJet
< VectorLike > > > 
fftjet_JetDistance_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::Functor1< double,
fftjet::RecombinedJet
< VectorLike > > > 
fftjet_JetFunctor_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::JetMagnitudeMapper2d
< fftjet::RecombinedJet
< VectorLike > > > 
fftjet_JetMagnitudeMapper2d_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::LinearInterpolator1d > 
fftjet_LinearInterpolator1d_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::LinearInterpolator2d > 
fftjet_LinearInterpolator2d_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjetcms::LinInterpolatedTable1D
fftjet_LinInterpolatedTable1D_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::ScaleSpaceKernel > 
fftjet_MembershipFunction_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::Functor1< double,
fftjet::Peak > > 
fftjet_PeakFunctor_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::JetMagnitudeMapper2d
< fftjet::Peak > > 
fftjet_PeakMagnitudeMapper2d_parser (const edm::ParameterSet &ps)
std::auto_ptr
< fftjet::Functor1< bool,
fftjet::Peak > > 
fftjet_PeakSelector_parser (const edm::ParameterSet &ps)
std::auto_ptr
< AbsPileupCalculator
fftjet_PileupCalculator_parser (const edm::ParameterSet &ps)
std::auto_ptr< std::vector
< double > > 
fftjet_ScaleSet_parser (const edm::ParameterSet &ps)
template<class Real >
fftjet::RecombinedJet< VectorLikejetFromStorable (const reco::FFTJet< Real > &jet)
template<class Real >
reco::FFTJet< RealjetToStorable (const fftjet::RecombinedJet< VectorLike > &jet)
template<class T1 , class T2 , class DistanceCalculator >
unsigned matchOneToOne (const std::vector< T1 > &v1, const std::vector< T2 > &v2, const DistanceCalculator &calc, std::vector< int > *matchFrom1To2, const double maxMatchingDistance=1.0e300)
JetType parseJetType (const std::string &name)
template<class Real >
void sparsePeakTreeFromStorable (const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::SparseClusteringTree< fftjet::Peak, long > *out)
template<class Real >
void sparsePeakTreeToStorable (const fftjet::SparseClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)

Typedef Documentation

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

Definition at line 38 of file fftjetTypedefs.h.

typedef double fftjetcms::BgData

Definition at line 34 of file fftjetTypedefs.h.

typedef fftw_complex fftjetcms::Complex

Definition at line 22 of file fftjetTypedefs.h.

typedef fftjet::FFTWDoubleEngine fftjetcms::MyFFTEngine

Definition at line 23 of file fftjetTypedefs.h.

typedef double fftjetcms::Real

Definition at line 21 of file fftjetTypedefs.h.

Definition at line 30 of file fftjetTypedefs.h.

Definition at line 26 of file fftjetTypedefs.h.


Enumeration Type Documentation

Enumerator:
BASICJET 
GENJET 
CALOJET 
PFJET 
TRACKJET 
JPTJET 

Definition at line 7 of file JetType.h.


Function Documentation

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

Definition at line 57 of file gridConverters.h.

References i.

Referenced by FFTJetPileupProcessor::mixExtraGrid().

    {
        assert(to);
        assert(from.nEta() == to->nEta());
        assert(from.nPhi() == to->nPhi());
        const unsigned len = from.nEta()*from.nPhi();
        const F1* fromData = from.data();
        F2* toData = const_cast<F2*>(to->data());
        for (unsigned i=0; i<len; ++i)
            toData[i] += fromData[i];
    }
math::XYZTLorentzVector fftjetcms::adjustForPileup ( const math::XYZTLorentzVector jet,
const math::XYZTLorentzVector pileup,
bool  subtractPileupAs4Vec 
)

Definition at line 4 of file adjustForPileup.cc.

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

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

    {
        const double pt = jet.Pt();
        if (pt > 0.0)
        {
            const double pileupPt = pileup.Pt();
            const double ptFactor = (pt - pileupPt)/pt;
            if (ptFactor <= 0.0)
                return math::XYZTLorentzVector();
            else if (subtractPileupAs4Vec)
            {
                const math::XYZTLorentzVector subtracted(jet - pileup);
                const double e = subtracted.E();
                if (e <= 0.0)
                    return math::XYZTLorentzVector();
                else
                {
                    // Avoid negative jet masses
                    const double px = subtracted.Px();
                    const double py = subtracted.Py();
                    const double pz = subtracted.Pz();
                    if (e*e < px*px + py*py + pz*pz)
                        // It is not clear what is the best thing to do here.
                        // For now, revert to Pt scaling.
                        return jet*ptFactor;
                    else
                        return subtracted;
                }
            }
            else
                return jet*ptFactor;
        }
        else
            return jet;
    }
template<typename Numeric >
fftjet::Grid2d< double > * fftjetcms::convert_Grid2d_to_double ( const fftjet::Grid2d< Numeric > &  grid)

Definition at line 82 of file gridConverters.h.

References copy_Grid2d_data().

    {
        fftjet::Grid2d<double>* to = new fftjet::Grid2d<double>(
            grid.nEta(), grid.etaMin(), grid.etaMax(),
            grid.nPhi(), grid.phiBin0Edge(), grid.title());
        copy_Grid2d_data(to, grid);
        return to;
    }
template<typename Numeric >
fftjet::Grid2d< float > * fftjetcms::convert_Grid2d_to_float ( const fftjet::Grid2d< Numeric > &  grid)

Definition at line 71 of file gridConverters.h.

References copy_Grid2d_data().

Referenced by FFTJetPatRecoProducer::produce().

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

Definition at line 43 of file gridConverters.h.

References i.

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

    {
        assert(to);
        assert(from.nEta() == to->nEta());
        assert(from.nPhi() == to->nPhi());
        const unsigned len = from.nEta()*from.nPhi();
        const F1* fromData = from.data();
        F2* toData = const_cast<F2*>(to->data());
        for (unsigned i=0; i<len; ++i)
            toData[i] = fromData[i];
    }
template<class Real >
void fftjetcms::densePeakTreeFromStorable ( const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &  in,
const std::vector< double > *  scaleSetIfNotAdaptive,
double  completeEventScale,
fftjet::AbsClusteringTree< fftjet::Peak, long > *  out 
)

Definition at line 297 of file clusteringTreeConverters.h.

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

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

    {
        typedef fftjet::AbsClusteringTree<fftjet::Peak,long> DenseTree;
        typedef reco::PattRecoPeak<Real> StoredPeak;
        typedef reco::PattRecoNode<StoredPeak> StoredNode;
        typedef reco::PattRecoTree<Real,StoredPeak> StoredTree;

        if (in.isSparse())
            throw cms::Exception("FFTJetBadConfig")
                << "can't restore dense clustering tree"
                << " from sparsely stored record" << std::endl;

        assert(out);
        out->clear();

        const std::vector<StoredNode>& nodes(in.getNodes());
        const unsigned n = nodes.size();
        double hessian[3] = {0., 0., 0.};
                
        const std::vector<Real>& scales (in.getScales());
        unsigned int scnum     = 0;
        std::vector<fftjet::Peak> clusters;
        const unsigned scsize1 = scales.size();
        unsigned scsize2 = scaleSetIfNotAdaptive ? scaleSetIfNotAdaptive->size() : 0;
        if (scsize2 && completeEventScale) ++scsize2;
        const unsigned scsize  = (scsize1==0?scsize2:scsize1);

        if (scsize == 0)  
            throw cms::Exception("FFTJetBadConfig")
                << " No scales passed to the function densePeakTreeFromStorable()"
                << std::endl;

        // to check whether the largest level equals the size of scale vector
        const double* sc_not_ad = scsize2 ? &(*scaleSetIfNotAdaptive)[0] : 0;

        unsigned templevel = n ? nodes[0].originalLevel() : 1;
        for (unsigned i=0; i<n; ++i)
        {
            const StoredNode& snode(nodes[i]);
            const StoredPeak& p(snode.getCluster());
            p.hessian(hessian);
        
            const unsigned levelNumber = snode.originalLevel();

            if (templevel != levelNumber) 
            {
                if (scnum >= scsize)
                    throw cms::Exception("FFTJetBadConfig")
                        << "bad scales, please check the scales"
                        << std::endl;
                const double scale = ( (scsize1==0) ? sc_not_ad[scnum] : scales[scnum] );
                out->insert(scale, clusters, 0L);
                clusters.clear();
                templevel = levelNumber;
                ++scnum;
            }

            fftjet::Peak apeak(p.eta(), p.phi(), p.magnitude(),
                               hessian, p.driftSpeed(),
                               p.magSpeed(), p.lifetime(),
                               p.scale(), p.nearestNeighborDistance(),
                               1.0, 0.0, 0.0,
                               p.clusterRadius(), p.clusterSeparation());
            clusters.push_back(apeak);
               
            if (i==(n-1) && levelNumber!=scsize) 
                throw cms::Exception("FFTJetBadConfig")
                    << "bad scales, please check the scales"
                    << std::endl;
        }

        const double scale = scsize1 ? scales[scnum] : completeEventScale ? 
            completeEventScale : sc_not_ad[scnum];
        out->insert(scale, clusters, 0L);
    }
template<class Real >
void fftjetcms::densePeakTreeToStorable ( const fftjet::AbsClusteringTree< fftjet::Peak, long > &  in,
bool  writeOutScaleInfo,
reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *  out 
)

Definition at line 219 of file clusteringTreeConverters.h.

References i, and dbtoconf::out.

Referenced by FFTJetPatRecoProducer::buildDenseProduct().

    {
        typedef fftjet::AbsClusteringTree<fftjet::Peak,long> DenseTree;
        typedef reco::PattRecoPeak<Real> StoredPeak;
        typedef reco::PattRecoNode<StoredPeak> StoredNode;
        typedef reco::PattRecoTree<Real,StoredPeak> StoredTree;
        
        
        assert(out);
        out->clear();
        out->setSparse(false);
        
        
        const unsigned nLevels = in.nLevels();
        double hessian[3] = {0., 0., 0.};

        
        // Do not write out the meaningless top node
        out->reserveNodes(in.nClusters() - 1);
        
        
        for (unsigned i=1; i<nLevels; ++i)
        {
            
            const unsigned int nclus = in.nClusters(i);
            DenseTree::NodeId id(i,0);
            for (;id.second<nclus; ++id.second) 
            {
           
           
                const fftjet::Peak& peak(in.getCluster(id));
                peak.hessian(hessian);
                StoredNode sn(StoredPeak(peak.eta(),
                                         peak.phi(),
                                         peak.magnitude(),
                                         hessian,
                                         peak.driftSpeed(),
                                         peak.magSpeed(),
                                         peak.lifetime(),
                                         peak.scale(),
                                         peak.nearestNeighborDistance(),
                                         peak.clusterRadius(),
                                         peak.clusterSeparation()),
                              i,
                              0,
                              0);
                
                out->addNode(sn);
                
            }
            
        }
        
    
        // Do we want to write out the scales? We will use the following
        // convention: if the tree is using an adaptive algorithm, the scales
        // will be written out. If not, they are not going to change from
        // event to event. In this case the scales would waste disk space
        // for no particularly good reason, so they will not be written out.
        if (writeOutScaleInfo)
        {
            // Do not write out the meaningless top-level scale
            const unsigned nScales = in.nLevels();
            
            out->reserveScales(nScales - 1);
            
            for (unsigned i=1; i<nScales; ++i)
                out->addScale(in.getScale(i));
            
        }
    }
std::auto_ptr< AbsBgFunctor > fftjetcms::fftjet_BgFunctor_parser ( const edm::ParameterSet ps)

Definition at line 396 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_bgMembershipFunction().

{
    const std::string bg_Membership_type = ps.getParameter<std::string>(
        "Class");

    if (!bg_Membership_type.compare("GaussianNoiseMembershipFcn"))
    {
        const double minWeight = ps.getParameter<double>("minWeight");
        const double prior = ps.getParameter<double>("prior");
        return std::auto_ptr<AbsBgFunctor>(
            new fftjet::GaussianNoiseMembershipFcn(minWeight,prior));
    }

    return std::auto_ptr<AbsBgFunctor>(NULL);
}
std::auto_ptr< fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > > fftjetcms::fftjet_ClusteringTreeSparsifier_parser ( const edm::ParameterSet ps)

Definition at line 468 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetPatRecoProducer::FFTJetPatRecoProducer().

{
    typedef std::auto_ptr<fftjet::ClusteringTreeSparsifier<fftjet::Peak,long> > return_type;

    const int maxLevelNumber = ps.getParameter<int>("maxLevelNumber");
    const unsigned filterMask = ps.getParameter<unsigned>("filterMask");
    const std::vector<double> userScalesV = 
        ps.getParameter<std::vector<double> >("userScales");
    const unsigned nUserScales = userScalesV.size();
    const double* userScales = nUserScales ? &userScalesV[0] : NULL;

    return return_type(
        new fftjet::ClusteringTreeSparsifier<fftjet::Peak,long>(
            maxLevelNumber,
            filterMask,
            userScales,
            nUserScales
            )
        );
}
std::auto_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjetcms::fftjet_DistanceCalculator_parser ( const edm::ParameterSet ps)

Definition at line 491 of file FFTJetParameterParser.cc.

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

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

{
    typedef std::auto_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak> > return_type;

    const std::string calc_type = ps.getParameter<std::string>("Class");

    if (!calc_type.compare("PeakEtaPhiDistance"))
    {
        const double etaToPhiBandwidthRatio = ps.getParameter<double>(
            "etaToPhiBandwidthRatio");
        return return_type(new fftjet::PeakEtaPhiDistance(etaToPhiBandwidthRatio));
    }

    if (!calc_type.compare("PeakEtaDependentDistance"))
    {
        std::auto_ptr<fftjet::LinearInterpolator1d> interp = 
            fftjet_LinearInterpolator1d_parser(
                ps.getParameter<edm::ParameterSet>("Interpolator"));
        const fftjet::LinearInterpolator1d* ip = interp.get();
        if (ip == NULL)
            return return_type(NULL);

        // Check that the interpolator is always positive
        const unsigned n = ip->nx();
        const double* data = ip->getData();
        for (unsigned i=0; i<n; ++i)
            if (data[i] <= 0.0)
                return return_type(NULL);
        if (ip->fLow() <= 0.0 || ip->fHigh() <= 0.0)
            return return_type(NULL);

        return return_type(new fftjet::PeakEtaDependentDistance(*ip));
    }

    return return_type(NULL);
}
std::auto_ptr< fftjet::Functor1< double, double > > fftjetcms::fftjet_Function_parser ( const edm::ParameterSet ps)

Definition at line 901 of file FFTJetParameterParser.cc.

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

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

{
    typedef std::auto_ptr<fftjet::Functor1<double,double> > return_type;

    const std::string fcn_type = ps.getParameter<std::string>("Class");

    if (!fcn_type.compare("LinearInterpolator1d"))
    {
        std::auto_ptr<fftjet::LinearInterpolator1d> p = 
            fftjet_LinearInterpolator1d_parser(ps);
        fftjet::LinearInterpolator1d* ptr = p.get();
        if (ptr)
        {
            p.release();
            return return_type(ptr);
        }
    }

    if (!fcn_type.compare("LinInterpolatedTable1D"))
    {
        std::auto_ptr<fftjetcms::LinInterpolatedTable1D> p = 
            fftjet_LinInterpolatedTable1D_parser(ps);
        fftjetcms::LinInterpolatedTable1D* ptr = p.get();
        if (ptr)
        {
            p.release();
            return return_type(ptr);
        }
    }

    if (!fcn_type.compare("Polynomial"))
    {
        std::vector<double> coeffs;
        for (unsigned i=0; ; ++i)
        {
            std::ostringstream s;
            s << 'c' << i;
            if (ps.exists(s.str()))
                coeffs.push_back(ps.getParameter<double>(s.str()));
            else
                break;
        }
        return return_type(new Polynomial(coeffs));
    }

    return return_type(NULL);
}
std::auto_ptr< fftjet::Grid2d< Real > > fftjetcms::fftjet_Grid2d_parser ( const edm::ParameterSet ps)

Definition at line 124 of file FFTJetParameterParser.cc.

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

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

{
    typedef std::auto_ptr<fftjet::Grid2d<Real> > return_type;
    fftjet::Grid2d<Real> *g = 0;

    // Check if the grid should be read from file
    if (ps.exists("file"))
    {
        const std::string file = ps.getParameter<std::string>("file");
        std::ifstream in(file.c_str(),
                         std::ios_base::in | std::ios_base::binary);
        if (!in.is_open())
            throw cms::Exception("FFTJetBadConfig")
                << "Failed to open file " << file << std::endl;
        g = fftjet::Grid2d<Real>::read(in);
        if (g == 0)
            throw cms::Exception("FFTJetBadConfig")
                << "Failed to read file " << file << std::endl;
    }
    else
    {
        const unsigned nEtaBins = ps.getParameter<unsigned>("nEtaBins");
        const Real etaMin = ps.getParameter<Real>("etaMin");
        const Real etaMax = ps.getParameter<Real>("etaMax");
        const unsigned nPhiBins = ps.getParameter<unsigned>("nPhiBins");
        const Real phiBin0Edge = ps.getParameter<Real>("phiBin0Edge");
        const std::string& title = ps.getUntrackedParameter<std::string>(
            "title", "");

        if (nEtaBins == 0 || nPhiBins == 0 || etaMin >= etaMax)
            return return_type(NULL);
        
        g = new fftjet::Grid2d<Real>(
            nEtaBins,
            etaMin,
            etaMax,
            nPhiBins,
            phiBin0Edge,
            title.c_str()
        );

        // Check if the grid data is provided
        if (ps.exists("data"))
        {
            const std::vector<Real>& data = 
                ps.getParameter<std::vector<Real> >("data");
            if (data.size() == nEtaBins*nPhiBins)
                g->blockSet(&data[0], nEtaBins, nPhiBins);
            else
            {
                delete g;
                g = 0;
            }
        }
    }

    return return_type(g);
}
std::auto_ptr< fftjet::Functor2< double, fftjet::RecombinedJet< VectorLike >, fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetDistance_parser ( const edm::ParameterSet ps)

Definition at line 876 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_jetDistanceCalc().

{
    typedef std::auto_ptr<fftjet::Functor2<
        double,
        fftjet::RecombinedJet<VectorLike>,
        fftjet::RecombinedJet<VectorLike> > > return_type;

    const std::string distance_type = ps.getParameter<std::string>(
        "Class");

    if (!distance_type.compare("JetConvergenceDistance"))
    {
        make_param(double, etaToPhiBandwidthRatio);
        make_param(double, relativePtBandwidth);

        if (etaToPhiBandwidthRatio > 0.0 && relativePtBandwidth > 0.0)
            return return_type(new JetConvergenceDistance(
                etaToPhiBandwidthRatio, relativePtBandwidth));
    }

    return return_type(NULL);
}
std::auto_ptr< fftjet::Functor1< double, fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetFunctor_parser ( const edm::ParameterSet ps)

Definition at line 743 of file FFTJetParameterParser.cc.

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

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

{
    typedef fftjet::Functor1<double,RecoFFTJet> ptr_type;
    typedef std::auto_ptr<ptr_type> return_type;

    const std::string property_type = ps.getParameter<std::string>("Class");

    if (!property_type.compare("Log"))
    {
        return_type wrapped = fftjet_JetFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function"));
        fftjet::Functor1<double,RecoFFTJet>* wr = wrapped.get();
        if (wr)
        {
            return_type result = return_type(
                new fftjet::LogProperty<RecoFFTJet>(wr, true));
            wrapped.release();
            return result;
        }
    }

    if (!property_type.compare("JetEtaDependent"))
    {
        std::auto_ptr<fftjet::Functor1<double,double> > fcn1 = 
            fftjet_Function_parser(
                ps.getParameter<edm::ParameterSet>("function"));
        fftjet::Functor1<double,double>* f1 = fcn1.get();
        if (f1)
        {
            return_type result = return_type(new JetEtaDependent(f1, true));
            fcn1.release();
            return result;
        }
    }

    if (!property_type.compare("JetProperty"))
    {
        const std::string member = ps.getParameter<std::string>("member");
        fftjet::JetProperty<RecoFFTJet>::JetMemberFunction fcn;
        if (parse_jet_member_function(member.c_str(), &fcn))
            return return_type(
                new fftjet::JetProperty<RecoFFTJet>(fcn));
        else
            return return_type(NULL);
    }

    if (!property_type.compare("ConstDouble"))
    {
        const double value = ps.getParameter<double>("value");
        return return_type(new ConstDouble<RecoFFTJet>(value));
    }

    if (!property_type.compare("ProportionalToScale"))
    {
        const double value = ps.getParameter<double>("value");
        return return_type(
            new ProportionalToScale<RecoFFTJet>(value));
    }

    if (!property_type.compare("MultiplyByConst"))
    {
        const double factor = ps.getParameter<double>("factor");
        return_type function = fftjet_JetFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function"));
        ptr_type* ptr = function.get();
        if (ptr)
        {
            return_type result = return_type(
                new MultiplyByConst<RecoFFTJet>(factor, ptr, true));
            function.release();
            return result;
        }
    }

    if (!property_type.compare("CompositeFunctor"))
    {
        std::auto_ptr<fftjet::Functor1<double,double> > fcn1 = 
            fftjet_Function_parser(
                ps.getParameter<edm::ParameterSet>("function1"));
        return_type fcn2 = fftjet_JetFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function2"));
        fftjet::Functor1<double,double>* f1 = fcn1.get();
        ptr_type* f2 = fcn2.get();
        if (f1 && f2)
        {
            return_type result = return_type(
                new CompositeFunctor<RecoFFTJet>(f1, f2, true));
            fcn1.release();
            fcn2.release();
            return result;
        }
    }

    if (!property_type.compare("ProductFunctor"))
    {
        return_type fcn1 = fftjet_JetFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function1"));
        return_type fcn2 = fftjet_JetFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function2"));
        ptr_type* f1 = fcn1.get();
        ptr_type* f2 = fcn2.get();
        if (f1 && f2)
        {
            return_type result = return_type(
                new ProductFunctor<RecoFFTJet>(f1, f2, true));
            fcn1.release();
            fcn2.release();
            return result;
        }
    }

    if (!property_type.compare("MagnitudeDependent"))
    {
        std::auto_ptr<fftjet::Functor1<double,double> > fcn1 = 
            fftjet_Function_parser(
                ps.getParameter<edm::ParameterSet>("function"));
        fftjet::Functor1<double,double>* f1 = fcn1.get();
        if (f1)
        {
            return_type result = return_type(
                new MagnitudeDependent<RecoFFTJet>(f1, true));
            fcn1.release();
            return result;
        }
    }

    return return_type(NULL);
}
std::auto_ptr< fftjet::JetMagnitudeMapper2d< fftjet::RecombinedJet< VectorLike > > > fftjetcms::fftjet_JetMagnitudeMapper2d_parser ( const edm::ParameterSet ps)

Definition at line 1014 of file FFTJetParameterParser.cc.

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

{
    std::auto_ptr<fftjet::LinearInterpolator2d> responseCurve =
        fftjet_LinearInterpolator2d_parser(
            ps.getParameter<edm::ParameterSet>("responseCurve"));

    const double minPredictor = ps.getParameter<double>("minPredictor");
    const double maxPredictor = ps.getParameter<double>("maxPredictor");
    const unsigned nPredPoints = ps.getParameter<unsigned>("nPredPoints");
    const double maxMagnitude = ps.getParameter<double>("maxMagnitude");
    const unsigned nMagPoints = ps.getParameter<unsigned>("nMagPoints");

    return (std::auto_ptr<fftjet::JetMagnitudeMapper2d<RecoFFTJet> >
            (new fftjet::JetMagnitudeMapper2d<RecoFFTJet>(
                 *responseCurve,
                 new fftjetcms::JetAbsEta<RecoFFTJet>(),
                 true,minPredictor,maxPredictor,nPredPoints,
                 maxMagnitude,nMagPoints)));
}
std::auto_ptr< fftjet::LinearInterpolator1d > fftjetcms::fftjet_LinearInterpolator1d_parser ( const edm::ParameterSet ps)

Definition at line 551 of file FFTJetParameterParser.cc.

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

Referenced by fftjet_DistanceCalculator_parser(), and fftjet_Function_parser().

{
    const double xmin = ps.getParameter<double>("xmin");
    const double xmax = ps.getParameter<double>("xmax");
    const double flow = ps.getParameter<double>("flow");
    const double fhigh = ps.getParameter<double>("fhigh");
    const std::vector<double> data(
        ps.getParameter<std::vector<double> >("data"));
    if (data.empty())
        return std::auto_ptr<fftjet::LinearInterpolator1d>(NULL);
    else
        return std::auto_ptr<fftjet::LinearInterpolator1d>(
            new fftjet::LinearInterpolator1d(
                &data[0], data.size(), xmin, xmax, flow, fhigh));
}
std::auto_ptr< fftjet::LinearInterpolator2d > fftjetcms::fftjet_LinearInterpolator2d_parser ( const edm::ParameterSet ps)

Definition at line 569 of file FFTJetParameterParser.cc.

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

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

{
    const std::string file = ps.getParameter<std::string>("file");
    std::ifstream in(file.c_str(),
                     std::ios_base::in | std::ios_base::binary);
    if (!in.is_open())
        throw cms::Exception("FFTJetBadConfig")
            << "Failed to open file " << file << std::endl;
    fftjet::LinearInterpolator2d* ip = fftjet::LinearInterpolator2d::read(in);
    if (!ip)
        throw cms::Exception("FFTJetBadConfig")
            << "Failed to read file " << file << std::endl;
    return std::auto_ptr<fftjet::LinearInterpolator2d>(ip);
}
std::auto_ptr< fftjetcms::LinInterpolatedTable1D > fftjetcms::fftjet_LinInterpolatedTable1D_parser ( const edm::ParameterSet ps)

Definition at line 530 of file FFTJetParameterParser.cc.

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

Referenced by fftjet_Function_parser().

{
    const double xmin = ps.getParameter<double>("xmin");
    const double xmax = ps.getParameter<double>("xmax");
    const bool leftExtrapolationLinear = 
        ps.getParameter<bool>("leftExtrapolationLinear");
    const bool rightExtrapolationLinear = 
        ps.getParameter<bool>("rightExtrapolationLinear");
    const std::vector<double> data(
        ps.getParameter<std::vector<double> >("data"));
    if (data.empty())
        return std::auto_ptr<fftjetcms::LinInterpolatedTable1D>(NULL);
    else
        return std::auto_ptr<fftjetcms::LinInterpolatedTable1D>(
            new fftjetcms::LinInterpolatedTable1D(
                &data[0], data.size(), xmin, xmax,
                leftExtrapolationLinear, rightExtrapolationLinear));
}
std::auto_ptr< fftjet::ScaleSpaceKernel > fftjetcms::fftjet_MembershipFunction_parser ( const edm::ParameterSet ps)

Definition at line 260 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_jetMembershipFunction().

{
    typedef std::auto_ptr<fftjet::ScaleSpaceKernel> return_type;

    const std::string MembershipFunction_type = ps.getParameter<std::string>(
        "Class");

    // Parse special cases first
    if (!MembershipFunction_type.compare("InterpolatedMembershipFcn"))
    {
        // This is a kernel defined by a 4d (sparsified) lookup table.
        // Here, it is simply loaded from a file using a built-in
        // method from fftjet. Note that the table representation
        // must be native binary (this will not work on platforms with
        // different endianity of floating point standard).
        const std::string file = ps.getParameter<std::string>("file");
        std::ifstream in(file.c_str(),
                         std::ios_base::in | std::ios_base::binary);
        if (!in.is_open())
            throw cms::Exception("FFTJetBadConfig")
                << "Failed to open file " << file << std::endl;
        return return_type(fftjet::InterpolatedMembershipFcn<float>::read(in));
    }

    if (!MembershipFunction_type.compare("Composite"))
    {
        throw cms::Exception("FFTJetBadConfig")
            << "Parsing of CompositeKernel objects is not implemented yet"
            << std::endl;
    }

    if (!MembershipFunction_type.compare("MagneticSmearing"))
    {
        // This kernel represents smearing of a jet in phi
        // in a magnetic field. The meaning of the parameters
        // is explained in the comments in the MagneticSmearingKernel.hh
        // header file of the fftjet package.
        make_param(std::vector<double>, fragmentationData);
        make_param(double, numeratorConst);
        make_param(double, charge1Fraction);
        make_param(double, charge2Fraction);
        make_param(unsigned, samplesPerBin);

        if (fragmentationData.empty())
            throw cms::Exception("FFTJetBadConfig")
                << "Fragmentation function data not defined for "
                "MagneticSmearingKernel" << std::endl;
        if (samplesPerBin < 1U)
            throw cms::Exception("FFTJetBadConfig")
                << "Bad number of samples per bin in "
                "MagneticSmearingKernel" << std::endl;

        fftjet::LinearInterpolator1d* fragmentationFunction = 
            new fftjet::LinearInterpolator1d(
                &fragmentationData[0], fragmentationData.size(), 0.0, 1.0);

        return return_type(
            new fftjet::MagneticSmearingKernel<fftjet::LinearInterpolator1d>(
                fragmentationFunction, numeratorConst,
                charge1Fraction, charge2Fraction,
                samplesPerBin, true));
    }

    if (!MembershipFunction_type.compare("Interpolated"))
    {
        // This is a kernel defined by a histogram-like 2d lookup table
        make_param(double, sx);
        make_param(double, sy);
        make_param(int, scalePower);
        make_param(unsigned, nxbins);
        make_param(double, xmin);
        make_param(double, xmax);
        make_param(unsigned, nybins);
        make_param(double, ymin);
        make_param(double, ymax);
        make_param(std::vector<double>, data);

        if (data.size() != nxbins*nybins)
            throw cms::Exception("FFTJetBadConfig")
                << "Bad number of data points for Interpolated kernel"
                << std::endl;

        return return_type(new fftjet::InterpolatedKernel(
                               sx, sy, scalePower,
                               &data[0], nxbins, xmin, xmax,
                               nybins, ymin, ymax));
    }

    if (!MembershipFunction_type.compare("Interpolated3d"))
    {
        // This is a kernel defined by a histogram-like 3d lookup table
        make_param(std::vector<double>, data);
        make_param(std::vector<double>, scales);
        make_param(bool, useLogSpaceForScale);
        make_param(unsigned, nxbins);
        make_param(double, xmin);
        make_param(double, xmax);
        make_param(unsigned, nybins);
        make_param(double, ymin);
        make_param(double, ymax);

        if (data.size() != nxbins*nybins*scales.size())
            throw cms::Exception("FFTJetBadConfig")
                << "Bad number of data points for Interpolated3d kernel"
                << std::endl;

        return return_type(new fftjet::InterpolatedKernel3d(
                               &data[0], scales, useLogSpaceForScale,
                               nxbins, xmin, xmax, nybins, ymin, ymax));
    }

    // This is not a special kernel. Try one of the classes
    // in the kernel factory provided by FFTJet.
    fftjet::DefaultKernel2dFactory factory;
    if (factory[MembershipFunction_type] == NULL) {
        return return_type(NULL);
    }

    make_param(double, sx);
    make_param(double, sy);
    make_param(int, scalePower);
    make_param(std::vector<double>, kernelParameters);

    const int n_expected = factory[MembershipFunction_type]->nParameters();
    if (n_expected >= 0)
        if (static_cast<unsigned>(n_expected) != kernelParameters.size())
            throw cms::Exception("FFTJetBadConfig")
                << "Bad number of kernel parameters" << std::endl;

    return std::auto_ptr<fftjet::ScaleSpaceKernel>(
        factory[MembershipFunction_type]->create(
            sx, sy, scalePower, kernelParameters));
}
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjetcms::fftjet_PeakFunctor_parser ( const edm::ParameterSet ps)

Definition at line 586 of file FFTJetParameterParser.cc.

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

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

{
    typedef fftjet::Functor1<double,fftjet::Peak> ptr_type;
    typedef std::auto_ptr<ptr_type> return_type;

    const std::string property_type = ps.getParameter<std::string>("Class");

    if (!property_type.compare("Log"))
    {
        return_type wrapped = fftjet_PeakFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function"));
        ptr_type* wr = wrapped.get();
        if (wr)
        {
            return_type result = return_type(
                new fftjet::LogProperty<fftjet::Peak>(wr, true));
            wrapped.release();
            return result;
        }
    }

    if (!property_type.compare("PeakProperty"))
    {
        const std::string member = ps.getParameter<std::string>("member");
        fftjet::JetProperty<fftjet::Peak>::JetMemberFunction fcn;
        if (parse_peak_member_function(member.c_str(), &fcn))
            return return_type(
                new fftjet::JetProperty<fftjet::Peak>(fcn));
        else
            return return_type(NULL);
    }

    if (!property_type.compare("MinusScaledLaplacian"))
    {
        const double sx = ps.getParameter<double>("sx");
        const double sy = ps.getParameter<double>("sx");
        return return_type(
            new fftjet::MinusScaledLaplacian<fftjet::Peak>(sx, sy));
    }

    if (!property_type.compare("ScaledHessianDet"))
    {
        return return_type(
            new fftjet::ScaledHessianDet<fftjet::Peak>());
    }

    if (!property_type.compare("ScaledMagnitude"))
    {
        return return_type(
            new fftjet::ScaledMagnitude<fftjet::Peak>());
    }

    if (!property_type.compare("ScaledMagnitude2"))
    {
        return return_type(
            new fftjet::ScaledMagnitude2<fftjet::Peak>());
    }

    if (!property_type.compare("ConstDouble"))
    {
        const double value = ps.getParameter<double>("value");
        return return_type(new ConstDouble<fftjet::Peak>(value));
    }

    if (!property_type.compare("ProportionalToScale"))
    {
        const double value = ps.getParameter<double>("value");
        return return_type(
            new ProportionalToScale<fftjet::Peak>(value));
    }

    if (!property_type.compare("MultiplyByConst"))
    {
        const double factor = ps.getParameter<double>("factor");
        return_type function = fftjet_PeakFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function"));
        ptr_type* ptr = function.get();
        if (ptr)
        {
            return_type result = return_type(
                new MultiplyByConst<fftjet::Peak>(factor, ptr, true));
            function.release();
            return result;
        }
    }

    if (!property_type.compare("CompositeFunctor"))
    {
        std::auto_ptr<fftjet::Functor1<double,double> > fcn1 = 
            fftjet_Function_parser(
                ps.getParameter<edm::ParameterSet>("function1"));
        return_type fcn2 = fftjet_PeakFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function2"));
        fftjet::Functor1<double,double>* f1 = fcn1.get();
        ptr_type* f2 = fcn2.get();
        if (f1 && f2)
        {
            return_type result = return_type(
                new CompositeFunctor<fftjet::Peak>(f1, f2, true));
            fcn1.release();
            fcn2.release();
            return result;
        }
    }

    if (!property_type.compare("ProductFunctor"))
    {
        return_type fcn1 = fftjet_PeakFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function1"));
        return_type fcn2 = fftjet_PeakFunctor_parser(
            ps.getParameter<edm::ParameterSet>("function2"));
        ptr_type* f1 = fcn1.get();
        ptr_type* f2 = fcn2.get();
        if (f1 && f2)
        {
            return_type result = return_type(
                new ProductFunctor<fftjet::Peak>(f1, f2, true));
            fcn1.release();
            fcn2.release();
            return result;
        }
    }

    if (!property_type.compare("MagnitudeDependent"))
    {
        std::auto_ptr<fftjet::Functor1<double,double> > fcn1 = 
            fftjet_Function_parser(
                ps.getParameter<edm::ParameterSet>("function"));
        fftjet::Functor1<double,double>* f1 = fcn1.get();
        if (f1)
        {
            return_type result = return_type(
                new MagnitudeDependent<fftjet::Peak>(f1, true));
            fcn1.release();
            return result;
        }
    }

    if (!property_type.compare("PeakEtaDependent"))
    {
        std::auto_ptr<fftjet::Functor1<double,double> > fcn1 = 
            fftjet_Function_parser(
                ps.getParameter<edm::ParameterSet>("function"));
        fftjet::Functor1<double,double>* f1 = fcn1.get();
        if (f1)
        {
            return_type result = return_type(new PeakEtaDependent(f1, true));
            fcn1.release();
            return result;
        }
    }

    return return_type(NULL);
}
std::auto_ptr< fftjet::JetMagnitudeMapper2d< fftjet::Peak > > fftjetcms::fftjet_PeakMagnitudeMapper2d_parser ( const edm::ParameterSet ps)

Definition at line 992 of file FFTJetParameterParser.cc.

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

{
    std::auto_ptr<fftjet::LinearInterpolator2d> responseCurve =
        fftjet_LinearInterpolator2d_parser(
            ps.getParameter<edm::ParameterSet>("responseCurve"));

    const double minPredictor = ps.getParameter<double>("minPredictor");
    const double maxPredictor = ps.getParameter<double>("maxPredictor");
    const unsigned nPredPoints = ps.getParameter<unsigned>("nPredPoints");
    const double maxMagnitude = ps.getParameter<double>("maxMagnitude");
    const unsigned nMagPoints = ps.getParameter<unsigned>("nMagPoints");

    return (std::auto_ptr<fftjet::JetMagnitudeMapper2d<fftjet::Peak> >
             (new fftjet::JetMagnitudeMapper2d<fftjet::Peak>(
                  *responseCurve,
                  new fftjetcms::PeakAbsEta<fftjet::Peak>(),
                  true,minPredictor,maxPredictor,nPredPoints,
                  maxMagnitude,nMagPoints)));
}
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjetcms::fftjet_PeakSelector_parser ( const edm::ParameterSet ps)

Definition at line 185 of file FFTJetParameterParser.cc.

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

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

{
    typedef std::auto_ptr<fftjet::Functor1<bool,fftjet::Peak> > return_type;

    const std::string peakselector_type = ps.getParameter<std::string>(
        "Class");

    if (!peakselector_type.compare("AllPeaksPass"))
    {
        return return_type(new fftjet::AllPeaksPass());
    }

    if (!peakselector_type.compare("EtaAndPtDependentPeakSelector"))
    {
        const std::string file = ps.getParameter<std::string>("file");
        std::ifstream in(file.c_str(),
                         std::ios_base::in | std::ios_base::binary);
        if (!in.is_open())
            throw cms::Exception("FFTJetBadConfig")
                << "Failed to open file " << file << std::endl;
        EtaAndPtDependentPeakSelector* ptr =
            new EtaAndPtDependentPeakSelector(in);
        if (!ptr->isValid())
            throw cms::Exception("FFTJetBadConfig")
                << "Failed to read file " << file << std::endl;
        return return_type(ptr);
    }

    if (!peakselector_type.compare("EtaAndPtLookupPeakSelector"))
    {
        make_param(unsigned, nx);
        make_param(unsigned, ny);
        make_param(double, xmin);
        make_param(double, xmax);
        make_param(double, ymin);
        make_param(double, ymax);
        make_param(std::vector<double>, data);

        if (xmin >= xmax || ymin >= ymax || !nx || !ny || data.size() != nx*ny)
            throw cms::Exception("FFTJetBadConfig")
                << "Failed to configure EtaAndPtLookupPeakSelector" << std::endl;

        return return_type(new EtaAndPtLookupPeakSelector(
                               nx, xmin, xmax, ny, ymin, ymax, data));
    }

    if (!peakselector_type.compare("SimplePeakSelector"))
    {
        const double magCut = ps.getParameter<double>("magCut");
        const double driftSpeedCut = ps.getParameter<double>("driftSpeedCut");
        const double magSpeedCut = ps.getParameter<double>("magSpeedCut");
        const double lifeTimeCut = ps.getParameter<double>("lifeTimeCut");
        const double NNDCut = ps.getParameter<double>("NNDCut");
        const double etaCut = ps.getParameter<double>("etaCut");

        return return_type(new fftjet::SimplePeakSelector(
            magCut, driftSpeedCut ,magSpeedCut, lifeTimeCut, NNDCut, etaCut));
    }

    if (!peakselector_type.compare("ScalePowerPeakSelector"))
    {
        const double a = ps.getParameter<double>("a");
        const double p = ps.getParameter<double>("p");
        const double b = ps.getParameter<double>("b");
        const double etaCut = ps.getParameter<double>("etaCut");

        return return_type(new fftjet::ScalePowerPeakSelector(
                               a, p, b, etaCut));
    }

    return return_type(NULL);
}
std::auto_ptr< AbsPileupCalculator > fftjetcms::fftjet_PileupCalculator_parser ( const edm::ParameterSet ps)

Definition at line 951 of file FFTJetParameterParser.cc.

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

Referenced by FFTJetProducer::parse_pileupDensityCalc().

{
    typedef std::auto_ptr<AbsPileupCalculator> return_type;

    const std::string fcn_type = ps.getParameter<std::string>("Class");

    if (!fcn_type.compare("EtaDependentPileup"))
    {
        std::auto_ptr<fftjet::LinearInterpolator2d> interp = 
            fftjet_LinearInterpolator2d_parser(
                ps.getParameter<edm::ParameterSet>("Interpolator2d"));
        const double inputRhoFactor = ps.getParameter<double>("inputRhoFactor");
        const double outputRhoFactor = ps.getParameter<double>("outputRhoFactor");

        const fftjet::LinearInterpolator2d* ip = interp.get();
        if (ip)
            return return_type(new EtaDependentPileup(
                                   *ip, inputRhoFactor, outputRhoFactor));
        else
            return return_type(NULL);
    }

    if (!fcn_type.compare("PileupGrid2d"))
    {
        std::auto_ptr<fftjet::Grid2d<Real> > grid = 
            fftjet_Grid2d_parser(
                ps.getParameter<edm::ParameterSet>("Grid2d"));
        const double rhoFactor = ps.getParameter<double>("rhoFactor");

        const fftjet::Grid2d<Real>* g = grid.get();
        if (g)
            return return_type(new PileupGrid2d(*g, rhoFactor));
        else
            return return_type(NULL);
    }

    return return_type(NULL);
}
std::auto_ptr< std::vector< double > > fftjetcms::fftjet_ScaleSet_parser ( const edm::ParameterSet ps)

Definition at line 414 of file FFTJetParameterParser.cc.

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

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

{
    typedef std::auto_ptr<std::vector<double> > return_type;

    const std::string className = ps.getParameter<std::string>("Class");

    if (!className.compare("EquidistantInLinearSpace") ||
        !className.compare("EquidistantInLogSpace"))
    {
        const double minScale = ps.getParameter<double>("minScale");
        const double maxScale = ps.getParameter<double>("maxScale");
        const unsigned nScales = ps.getParameter<unsigned>("nScales");

        if (minScale <= 0.0 || maxScale <= 0.0 ||
            nScales == 0 || minScale == maxScale)
            return return_type(NULL);

        // Can't return pointers to EquidistantInLinearSpace
        // or EquidistantInLogSpace directly because std::vector
        // destructor is not virtual.
        if (!className.compare("EquidistantInLinearSpace"))
            return return_type(new std::vector<double>(
                                   fftjet::EquidistantInLinearSpace(
                                       minScale, maxScale, nScales)));
        else
            return return_type(new std::vector<double>(
                                   fftjet::EquidistantInLogSpace(
                                       minScale, maxScale, nScales)));
    }

    if (!className.compare("UserSet"))
    {
        return_type scales(new std::vector<double>(
            ps.getParameter<std::vector<double> >("scales")));

        // Verify that all scales are positive and unique
        const unsigned nscales = scales->size();
        for (unsigned i=0; i<nscales; ++i)
            if ((*scales)[i] <= 0.0)
                return return_type(NULL);

        for (unsigned i=1; i<nscales; ++i)
            for (unsigned j=0; j<i; ++j)
                if ((*scales)[i] == (*scales)[j])
                    return return_type(NULL);

        return scales;
    }

    return return_type(NULL);
}
template<class Real >
fftjet::RecombinedJet< VectorLike > fftjetcms::jetFromStorable ( const reco::FFTJet< Real > &  jet)

Definition at line 61 of file jetConverters.h.

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

Referenced by FFTJetProducer::genJetPreclusters().

    {
        typedef reco::PattRecoPeak<Real> StoredPeak;
        typedef fftjet::RecombinedJet<VectorLike> RecoFFTJet;

        double hessian[3] = {0., 0., 0.};
        const StoredPeak& p(jet.f_precluster());
        p.hessian(hessian);
        const double pileupPt = jet.f_pileup().Pt();

        return RecoFFTJet(fftjet::Peak(p.eta(), p.phi(), p.magnitude(),
                                       hessian, p.driftSpeed(),
                                       p.magSpeed(), p.lifetime(),
                                       p.scale(), p.nearestNeighborDistance(),
                                       jet.f_membershipFactor(),
                                       jet.f_recoScale(),
                                       jet.f_recoScaleRatio(),
                                       p.clusterRadius(),
                                       p.clusterSeparation(), jet.f_code(),
                                       jet.f_status()),
                          jet.f_vec(), jet.f_ncells(), jet.f_etSum(),
                          jet.f_centroidEta(), jet.f_centroidPhi(),
                          jet.f_etaWidth(), jet.f_phiWidth(),
                          jet.f_etaPhiCorr(), jet.f_fuzziness(),
                          pileupPt, 0.0, jet.f_convergenceDistance());
    }
template<class Real >
reco::FFTJet< Real > fftjetcms::jetToStorable ( const fftjet::RecombinedJet< VectorLike > &  jet)

Definition at line 29 of file jetConverters.h.

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

    {
        typedef reco::PattRecoPeak<Real> StoredPeak;

        double hessian[3] = {0., 0., 0.};
        const fftjet::Peak& peak(jet.precluster());
        peak.hessian(hessian);

        return reco::FFTJet<Real>(StoredPeak(peak.eta(),
                                             peak.phi(),
                                             peak.magnitude(),
                                             hessian,
                                             peak.driftSpeed(),
                                             peak.magSpeed(),
                                             peak.lifetime(),
                                             peak.scale(),
                                             peak.nearestNeighborDistance(),
                                             peak.clusterRadius(),
                                             peak.clusterSeparation()),
                                  jet.vec(), jet.ncells(), jet.etSum(),
                                  jet.centroidEta(), jet.centroidPhi(),
                                  jet.etaWidth(), jet.phiWidth(),
                                  jet.etaPhiCorr(), jet.fuzziness(),
                                  jet.convergenceDistance(),
                                  jet.recoScale(), jet.recoScaleRatio(),
                                  jet.membershipFactor(),
                                  jet.code(), jet.status());
    }
template<class T1 , class T2 , class DistanceCalculator >
unsigned fftjetcms::matchOneToOne ( const std::vector< T1 > &  v1,
const std::vector< T2 > &  v2,
const DistanceCalculator &  calc,
std::vector< int > *  matchFrom1To2,
const double  maxMatchingDistance = 1.0e300 
)

Definition at line 41 of file matchOneToOne.h.

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

Referenced by FFTJetProducer::removeFakePreclusters().

    {
        unsigned nused = 0;
        matchFrom1To2->clear();

        const unsigned n1 = v1.size();
        if (n1)
        {
            matchFrom1To2->reserve(n1);
            for (unsigned i1=0; i1<n1; ++i1)
                matchFrom1To2->push_back(-1);

            const unsigned n2 = v2.size();
            if (n2)
            {
                const unsigned nmatches = n1*n2;
                std::vector<Private::matchOneToOne_MatchInfo> distanceTable(nmatches);
                std::vector<int> taken2(n2);

                for (unsigned i2=0; i2<n2; ++i2)
                    taken2[i2] = 0;

                Private::matchOneToOne_MatchInfo* m;
                for (unsigned i1=0; i1<n1; ++i1)
                    for (unsigned i2=0; i2<n2; ++i2)
                    {
                        m = &distanceTable[i1*n2+i2];
                        m->distance = calc(v1[i1], v2[i2]);
                        m->i1 = i1;
                        m->i2 = i2;
                    }

                std::sort(distanceTable.begin(), distanceTable.end());
                for (unsigned i=0; i<nmatches && nused<n1 && nused<n2; ++i)
                {
                    m = &distanceTable[i];
                    if (m->distance > maxMatchingDistance)
                        break;
                    if ((*matchFrom1To2)[m->i1] < 0 && !taken2[m->i2])
                    {
                        (*matchFrom1To2)[m->i1] = static_cast<int>(m->i2);
                        taken2[m->i2] = 1;
                        ++nused;
                    }
                }
            }
        }

        return nused;
    }
JetType fftjetcms::parseJetType ( const std::string &  name)

Definition at line 5 of file JetType.cc.

References BASICJET, CALOJET, Exception, GENJET, JPTJET, PFJET, and TRACKJET.

    {
        if (!name.compare("BasicJet"))
            return BASICJET;
        else if (!name.compare("GenJet"))
            return GENJET;
        else if (!name.compare("CaloJet"))
            return CALOJET;
        else if (!name.compare("PFJet"))
            return PFJET;
        else if (!name.compare("TrackJet"))
            return TRACKJET;
        else if (!name.compare("JPTJet"))
            return JPTJET;
        else
            throw cms::Exception("FFTJetBadConfig")
                << "In parseJetType: unsupported jet type specification \""
                << name << "\"\n";
    }
template<class Real >
void fftjetcms::sparsePeakTreeFromStorable ( const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &  in,
const std::vector< double > *  scaleSetIfNotAdaptive,
double  completeEventScale,
fftjet::SparseClusteringTree< fftjet::Peak, long > *  out 
)

Definition at line 139 of file clusteringTreeConverters.h.

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

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

    {
        typedef fftjet::SparseClusteringTree<fftjet::Peak,long> SparseTree;
        typedef reco::PattRecoPeak<Real> StoredPeak;
        typedef reco::PattRecoNode<StoredPeak> StoredNode;
        typedef reco::PattRecoTree<Real,StoredPeak> StoredTree;

        if (!in.isSparse())
            throw cms::Exception("FFTJetBadConfig")
                << "can't restore sparse clustering tree"
                << " from densely stored record" << std::endl;

        assert(out);
        out->clear();

        const std::vector<StoredNode>& nodes(in.getNodes());
        const unsigned n = nodes.size();
        out->reserveNodes(n + 1U);

        double hessian[3] = {0., 0., 0.};

        for (unsigned i=0; i<n; ++i)
        {
            const StoredNode& snode(nodes[i]);
            const StoredPeak& p(snode.getCluster());
            p.hessian(hessian);
            const SparseTree::Node node(
                fftjet::Peak(p.eta(), p.phi(), p.magnitude(),
                             hessian, p.driftSpeed(),
                             p.magSpeed(), p.lifetime(),
                             p.scale(), p.nearestNeighborDistance(),
                             1.0, 0.0, 0.0,
                             p.clusterRadius(), p.clusterSeparation()),
                snode.originalLevel(),
                snode.mask());
            out->addNode(node, snode.parent());
        }

        const std::vector<Real>& storedScales(in.getScales());
        if (!storedScales.empty())
        {
            const unsigned nsc = storedScales.size();
            out->reserveScales(nsc + 1U);
            out->addScale(DBL_MAX);
            const Real* scales = &storedScales[0];
            for (unsigned i=0; i<nsc; ++i)
                out->addScale(scales[i]);
        }
        else if (scaleSetIfNotAdaptive && !scaleSetIfNotAdaptive->empty())
        {
            const unsigned nsc = scaleSetIfNotAdaptive->size();
            // There may be the "complete event" scale added at the end.
            // Reserve a sufficient number of scales to take this into
            // account.
            if (completeEventScale)
                out->reserveScales(nsc + 2U);
            else
                out->reserveScales(nsc + 1U);
            out->addScale(DBL_MAX);
            const double* scales = &(*scaleSetIfNotAdaptive)[0];
            for (unsigned i=0; i<nsc; ++i)
                out->addScale(scales[i]);
            if (completeEventScale)
                out->addScale(completeEventScale);
        }
        else
        {
            throw cms::Exception("FFTJetBadConfig")
                << "can't restore sparse clustering tree scales"
                << std::endl;
        }
    }
template<class Real >
void fftjetcms::sparsePeakTreeToStorable ( const fftjet::SparseClusteringTree< fftjet::Peak, long > &  in,
bool  writeOutScaleInfo,
reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *  out 
)

Definition at line 79 of file clusteringTreeConverters.h.

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

Referenced by FFTJetPatRecoProducer::buildSparseProduct().

    {
        typedef fftjet::SparseClusteringTree<fftjet::Peak,long> SparseTree;
        typedef reco::PattRecoPeak<Real> StoredPeak;
        typedef reco::PattRecoNode<StoredPeak> StoredNode;
        typedef reco::PattRecoTree<Real,StoredPeak> StoredTree;

        assert(tree);

        tree->clear();
        tree->setSparse(true);

        const unsigned nNodes = sparseTree.size();
        double hessian[3] = {0., 0., 0.};

        // Do not write out the meaningless top node
        tree->reserveNodes(nNodes - 1);
        for (unsigned i=1; i<nNodes; ++i)
        {
            const SparseTree::Node& node(sparseTree.getNode(i));
            const fftjet::Peak& peak(node.getCluster());
            peak.hessian(hessian);
            StoredNode sn(StoredPeak(peak.eta(),
                                     peak.phi(),
                                     peak.magnitude(),
                                     hessian,
                                     peak.driftSpeed(),
                                     peak.magSpeed(),
                                     peak.lifetime(),
                                     peak.scale(),
                                     peak.nearestNeighborDistance(),
                                     peak.clusterRadius(),
                                     peak.clusterSeparation()),
                          node.originalLevel(),
                          node.mask(),
                          node.parent());
            tree->addNode(sn);
        }

        // Do we want to write out the scales? We will use the following
        // convention: if the tree is using an adaptive algorithm, the scales
        // will be written out. If not, they are not going to change from
        // event to event. In this case the scales would waste disk space
        // for no particularly good reason, so they will not be written out.
        if (writeOutScaleInfo)
        {
            // Do not write out the meaningless top-level scale
            const unsigned nScales = sparseTree.nLevels();
            tree->reserveScales(nScales - 1);
            for (unsigned i=1; i<nScales; ++i)
                tree->addScale(sparseTree.getScale(i));
        }
    }