Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:08

0001 #ifndef Alignment_CommonAlignmentAlgorithm_IntegratedCalibrationBase_h
0002 #define Alignment_CommonAlignmentAlgorithm_IntegratedCalibrationBase_h
0003 
0004 /**
0005  * \file IntegratedCalibrationBase.cc
0006  *
0007  *  \author Gero Flucke
0008  *  \date August 2012
0009  *  $Revision: 1.2.2.1 $
0010  *  $Date: 2013/04/23 08:13:27 $
0011  *  (last update by $Author: jbehr $)
0012  *
0013  *  Base class for the calibrations that are integrated
0014  *  into the alignment algorithms.
0015  *  Note that not all algorithms support this...
0016  *  Limitations:
0017  *   o Hits are assumed to be (up to) 2D.
0018  *   o Derivatives depend only on local things (hit and track TSOS),
0019  *     EventSetup and AlignmentAlgorithmBase::EventInfo.
0020  */
0021 
0022 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentAlgorithmBase.h"
0023 
0024 #include <vector>
0025 #include <utility>
0026 #include <string>
0027 
0028 class AlignableTracker;
0029 class AlignableMuon;
0030 class AlignableExtras;
0031 
0032 class TrajectoryStateOnSurface;
0033 class TrackingRecHit;
0034 
0035 namespace edm {
0036   class EventSetup;
0037   class ParameterSet;
0038 }  // namespace edm
0039 
0040 class IntegratedCalibrationBase {
0041 public:
0042   typedef AlignmentAlgorithmBase::EventInfo EventInfo;
0043   typedef std::pair<double, double> Values;                 /// x- and y-values
0044   typedef std::pair<Values, unsigned int> ValuesIndexPair;  /// Values and their parameter index
0045 
0046   /// Constructor
0047   explicit IntegratedCalibrationBase(const edm::ParameterSet &cfg);
0048 
0049   /// Destructor
0050   virtual ~IntegratedCalibrationBase(){};
0051 
0052   /// How many parameters does this calibration define?
0053   virtual unsigned int numParameters() const = 0;
0054 
0055   /// Return all derivatives for x- (Values.first) and y-measurement (Values.second),
0056   /// default implementation uses other derivatives(..) method,
0057   /// but can be overwritten in derived class for efficiency.
0058   virtual std::vector<Values> derivatives(const TrackingRecHit &hit,
0059                                           const TrajectoryStateOnSurface &tsos,
0060                                           const edm::EventSetup &setup,
0061                                           const EventInfo &eventInfo) const;
0062 
0063   /// Return non-zero derivatives for x- (ValuesIndexPair.first.first)
0064   /// and y-measurement (ValuesIndexPair.first.second) with their
0065   /// indices (ValuesIndexPair.second) by reference.
0066   /// Return value is their number.
0067   virtual unsigned int derivatives(std::vector<ValuesIndexPair> &outDerivInds,
0068                                    const TrackingRecHit &hit,
0069                                    const TrajectoryStateOnSurface &tsos,
0070                                    const edm::EventSetup &setup,
0071                                    const EventInfo &eventInfo) const = 0;
0072 
0073   /// Setting the determined parameter identified by index,
0074   /// should return false if out-of-bounds, true otherwise.
0075   virtual bool setParameter(unsigned int index, double value) = 0;
0076 
0077   /// Setting the determined parameter uncertainty identified by index,
0078   /// should return false if out-of-bounds or errors not treated, true otherwise.
0079   virtual bool setParameterError(unsigned int index, double value) = 0;
0080 
0081   /// Return current value of parameter identified by index.
0082   /// Should return 0. if index out-of-bounds.
0083   virtual double getParameter(unsigned int index) const = 0;
0084 
0085   /// Return current value of parameter identified by index.
0086   /// Should return 0. if index out-of-bounds or if errors not treated/undetermined.
0087   virtual double getParameterError(unsigned int index) const = 0;
0088 
0089   /// Call at beginning of job:
0090   /// default implementation is dummy, to be overwritten in derived class if useful.
0091   virtual void beginOfJob(AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras){};
0092 
0093   /// Call at beginning of run:
0094   /// default implementation is dummy, to be overwritten in derived class if useful.
0095   virtual void beginRun(const edm::Run &, const edm::EventSetup &){};
0096 
0097   /// Called at beginning of a loop of the AlignmentProducer,
0098   /// to be used for iterative algorithms, default does nothing.
0099   /// FIXME: move call to algorithm?
0100   virtual void startNewLoop(){};
0101 
0102   /// Called at end of a loop of the AlignmentProducer,
0103   /// to be used for iterative algorithms, default does nothing.
0104   /// FIXME: move call to algorithm?
0105   virtual void endOfLoop(){};
0106 
0107   /// Called at end of a the job of the AlignmentProducer.
0108   /// Do here the necessary stuff with the results that should have been passed
0109   /// by the algorithm to the calibration, e.g. write out to database.
0110   /// FIXME: How to deal with single jobs for an iterative algorithm?
0111   virtual void endOfJob() = 0;
0112 
0113   /* /// called at begin of run */
0114   /* virtual void beginRun(const edm::EventSetup &setup) {}; */
0115 
0116   /* /// called at end of run - order of arguments like in EDProducer etc. */
0117   /* virtual void endRun(const EndRunInfo &runInfo, const edm::EventSetup &setup) {}; */
0118 
0119   /* /// called at begin of luminosity block (no lumi block info passed yet) */
0120   /* virtual void beginLuminosityBlock(const edm::EventSetup &setup) {}; */
0121 
0122   /* /// called at end of luminosity block (no lumi block info passed yet) */
0123   /* virtual void endLuminosityBlock(const edm::EventSetup &setup) {}; */
0124 
0125   /// name of this calibration
0126   const std::string &name() const { return name_; }  // non-virtual since refering to private member
0127 
0128 private:
0129   const std::string name_;  /// name of this calibration (i.e. defining plugin)
0130 };
0131 
0132 #endif