CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

lhef::BranchingRatios Class Reference

#include <BranchingRatios.h>

List of all members.

Public Member Functions

 BranchingRatios ()
double getFactor (const Hadronisation *hadronisation, const boost::shared_ptr< LHEEvent > &event) const
void reset ()
void set (int pdgId, bool both=true, double value=1.0)
 ~BranchingRatios ()

Private Member Functions

double get (int pdgId, const Hadronisation *hadronisation) const

Private Attributes

std::map< int, double > cache

Detailed Description

Definition at line 13 of file BranchingRatios.h.


Constructor & Destructor Documentation

lhef::BranchingRatios::BranchingRatios ( ) [inline]

Definition at line 15 of file BranchingRatios.h.

{}
lhef::BranchingRatios::~BranchingRatios ( ) [inline]

Definition at line 16 of file BranchingRatios.h.

{}

Member Function Documentation

double lhef::BranchingRatios::get ( int  pdgId,
const Hadronisation hadronisation 
) const [private]

Definition at line 38 of file BranchingRatios.cc.

References cache, pos, and lhef::Hadronisation::totalBranchingRatio().

{
        std::map<int, double>::const_iterator pos = cache.find(pdgId);
        if (pos == cache.end()) {
                double val = hadronisation->totalBranchingRatio(pdgId);
                if (val <= 0.0)
                        val = 1.0;
                if (val < 0.99)
                        edm::LogInfo("Generator|LHEInterface")
                                << "Particle with pdgId " << pdgId
                                << " only partly decayed in hadronizer, "
                                   "reducing respective event cross-section "
                                   "contribution with a factor of "
                                << val << "." << std::endl;

                cache.insert(std::make_pair(pdgId, val));
                return val;
        } else
                return pos->second;
}
double lhef::BranchingRatios::getFactor ( const Hadronisation hadronisation,
const boost::shared_ptr< LHEEvent > &  event 
) const

Definition at line 25 of file BranchingRatios.cc.

References i, lhef::HEPEUP::IDUP, lhef::HEPEUP::ISTUP, and lhef::HEPEUP::NUP.

Referenced by LHEProducer::filter().

{
        double factor = 1.0;
        const HEPEUP *hepeup = event->getHEPEUP();
        for(int i = 0; i < hepeup->NUP; i++) {
                if (hepeup->ISTUP[i] == 1)
                        factor *= get(hepeup->IDUP[i], hadronisation);
        }
        return factor;
}
void lhef::BranchingRatios::reset ( void  )

Definition at line 13 of file BranchingRatios.cc.

References cache.

{
        cache.clear();
}
void lhef::BranchingRatios::set ( int  pdgId,
bool  both = true,
double  value = 1.0 
)

Definition at line 18 of file BranchingRatios.cc.

References cache, benchmark_cfg::pdgId, and relativeConstraints::value.

Referenced by LHEProducer::LHEProducer().

{
        cache[pdgId] = value;
        if (both)
                cache[-pdgId] = value;
}

Member Data Documentation

std::map<int, double> lhef::BranchingRatios::cache [mutable, private]

Definition at line 27 of file BranchingRatios.h.

Referenced by get(), reset(), and set().