Project
Loading...
Searching...
No Matches
AlignableSensorITS.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
18#include "Align/utils.h"
19#include "Framework/Logger.h"
22
24
25using namespace o2::align::utils;
26using namespace TMath;
27
28namespace o2
29{
30namespace align
31{
32
33//_________________________________________________________
34AlignableSensorITS::AlignableSensorITS(const char* name, int vid, int iid, Controller* ctr)
35 : AlignableSensor(name, vid, iid, ctr)
36{
37 // def c-tor
38}
39
40//____________________________________________
42{
43 // extract geometry T2L matrix
44 TGeoHMatrix t2l;
45 const auto& l2g = getMatrixL2GIdeal();
46 double locA[3] = {-100., 0., 0.}, locB[3] = {100., 0., 0.}, gloA[3], gloB[3];
47 l2g.LocalToMaster(locA, gloA);
48 l2g.LocalToMaster(locB, gloB);
49 double dx = gloB[0] - gloA[0], dy = gloB[1] - gloA[1];
50 double t = (gloB[0] * dx + gloB[1] * dy) / (dx * dx + dy * dy);
51 double xp = gloB[0] - dx * t, yp = gloB[1] - dy * t;
52 mX = std::sqrt(xp * xp + yp * yp);
53 float alp = std::atan2(yp, xp);
54 o2::math_utils::bringTo02Pi(alp);
55 mAlp = alp;
56 /* // this would proved x, alpha accounting for the corrections, we need ideal ones ?
57 float x, alp;
58 auto geom = o2::its::GeometryTGeo::Instance();
59 geom->getSensorXAlphaRefPlane(getVolID(), x, alp);
60 mAlp = alp;
61 mX = x;
62 */
63 t2l.RotateZ(mAlp * RadToDeg()); // rotate in direction of normal to the sensor plane
64 const TGeoHMatrix l2gi = l2g.Inverse();
65 t2l.MultiplyLeft(&l2gi);
66 setMatrixT2L(t2l);
67}
68
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
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
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
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
104} // namespace align
105} // namespace o2
Base class for detector: wrapper for set of volumes.
ClassImp(o2::align::AlignableSensorITS)
Meausered point in the sensor.
Collection of auxillary methods.
Definition of the GeometryTGeo class.
void prepareMatrixL2G(bool reco=false) final
void setMatrixL2GIdeal(const TGeoHMatrix &m)
void setMatrixL2GReco(const TGeoHMatrix &m)
void setMatrixL2G(const TGeoHMatrix &m)
const TGeoHMatrix & getMatrixL2GIdeal() const
void setMatrixT2L(const TGeoHMatrix &m)
const char * getSymName() const
static Bool_t getOriginalMatrix(o2::detectors::DetID detid, int sensid, TGeoHMatrix &m)
static GeometryTGeo * Instance()
const GLfloat * m
Definition glcorearb.h:4066
GLuint const GLchar * name
Definition glcorearb.h:781
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"