CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoParticleFlow/PFClusterTools/interface/Calibrator.h

Go to the documentation of this file.
00001 #ifndef CALIBRATOR_HH_
00002 #define CALIBRATOR_HH_
00003 
00004 #include "RecoParticleFlow/PFClusterTools/interface/DetectorElement.h"
00005 #include "RecoParticleFlow/PFClusterTools/interface/ParticleDeposit.h"
00006 #include "RecoParticleFlow/PFClusterTools/interface/PFToolsException.h"
00007 
00008 #include <map>
00009 #include <vector>
00010 #include <boost/shared_ptr.hpp>
00011 
00012 namespace pftools {
00013 
00021 class Calibrator {
00022 public:
00023 
00024         Calibrator();
00025         virtual ~Calibrator();
00026 
00027         void addDetectorElement(DetectorElementPtr const de);
00028 
00029         void addParticleDeposit(ParticleDepositPtr pd);
00030 
00031         /*
00032          * Returns the calibration coefficient for each detector element, using data
00033          * from all particle depositions stored within.
00034          */
00035         std::map<DetectorElementPtr, double> getCalibrationCoefficients() throw(
00036                         PFToolsException&) {
00037                 return getCalibrationCoefficientsCore();
00038         }
00039         
00040         /* 
00041          * Here we use the virtual constructor idea to allow for plug-and-play Calibrators
00042          * See https://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.8
00043          */
00044         virtual Calibrator* clone() const = 0;
00045         virtual Calibrator* create() const = 0;
00046 
00047         int hasParticles() const {
00048                 return myParticleDeposits.size();
00049         }
00050         
00051         std::vector<ParticleDepositPtr> getParticles() {
00052                 return myParticleDeposits;
00053         }
00054 
00055 
00056 
00057 protected:
00058         virtual std::map<DetectorElementPtr, double>
00059                         getCalibrationCoefficientsCore() throw(PFToolsException&);
00060 
00061         std::vector<DetectorElementPtr> myDetectorElements;
00062         std::vector<ParticleDepositPtr> myParticleDeposits;
00063 };
00064 
00065 typedef boost::shared_ptr<Calibrator> CalibratorPtr;
00066 
00067 }
00068 
00069 #endif /*CALIBRATOR_HH_*/