104#include <TClonesArray.h>
105#include <TGeoManager.h>
106#include <TGeoPhysicalNode.h>
114using namespace TMath;
125 kDOFBitTX | kDOFBitTY | kDOFBitTZ | kDOFBitPS | kDOFBitTH | kDOFBitPH;
134 LOG(fatal) <<
"Controller has to be provided :" << symname;
153 const double *tr = &delta[0], *rt = &delta[3];
176 matMod.MultiplyLeft(&t2li);
189 TGeoHMatrix tmp = relMat;
191 matMod.Multiply(&tmp);
192 const TGeoHMatrix& tmpi = tmp.Inverse();
193 matMod.MultiplyLeft(&tmpi);
216 matMod.Multiply(&relMat);
217 const TGeoHMatrix& reli = relMat.Inverse();
218 matMod.MultiplyLeft(&reli);
239 printf(
"Lev:%2d IntID:%7d %s | %2d nodes | Effective X:%8.4f Alp:%+.4f | Used Points: %d\n",
247 printf(
" Child.Constr: {");
254 printf(
" Excl.from parent constr.");
276 if (opts.Contains(
"mat")) {
277 printf(
"L2G ideal : ");
279 printf(
"L2G misalign: ");
281 printf(
"L2G RecoTime: ");
283 printf(
"T2L (fake) : ");
298 if (gGeoManager->GetAlignableEntry(
path)) {
301 LOG(fatal) <<
"Failed to find L2G matrix for alignable " <<
path;
305 if (!gGeoManager->CheckPath(
path)) {
306 LOG(fatal) <<
"Volume path " <<
path <<
" is not valid!";
308 TGeoPhysicalNode* node = (TGeoPhysicalNode*)gGeoManager->GetListOfPhysicalNodes()->FindObject(
path);
311 LOG(warning) <<
"volume " <<
path <<
" was not misaligned, extracting original matrix";
313 LOG(fatal) <<
"Failed to find ideal L2G matrix for " <<
path;
316 l2g = *node->GetMatrix();
328 LOG(fatal) <<
"Failed to find ideal L2G matrix for " <<
getSymName();
340 LOGP(fatal,
"Sensor {} must provide its own prepareMatrixT2L method",
getSymName());
343 double tot[3] = {0, 0, 0}, loc[3] = {0, 0, 0}, glo[3];
345 for (
int ich = nch; ich--;) {
348 for (
int j = 3;
j--;) {
353 for (
int j = 3;
j--;) {
358 mAlp = TMath::ATan2(tot[1], tot[0]);
359 math_utils::detail::bringToPMPi(
mAlp);
361 mX = TMath::Sqrt(tot[0] * tot[0] + tot[1] * tot[1]);
386 for (
int ich = 0; ich < nch; ich++) {
400 LOG(fatal) <<
"DOFs are already initialized for " << GetName();
479 const char* comment[3] = {
" ",
"! ",
"!!"};
480 const char* kKeyParam =
"parameter";
481 const char* kKeyMeas =
"measurement";
484 bool showDef = opts.Contains(
"d");
485 bool showFix = opts.Contains(
"f");
486 bool showNam = opts.Contains(
"n");
489 int nCond(0), nFix(0), nDef(0);
502 int cmt = nCond > 0 || nFix > 0 ? kOff : kOn;
510 if (nCond || showDef || showFix || showNam) {
511 fprintf(parOut,
"%s%s %s\t\tDOF/Free: %d/%d (%s) %s id : %d | Stat: %d\n", comment[cmt], kKeyParam, comment[kOnOn],
515 if (nCond || showDef || showFix) {
530 fprintf(parOut,
"%s %9d %+e %+e\t%s %s p%d\n", comment[cmt],
getParLab(
i),
537 fprintf(parOut,
"%s %d 1.0\n", comment[cmt],
getParLab(
i));
539 fprintf(parOut,
"\n");
544 for (
int ich = 0; ich < nch; ich++) {
561 for (
int ich = 0; ich < nch; ich++) {
576 const TGeoHMatrix l2gi = l2g.Inverse();
577 deltaM.Multiply(&l2gi);
578 deltaM.MultiplyLeft(&l2g);
704 const TGeoHMatrix t2li = t2l.Inverse();
705 deltaM.Multiply(&t2li);
706 deltaM.MultiplyLeft(&t2l);
732 alg.MultiplyLeft(envelopeDelta);
734 alg = *envelopeDelta;
747 const TGeoHMatrix& dchaini = dchain.Inverse();
748 alg.Multiply(&dchain);
749 alg.MultiplyLeft(&dchaini);
797 LOGP(info,
"Skipping alignment object creation for dummy volume {}", GetName());
801 bool nonTrivial =
false;
805 envelopeDelta =
nullptr;
810 algM.MultiplyLeft(envelopeDelta);
812 algM = *envelopeDelta;
816 envelopeDelta = &algM;
820 for (
int ich = 0; ich < nch; ich++) {
837 for (
size_t i = 0;
i < algArr.size();
i++) {
845 LOG(info) <<
"Alignment for " <<
getSymName() <<
" is absent in Reco-Time alignment object";
847 delta = algArr[selPar].createMatrix();
850 delta *= *cumulDelta;
909 auto& cstr =
getController()->getConstraints().emplace_back();
911 cstr.setParent(
this);
912 for (
int ich = nch; ich--;) {
914 if (child->getExcludeFromParentConstraint()) {
917 cstr.addChild(child);
919 if (!cstr.getNChildren()) {
923 for (
int ich = 0; ich < nch; ich++) {
931 return (!regexStr.empty() && std::regex_match(
getSymName(), std::regex{regexStr}));
Definition of the base alignment parameters class.
Configuration file for global alignment.
ClassImp(o2::align::AlignableVolume)
Base class of alignable volume.
Steering class for the global alignment.
Collection of auxillary methods.
Definition of the GeometryManager class.
Descriptor of geometrical constraint.
void calcFree(bool condFree=true)
virtual void prepareMatrixL2G(bool reco=false)
int getNProcessedPoints() const
virtual void updateL2GRecoMatrices(const std::vector< o2::detectors::AlignParam > &algArr, const TGeoHMatrix *cumulDelta)
void createPreGloDeltaMatrix(TGeoHMatrix &deltaM) const
bool isNameMatching(const std::string ®exStr) const
static const char * sFrameName[kNVarFrames]
static uint32_t sDefGeomFree
AlignableVolume * getChild(int i) const
const TGeoHMatrix & getMatrixT2L() const
virtual void writePedeInfo(FILE *parOut, const Option_t *opt="") const
bool isChildrenDOFConstrained(int dof) const
virtual bool isSensor() const
AlignableVolume()=default
void Print(const Option_t *opt="") const override
static const char * sDOFName[kNDOFGeom]
void getDeltaT2LmodLOC(TGeoHMatrix &matMod, const double *delta) const
virtual void prepareMatrixL2GIdeal()
void addAutoConstraints()
bool isMeasuredDOF(int dof) const
void delta2Matrix(TGeoHMatrix &deltaM, const double *delta) const
~AlignableVolume() override
void setMatrixL2GIdeal(const TGeoHMatrix &m)
void getParValGeom(double *delta) const
void getDeltaT2LmodTRA(TGeoHMatrix &matMod, const double *delta) const
bool getExcludeFromParentConstraint() const
bool isCondDOF(int dof) const
const TGeoHMatrix & getMatrixL2G() const
virtual void writeLabeledPedeResults(FILE *parOut) const
const TGeoHMatrix & getMatrixL2GReco() const
bool isFreeDOF(int dof) const
bool createGloDeltaMatrix(TGeoHMatrix &deltaM) const
bool hasChildrenConstraint() const
virtual void addChild(AlignableVolume *ch)
bool createLocDeltaMatrix(TGeoHMatrix &deltaM) const
void createAlignmenMatrix(TGeoHMatrix &alg, const TGeoHMatrix *envelopeDelta=nullptr) const
bool ownsDOFID(int id) const
void setMatrixL2GReco(const TGeoHMatrix &m)
static const char * getGeomDOFName(int i)
AlignableVolume * getVolOfDOFID(int id) const
void setMatrixL2G(const TGeoHMatrix &m)
bool isDummyEnvelope() const
void createAlignmentObjects(std::vector< o2::detectors::AlignParam > &arr, const TGeoHMatrix *envelopeDelta=nullptr) const
const TGeoHMatrix & getMatrixL2GIdeal() const
virtual int finalizeStat()
bool getInitDOFsDone() const
int getInternalID() const
AlignableVolume * getParent() const
void createPreLocDeltaMatrix(TGeoHMatrix &deltaM) const
const TGeoHMatrix & getGlobalDeltaRef() const
virtual void prepareMatrixT2L()
const char * getSymName() const
virtual const char * getDOFName(int i) const
void setFreeDOFPattern(uint32_t pat)
void expandGlobalsBy(int n)
void setParLab(int par, int lab)
const float * getParVals() const
void setFirstParGloID(int id)
float getParVal(int par) const
const float * getParErrs() const
float getParErr(int par) const
int getParLab(int par) const
void setParErr(int par, double e=0)
static Bool_t getOriginalMatrix(o2::detectors::DetID detid, int sensid, TGeoHMatrix &m)
static TGeoHMatrix * getMatrix(const char *symname)
static const AlignConfig & Instance()
TGeoHMatrix createMatrix() const
extract global delta matrix
void setRotation(double psi, double theta, double phi)
set global delta rotations angles in radian
void setTranslation(double x, double y, double z)
set global delta displacements in cm
GLsizei const GLchar *const * path
constexpr bool isZeroAbs(double d) noexcept
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"