Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:37

0001 #ifndef CALIBRATED_OBJECT_H
0002 #define CALIBRATED_OBJECT_H
0003 #include <string>
0004 #include <xercesc/dom/DOM.hpp>
0005 
0006 /** CalibratedObject class.
0007 * This is the abstract class of any object that the calibration framework returns to
0008 * the algorithm. 
0009 * Actually in the simplified framework it is not needed to inherit from it, it is 
0010 * enough to mimic the same interface.
0011 * Example of "CalibratedObjects" are PDFs,Neural Network set of parameters, ...
0012 */
0013 
0014 class CalibratedObject {
0015 public:
0016   virtual ~CalibratedObject() = default;
0017   /** This function has to be implemented in derived class.
0018     * It should read all the information the calibrated objects need to
0019     * load to be initialized from the xml file.
0020     * It is possible to use CalibrationXML::readAttribute<type>() to read an
0021     * attribute from the passed DOMElement.
0022     */
0023   virtual void read(XERCES_CPP_NAMESPACE::DOMElement* dom) = 0;
0024 
0025   /** This function has to be implemented in derived class.
0026     * It should write all the information the calibrated objects need to\
0027     * save/load.
0028     * It is possible to use CalibrationXML::writeAttribute() to write an
0029     * attribute in the passed DOMElement.
0030     */
0031   virtual void write(XERCES_CPP_NAMESPACE::DOMElement* dom) const = 0;
0032 
0033   /** This function has to be implemented in derived class.
0034     * Prepare the calibrated object for a calibration run.
0035     * E.g. clear the right data members.
0036     */
0037   virtual void startCalibration(){};
0038 
0039   /** This function has to be implemented in derived class.
0040     * Calibration is finished. Prepare for writing.
0041     * E.g. fit histogram, normalize, compute averages, whatever...
0042     */
0043   virtual void finishCalibration(){};
0044 
0045   /** 
0046     * You have to impelement a different updateCalibration(CalibrationInput) in the derived class for each 
0047     * CalibrationInput you want to be able to calibrate on.
0048     * So for example you may want to have an updateCalibration(RecTrack) but also a 
0049     * updateCalibration(JetWithTracks) that only loops on jet rectracks and calls 
0050     * updateCalibration(RecTrack).
0051     *
0052     * This implementation do nothing. 
0053     */
0054   virtual void updateCalibration() {}
0055 
0056   /** Return a name for your calibrated object. It is used as XML tag name in reading and writing.
0057     */
0058   virtual std::string name() const = 0;
0059 };
0060 
0061 #endif