CMS 3D CMS Logo

Namespaces | Classes | Functions | Variables

PhysicsTools Namespace Reference

Namespaces

namespace  Calibration
namespace  helper

Classes

class  AtomicId
 Cheap generic unique keyword identifier class. More...
class  BitSet
 A compact container for storing single bits. More...
class  Interceptor
class  LeastSquares
class  MLP
class  MVAComputer
 Main interface class to the generic discriminator computer framework. More...
class  MVAComputerCache
 Creates and and MVAComputer from calibrations via EventSetup. More...
class  MVAComputerESSourceBase
class  MVAComputerESSourceImpl
class  MVAModuleHelper
 Template for automated variable collection and MVA computation in EDM modules. More...
class  MVAModuleHelperDefaultFiller
 Default template for MVAModuleHelper "Filler" template argument. More...
class  MVATrainer
class  MVATrainerContainer
class  MVATrainerContainerLooperImpl
class  MVATrainerContainerSave
class  MVATrainerContainerSaveImpl
class  MVATrainerFileSave
class  MVATrainerFileSaveImpl
class  MVATrainerLooper
class  MVATrainerLooperImpl
class  MVATrainerSave
class  MVATrainerSaveImpl
class  ProcessRegistry
 Generic registry template for polymorphic processor implementations. More...
class  Source
class  SourceVariable
class  SourceVariableSet
class  Spline
 A simple class for cubic splines. More...
class  TrainerMonitoring
class  TrainMVAComputerCalibration
 for internal use by MVATrainer More...
class  TrainProcessor
class  TreeReader
class  TreeTrainer
class  Variable
 Class describing an input variable. More...
class  VarProcessor
 Common base class for variable processors. More...

Functions

static std::string escape (const std::string &in)
static IdCache & getAtomicIdCache ()
static bool isMagic (AtomicId id)
static void loadMatrix (DOMElement *elem, unsigned int n, TMatrixDBase &matrix)
static void loadVector (DOMElement *elem, unsigned int n, TVectorD &vector)
template<typename T >
static std::pair< void
*, std::vector< T > > 
makeMulti ()
std::ostream & operator<< (std::ostream &os, const PhysicsTools::AtomicId &id)
 STL streaming operator.
static DOMElement * saveMatrix (DOMDocument *doc, unsigned int n, const TMatrixDBase &matrix)
static DOMElement * saveVector (DOMDocument *doc, unsigned int n, const TVectorD &vector)
static std::vector< std::string > split (const std::string line, char delim)
static std::string stdStringPrintf (const char *format,...)
static std::string stdStringVPrintf (const char *format, std::va_list va)

Variables

static const AtomicId kOutputId ("__OUTPUT__")
static Interceptor::Registry registry ("Interceptor")

Function Documentation

static std::string PhysicsTools::escape ( const std::string &  in) [static]

Definition at line 405 of file MVATrainer.cc.

References query::result.

Referenced by PhysicsTools::MVATrainer::MVATrainer().

{
        std::string result("'");
        for(std::string::const_iterator iter = in.begin();
            iter != in.end(); ++iter) {
                switch(*iter) {
                    case '\'':
                        result += "'\\''";
                        break;
                    default:
                        result += *iter;
                }
        }
        result += '\'';
        return result;
}
static IdCache& PhysicsTools::getAtomicIdCache ( ) [static]

Definition at line 61 of file AtomicId.cc.

Referenced by PhysicsTools::AtomicId::lookup().

{
        static IdCache atomicIdCache;
        return atomicIdCache;
}
static bool PhysicsTools::isMagic ( AtomicId  id) [static]

Definition at line 398 of file MVATrainer.cc.

References kOutputId.

Referenced by PhysicsTools::MVATrainer::fillOutputVars().

{
        return id == MVATrainer::kTargetId ||
               id == MVATrainer::kWeightId ||
               id == kOutputId;
}
static void PhysicsTools::loadMatrix ( DOMElement *  elem,
unsigned int  n,
TMatrixDBase &  matrix 
) [static]

Definition at line 144 of file LeastSquares.cc.

References Exception, makeMuonMisalignmentScenario::matrix, and python::Node::node.

Referenced by FWGeometry::loadMap().

{
        if (std::strcmp(XMLSimpleStr(elem->getNodeName()),
                                     "matrix") != 0)
                throw cms::Exception("LeastSquares")
                        << "Expected matrix in data file."
                        << std::endl;

        unsigned int row = 0;
        for(DOMNode *node = elem->getFirstChild();
            node; node = node->getNextSibling()) {
                if (node->getNodeType() != DOMNode::ELEMENT_NODE)
                        continue;

                if (std::strcmp(XMLSimpleStr(node->getNodeName()),
                                             "row") != 0)
                        throw cms::Exception("LeastSquares")
                                << "Expected row tag in data file."
                                << std::endl;

                if (row >= n)
                        throw cms::Exception("LeastSquares")
                                << "Too many rows in data file." << std::endl;

                elem = static_cast<DOMElement*>(node);

                unsigned int col = 0;
                for(DOMNode *subNode = elem->getFirstChild();
                    subNode; subNode = subNode->getNextSibling()) {
                        if (subNode->getNodeType() != DOMNode::ELEMENT_NODE)
                                continue;

                        if (std::strcmp(XMLSimpleStr(subNode->getNodeName()),
                                                     "value") != 0)
                        throw cms::Exception("LeastSquares")
                                << "Expected value tag in data file."
                                << std::endl;

                        if (col >= n)
                                throw cms::Exception("LeastSquares")
                                        << "Too many columns in data file."
                                        << std::endl;

                        matrix(row, col) =
                                XMLDocument::readContent<double>(subNode);
                        col++;
                }

                if (col != n)
                        throw cms::Exception("LeastSquares")
                                << "Missing columns in data file."
                                << std::endl;
                row++;
        }

        if (row != n)
                throw cms::Exception("LeastSquares")
                        << "Missing rows in data file."
                        << std::endl;
}
static void PhysicsTools::loadVector ( DOMElement *  elem,
unsigned int  n,
TVectorD &  vector 
) [static]

Definition at line 205 of file LeastSquares.cc.

References Exception, and python::Node::node.

{
        if (std::strcmp(XMLSimpleStr(elem->getNodeName()),
                                     "vector") != 0)
                throw cms::Exception("LeastSquares")
                        << "Expected matrix in data file."
                        << std::endl;

        unsigned int col = 0;
        for(DOMNode *node = elem->getFirstChild();
            node; node = node->getNextSibling()) {
                if (node->getNodeType() != DOMNode::ELEMENT_NODE)
                        continue;

                if (std::strcmp(XMLSimpleStr(node->getNodeName()),
                                             "value") != 0)
                throw cms::Exception("LeastSquares")
                        << "Expected value tag in data file."
                        << std::endl;

                if (col >= n)
                        throw cms::Exception("LeastSquares")
                                << "Too many columns in data file."
                                << std::endl;

                vector(col) = XMLDocument::readContent<double>(node);
                col++;
        }

        if (col != n)
                throw cms::Exception("LeastSquares")
                        << "Missing columns in data file."
                        << std::endl;
}
template<typename T >
static std::pair<void*, std::vector<T> > PhysicsTools::makeMulti ( ) [static]

Definition at line 196 of file TreeReader.cc.

{ return std::pair<void*, std::vector<T> >(0, std::vector<T>()); }
std::ostream& PhysicsTools::operator<< ( std::ostream &  os,
const PhysicsTools::AtomicId id 
) [inline]

STL streaming operator.

Definition at line 73 of file AtomicId.h.

{ return os << (const char*)id; }
static DOMElement* PhysicsTools::saveMatrix ( DOMDocument *  doc,
unsigned int  n,
const TMatrixDBase &  matrix 
) [static]

Definition at line 240 of file LeastSquares.cc.

References asciidump::doc, i, j, makeMuonMisalignmentScenario::matrix, n, dbtoconf::root, and relativeConstraints::value.

Referenced by TestHistoMgr::save().

{
        DOMElement *root = doc->createElement(XMLUniStr("matrix"));
        XMLDocument::writeAttribute<unsigned int>(root, "size", n);

        for(unsigned int i = 0; i < n; i++) {
                DOMElement *row = doc->createElement(XMLUniStr("row"));
                root->appendChild(row);

                for(unsigned int j = 0; j < n; j++) {
                        DOMElement *value =
                                doc->createElement(XMLUniStr("value"));
                        row->appendChild(value);

                        XMLDocument::writeContent<double>(value, doc,
                                                          matrix(i, j));
                }
        }

        return root;
}
static DOMElement* PhysicsTools::saveVector ( DOMDocument *  doc,
unsigned int  n,
const TVectorD &  vector 
) [static]

Definition at line 263 of file LeastSquares.cc.

References asciidump::doc, i, n, dbtoconf::root, and relativeConstraints::value.

Referenced by TestHistoMgr::save().

{
        DOMElement *root = doc->createElement(XMLUniStr("vector"));
        XMLDocument::writeAttribute<unsigned int>(root, "size", n);

        for(unsigned int i = 0; i < n; i++) {
                DOMElement *value =
                        doc->createElement(XMLUniStr("value"));
                root->appendChild(value);

                XMLDocument::writeContent<double>(value, doc, vector(i));
        }

        return root;
}
static std::vector<std::string> PhysicsTools::split ( const std::string  line,
char  delim 
) [static]

Definition at line 20 of file MLP.cc.

References lumiQueryAPI::q.

Referenced by PhysicsTools::MLP::MLP(), and PhysicsTools::MVATrainer::setCrossValidation().

                 {
                const char *q = std::strchr(p, delim);

                if (!q) {
                        tokens.push_back(std::string(p));
                        p = 0;
                } else {
                        tokens.push_back(std::string(p, q - p));
                        p = q + 1;
                }
        }

        return tokens;
}

MLP::MLP(unsigned int nIn, unsigned int nOut, const std::string layout_) :
static std::string PhysicsTools::stdStringPrintf ( const char *  format,
  ... 
) [static]

Definition at line 183 of file MVATrainer.cc.

References query::result, and stdStringVPrintf().

Referenced by PhysicsTools::MVATrainer::bookMonitor(), and PhysicsTools::MVATrainer::trainFileName().

{
        std::va_list va;
        va_start(va, format);
        std::string result = stdStringVPrintf(format, va);
        va_end(va);
        return result;
}
static std::string PhysicsTools::stdStringVPrintf ( const char *  format,
std::va_list  va 
) [static]

Definition at line 160 of file MVATrainer.cc.

References n, query::result, and findQualityFiles::size.

Referenced by stdStringPrintf().

{
        unsigned int size = std::min<unsigned int>(128, std::strlen(format));
        char *buffer = new char[size];
        for(;;) {
                int n = std::vsnprintf(buffer, size, format, va);
                if (n >= 0 && (unsigned int)n < size)
                        break;

                if (n >= 0)
                        size = n + 1;
                else
                        size *= 2;

                delete[] buffer;
                buffer = new char[size];
        }

        std::string result(buffer);
        delete[] buffer;
        return result;
}

Variable Documentation

const AtomicId PhysicsTools::kOutputId("__OUTPUT__") [static]