diff --git a/Alignment/CommonAlignment/BuildFile.xml b/Alignment/CommonAlignment/BuildFile.xml
index f8625ce106320..5880f7fdcc7db 100644
--- a/Alignment/CommonAlignment/BuildFile.xml
+++ b/Alignment/CommonAlignment/BuildFile.xml
@@ -1,6 +1,7 @@
+
diff --git a/Alignment/CommonAlignment/interface/Alignable.h b/Alignment/CommonAlignment/interface/Alignable.h
index f5cb581c1f694..a013c37c5337d 100644
--- a/Alignment/CommonAlignment/interface/Alignable.h
+++ b/Alignment/CommonAlignment/interface/Alignable.h
@@ -3,6 +3,7 @@
#include "Alignment/CommonAlignment/interface/AlignableSurface.h"
#include "Alignment/CommonAlignment/interface/StructureType.h"
+#include "Alignment/CommonAlignment/interface/Utilities.h"
#include "DataFormats/DetId/interface/DetId.h"
class AlignmentErrorsExtended;
@@ -18,9 +19,6 @@ class SurfaceDeformation;
* Any Alignable object can be moved and rotated.
* Also an alignment uncertainty can be set.
*
- * $Date: 2011/09/19 11:42:35 $
- * $Revision: 1.36 $
- * (last update by $Author: mussgill $)
*/
class AlignmentParameters;
@@ -39,6 +37,8 @@ class Alignable
typedef align::Alignables Alignables;
typedef align::StructureType StructureType;
+ enum class CompConstraintType { NONE, POSITION, POSITION_Z };
+
/// Constructor from id and surface, setting also geomDetId
/// (AlignableNavigator relies on the fact that only AlignableDet/DetUnit have geomDetId!)
Alignable( align::ID, const AlignableSurface& );
@@ -50,6 +50,10 @@ class Alignable
/// Destructor
virtual ~Alignable();
+ /// Updater using id and surface.
+ /// The given id has to match the current id.
+ void update(align::ID, const AlignableSurface&);
+
/// Set the AlignmentParameters
void setAlignmentParameters( AlignmentParameters* dap );
@@ -184,6 +188,9 @@ class Alignable
/// Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
align::ID id() const { return theId; }
+ /// Return the alignable type of contraints wrt. its components
+ virtual CompConstraintType compConstraintType() const { return compConstraintType_; }
+
/// Recursive printout of alignable information
virtual void dump() const = 0;
@@ -203,9 +210,17 @@ class Alignable
/// cache the current position, rotation and other parameters (e.g. surface deformations), also for possible components
virtual void cacheTransformation();
+ /// cache for the given run the current position, rotation and other
+ /// parameters (e.g. surface deformations), also for possible components
+ virtual void cacheTransformation(const align::RunNumber&);
+
/// restore the previously cached transformation, also for possible components
virtual void restoreCachedTransformation();
+ /// restore for the given run the previously cached transformation, also for
+ /// possible components
+ virtual void restoreCachedTransformation(const align::RunNumber&);
+
/// Return survey info
const SurveyDet* survey() const { return theSurvey; }
@@ -213,11 +228,12 @@ class Alignable
void setSurvey( const SurveyDet* );
protected:
+ template
+ using Cache = std::map;
void addDisplacement( const GlobalVector& displacement );
void addRotation( const RotationType& rotation );
-
-protected:
+ virtual void updateMother(const GlobalVector& shift);
DetId theDetId; // used to check if Alignable is associated to a GeomDet
// ugly way to keep AlignableNavigator happy for now
@@ -233,10 +249,17 @@ class Alignable
GlobalVector theCachedDisplacement;
RotationType theCachedRotation;
+ CompConstraintType compConstraintType_{CompConstraintType::NONE};
+
Alignables theDeepComponents; // list of lowest daughters
// contain itself if Alignable is a unit
+ Cache surfacesCache_;
+ Cache displacementsCache_;
+ Cache rotationsCache_;
+
private:
+
/// private default ctr. to enforce usage of the specialised ones
Alignable() {};
diff --git a/Alignment/CommonAlignment/interface/AlignableBeamSpot.h b/Alignment/CommonAlignment/interface/AlignableBeamSpot.h
index 9e794fe99ef15..876cf20c2a289 100644
--- a/Alignment/CommonAlignment/interface/AlignableBeamSpot.h
+++ b/Alignment/CommonAlignment/interface/AlignableBeamSpot.h
@@ -87,6 +87,9 @@ class AlignableBeamSpot : public Alignable
void initialize(double x, double y, double z,
double dxdz, double dydz);
+ /// reset beam spot to the uninitialized state
+ void reset();
+
/// returns the DetId corresponding to the alignable beam spot. Also used
/// by BeamSpotGeomDet and BeamSpotTransientTrackingRecHit
static const DetId detId() { return DetId((DetId::Tracker< void update(T) = delete;
+
void setSurface( const AlignableSurface& s) { theSurface = s; }
StructureType theStructureType;
diff --git a/Alignment/CommonAlignment/interface/AlignableCompositeBuilder.h b/Alignment/CommonAlignment/interface/AlignableCompositeBuilder.h
index 4e4b4be3f7f64..5b33cabad7cd2 100644
--- a/Alignment/CommonAlignment/interface/AlignableCompositeBuilder.h
+++ b/Alignment/CommonAlignment/interface/AlignableCompositeBuilder.h
@@ -39,7 +39,7 @@ class AlignableCompositeBuilder {
/// - TPBHalfBarrel (with TPBLayer as children)
/// - TPBBarrel (with TPBHalfBarrel as children)
/// Returns the number of composite Alignables which were built.
- unsigned int buildAll(AlignableMap&);
+ unsigned int buildAll(AlignableMap&, bool update = false);
/// Return tracker alignable object ID provider derived from the tracker's geometry
const AlignableObjectId& objectIdProvider() const { return alignableObjectId_; }
@@ -49,7 +49,7 @@ class AlignableCompositeBuilder {
/// Builds the components for a given level in the hierarchy.
unsigned int buildLevel(unsigned int parentLevel, AlignableMap&,
- std::ostringstream&);
+ std::ostringstream&, bool update = false);
/// Calculates the theoretical max. number of components for a given level
/// in the hierarchy.
diff --git a/Alignment/CommonAlignment/interface/AlignableDet.h b/Alignment/CommonAlignment/interface/AlignableDet.h
index 9ea5badca9286..796205fe1a32a 100644
--- a/Alignment/CommonAlignment/interface/AlignableDet.h
+++ b/Alignment/CommonAlignment/interface/AlignableDet.h
@@ -17,6 +17,10 @@ class AlignableDet: public AlignableComposite
/// Destructor
virtual ~AlignableDet();
+ /// Updater from GeomDet
+ /// The given GeomDet id has to match the current id.
+ void update(const GeomDet* geomDet, bool updateComponents = true);
+
/// Set the AlignmentPositionError and, if (propagateDown), to all components
virtual void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown);
diff --git a/Alignment/CommonAlignment/interface/AlignableDetUnit.h b/Alignment/CommonAlignment/interface/AlignableDetUnit.h
index b5194f7c76a4e..2faff6d3c10c6 100644
--- a/Alignment/CommonAlignment/interface/AlignableDetUnit.h
+++ b/Alignment/CommonAlignment/interface/AlignableDetUnit.h
@@ -21,6 +21,10 @@ class AlignableDetUnit : public Alignable
/// Destructor
virtual ~AlignableDetUnit();
+ /// Updater from GeomDetUnit
+ /// The given GeomDetUnit id has to match the current id.
+ void update(const GeomDetUnit* geomDetUnit);
+
/// No components here => exception!
virtual void addComponent( Alignable* );
@@ -76,9 +80,15 @@ class AlignableDetUnit : public Alignable
/// cache the current position, rotation and other parameters (e.g. surface deformations)
virtual void cacheTransformation();
+ /// cache for the given run the current position, rotation and other parameters (e.g. surface deformations)
+ virtual void cacheTransformation(const align::RunNumber&);
+
/// restore the previously cached transformation
virtual void restoreCachedTransformation();
+ /// restore for the given run the previously cached transformation
+ virtual void restoreCachedTransformation(const align::RunNumber&);
+
/// alignment position error - for checking only, otherwise use alignmentErrors() above!
const AlignmentPositionError* alignmentPositionError() const { return theAlignmentPositionError;}
@@ -87,6 +97,7 @@ class AlignableDetUnit : public Alignable
AlignmentPositionError* theAlignmentPositionError;
SurfaceDeformation* theSurfaceDeformation;
SurfaceDeformation* theCachedSurfaceDeformation;
+ Cache surfaceDeformationsCache_;
};
#endif
diff --git a/Alignment/CommonAlignment/interface/AlignableExtras.h b/Alignment/CommonAlignment/interface/AlignableExtras.h
index 0d0460dbc5c3c..01b732fb870aa 100644
--- a/Alignment/CommonAlignment/interface/AlignableExtras.h
+++ b/Alignment/CommonAlignment/interface/AlignableExtras.h
@@ -47,6 +47,9 @@ class AlignableExtras
void initializeBeamSpot(double x, double y, double z,
double dxdz, double dydz);
+ /// Initialize the alignable beam spot with the given parameters
+ void resetBeamSpot();
+
private:
AlignableMap alignableLists_; //< kind of map of lists of alignables
diff --git a/Alignment/CommonAlignment/interface/Utilities.h b/Alignment/CommonAlignment/interface/Utilities.h
index 18a9a8e41dfef..e8583b3d68f6b 100644
--- a/Alignment/CommonAlignment/interface/Utilities.h
+++ b/Alignment/CommonAlignment/interface/Utilities.h
@@ -13,8 +13,9 @@
#include