Skip to content

Commit 3d8d171

Browse files
committed
macro to dump volumes ideal and real origins in lab frame
1 parent aecee1b commit 3d8d171

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

Detectors/Align/macro/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@
1010
# or submit itself to any jurisdiction.
1111

1212
install(FILES algconf.C
13+
algDump.C
1314
MPRec2Mille.C
1415
DESTINATION share/Detectors/Align/macro)
1516

1617
o2_add_test_root_macro(algconf.C
1718
PUBLIC_LINK_LIBRARIES O2::Align
1819
LABELS align COMPILE_ONLY)
1920

21+
o2_add_test_root_macro(algDump.C
22+
PUBLIC_LINK_LIBRARIES O2::Align
23+
LABELS align COMPILE_ONLY)
24+
2025
o2_add_test_root_macro(MPRec2Mille.C
2126
PUBLIC_LINK_LIBRARIES O2::Align
2227
LABELS align COMPILE_ONLY)

Detectors/Align/macro/algDump.C

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
12+
#if !defined(__CLING__) || defined(__ROOTCLING__)
13+
#include "DetectorsBase/GeometryManager.h"
14+
#include "CommonUtils/TreeStreamRedirector.h"
15+
#include "ITSMFTReconstruction/ChipMappingITS.h"
16+
#include "DetectorsCommonDataFormats/DetID.h"
17+
#include "DataFormatsTRD/Constants.h"
18+
#include "TRDBase/Geometry.h"
19+
#include "TOFBase/Geo.h"
20+
#include <TVector3.h>
21+
#endif
22+
23+
using DetID = o2::detectors::DetID;
24+
25+
void algDump(const std::string& geom = "", const std::string& outname = "algdump.root")
26+
{
27+
o2::base::GeometryManager::loadGeometry(geom.c_str());
28+
o2::utils::TreeStreamRedirector outstream(outname.c_str(), "recreate");
29+
TGeoHMatrix* matAlg = nullptr;
30+
TGeoHMatrix matOrig;
31+
TVector3 pos0, pos;
32+
DetID det;
33+
34+
auto procSens = [](TGeoHMatrix& mat) {
35+
double loc[3] = {0., 0., 0.}, glo[3];
36+
mat.LocalToMaster(loc, glo);
37+
return TVector3(glo[0], glo[1], glo[2]);
38+
};
39+
40+
auto store = [&outstream, &det, &pos, &pos0](int lr, int sid, int sidLr) {
41+
outstream << "gm"
42+
<< "det=" << det.getID() << "lr=" << lr << "sid=" << sid << "sidlr=" << sidLr << "pos0=" << pos0 << "pos=" << pos << "\n";
43+
// printf("xx %d %d %d %f %f %f\n", det.getID(), lr, sid, pos0[0], pos0[1], pos0[1]);
44+
};
45+
46+
det = DetID("ITS");
47+
o2::itsmft::ChipMappingITS mpits;
48+
for (int ic = 0; ic < mpits.getNChips(); ic++) {
49+
int lr = mpits.getLayer(ic);
50+
int ic0 = ic - mpits.getFirstChipsOnLayer(lr);
51+
matAlg = o2::base::GeometryManager::getMatrix(det, ic);
52+
o2::base::GeometryManager::getOriginalMatrix(det, ic, matOrig);
53+
pos0 = procSens(matOrig);
54+
pos = procSens(*matAlg);
55+
store(lr, ic, ic0);
56+
}
57+
58+
det = DetID("TRD");
59+
for (int ilr = 0; ilr < o2::trd::constants::NLAYER; ilr++) { // layer
60+
for (int ich = 0; ich < o2::trd::constants::NSTACK * o2::trd::constants::NSECTOR; ich++) { // chamber
61+
int isector = ich / o2::trd::constants::NSTACK;
62+
int istack = ich % o2::trd::constants::NSTACK;
63+
uint16_t sid = o2::trd::Geometry::getDetector(ilr, istack, isector);
64+
const char* symname = Form("TRD/sm%02d/st%d/pl%d", isector, istack, ilr);
65+
if (!gGeoManager->GetAlignableEntry(symname)) {
66+
continue;
67+
}
68+
matAlg = o2::base::GeometryManager::getMatrix(det, sid);
69+
o2::base::GeometryManager::getOriginalMatrix(det, sid, matOrig);
70+
pos0 = procSens(matOrig);
71+
pos = procSens(*matAlg);
72+
store(ilr, sid, ich);
73+
}
74+
}
75+
76+
det = DetID("TOF");
77+
int cnt = -1;
78+
for (int isc = 0; isc < 18; isc++) {
79+
for (int istr = 1; istr <= o2::tof::Geo::NSTRIPXSECTOR; istr++) { // strip
80+
const char* symname = Form("TOF/sm%02d/strip%02d", isc, istr);
81+
cnt++;
82+
if (!gGeoManager->GetAlignableEntry(symname)) {
83+
continue;
84+
}
85+
matAlg = o2::base::GeometryManager::getMatrix(det, cnt);
86+
o2::base::GeometryManager::getOriginalMatrix(det, cnt, matOrig);
87+
pos0 = procSens(matOrig);
88+
pos = procSens(*matAlg);
89+
store(0, cnt, cnt);
90+
}
91+
}
92+
outstream.Close();
93+
}

0 commit comments

Comments
 (0)