#include <RecoBTag/XMLCalibration/interface/AlgorithmCalibration.h>
Public Member Functions | |
AlgorithmCalibration (const std::string &fileName) | |
Create an AlgorithmCalibration class and load from fileName the cateogries and their objects. | |
void | saveCalibration (const std::string &fileName) |
Finalize and save the calibration run to fileName. | |
void | startCalibration () |
Prepare for a new calibration run. | |
template<class CI> | |
void | updateCalibration (const typename T::Input &calibrationInputForCategory, const CI &inputForCalibration) |
void | updateCalibration (const typename T::Input &calibrationInput) |
Accumulate information to calibrate. | |
~AlgorithmCalibration () | |
Protected Member Functions | |
DOMElement * | dom () |
bool | readCategories () |
CO * | readObject (DOMNode *) |
Private Attributes | |
string | m_filename |
CalibrationXML * | m_xml |
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 39 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.
AlgorithmCalibration< T, CO >::~AlgorithmCalibration | ( | ) | [inline] |
Definition at line 102 of file AlgorithmCalibration.h.
References AlgorithmCalibration< T, CO >::m_xml.
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().
Referenced by AlgorithmCalibration< T, CO >::readCategories().
00076 { 00077 if(m_xml == 0) 00078 { 00079 m_xml=new CalibrationXML(); 00080 m_xml->openFile(m_filename); 00081 00082 } 00083 return m_xml->calibrationDOM(); 00084 }
bool AlgorithmCalibration< T, CO >::readCategories | ( | ) | [inline, protected] |
Definition at line 108 of file AlgorithmCalibration.h.
References CalibrationInterface< T, CO >::addEntry(), AlgorithmCalibration< T, CO >::dom(), VarParsing::obj, and AlgorithmCalibration< T, CO >::readObject().
00109 { 00110 if(dom()==0) return false; 00111 00112 DOMNode* n1 = dom()->getFirstChild(); 00113 while(n1) 00114 { 00115 if (n1->getNodeType() == DOMNode::ELEMENT_NODE ) 00116 { 00117 T *cat = new T(); 00118 cat->readFromDOM((DOMElement *)n1); 00119 CO * obj =readObject(n1->getFirstChild()); 00120 if(obj) 00121 { 00122 addEntry(*cat,*obj); 00123 delete obj; 00124 } 00125 delete cat; 00126 } 00127 n1 = n1->getNextSibling(); 00128 } 00129 00130 return true; 00131 }
CO * AlgorithmCalibration< T, CO >::readObject | ( | DOMNode * | dom | ) | [inline, protected] |
Definition at line 133 of file AlgorithmCalibration.h.
Referenced by AlgorithmCalibration< T, CO >::readCategories().
00134 { 00135 DOMNode* n1 = dom; 00136 while(n1) 00137 { 00138 if (n1->getNodeType() == DOMNode::ELEMENT_NODE ) 00139 break; 00140 n1 = n1->getNextSibling(); 00141 } 00142 00143 if(n1==0) return 0; //Cannot find any calibrated objects 00144 00145 CO * co = new CO(); 00146 co->read((DOMElement *)n1); 00147 return co; 00148 }
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 | |||
) | [inline] |
void AlgorithmCalibration< T, CO >::updateCalibration | ( | const typename T::Input & | calibrationInput | ) |
Accumulate information to calibrate.
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 >::dom(), and AlgorithmCalibration< T, CO >::~AlgorithmCalibration().