]>
Commit | Line | Data |
---|---|---|
21dd83fc | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * SigmaEffect_thetadegrees * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpeateose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | // | |
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
a9aad96e | 19 | /// \class AliMUONGeometryMisAligner |
20 | /// | |
21 | /// This performs the misalignment on an existing muon arm geometry | |
22 | /// based on the standard definition of the detector elements in | |
23 | /// $ALICE_ROOT/MUON/data | |
24 | /// | |
25 | /// --> User has to specify the magnitude of the alignments, in the Cartesian | |
26 | /// co-ordiantes (which are used to apply translation misalignments) and in the | |
27 | /// spherical co-ordinates (which are used to apply angular displacements) | |
28 | /// | |
29 | /// --> If the constructor is used with no arguments, user has to set | |
30 | /// misalignment ranges by hand using the methods : | |
31 | /// SetApplyMisAlig, SetMaxCartMisAlig, SetMaxAngMisAlig, SetXYAngMisAligFactor | |
32 | /// (last method takes account of the fact that the misalingment is greatest in | |
33 | /// the XY plane, since the detection elements are fixed to a support structure | |
34 | /// in this plane. Misalignments in the XZ and YZ plane will be very small | |
35 | /// compared to those in the XY plane, which are small already - of the order | |
36 | /// of microns) | |
37 | /// | |
38 | /// Note : If the detection elements are allowed to be misaligned in all | |
39 | /// directions, this has consequences for the alignment algorithm | |
40 | /// (AliMUONAlignment), which needs to know the number of free parameters. | |
41 | /// Eric only allowed 3 : x,y,theta_xy, but in principle z and the other | |
42 | /// two angles are alignable as well. | |
43 | /// | |
4600314b | 44 | /// \author Bruce Becker, Javier Castillo |
3d1463c8 | 45 | //----------------------------------------------------------------------------- |
21dd83fc | 46 | |
21dd83fc | 47 | #include "AliMUONGeometryMisAligner.h" |
48 | #include "AliMUONGeometryTransformer.h" | |
49 | #include "AliMUONGeometryModuleTransformer.h" | |
50 | #include "AliMUONGeometryDetElement.h" | |
21dd83fc | 51 | #include "AliMUONGeometryBuilder.h" |
8c95578a | 52 | #include "AliMpExMap.h" |
630711ed | 53 | #include "AliMpExMapIterator.h" |
8c95578a | 54 | |
4818a9b7 | 55 | #include "AliAlignObjMatrix.h" |
fdc9da07 | 56 | #include "AliMathBase.h" |
ef79ed3a | 57 | #include "AliLog.h" |
58 | ||
4818a9b7 | 59 | #include <TClonesArray.h> |
328e160e | 60 | #include <TGeoMatrix.h> |
4818a9b7 | 61 | #include <TMatrixDSym.h> |
21dd83fc | 62 | #include <TMath.h> |
63 | #include <TRandom.h> | |
ef4cb4f1 | 64 | #include <Riostream.h> |
21dd83fc | 65 | |
a9aad96e | 66 | /// \cond CLASSIMP |
21dd83fc | 67 | ClassImp(AliMUONGeometryMisAligner) |
a9aad96e | 68 | /// \endcond |
69 | ||
328e160e | 70 | //______________________________________________________________________________ |
71 | AliMUONGeometryMisAligner::AliMUONGeometryMisAligner(Double_t cartXMisAligM, Double_t cartXMisAligW, Double_t cartYMisAligM, Double_t cartYMisAligW, Double_t angMisAligM, Double_t angMisAligW) | |
8395bff1 | 72 | : TObject(), |
73 | fUseUni(kFALSE), | |
74 | fUseGaus(kTRUE), | |
8395bff1 | 75 | fXYAngMisAligFactor(0.0), |
fdc9da07 | 76 | fZCartMisAligFactor(0.0) |
328e160e | 77 | { |
78 | /// Standard constructor | |
4600314b | 79 | for (Int_t i=0; i<6; i++){ |
80 | for (Int_t j=0; j<2; j++){ | |
81 | fDetElemMisAlig[i][j] = 0.0; | |
82 | fModuleMisAlig[i][j] = 0.0; | |
83 | } | |
84 | } | |
85 | fDetElemMisAlig[0][0] = cartXMisAligM; | |
86 | fDetElemMisAlig[0][1] = cartXMisAligW; | |
87 | fDetElemMisAlig[1][0] = cartYMisAligM; | |
88 | fDetElemMisAlig[1][1] = cartYMisAligW; | |
89 | fDetElemMisAlig[5][0] = angMisAligM; | |
90 | fDetElemMisAlig[5][1] = angMisAligW; | |
91 | ||
328e160e | 92 | } |
93 | ||
94 | //______________________________________________________________________________ | |
95 | AliMUONGeometryMisAligner::AliMUONGeometryMisAligner(Double_t cartMisAligM, Double_t cartMisAligW, Double_t angMisAligM, Double_t angMisAligW) | |
8395bff1 | 96 | : TObject(), |
97 | fUseUni(kFALSE), | |
98 | fUseGaus(kTRUE), | |
8395bff1 | 99 | fXYAngMisAligFactor(0.0), |
fdc9da07 | 100 | fZCartMisAligFactor(0.0) |
328e160e | 101 | { |
102 | /// Standard constructor | |
4600314b | 103 | for (Int_t i=0; i<6; i++){ |
104 | for (Int_t j=0; j<2; j++){ | |
105 | fDetElemMisAlig[i][j] = 0.0; | |
106 | fModuleMisAlig[i][j] = 0.0; | |
107 | } | |
108 | } | |
109 | fDetElemMisAlig[0][0] = cartMisAligM; | |
110 | fDetElemMisAlig[0][1] = cartMisAligW; | |
111 | fDetElemMisAlig[1][0] = cartMisAligM; | |
112 | fDetElemMisAlig[1][1] = cartMisAligW; | |
113 | fDetElemMisAlig[5][0] = angMisAligM; | |
114 | fDetElemMisAlig[5][1] = angMisAligW; | |
115 | ||
328e160e | 116 | } |
117 | ||
21dd83fc | 118 | //______________________________________________________________________________ |
119 | AliMUONGeometryMisAligner::AliMUONGeometryMisAligner(Double_t cartMisAlig, Double_t angMisAlig) | |
8395bff1 | 120 | : TObject(), |
121 | fUseUni(kTRUE), | |
122 | fUseGaus(kFALSE), | |
8395bff1 | 123 | fXYAngMisAligFactor(0.0), |
fdc9da07 | 124 | fZCartMisAligFactor(0.0) |
21dd83fc | 125 | { |
126 | /// Standard constructor | |
4600314b | 127 | for (Int_t i=0; i<6; i++){ |
128 | for (Int_t j=0; j<2; j++){ | |
129 | fDetElemMisAlig[i][j] = 0.0; | |
130 | fModuleMisAlig[i][j] = 0.0; | |
131 | } | |
132 | } | |
133 | fDetElemMisAlig[0][1] = cartMisAlig; | |
134 | fDetElemMisAlig[1][1] = cartMisAlig; | |
135 | fDetElemMisAlig[5][1] = angMisAlig; | |
136 | ||
21dd83fc | 137 | } |
138 | ||
139 | //_____________________________________________________________________________ | |
140 | AliMUONGeometryMisAligner::AliMUONGeometryMisAligner() | |
8395bff1 | 141 | : TObject(), |
142 | fUseUni(kTRUE), | |
143 | fUseGaus(kFALSE), | |
8395bff1 | 144 | fXYAngMisAligFactor(0.0), |
fdc9da07 | 145 | fZCartMisAligFactor(0.0) |
21dd83fc | 146 | { |
8395bff1 | 147 | /// Default constructor |
4600314b | 148 | for (Int_t i=0; i<6; i++){ |
149 | for (Int_t j=0; j<2; j++){ | |
150 | fDetElemMisAlig[i][j] = 0.0; | |
151 | fModuleMisAlig[i][j] = 0.0; | |
152 | } | |
153 | } | |
21dd83fc | 154 | } |
155 | ||
21dd83fc | 156 | //______________________________________________________________________________ |
157 | AliMUONGeometryMisAligner::~AliMUONGeometryMisAligner() | |
158 | { | |
159 | /// Destructor | |
160 | ||
21dd83fc | 161 | } |
162 | ||
490da820 | 163 | //_________________________________________________________________________ |
21dd83fc | 164 | void |
165 | AliMUONGeometryMisAligner::SetXYAngMisAligFactor(Double_t factor) | |
166 | { | |
328e160e | 167 | /// Set XY angular misalign factor |
490da820 | 168 | |
4600314b | 169 | if (TMath::Abs(factor) > 1.0 && factor > 0.){ |
21dd83fc | 170 | fXYAngMisAligFactor = factor; |
4600314b | 171 | fDetElemMisAlig[3][0] = fDetElemMisAlig[5][0]*factor; // These lines were |
172 | fDetElemMisAlig[3][1] = fDetElemMisAlig[5][1]*factor; // added to keep | |
173 | fDetElemMisAlig[4][0] = fDetElemMisAlig[5][0]*factor; // backward | |
174 | fDetElemMisAlig[4][1] = fDetElemMisAlig[5][1]*factor; // compatibility | |
175 | } | |
21dd83fc | 176 | else |
328e160e | 177 | AliError(Form("Invalid XY angular misalign factor, %d", factor)); |
178 | } | |
179 | ||
180 | //_________________________________________________________________________ | |
181 | void AliMUONGeometryMisAligner::SetZCartMisAligFactor(Double_t factor) | |
182 | { | |
183 | /// Set XY angular misalign factor | |
4600314b | 184 | if (TMath::Abs(factor)<1.0 && factor>0.) { |
328e160e | 185 | fZCartMisAligFactor = factor; |
4600314b | 186 | fDetElemMisAlig[2][0] = fDetElemMisAlig[0][0]; // These lines were added to |
187 | fDetElemMisAlig[2][1] = fDetElemMisAlig[0][1]*factor; // keep backward compatibility | |
188 | } | |
328e160e | 189 | else |
190 | AliError(Form("Invalid Z cartesian misalign factor, %d", factor)); | |
191 | } | |
192 | ||
193 | //_________________________________________________________________________ | |
4600314b | 194 | void AliMUONGeometryMisAligner::GetUniMisAlign(Double_t cartMisAlig[3], Double_t angMisAlig[3], const Double_t lParMisAlig[6][2]) const |
328e160e | 195 | { |
196 | /// Misalign using uniform distribution | |
a9aad96e | 197 | /** |
328e160e | 198 | misalign the centre of the local transformation |
199 | rotation axes : | |
200 | fAngMisAlig[1,2,3] = [x,y,z] | |
201 | Assume that misalignment about the x and y axes (misalignment of z plane) | |
202 | is much smaller, since the entire detection plane has to be moved (the | |
203 | detection elements are on a support structure), while rotation of the x-y | |
204 | plane is more free. | |
205 | */ | |
fdc9da07 | 206 | cartMisAlig[0] = gRandom->Uniform(-lParMisAlig[0][1]+lParMisAlig[0][0], lParMisAlig[0][0]+lParMisAlig[0][1]); |
207 | cartMisAlig[1] = gRandom->Uniform(-lParMisAlig[1][1]+lParMisAlig[1][0], lParMisAlig[1][0]+lParMisAlig[1][1]); | |
208 | cartMisAlig[2] = gRandom->Uniform(-lParMisAlig[2][1]+lParMisAlig[2][0], lParMisAlig[2][0]+lParMisAlig[2][1]); | |
328e160e | 209 | |
fdc9da07 | 210 | angMisAlig[0] = gRandom->Uniform(-lParMisAlig[3][1]+lParMisAlig[3][0], lParMisAlig[3][0]+lParMisAlig[3][1]); |
211 | angMisAlig[1] = gRandom->Uniform(-lParMisAlig[4][1]+lParMisAlig[4][0], lParMisAlig[4][0]+lParMisAlig[4][1]); | |
212 | angMisAlig[2] = gRandom->Uniform(-lParMisAlig[5][1]+lParMisAlig[5][0], lParMisAlig[5][0]+lParMisAlig[5][1]); // degrees | |
328e160e | 213 | } |
214 | ||
215 | //_________________________________________________________________________ | |
4600314b | 216 | void AliMUONGeometryMisAligner::GetGausMisAlign(Double_t cartMisAlig[3], Double_t angMisAlig[3], const Double_t lParMisAlig[6][2]) const |
328e160e | 217 | { |
218 | /// Misalign using gaussian distribution | |
a9aad96e | 219 | /** |
328e160e | 220 | misalign the centre of the local transformation |
221 | rotation axes : | |
222 | fAngMisAlig[1,2,3] = [x,y,z] | |
223 | Assume that misalignment about the x and y axes (misalignment of z plane) | |
224 | is much smaller, since the entire detection plane has to be moved (the | |
225 | detection elements are on a support structure), while rotation of the x-y | |
226 | plane is more free. | |
227 | */ | |
fdc9da07 | 228 | cartMisAlig[0] = AliMathBase::TruncatedGaus(lParMisAlig[0][0], lParMisAlig[0][1], 3.*lParMisAlig[0][1]); |
229 | cartMisAlig[1] = AliMathBase::TruncatedGaus(lParMisAlig[1][0], lParMisAlig[1][1], 3.*lParMisAlig[1][1]); | |
230 | cartMisAlig[2] = AliMathBase::TruncatedGaus(lParMisAlig[2][0], lParMisAlig[2][1], 3.*lParMisAlig[2][1]); | |
328e160e | 231 | |
fdc9da07 | 232 | angMisAlig[0] = AliMathBase::TruncatedGaus(lParMisAlig[3][0], lParMisAlig[3][1], 3.*lParMisAlig[3][1]); |
233 | angMisAlig[1] = AliMathBase::TruncatedGaus(lParMisAlig[4][0], lParMisAlig[4][1], 3.*lParMisAlig[4][1]); | |
234 | angMisAlig[2] = AliMathBase::TruncatedGaus(lParMisAlig[5][0], lParMisAlig[5][1], 3.*lParMisAlig[5][1]); // degrees | |
21dd83fc | 235 | } |
236 | ||
237 | //_________________________________________________________________________ | |
4600314b | 238 | TGeoCombiTrans AliMUONGeometryMisAligner::MisAlignDetElem(const TGeoCombiTrans & transform) const |
21dd83fc | 239 | { |
4600314b | 240 | /// Misalign given transformation and return the misaligned transformation. |
241 | /// Use misalignment parameters for detection elements. | |
242 | /// Note that applied misalignments are small deltas with respect to the detection | |
243 | /// element own ideal local reference frame. Thus deltaTransf represents | |
244 | /// the transformation to go from the misaligned d.e. local coordinates to the | |
245 | /// ideal d.e. local coordinates. | |
246 | /// Also note that this -is not- what is in the ALICE alignment framework known | |
247 | /// as local nor global (see AliMUONGeometryMisAligner::MisAlign) | |
21dd83fc | 248 | |
249 | Double_t cartMisAlig[3] = {0,0,0}; | |
250 | Double_t angMisAlig[3] = {0,0,0}; | |
328e160e | 251 | |
252 | if (fUseUni) { | |
4600314b | 253 | GetUniMisAlign(cartMisAlig,angMisAlig,fDetElemMisAlig); |
328e160e | 254 | } |
255 | else { | |
256 | if (!fUseGaus) { | |
257 | AliWarning("Neither uniform nor gausian distribution is set! Will use gausian..."); | |
258 | } | |
4600314b | 259 | GetGausMisAlign(cartMisAlig,angMisAlig,fDetElemMisAlig); |
328e160e | 260 | } |
261 | ||
4600314b | 262 | TGeoTranslation deltaTrans(cartMisAlig[0], cartMisAlig[1], cartMisAlig[2]); |
263 | TGeoRotation deltaRot; | |
264 | deltaRot.RotateX(angMisAlig[0]); | |
265 | deltaRot.RotateY(angMisAlig[1]); | |
266 | deltaRot.RotateZ(angMisAlig[2]); | |
267 | ||
268 | TGeoCombiTrans deltaTransf(deltaTrans,deltaRot); | |
269 | TGeoHMatrix newTransfMat = transform * deltaTransf; | |
270 | ||
ef4cb4f1 | 271 | AliInfo(Form("Rotated DE by %f about Z axis.", angMisAlig[2])); |
4600314b | 272 | |
273 | return TGeoCombiTrans(newTransfMat); | |
274 | } | |
275 | ||
276 | //_________________________________________________________________________ | |
277 | TGeoCombiTrans AliMUONGeometryMisAligner::MisAlignModule(const TGeoCombiTrans & transform) const | |
278 | { | |
279 | /// Misalign given transformation and return the misaligned transformation. | |
280 | /// Use misalignment parameters for modules. | |
281 | /// Note that applied misalignments are small deltas with respect to the module | |
282 | /// own ideal local reference frame. Thus deltaTransf represents | |
283 | /// the transformation to go from the misaligned module local coordinates to the | |
284 | /// ideal module local coordinates. | |
285 | /// Also note that this -is not- what is in the ALICE alignment framework known | |
286 | /// as local nor global (see AliMUONGeometryMisAligner::MisAlign) | |
21dd83fc | 287 | |
4600314b | 288 | Double_t cartMisAlig[3] = {0,0,0}; |
289 | Double_t angMisAlig[3] = {0,0,0}; | |
290 | ||
291 | if (fUseUni) { | |
292 | GetUniMisAlign(cartMisAlig,angMisAlig,fModuleMisAlig); | |
293 | } | |
294 | else { | |
295 | if (!fUseGaus) { | |
296 | AliWarning("Neither uniform nor gausian distribution is set! Will use gausian..."); | |
297 | } | |
298 | GetGausMisAlign(cartMisAlig,angMisAlig,fModuleMisAlig); | |
299 | } | |
300 | ||
301 | TGeoTranslation deltaTrans(cartMisAlig[0], cartMisAlig[1], cartMisAlig[2]); | |
302 | TGeoRotation deltaRot; | |
303 | deltaRot.RotateX(angMisAlig[0]); | |
304 | deltaRot.RotateY(angMisAlig[1]); | |
305 | deltaRot.RotateZ(angMisAlig[2]); | |
21dd83fc | 306 | |
4600314b | 307 | TGeoCombiTrans deltaTransf(deltaTrans,deltaRot); |
308 | TGeoHMatrix newTransfMat = transform * deltaTransf; | |
309 | ||
310 | AliInfo(Form("Rotated Module by %f about Z axis.", angMisAlig[2])); | |
311 | ||
312 | return TGeoCombiTrans(newTransfMat); | |
21dd83fc | 313 | } |
314 | ||
21dd83fc | 315 | //______________________________________________________________________ |
316 | AliMUONGeometryTransformer * | |
317 | AliMUONGeometryMisAligner::MisAlign(const AliMUONGeometryTransformer * | |
4600314b | 318 | transformer, Bool_t verbose) |
21dd83fc | 319 | { |
4600314b | 320 | /// Takes the internal geometry module transformers, copies them to |
321 | /// new geometry module transformers. | |
322 | /// Calculates module misalignment parameters and applies these | |
323 | /// to the new module transformer. | |
324 | /// Calculates the module misalignment delta transformation in the | |
325 | /// Alice Alignment Framework newTransf = delta * oldTransf. | |
326 | /// Add a module misalignment to the new geometry transformer. | |
327 | /// Gets the Detection Elements from the module transformer. | |
a9aad96e | 328 | /// Calculates misalignment parameters and applies these |
4600314b | 329 | /// to the local transformation of the Detection Element. |
330 | /// Obtains the new global transformation by multiplying the new | |
331 | /// module transformer transformation with the new local transformation. | |
332 | /// Applies the new global transform to a new detection element. | |
333 | /// Adds the new detection element to a new module transformer. | |
334 | /// Calculates the d.e. misalignment delta transformation in the | |
335 | /// Alice Alignment Framework (newGlobalTransf = delta * oldGlobalTransf). | |
336 | /// Add a d.e. misalignment to the new geometry transformer. | |
337 | /// Adds the new module transformer to a new geometry transformer. | |
338 | /// Returns the new geometry transformer. | |
21dd83fc | 339 | |
340 | ||
341 | AliMUONGeometryTransformer *newGeometryTransformer = | |
ef4cb4f1 | 342 | new AliMUONGeometryTransformer(); |
21dd83fc | 343 | for (Int_t iMt = 0; iMt < transformer->GetNofModuleTransformers(); iMt++) |
344 | { // module transformers | |
21dd83fc | 345 | const AliMUONGeometryModuleTransformer *kModuleTransformer = |
346 | transformer->GetModuleTransformer(iMt, true); | |
347 | ||
348 | AliMUONGeometryModuleTransformer *newModuleTransformer = | |
349 | new AliMUONGeometryModuleTransformer(iMt); | |
350 | newGeometryTransformer->AddModuleTransformer(newModuleTransformer); | |
351 | ||
ef79ed3a | 352 | TGeoCombiTrans moduleTransform = |
353 | TGeoCombiTrans(*kModuleTransformer->GetTransformation()); | |
4600314b | 354 | // New module transformation |
355 | TGeoCombiTrans newModuleTransform = MisAlignModule(moduleTransform); | |
356 | newModuleTransformer->SetTransformation(newModuleTransform); | |
357 | ||
358 | // Get delta transformation: | |
359 | // Tdelta = Tnew * Told.inverse | |
360 | TGeoHMatrix deltaModuleTransform = | |
361 | AliMUONGeometryBuilder::Multiply( | |
362 | newModuleTransform, | |
363 | kModuleTransformer->GetTransformation()->Inverse()); | |
364 | ||
365 | // Create module mis alignment matrix | |
366 | newGeometryTransformer | |
367 | ->AddMisAlignModule(kModuleTransformer->GetModuleId(), deltaModuleTransform); | |
21dd83fc | 368 | |
8c95578a | 369 | AliMpExMap *detElements = kModuleTransformer->GetDetElementStore(); |
21dd83fc | 370 | |
371 | if (verbose) | |
4600314b | 372 | AliInfo(Form("%i DEs in old GeometryStore %i",detElements->GetSize(), iMt)); |
21dd83fc | 373 | |
630711ed | 374 | TIter next(detElements->CreateIterator()); |
375 | AliMUONGeometryDetElement *detElement; | |
376 | ||
377 | while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) ) | |
378 | { | |
ef79ed3a | 379 | /// make a new detection element |
21dd83fc | 380 | AliMUONGeometryDetElement *newDetElement = |
381 | new AliMUONGeometryDetElement(detElement->GetId(), | |
ef79ed3a | 382 | detElement->GetVolumePath()); |
21dd83fc | 383 | |
ef79ed3a | 384 | // local transformation of this detection element. |
385 | TGeoCombiTrans localTransform | |
386 | = TGeoCombiTrans(*detElement->GetLocalTransformation()); | |
4600314b | 387 | TGeoCombiTrans newLocalTransform = MisAlignDetElem(localTransform); |
388 | newDetElement->SetLocalTransformation(newLocalTransform); | |
389 | ||
21dd83fc | 390 | |
ef79ed3a | 391 | // global transformation |
392 | TGeoHMatrix newGlobalTransform = | |
4600314b | 393 | AliMUONGeometryBuilder::Multiply(newModuleTransform, |
394 | newLocalTransform); | |
21dd83fc | 395 | newDetElement->SetGlobalTransformation(newGlobalTransform); |
ef79ed3a | 396 | |
397 | // add this det element to module | |
398 | newModuleTransformer->GetDetElementStore()->Add(newDetElement->GetId(), | |
21dd83fc | 399 | newDetElement); |
4600314b | 400 | |
401 | // In the Alice Alignment Framework misalignment objects store | |
402 | // global delta transformation | |
403 | // Get detection "intermediate" global transformation | |
404 | TGeoHMatrix newOldGlobalTransform = newModuleTransform * localTransform; | |
405 | // Get detection element global delta transformation: | |
ef79ed3a | 406 | // Tdelta = Tnew * Told.inverse |
4600314b | 407 | TGeoHMatrix deltaGlobalTransform |
ef79ed3a | 408 | = AliMUONGeometryBuilder::Multiply( |
409 | newGlobalTransform, | |
4600314b | 410 | newOldGlobalTransform.Inverse()); |
ef79ed3a | 411 | |
412 | // Create mis alignment matrix | |
413 | newGeometryTransformer | |
4600314b | 414 | ->AddMisAlignDetElement(detElement->GetId(), deltaGlobalTransform); |
21dd83fc | 415 | } |
4600314b | 416 | |
417 | ||
21dd83fc | 418 | if (verbose) |
419 | AliInfo(Form("Added module transformer %i to the transformer", iMt)); | |
420 | newGeometryTransformer->AddModuleTransformer(newModuleTransformer); | |
421 | } | |
422 | return newGeometryTransformer; | |
423 | } | |
424 | ||
425 | ||
4818a9b7 | 426 | void AliMUONGeometryMisAligner::SetAlignmentResolution(const TClonesArray* misAlignArray, Int_t rChId, Double_t rChResX, Double_t rChResY, Double_t rDeResX, Double_t rDeResY){ |
427 | ||
428 | Int_t chIdMin = (rChId<0)? 0 : rChId; | |
429 | Int_t chIdMax = (rChId<0)? 9 : rChId; | |
430 | Double_t chResX = (rChResX<0)? fModuleMisAlig[0][1] : rChResX; | |
431 | Double_t chResY = (rChResY<0)? fModuleMisAlig[1][1] : rChResY; | |
432 | Double_t deResX = (rDeResX<0)? fDetElemMisAlig[0][1] : rDeResX; | |
433 | Double_t deResY = (rDeResY<0)? fDetElemMisAlig[1][1] : rDeResY; | |
434 | ||
435 | TMatrixDSym mChCorrMatrix(6); | |
436 | mChCorrMatrix[0][0]=chResX*chResX; | |
437 | mChCorrMatrix[1][1]=chResY*chResY; | |
438 | // mChCorrMatrix.Print(); | |
439 | ||
440 | TMatrixDSym mDECorrMatrix(6); | |
441 | mDECorrMatrix[0][0]=deResX*deResX; | |
442 | mDECorrMatrix[1][1]=deResY*deResY; | |
443 | // mDECorrMatrix.Print(); | |
444 | ||
445 | AliAlignObjMatrix *alignMat = 0x0; | |
446 | ||
447 | for(Int_t chId=chIdMin; chId<=chIdMax; chId++) { | |
448 | TString chName1; | |
449 | TString chName2; | |
450 | if (chId<4){ | |
451 | chName1 = Form("GM%d",chId); | |
452 | chName2 = Form("GM%d",chId); | |
453 | } else { | |
454 | chName1 = Form("GM%d",4+(chId-4)*2); | |
455 | chName2 = Form("GM%d",4+(chId-4)*2+1); | |
456 | } | |
457 | ||
458 | for (int i=0; i<misAlignArray->GetEntries(); i++) { | |
459 | alignMat = (AliAlignObjMatrix*)misAlignArray->At(i); | |
460 | TString volName(alignMat->GetSymName()); | |
461 | if((volName.Contains(chName1)&& | |
462 | ((volName.Last('/')==volName.Index(chName1)+chName1.Length())|| | |
463 | (volName.Length()==volName.Index(chName1)+chName1.Length())))|| | |
464 | (volName.Contains(chName2)&& | |
465 | ((volName.Last('/')==volName.Index(chName2)+chName2.Length())|| | |
466 | (volName.Length()==volName.Index(chName2)+chName2.Length())))){ | |
467 | volName.Remove(0,volName.Last('/')+1); | |
468 | if (volName.Contains("GM")) { | |
469 | // alignMat->Print("NULL"); | |
470 | alignMat->SetCorrMatrix(mChCorrMatrix); | |
471 | } else if (volName.Contains("DE")) { | |
472 | // alignMat->Print("NULL"); | |
473 | alignMat->SetCorrMatrix(mDECorrMatrix); | |
474 | } | |
475 | } | |
476 | } | |
477 | } | |
478 | } | |
479 | ||
21dd83fc | 480 | |
481 |