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