#include <AlgorithmCalibration.h>
Public Types | |
typedef XERCES_CPP_NAMESPACE::DOMElement | DOMElement |
typedef XERCES_CPP_NAMESPACE::DOMNode | DOMNode |
Public Member Functions | |
AlgorithmCalibration (const std::string &fileName) | |
void | saveCalibration (const std::string &fileName) |
void | startCalibration () |
void | updateCalibration (const typename T::Input &calibrationInput) |
template<class CI > | |
void | updateCalibration (const typename T::Input &calibrationInputForCategory, const CI &inputForCalibration) |
~AlgorithmCalibration () | |
Protected Member Functions | |
DOMElement * | dom () |
bool | readCategories () |
CO * | readObject (DOMNode *) |
Private Attributes | |
std::string | m_filename |
CalibrationXML * | m_xml |
The AlgorithmCalibration class is the interface between user code and calibration framework developed for BReco subsytem. Both the analysis programs and the calibration programs should only access calibration information via that class.
An algorithm is supposed to keep a single instance of that class to avoid the reload of XML for every event (during analysis) and because you want to accumulate over all events the data to perform a new calibration in the calibration program.
The class is templated on the Category T and on the CalibratedObject CO
Definition at line 37 of file AlgorithmCalibration.h.
typedef XERCES_CPP_NAMESPACE::DOMElement AlgorithmCalibration< T, CO >::DOMElement |
Definition at line 41 of file AlgorithmCalibration.h.
typedef XERCES_CPP_NAMESPACE::DOMNode AlgorithmCalibration< T, CO >::DOMNode |
Definition at line 42 of file AlgorithmCalibration.h.
AlgorithmCalibration< T, CO >::AlgorithmCalibration | ( | const std::string & | fileName | ) |
Create an AlgorithmCalibration class and load from fileName the cateogries and their objects.
Definition at line 93 of file AlgorithmCalibration.h.
References CalibrationXML::closeFile(), AlgorithmCalibration< T, CO >::m_xml, and AlgorithmCalibration< T, CO >::readCategories().
: m_filename(filename), m_xml(0) { readCategories(); if(m_xml) { m_xml->closeFile(); } }
AlgorithmCalibration< T, CO >::~AlgorithmCalibration | ( | ) |
Definition at line 102 of file AlgorithmCalibration.h.
DOMElement* AlgorithmCalibration< T, CO >::dom | ( | ) | [inline, protected] |
Definition at line 75 of file AlgorithmCalibration.h.
References CalibrationXML::calibrationDOM(), AlgorithmCalibration< T, CO >::m_filename, AlgorithmCalibration< T, CO >::m_xml, and CalibrationXML::openFile().
{ if(m_xml == 0) { m_xml=new CalibrationXML(); m_xml->openFile(m_filename); } return m_xml->calibrationDOM(); }
bool AlgorithmCalibration< T, CO >::readCategories | ( | ) | [protected] |
Definition at line 108 of file AlgorithmCalibration.h.
References revisionDML::addEntry(), and VarParsing::obj.
Referenced by AlgorithmCalibration< T, CO >::AlgorithmCalibration().
{ if(dom()==0) return false; DOMNode* n1 = dom()->getFirstChild(); while(n1) { if (n1->getNodeType() == DOMNode::ELEMENT_NODE ) { T *cat = new T(); cat->readFromDOM((DOMElement *)n1); CO * obj =readObject(n1->getFirstChild()); if(obj) { this->addEntry(*cat,*obj); delete obj; } delete cat; } n1 = n1->getNextSibling(); } return true; }
CO * AlgorithmCalibration< T, CO >::readObject | ( | DOMNode * | dom | ) | [protected] |
Definition at line 133 of file AlgorithmCalibration.h.
{ DOMNode* n1 = dom; while(n1) { if (n1->getNodeType() == DOMNode::ELEMENT_NODE ) break; n1 = n1->getNextSibling(); } if(n1==0) return 0; //Cannot find any calibrated objects CO * co = new CO(); co->read((DOMElement *)n1); return co; }
void AlgorithmCalibration< T, CO >::saveCalibration | ( | const std::string & | fileName | ) |
Finalize and save the calibration run to fileName
void AlgorithmCalibration< T, CO >::startCalibration | ( | ) |
Prepare for a new calibration run
void AlgorithmCalibration< T, CO >::updateCalibration | ( | const typename T::Input & | calibrationInputForCategory, |
const CI & | inputForCalibration | ||
) |
void AlgorithmCalibration< T, CO >::updateCalibration | ( | const typename T::Input & | calibrationInput | ) |
Accumulate information to calibrate.
std::string AlgorithmCalibration< T, CO >::m_filename [private] |
Definition at line 87 of file AlgorithmCalibration.h.
Referenced by AlgorithmCalibration< T, CO >::dom().
CalibrationXML* AlgorithmCalibration< T, CO >::m_xml [private] |
Definition at line 88 of file AlgorithmCalibration.h.
Referenced by AlgorithmCalibration< T, CO >::AlgorithmCalibration(), and AlgorithmCalibration< T, CO >::dom().