CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Private Attributes

AlgorithmCalibration< T, CO > Class Template Reference

#include <AlgorithmCalibration.h>

Inheritance diagram for AlgorithmCalibration< T, CO >:
CalibrationInterface< T, CO >

List of all members.

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

DOMElementdom ()
bool readCategories ()
CO * readObject (DOMNode *)

Private Attributes

std::string m_filename
CalibrationXMLm_xml

Detailed Description

template<class T, class CO>
class AlgorithmCalibration< T, CO >

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.


Member Typedef Documentation

template<class T, class CO>
typedef XERCES_CPP_NAMESPACE::DOMElement AlgorithmCalibration< T, CO >::DOMElement

Definition at line 41 of file AlgorithmCalibration.h.

template<class T, class CO>
typedef XERCES_CPP_NAMESPACE::DOMNode AlgorithmCalibration< T, CO >::DOMNode

Definition at line 42 of file AlgorithmCalibration.h.


Constructor & Destructor Documentation

template<class T , class CO >
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().

template<class T , class CO >
AlgorithmCalibration< T, CO >::~AlgorithmCalibration ( )

Definition at line 102 of file AlgorithmCalibration.h.

{
   if(m_xml) delete m_xml;
}

Member Function Documentation

template<class T, class CO>
DOMElement* AlgorithmCalibration< T, CO >::dom ( ) [inline, protected]
template<class T , class CO >
bool AlgorithmCalibration< T, CO >::readCategories ( ) [protected]

Definition at line 108 of file AlgorithmCalibration.h.

References revisionDML::addEntry(), cmsDownloadME::cat, 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) 
           {
                addEntry(*cat,*obj);  
                delete obj;  
           }
          delete cat;
      }
      n1 = n1->getNextSibling();
    }
    
 return true;
}
template<class T , class CO >
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;
}
template<class T, class CO>
void AlgorithmCalibration< T, CO >::saveCalibration ( const std::string &  fileName)

Finalize and save the calibration run to fileName

template<class T, class CO>
void AlgorithmCalibration< T, CO >::startCalibration ( )

Prepare for a new calibration run

template<class T, class CO>
template<class CI >
void AlgorithmCalibration< T, CO >::updateCalibration ( const typename T::Input &  calibrationInputForCategory,
const CI &  inputForCalibration 
)
template<class T, class CO>
void AlgorithmCalibration< T, CO >::updateCalibration ( const typename T::Input &  calibrationInput)

Accumulate information to calibrate.


Member Data Documentation

template<class T, class CO>
std::string AlgorithmCalibration< T, CO >::m_filename [private]

Definition at line 87 of file AlgorithmCalibration.h.

Referenced by AlgorithmCalibration< T, CO >::dom().

template<class T, class CO>
CalibrationXML* AlgorithmCalibration< T, CO >::m_xml [private]