1 #include "LaserBeams.h"
4 cout <<
"NoLocals " << NoLocals <<
"\tNoBeams " << NoBeams << endl;
5 const Int_t numSectors = 24;
7 Double_t dBeta = 720./numSectors;
10 TGeoHMatrix TpcHalf[2];
11 Double_t rotHalfs[18] = {
12 0, -1, 0, -1, 0, 0, 0, 0, -1,
13 0, 1, 0, -1, 0, 0, 0, 0, 1
15 for (half = 0; half <2; half++) TpcHalf[half].SetRotation(&rotHalfs[9*half]);
16 TGeoHMatrix RotSec[24];
17 for (sector = 1; sector <= numSectors; sector++) {
18 if (sector > 12) beta = (numSectors-sector)*dBeta;
19 else beta = sector*dBeta;
20 RotSec[sector-1].RotateZ(-beta);
23 for (Int_t raft = 1; raft <= 14; raft++) {
27 for (Int_t bundle = 1; bundle <= 6; bundle++) {
28 for (Int_t mirror = 1; mirror <= 7; mirror++) {
29 Int_t RBM = 100*raft + 10*bundle + mirror;
50 if (raft == 5)
continue;
52 for (Int_t local = 0; local < NoLocals; local++) {
53 if (Locals[local].Raft == raft && Locals[local].Bundle == bundle && Locals[local].Mirror == mirror) {l = local;
break;}
56 for (Int_t global = 0; global < NoBeams; global++) {
57 if (LaserBeams[global].Raft == raft && LaserBeams[global].Bundle == bundle && LaserBeams[global].Mirror == mirror) {k = global;
break;}
59 if (l < 0 || k < 0)
continue;
61 Double_t *xg = &LaserBeams[k].X;
63 sector = LaserBeams[k].Sector;
65 if (sector > 12) half = 1;
66 TGeoHMatrix RotM = RotSec[sector-1] * TpcHalf[half];
70 RotM.MasterToLocal(xg,xG);
71 Double_t *xl = &Locals[l].X;
72 Double_t xL[3] = {0.1*xl[0], 0.1*xl[1], 0.1*xl[2]};
79 0., xL[2], -xL[1], 1., 0., 0.,
80 -xL[2], 0., xL[0], 0., 1., 0.,
81 xL[1], -xL[0], 0., 0., 0., 1.
83 for (Int_t i = 0; i < 3; i++) {
84 Double_t x = xG[i] - xL[i];
92 if (A.GetNrows() < 1) {
93 cout <<
"Raft " << raft <<
" is empty" << endl;
96 cout <<
"Raft " << raft <<
" Sector = " << sector <<
" =========================" << endl;
101 TGeoHMatrix T(Form(
"Raft%0i",raft));
103 Double_t *xx = X.GetArray();
104 T.RotateX(xx[0]*180/TMath::Pi());
105 T.RotateY(xx[1]*180/TMath::Pi());
106 T.RotateZ(xx[2]*180/TMath::Pi());
107 T.SetTranslation(&xx[3]);
108 cout << Form(
"{%i,%i",raft,sector);
109 for (Int_t i = 0; i < 6; i++) cout << Form(
",%15.5f",xx[i]);
110 cout <<
"}," << endl;
113 TGeoHMatrix RotM = RotSec[sector-1] * TpcHalf[half] * T;
117 for (Int_t bundle = 1; bundle <= 6; bundle++) {
118 for (Int_t mirror = 1; mirror <= 7; mirror++) {
120 for (Int_t local = 0; local < NoLocals; local++) {
121 if (Locals[local].Raft == raft && Locals[local].Bundle == bundle && Locals[local].Mirror == mirror) {l = local;
break;}
124 for (Int_t global = 0; global < NoBeams; global++) {
125 if (LaserBeams[global].Raft == raft && LaserBeams[global].Bundle == bundle && LaserBeams[global].Mirror == mirror) {k = global;
break;}
127 if (l < 0 || k < 0)
continue;
128 sector = LaserBeams[k].Sector;
130 Double_t *xg = &LaserBeams[k].X;
131 Double_t *xl = &Locals[l].X;
132 Double_t xL[3] = {0.1*xl[0],0.1*xl[1],0.1*xl[2]};
135 RotM.LocalToMaster(xL,xG);
137 for (Int_t i = 0; i < 3; i++) {
138 Double_t dif = (xG[i] - xg[i]);
141 dev = TMath::Sqrt(dev);
143 cout << Form(
"S%02iR%02iB%iM%i dev = %f",sector,raft,bundle,mirror,dev);
144 cout << Form(
" dX/dY/dZ = %f/%f/%f",xG[0] - xg[0],xG[1] - xg[1],xG[2] - xg[2]);
145 if (dev > 0.005) cout <<
" ===========";