Update master to aliroot
[u/mrichter/AliRoot.git] / PHOS / macros / AlignmentDB / MakeFinalAlignment.C
CommitLineData
b79eb35f 1/*
2**********No misalignment*******
3i=0
4matrix global_1 - tr=1 rot=1 refl=0 scl=0
5 0.766044 0.000000 0.642788 Tx = 310.215729
6 0.642788 0.000000 -0.766044 Ty = -369.700684
7 0.000000 1.000000 0.000000 Tz = 0.000000
8i=1
9matrix global_1 - tr=1 rot=1 refl=0 scl=0
10 0.939693 0.000000 0.342020 Tx = 165.062332
11 0.342020 0.000000 -0.939693 Ty = -453.505035
12 0.000000 1.000000 0.000000 Tz = 0.000000
13i=2
14matrix global_1 - tr=1 rot=1 refl=0 scl=0
15 1.000000 0.000000 0.000000 Tx = 0.000000
16 0.000000 0.000000 -1.000000 Ty = -482.609985
17 0.000000 1.000000 0.000000 Tz = 0.000000
18i=3
19matrix global_1 - tr=1 rot=1 refl=0 scl=0
20 0.939693 0.000000 -0.342020 Tx = -165.062332
21 -0.342020 0.000000 -0.939693 Ty = -453.505035
22 0.000000 1.000000 0.000000 Tz = 0.000000
23
24*************
25=========Should be========
26
27mod 4 (i=0)
28matrix - tr=1 rot=1 refl=0 scl=0
29 0.767337 -0.004312 0.641229 Tx = 313.381746
30 0.641189 -0.007942 -0.767342 Ty = -372.024764
31 0.008402 0.999959 -0.003330 Tz = -2.354855
32
33mod 3 (i=1)
34matrix - tr=1 rot=1 refl=0 scl=0
35 0.940798 0.002136 0.338961 Tx = 165.078518
36 0.338959 0.001227 -0.940800 Ty = -454.148853
37 -0.002426 0.999997 0.000431 Tz = -2.801675
38
39mod 3 (i=2)
40matrix - tr=1 rot=1 refl=0 scl=0
41 0.999976 -0.000756 -0.006876 Tx = -0.083626
42 -0.006877 -0.001172 -0.999976 Ty = -482.172358
43 0.000748 0.999999 -0.001178 Tz = -1.906440
44
45mod 3 (i=3)
46matrix - tr=1 rot=1 refl=0 scl=0
47 0.934365 -0.002092 -0.356311 Tx = -167.233337
48 -0.356313 -0.000801 -0.934366 Ty = -460.901723
49 0.001670 0.999997 -0.001494 Tz = -1.821245
50
51------------Correct angles, but zero offsets------
52 0.767338 -0.004312 0.641229 Tx = 309.463421
53 0.641188 -0.007942 -0.767343 Ty = -370.327157
54 0.008401 0.999959 -0.003329 Tz = -1.606798
55i=1
56matrix global_1 - tr=1 rot=1 refl=0 scl=0
57 0.940798 0.002136 0.338961 Tx = 163.586079
58 0.338959 0.001227 -0.940800 Ty = -454.039582
59 -0.002425 0.999997 0.000430 Tz = 0.207687
60i=2
61matrix global_1 - tr=1 rot=1 refl=0 scl=0
62 0.999976 -0.000756 -0.006876 Tx = -3.318427
63 -0.006877 -0.001172 -0.999976 Ty = -482.598242
64 0.000748 0.999999 -0.001177 Tz = -0.568114
65i=3
66matrix global_1 - tr=1 rot=1 refl=0 scl=0
67 0.934365 -0.002092 -0.356311 Tx = -171.959374
68 -0.356314 -0.000801 -0.934366 Ty = -450.934413
69 0.001669 0.999997 -0.001494 Tz = -0.720939
70
71
72
73
74*/
75
76void MakeFinalAlignment(){
77 // Create ideal (no misalignment) object for PHOS
78
79
80 const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("Run2", "Run2");
81 if (!phosGeom) {
82 Error(macroName, "Cannot obtain AliPHOSGeometry singleton.\n");
83 return;
84 }
85
86 //Activate CDB storage and load geometry from CDB
87 //[Part of code, taken from ITS version of MakexxxFullMisalignment
88 AliCDBManager * cdb = AliCDBManager::Instance();
89 cdb->SetDefaultStorage("local://./OCDB");
90 cdb->SetRun(0);
91
92 AliPHOSEMCAGeometry * emca = phosGeom->GetEMCAGeometry();
93 TClonesArray alobj("AliAlignObjParams", 16);
94
95 const Double_t dpsi = 0., dtheta = 0., dphi = 0.;
96 Int_t iIndex = 0; //let all modules have index=0 in a layer with no LUT
97 const AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
98 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer, iIndex);
99 Int_t i = 0;
100
101 // Alignment for 5 PHOS modules
102 Double_t ideal1[9] = {0.766044, 0.000000, 0.642788,
103 0.642788, 0.000000, -0.766044,
104 0.000000, 1.000000, 0.000000} ;
105 Double_t final1[9] = {0.767337, -0.004312, 0.641229,
106 0.641189, -0.007942, -0.767342,
107 0.008402, 0.999959, -0.003330} ;
108 TGeoRotation rot1;
109 rot1.SetMatrix(ideal1);
110 TGeoRotation inv =rot1.Inverse() ;
111 TGeoRotation rotF1;
112 rotF1.SetMatrix(final1);
113 rotF1.MultiplyBy(&inv) ;
114 Double_t dX= 313.381746-309.463421;
115 Double_t dY=-372.024764+370.327157;
116 Double_t dZ=-2.354855 +1.606798 ;
117
118 AliAlignObjParams * mod1 = new(alobj[i++]) AliAlignObjParams("PHOS/Module1",volid, dX, dY, dZ, 0., 0., 0., kTRUE);
119 mod1->SetRotation(rotF1);
120
121
122 Double_t ideal2[9] = {0.939693, 0.000000, 0.342020,
123 0.342020, 0.000000, -0.939693,
124 0.000000, 1.000000, 0.000000} ;
125 Double_t final2[9] = {0.940798, 0.002136, 0.338961,
126 0.338959, 0.001227, -0.940800,
127 -0.002426, 0.999997, 0.000431} ;
128 TGeoRotation rot2;
129 rot2.SetMatrix(ideal2);
130 TGeoRotation inv2 =rot2.Inverse() ;
131 TGeoRotation rotF2;
132 rotF2.SetMatrix(final2);
133 rotF2.MultiplyBy(&inv2) ;
134 dX= 165.078518-163.586079;
135 dY=-454.148853+454.039582;
136 dZ=-2.801675-0.207687 ;
137
138 AliAlignObjParams * mod2 = new(alobj[i++]) AliAlignObjParams("PHOS/Module2",volid, dX, dY, dZ, 0., 0., 0., kTRUE);
139 mod2->SetRotation(rotF2);
140
141 Double_t ideal3[9] = {1.000000, 0.000000, 0.000000,
142 0.000000, 0.000000, -1.000000,
143 0.000000, 1.000000, 0.000000} ;
144 Double_t final3[9] = {0.999976, -0.000756, -0.006876,
145 -0.006877, -0.001172, -0.999976,
146 0.000748, 0.999999, -0.001178} ;
147 TGeoRotation rot3;
148 rot3.SetMatrix(ideal3);
149 TGeoRotation inv3 =rot3.Inverse() ;
150 TGeoRotation rotF3;
151 rotF3.SetMatrix(final3);
152 rotF3.MultiplyBy(&inv3) ;
153 dX= -0.083626+3.318427;
154 dY=-482.172358+482.598242;
155 dZ=-1.906440+0.568114 ;
156
157 AliAlignObjParams * mod3 = new(alobj[i++]) AliAlignObjParams("PHOS/Module3",volid, dX, dY, dZ, 0., 0., 0., kTRUE);
158 mod3->SetRotation(rotF3);
159
160 Double_t ideal4[9] = {0.939693, 0.000000, -0.342020,
161 -0.342020, 0.000000, -0.939693,
162 0.000000, 1.000000, 0.000000} ;
163 Double_t final4[9] = {0.934365, -0.002092, -0.356311,
164 -0.356313, -0.000801, -0.934366,
165 0.001670, 0.999997, -0.001494} ;
166 TGeoRotation rot4;
167 rot4.SetMatrix(ideal4);
168 TGeoRotation inv4 =rot4.Inverse() ;
169 TGeoRotation rotF4;
170 rotF4.SetMatrix(final4);
171 rotF4.MultiplyBy(&inv4) ;
172 dX=-167.233337+171.959374;
173 dY=-460.901723+450.934413;
174 dZ=-1.821245+0.720939 ;
175
176 AliAlignObjParams * mod4 = new(alobj[i++]) AliAlignObjParams("PHOS/Module4",volid, dX, dY, dZ, 0., 0., 0., kTRUE);
177 mod4->SetRotation(rotF4);
178
179 new(alobj[i++]) AliAlignObjParams("PHOS/Module5",
180 volid, 0., 0., 0., 0., 0., 0., kTRUE);
181
182 const Double_t dx = 0., dy = 0., dz = 0. ;
183 // Alignment of CPV modules
184 new(alobj[i++]) AliAlignObjParams("PHOS/Module1/CPV",
185 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
186 new(alobj[i++]) AliAlignObjParams("PHOS/Module2/CPV",
187 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
188 new(alobj[i++]) AliAlignObjParams("PHOS/Module3/CPV",
189 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
190 new(alobj[i++]) AliAlignObjParams("PHOS/Module4/CPV",
191 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
192 new(alobj[i++]) AliAlignObjParams("PHOS/Module5/CPV",
193 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
194
195 Double_t displacement=0 ;
196 // Alignment for PHOS cradle
197 new(alobj[i++]) AliAlignObjParams("PHOS/Cradle0",
198 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
199 new(alobj[i++]) AliAlignObjParams("PHOS/Cradle1",
200 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
201
202 // Alignment for cradle wheels
203 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel0",
204 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
205 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel1",
206 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
207 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel2",
208 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
209 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel3",
210 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
211
212 AliCDBMetaData md;
213 md.SetResponsible("Dmitri Peressounko");
214 md.SetComment("Ideal alignment objects for PHOS");
215 md.SetAliRootVersion(gSystem->Getenv("ARVERSION"));
216 AliCDBId id("PHOS/Align/Data",0,AliCDBRunRange::Infinity());
217 cdb->Put(&alobj, id, &md);
218
219 alobj.Delete();
220}
221
222