22 theCachedSurface(surf),
23 theAlignmentParameters(
nullptr),
53 <<
"@SUB=Alignable::update\n" 54 <<
"Current alignable ID does not match ID of the update.";
70 bool isConsistent =
true;
71 bool hasAliComp =
false;
74 for (
const auto& iComp: comps) {
75 if (iComp->alignmentParameters()) {
76 paramComps.push_back(iComp);
77 if (!first && !hasAliComp) isConsistent =
false;
80 const unsigned int nCompBefore = paramComps.size();
81 if (!(iComp->firstCompsWithParams(paramComps))) {
84 if (paramComps.size() != nCompBefore) {
85 if (!first && !hasAliComp) isConsistent =
false;
87 }
else if (hasAliComp) {
100 bool isConsistent =
true;
101 bool hasAliComp =
false;
104 for (
const auto& iComp: comps) {
105 const auto nCompsBefore = paramComps.size();
106 isConsistent = iComp->lastCompsWithParams(paramComps);
107 if (paramComps.size() == nCompsBefore) {
108 if (iComp->alignmentParameters()) {
109 paramComps.push_back(iComp);
110 if (!first && !hasAliComp) isConsistent =
false;
115 isConsistent =
false;
117 if (!first && !hasAliComp) isConsistent =
false;
265 typedef std::pair<int,SurfaceDeformation*> IdSurfaceDeformationPtrPair;
267 std::vector<IdSurfaceDeformationPtrPair>
result;
269 std::sort( result.begin(), result.end(), [](
auto&
a,
auto&
b){
return a.first <
b.first;});
273 for ( std::vector<IdSurfaceDeformationPtrPair>::const_iterator iPair = result.begin();
274 iPair != result.end();
279 allSurfaceDeformations->add((*iPair).first,
280 (*iPair).second->type(),
281 (*iPair).second->parameters());
284 return allSurfaceDeformations;
296 for (
const auto& it: this->
components()) it->cacheTransformation();
307 for (
const auto& it: this->
components()) it->cacheTransformation(run);
318 for (
const auto& it: this->
components()) it->restoreCachedTransformation();
325 <<
"@SUB=Alignable::restoreCachedTransformation\n" 326 <<
"Trying to restore cached transformation for a run (" << run
327 <<
") that has not been cached.";
335 for (
const auto& it: this->
components()) it->restoreCachedTransformation();
355 const auto motherShift = shift *
static_cast<Scalar>(thisComps) / motherComps;
376 -currentPosition.y(),
377 -currentPosition.z()});
RotationType theCachedRotation
void update(align::ID, const AlignableSurface &)
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
virtual int surfaceDeformationIdPairs(std::vector< std::pair< int, SurfaceDeformation * > > &) const =0
virtual void rotateAroundLocalZ(Scalar radians)
Rotation around local z-axis.
virtual void rotateAroundLocalAxis(const LocalVector &axis, Scalar radians)
Rotation around arbitratry local axis.
Alignable()
private default ctr. to enforce usage of the specialised ones
Sin< T >::type sin(const T &t)
const SurveyDet * survey() const
Return survey info.
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
void move(const GlobalVector &displacement)
Cache< GlobalVector > displacementsCache_
Cache< AlignableSurface > surfacesCache_
virtual const Alignables & components() const =0
Return vector of all direct components.
Cache< RotationType > rotationsCache_
virtual void rotateAroundGlobalAxis(const GlobalVector &axis, Scalar radians)
Rotation around arbitratry global axis.
GlobalVector theDisplacement
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
virtual void recenterSurface()
Recenter surface object without moving possible components.
const RotationType & rotation() const
Return change of orientation since the creation of the object.
AlignmentParameters * theAlignmentParameters
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Cos< T >::type cos(const T &t)
bool firstCompsWithParams(Alignables ¶mComps) const
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
virtual void restoreCachedTransformation()
restore the previously cached transformation, also for possible components
virtual void updateMother(const GlobalVector &shift)
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
AlignableSurface theCachedSurface
const Alignables & deepComponents() const
virtual void rotateAroundGlobalX(Scalar radians)
Rotation around global x-axis.
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
void setSurvey(const SurveyDet *)
Set survey info.
void addRotation(const RotationType &rotation)
align::RotationType RotationType
GlobalVector theCachedDisplacement
virtual void rotateAroundLocalY(Scalar radians)
Rotation around local y-axis.
virtual void rotateAroundGlobalY(Scalar radians)
Rotation around global y-axis.
void addDisplacement(const GlobalVector &displacement)
virtual CompConstraintType compConstraintType() const
Return the alignable type of contraints wrt. its components.
virtual void cacheTransformation()
cache the current position, rotation and other parameters (e.g. surface deformations), also for possible components
virtual void rotateAroundLocalX(Scalar radians)
Rotation around local x-axis.
static unsigned int const shift
const PositionType & globalPosition() const
Return the global position of the object.
align::GlobalVector GlobalVector
const BasicVectorType & basicVector() const
const PositionType & position() const
virtual ~Alignable()
Destructor.
const SurveyDet * theSurvey
align::Alignables Alignables
AlignableSurface theSurface
bool lastCompsWithParams(Alignables ¶mComps) const
cond::RealTimeType< cond::runnumber >::type RunNumber