1 |
#ifndef Alignment_CommonAlignmentAlgorithm_IntegratedCalibrationBase_h
|
2 |
#define Alignment_CommonAlignmentAlgorithm_IntegratedCalibrationBase_h
|
3 |
|
4 |
/**
|
5 |
* \file IntegratedCalibrationBase.cc
|
6 |
*
|
7 |
* \author Gero Flucke
|
8 |
* \date August 2012
|
9 |
* $Revision: 1.2.2.1 $
|
10 |
* $Date: 2013/04/23 08:13:27 $
|
11 |
* (last update by $Author: jbehr $)
|
12 |
*
|
13 |
* Base class for the calibrations that are integrated
|
14 |
* into the alignment algorithms.
|
15 |
* Note that not all algorithms support this...
|
16 |
* Limitations:
|
17 |
* o Hits are assumed to be (up to) 2D.
|
18 |
* o Derivatives depend only on local things (hit and track TSOS),
|
19 |
* EventSetup and AlignmentAlgorithmBase::EventInfo.
|
20 |
*/
|
21 |
|
22 |
|
23 |
#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentAlgorithmBase.h"
|
24 |
|
25 |
#include <vector>
|
26 |
#include <utility>
|
27 |
#include <string>
|
28 |
|
29 |
class AlignableTracker;
|
30 |
class AlignableMuon;
|
31 |
class AlignableExtras;
|
32 |
|
33 |
class TrajectoryStateOnSurface;
|
34 |
class TransientTrackingRecHit;
|
35 |
|
36 |
namespace edm { class EventSetup; class ParameterSet; }
|
37 |
|
38 |
class IntegratedCalibrationBase
|
39 |
{
|
40 |
public:
|
41 |
|
42 |
typedef AlignmentAlgorithmBase::EventInfo EventInfo;
|
43 |
typedef std::pair<double,double> Values; /// x- and y-values
|
44 |
typedef std::pair<Values, unsigned int> ValuesIndexPair; /// Values and their parameter index
|
45 |
|
46 |
/// Constructor
|
47 |
explicit IntegratedCalibrationBase(const edm::ParameterSet &cfg);
|
48 |
|
49 |
/// Destructor
|
50 |
virtual ~IntegratedCalibrationBase() {};
|
51 |
|
52 |
/// How many parameters does this calibration define?
|
53 |
virtual unsigned int numParameters() const = 0;
|
54 |
|
55 |
/// Return all derivatives for x- (Values.first) and y-measurement (Values.second),
|
56 |
/// default implementation uses other derivatives(..) method,
|
57 |
/// but can be overwritten in derived class for efficiency.
|
58 |
virtual std::vector<Values> derivatives(const TransientTrackingRecHit &hit,
|
59 |
const TrajectoryStateOnSurface &tsos,
|
60 |
const edm::EventSetup &setup,
|
61 |
const EventInfo &eventInfo) const;
|
62 |
|
63 |
/// Return non-zero derivatives for x- (ValuesIndexPair.first.first)
|
64 |
/// and y-measurement (ValuesIndexPair.first.second) with their
|
65 |
/// indices (ValuesIndexPair.second) by reference.
|
66 |
/// Return value is their number.
|
67 |
virtual unsigned int derivatives(std::vector<ValuesIndexPair> &outDerivInds,
|
68 |
const TransientTrackingRecHit &hit,
|
69 |
const TrajectoryStateOnSurface &tsos,
|
70 |
const edm::EventSetup &setup,
|
71 |
const EventInfo &eventInfo) const = 0;
|
72 |
|
73 |
/// Setting the determined parameter identified by index,
|
74 |
/// should return false if out-of-bounds, true otherwise.
|
75 |
virtual bool setParameter(unsigned int index, double value) = 0;
|
76 |
|
77 |
/// Setting the determined parameter uncertainty identified by index,
|
78 |
/// should return false if out-of-bounds or errors not treated, true otherwise.
|
79 |
virtual bool setParameterError(unsigned int index, double value) = 0;
|
80 |
|
81 |
/// Return current value of parameter identified by index.
|
82 |
/// Should return 0. if index out-of-bounds.
|
83 |
virtual double getParameter(unsigned int index) const = 0;
|
84 |
|
85 |
/// Return current value of parameter identified by index.
|
86 |
/// Should return 0. if index out-of-bounds or if errors not treated/undetermined.
|
87 |
virtual double getParameterError(unsigned int index) const = 0;
|
88 |
|
89 |
/// Call at beginning of job:
|
90 |
/// default implementation is dummy, to be overwritten in derived class if useful.
|
91 |
virtual void beginOfJob(AlignableTracker *tracker,
|
92 |
AlignableMuon *muon,
|
93 |
AlignableExtras *extras) {};
|
94 |
|
95 |
/// Called at beginning of a loop of the AlignmentProducer,
|
96 |
/// to be used for iterative algorithms, default does nothing.
|
97 |
/// FIXME: move call to algorithm?
|
98 |
virtual void startNewLoop() {};
|
99 |
|
100 |
/// Called at end of a loop of the AlignmentProducer,
|
101 |
/// to be used for iterative algorithms, default does nothing.
|
102 |
/// FIXME: move call to algorithm?
|
103 |
virtual void endOfLoop() {};
|
104 |
|
105 |
/// Called at end of a the job of the AlignmentProducer.
|
106 |
/// Do here the necessary stuff with the results that should have been passed
|
107 |
/// by the algorithm to the calibration, e.g. write out to database.
|
108 |
/// FIXME: How to deal with single jobs for an iterative algorithm?
|
109 |
virtual void endOfJob() = 0;
|
110 |
|
111 |
/* /// called at begin of run */
|
112 |
/* virtual void beginRun(const edm::EventSetup &setup) {}; */
|
113 |
|
114 |
/* /// called at end of run - order of arguments like in EDProducer etc. */
|
115 |
/* virtual void endRun(const EndRunInfo &runInfo, const edm::EventSetup &setup) {}; */
|
116 |
|
117 |
/* /// called at begin of luminosity block (no lumi block info passed yet) */
|
118 |
/* virtual void beginLuminosityBlock(const edm::EventSetup &setup) {}; */
|
119 |
|
120 |
/* /// called at end of luminosity block (no lumi block info passed yet) */
|
121 |
/* virtual void endLuminosityBlock(const edm::EventSetup &setup) {}; */
|
122 |
|
123 |
/// name of this calibration
|
124 |
const std::string& name() const { return name_;} // non-virtual since refering to private member
|
125 |
|
126 |
private:
|
127 |
const std::string name_; /// name of this calibration (i.e. defining plugin)
|
128 |
};
|
129 |
|
130 |
#endif
|