@@ -66,5 +66,40 @@ void AlignableSensorITS::prepareMatrixT2L()
6666 setMatrixT2L (t2l);
6767}
6868
69+ void AlignableSensorITS::prepareMatrixL2G (bool reco)
70+ {
71+ // Note that for ITS2 it is NOT the same as GeometryManager::getMatrix() (i.e. that of the alignable volule)
72+ // since we need the matrix of epitaxial layer and not the whole chip
73+ auto geom = o2::its::GeometryTGeo::Instance ();
74+ const auto * m = geom->extractMatrixSensor (getVolID ());
75+ if (!m) {
76+ LOGP (fatal, " Failed on :GeometryTGeo::extractMatrixSensor({})" , getVolID ());
77+ }
78+ reco ? setMatrixL2GReco (*m) : setMatrixL2G (*m);
79+ }
80+
81+ void AlignableSensorITS::prepareMatrixL2GIdeal ()
82+ {
83+ // Note that for ITS2 it is NOT the same as GeometryManager::getOriginalMatrix (i.e. that of the alignable volule)
84+ // since we need the matrix of epitaxial layer and not the whole chip
85+ auto geom = o2::its::GeometryTGeo::Instance ();
86+ TGeoHMatrix mtmp;
87+ if (!base::GeometryManager::getOriginalMatrix (getSymName (), mtmp)) { // this is chip ideal matrix, not that of the epitaxial layer
88+ LOG (fatal) << " Failed to find ideal L2G matrix for " << getSymName ();
89+ }
90+ // we have to apply to it the difference between the aligner epitaxial layer matrix and that of the chip
91+ const auto * malgSens = geom->extractMatrixSensor (getVolID ());
92+ if (!malgSens) {
93+ LOGP (fatal, " Failed on :GeometryTGeo::extractMatrixSensor({})" , getVolID ());
94+ }
95+ const auto * malgChip = geom->getMatrix (getVolID ());
96+ // correct chip original matrix by the difference between aligneg chip and sensor matrices
97+ // Sens_ideal = Chip_ideal * Chip_aligned^-1 * Sens_aligned
98+ auto chAlignInv = malgChip->Inverse ();
99+ chAlignInv.Multiply (*malgSens);
100+ mtmp.Multiply (chAlignInv);
101+ setMatrixL2GIdeal (mtmp);
102+ }
103+
69104} // namespace align
70105} // namespace o2
0 commit comments