AliTPCPointCorrection.cxx - warning removal
[u/mrichter/AliRoot.git] / STEER / AliGeomManager.cxx
CommitLineData
67dd5535 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
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 purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15//-------------------------------------------------------------------------
16// Implementation of AliGeomManager, the geometry manager class
17// which interfaces to TGeo and the look-up table mapping unique
18// volume indices to symbolic volume names. For that it collects
19// several static methods.
20//-------------------------------------------------------------------------
21
22#include <TClass.h>
23#include <TFile.h>
24#include <TGeoManager.h>
25#include <TObjString.h>
26#include <TGeoPhysicalNode.h>
27#include <TClonesArray.h>
28#include <TGeoMatrix.h>
29#include <TGeoPhysicalNode.h>
99de26a3 30#include <TSystem.h>
5590c6c3 31#include <TStopwatch.h>
32#include <TGeoOverlap.h>
33#include <TPluginManager.h>
34#include <TROOT.h>
67dd5535 35
36#include "AliGeomManager.h"
37#include "AliLog.h"
38#include "AliAlignObj.h"
90dbf5fb 39#include "AliAlignObjParams.h"
67dd5535 40#include "AliCDBManager.h"
41#include "AliCDBStorage.h"
42#include "AliCDBEntry.h"
43
44ClassImp(AliGeomManager)
45
46Int_t AliGeomManager::fgLayerSize[kLastLayer - kFirstLayer] = {
47 80, 160, // ITS SPD first and second layer
48 84, 176, // ITS SDD first and second layer
49 748, 950, // ITS SSD first and second layer
50 36, 36, // TPC inner and outer chambers
51 90, 90, 90, 90, 90, 90, // 6 TRD chambers' layers
52 1638, // TOF
df117114 53 5, 5, // PHOS,CPV
67dd5535 54 7, // HMPID ??
3dfc15c0 55 1, // MUON ??
56 12 // EMCAL
67dd5535 57};
58
59const char* AliGeomManager::fgLayerName[kLastLayer - kFirstLayer] = {
60 "ITS inner pixels layer", "ITS outer pixels layer",
61 "ITS inner drifts layer", "ITS outer drifts layer",
62 "ITS inner strips layer", "ITS outer strips layer",
63 "TPC inner chambers layer", "TPC outer chambers layer",
64 "TRD chambers layer 1", "TRD chambers layer 2", "TRD chambers layer 3",
65 "TRD chambers layer 4", "TRD chambers layer 5", "TRD chambers layer 6",
66 "TOF layer",
df117114 67 "PHOS EMC layer","PHOS CPV layer",
3dfc15c0 68 "HMPID layer",
69 "MUON ?",
70 "EMCAL layer"
67dd5535 71};
72
67dd5535 73TGeoPNEntry** AliGeomManager::fgPNEntry[kLastLayer - kFirstLayer] = {
74 0x0,0x0,
75 0x0,0x0,
76 0x0,0x0,
77 0x0,0x0,
78 0x0,0x0,0x0,
79 0x0,0x0,0x0,
80 0x0,
81 0x0,0x0,
82 0x0,
3dfc15c0 83 0x0,
67dd5535 84 0x0
85};
86
36b010bf 87AliAlignObj** AliGeomManager::fgAlignObjs[kLastLayer - kFirstLayer] = {
88 0x0,0x0,
89 0x0,0x0,
90 0x0,0x0,
91 0x0,0x0,
92 0x0,0x0,0x0,
93 0x0,0x0,0x0,
94 0x0,
95 0x0,0x0,
96 0x0,
3dfc15c0 97 0x0,
36b010bf 98 0x0
99};
67dd5535 100
4fbb8e9d 101const char* AliGeomManager::fgkDetectorName[AliGeomManager::fgkNDetectors] = {"GRP","ITS","TPC","TRD","TOF","PHOS","HMPID","EMCAL","MUON","FMD","ZDC","PMD","T0","VZERO","ACORDE"};
102Int_t AliGeomManager::fgNalignable[fgkNDetectors] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
103
104
67dd5535 105TGeoManager* AliGeomManager::fgGeometry = 0x0;
106
107//_____________________________________________________________________________
36b010bf 108void AliGeomManager::LoadGeometry(const char *geomFileName)
67dd5535 109{
9d47e237 110 // initialization
111 // Load geometry either from a file
112 // or from the corresponding CDB entry
67dd5535 113
36b010bf 114 fgGeometry = NULL;
b8cf7791 115 if (geomFileName && (!gSystem->AccessPathName(geomFileName))) {
36b010bf 116 fgGeometry = TGeoManager::Import(geomFileName);
4fbb8e9d 117 AliInfoClass(Form("From now on using geometry from custom geometry file \"%s\"",geomFileName));
36b010bf 118 }
119
120 if (!fgGeometry) {
36b010bf 121 AliCDBPath path("GRP","Geometry","Data");
122
123 AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath());
124 if(!entry) AliFatalClass("Couldn't load geometry data from CDB!");
125
126 entry->SetOwner(0);
127 fgGeometry = (TGeoManager*) entry->GetObject();
128 if (!fgGeometry) AliFatalClass("Couldn't find TGeoManager in the specified CDB entry!");
b8cf7791 129
4fbb8e9d 130 AliInfoClass(Form("From now on using geometry from CDB base folder \"%s\"",
b8cf7791 131 AliCDBManager::Instance()->GetURI("Geometry/Align/Data")));
36b010bf 132 }
3564f2da 133 ResetPNEntriesLUT();
67dd5535 134 InitPNEntriesLUT();
4fbb8e9d 135 InitNalignable();
67dd5535 136}
137
138//_____________________________________________________________________________
53dd673d 139void AliGeomManager::SetGeometry(TGeoManager * const geom)
9d47e237 140{
141 // Load already active geometry
142 if (!geom) AliFatalClass("Pointer to the active geometry is 0x0!");
3564f2da 143 ResetPNEntriesLUT();
9d47e237 144 fgGeometry = geom;
9d47e237 145 InitPNEntriesLUT();
4fbb8e9d 146 InitNalignable();
9d47e237 147}
148
149//_____________________________________________________________________________
67dd5535 150AliGeomManager::AliGeomManager():
36b010bf 151 TObject()
67dd5535 152{
153 // default constructor
154}
155
156//_____________________________________________________________________________
157AliGeomManager::~AliGeomManager()
158{
159 // dummy destructor
67dd5535 160}
161
162//_____________________________________________________________________________
163Int_t AliGeomManager::LayerSize(Int_t layerId)
164{
165 // Get the layer size for layer corresponding to layerId.
166 // Implemented only for ITS,TPC,TRD,TOF and HMPID
167 //
168 if (layerId < kFirstLayer || layerId >= kLastLayer) {
169 AliErrorClass(Form("Invalid layer index %d ! Layer range is (%d -> %d) !",layerId,kFirstLayer,kLastLayer));
170 return 0;
171 }
172 else {
173 return fgLayerSize[layerId - kFirstLayer];
5aedd709 174 }
67dd5535 175}
176
177//_____________________________________________________________________________
178const char* AliGeomManager::LayerName(Int_t layerId)
179{
180 // Get the layer name corresponding to layerId.
181 // Implemented only for ITS,TPC,TRD,TOF and HMPID
182 //
183 if (layerId < kFirstLayer || layerId >= kLastLayer) {
184 AliErrorClass(Form("Invalid layer index %d ! Layer range is (%d -> %d) !",layerId,kFirstLayer,kLastLayer));
185 return "Invalid Layer!";
186 }
187 else {
188 return fgLayerName[layerId - kFirstLayer];
5aedd709 189 }
67dd5535 190}
191
192//_____________________________________________________________________________
193UShort_t AliGeomManager::LayerToVolUID(ELayerID layerId, Int_t modId)
194{
195 // From detector (layer) name and module number (according to detector
196 // internal numbering) build the unique numerical identity of that volume
197 // inside ALICE
198 // fVolUID is 16 bits, first 5 reserved for layerID (32 possible values),
199 // remaining 11 for module ID inside det (2048 possible values).
200 // NO check for validity of given modId inside the layer for speed's sake.
201 //
202 return ((UShort_t(layerId) << 11) | UShort_t(modId));
203}
204
205//_____________________________________________________________________________
206UShort_t AliGeomManager::LayerToVolUID(Int_t layerId, Int_t modId)
207{
208 // From detector (layer) name and module number (according to detector
209 // internal numbering) build the unique numerical identity of that volume
210 // inside ALICE
211 // fVolUID is 16 bits, first 5 reserved for layerID (32 possible values),
212 // remaining 11 for module ID inside det (2048 possible values).
213 // NO check for validity of given modId inside the layer for speed's sake.
214 //
215 return ((UShort_t(layerId) << 11) | UShort_t(modId));
216}
217
218//_____________________________________________________________________________
219UShort_t AliGeomManager::LayerToVolUIDSafe(ELayerID layerId, Int_t modId)
220{
221 // From detector (layer) name and module number (according to detector
222 // internal numbering) build the unique numerical identity of that volume
223 // inside ALICE
224 // fVolUID is 16 bits, first 5 reserved for layerID (32 possible values),
225 // remaining 11 for module ID inside det (2048 possible values).
226 // Check validity of given modId inside the layer.
227 //
228 if(modId < 0 || modId >= LayerSize(layerId)){
229 AliErrorClass(Form("Invalid volume id %d ! Range of valid ids for layer \"%s\" is [0, %d] !",modId,LayerName(layerId),LayerSize(layerId)-1));
230 return 0;
231 }
232 return ((UShort_t(layerId) << 11) | UShort_t(modId));
233}
234
235//_____________________________________________________________________________
236UShort_t AliGeomManager::LayerToVolUIDSafe(Int_t layerId, Int_t modId)
237{
238 // From detector (layer) name and module number (according to detector
239 // internal numbering) build the unique numerical identity of that volume
240 // inside ALICE
241 // fVolUID is 16 bits, first 5 reserved for layerID (32 possible values),
242 // remaining 11 for module ID inside det (2048 possible values).
243 // Check validity of given modId inside the layer.
244 //
245 if(modId < 0 || modId >= LayerSize(layerId)){
246 AliErrorClass(Form("Invalid volume id %d ! Range of valid ids for layer \"%s\" is [0, %d] !",modId,LayerName(layerId),LayerSize(layerId)-1));
247 return 0;
248 }
249 return ((UShort_t(layerId) << 11) | UShort_t(modId));
250}
251
252//_____________________________________________________________________________
253AliGeomManager::ELayerID AliGeomManager::VolUIDToLayer(UShort_t voluid, Int_t &modId)
254{
255 // From voluid, unique numerical identity of that volume inside ALICE,
256 // (voluid is 16 bits, first 5 reserved for layerID (32 possible values),
257 // remaining 11 for module ID inside det (2048 possible values)), return
258 // the identity of the layer to which that volume belongs and sets the
259 // argument modId to the identity of that volume internally to the layer.
260 // NO check for validity of given voluid for speed's sake.
261 //
262 modId = voluid & 0x7ff;
263
264 return VolUIDToLayer(voluid);
265}
266
267//_____________________________________________________________________________
268AliGeomManager::ELayerID AliGeomManager::VolUIDToLayer(UShort_t voluid)
269{
270 // From voluid, unique numerical identity of that volume inside ALICE,
271 // (voluid is 16 bits, first 5 reserved for layerID (32 possible values),
272 // remaining 11 for module ID inside det (2048 possible values)), return
273 // the identity of the layer to which that volume belongs
274 // NO check for validity of given voluid for speed's sake.
275 //
276 return ELayerID(voluid >> 11);
277}
278
279//_____________________________________________________________________________
280AliGeomManager::ELayerID AliGeomManager::VolUIDToLayerSafe(UShort_t voluid, Int_t &modId)
281{
282 // From voluid, unique numerical identity of that volume inside ALICE,
283 // (voluid is 16 bits, first 5 reserved for layerID (32 possible values),
284 // remaining 11 for module ID inside det (2048 possible values)), returns
285 // the identity of the layer to which that volume belongs and sets the
286 // argument modId to the identity of that volume internally to the layer.
287 // Checks the validity of the given voluid
288 //
289 ELayerID layId = VolUIDToLayerSafe(voluid);
290 if(layId){
291 Int_t mId = Int_t(voluid & 0x7ff);
292 if( mId>=0 && mId<LayerSize(layId)){
293 modId = mId;
294 return layId;
295 }
296 }
297
298 AliErrorClass(Form("Invalid unique volume id: %d !",voluid));
299 modId = -1;
300 return kInvalidLayer;
301
302}
303
304//_____________________________________________________________________________
305AliGeomManager::ELayerID AliGeomManager::VolUIDToLayerSafe(UShort_t voluid)
306{
307 // From voluid, unique numerical identity of that volume inside ALICE,
308 // (voluid is 16 bits, first 5 reserved for layerID (32 possible values),
309 // remaining 11 for module ID inside det (2048 possible values)), returns
310 // the identity of the layer to which that volume belongs
311 // Checks the validity of the given voluid
312 //
313 if( (voluid >> 11) < kLastLayer) return ELayerID(voluid >> 11);
314
315 AliErrorClass(Form("Invalid layer id: %d !",(voluid >> 11)));
316 return kInvalidLayer;
317
318}
319
320//_____________________________________________________________________________
321Bool_t AliGeomManager::GetFromGeometry(const char *symname, AliAlignObj &alobj)
322{
323 // Get the alignment object which corresponds to the symbolic volume name
324 // symname (in case equal to the TGeo volume path)
325 // The method is extremely slow due to the searching by string,
326 // therefore it should be used with great care!!
327 // This method returns FALSE if the symname of the object was not
328 // valid neither to get a TGeoPEntry nor as a volume path, or if the path
329 // associated to the TGeoPNEntry was not valid.
330 //
331
332 // Reset the alignment object
333 alobj.SetPars(0,0,0,0,0,0);
334 alobj.SetSymName(symname);
335
36b010bf 336 if (!fgGeometry || !fgGeometry->IsClosed()) {
67dd5535 337 AliErrorClass("Can't get the alignment object! gGeoManager doesn't exist or it is still opened!");
338 return kFALSE;
339 }
340
36b010bf 341 if (!fgGeometry->GetListOfPhysicalNodes()) {
67dd5535 342 AliErrorClass("Can't get the alignment object! gGeoManager doesn't contain any aligned nodes!");
343 return kFALSE;
344 }
345
67dd5535 346 const char *path;
36b010bf 347 TGeoPNEntry* pne = fgGeometry->GetAlignableEntry(symname);
67dd5535 348 if(pne){
349 path = pne->GetTitle();
350 }else{
351 AliWarningClass(Form("The symbolic volume name %s does not correspond to a physical entry. Using it as a volume path!",symname));
352 path = symname;
353 }
36b010bf 354 TObjArray* nodesArr = fgGeometry->GetListOfPhysicalNodes();
67dd5535 355 TGeoPhysicalNode* node = NULL;
356 for (Int_t iNode = 0; iNode < nodesArr->GetEntriesFast(); iNode++) {
357 TGeoPhysicalNode* tempNode = (TGeoPhysicalNode*) nodesArr->UncheckedAt(iNode);
358 const char *nodePath = tempNode->GetName();
359 if (strcmp(path,nodePath) == 0) {
360 node = tempNode;
361 break;
362 }
363 }
364
365 if (!node) {
36b010bf 366 if (!fgGeometry->cd(path)) {
67dd5535 367 AliErrorClass(Form("%s not valid neither as symbolic volume name nor as volume path!",path));
368 return kFALSE;
369 }
370 else {
371 AliWarningClass(Form("Volume (%s) has not been misaligned!",path));
372 return kTRUE;
373 }
374 }
375
376 TGeoHMatrix align,gprime,g,ginv,l;
377 gprime = *node->GetMatrix();
378 l = *node->GetOriginalMatrix();
379 g = *node->GetMatrix(node->GetLevel()-1);
380 g *= l;
381 ginv = g.Inverse();
382 align = gprime * ginv;
383
384 return alobj.SetMatrix(align);
385}
386
387
388//_____________________________________________________________________________
389void AliGeomManager::InitAlignObjFromGeometry()
390{
5aedd709 391 // Loop over all alignable volumes and extract
392 // the corresponding alignment objects from
393 // the TGeo geometry
3564f2da 394 //
67dd5535 395 for (Int_t iLayer = kFirstLayer; iLayer < AliGeomManager::kLastLayer; iLayer++) {
3564f2da 396 if (!fgAlignObjs[iLayer-kFirstLayer]) {
397 fgAlignObjs[iLayer-kFirstLayer] = new AliAlignObj*[LayerSize(iLayer)];
398 memset(fgAlignObjs[iLayer-kFirstLayer],0,LayerSize(iLayer)*sizeof(AliAlignObj*));
399 }
67dd5535 400 for (Int_t iModule = 0; iModule < LayerSize(iLayer); iModule++) {
401 UShort_t volid = LayerToVolUID(iLayer,iModule);
3564f2da 402 if (!fgAlignObjs[iLayer-kFirstLayer][iModule]) fgAlignObjs[iLayer-kFirstLayer][iModule] =
403 new AliAlignObjParams("",volid,0,0,0,0,0,0,kTRUE);
67dd5535 404 const char *symname = SymName(volid);
405 if (!GetFromGeometry(symname, *fgAlignObjs[iLayer-kFirstLayer][iModule]))
406 AliErrorClass(Form("Failed to extract the alignment object for the volume (ID=%d and path=%s) !",volid,symname));
407 }
408 }
5aedd709 409
67dd5535 410}
411
412//_____________________________________________________________________________
5aedd709 413AliAlignObj* AliGeomManager::GetAlignObj(UShort_t voluid)
414{
67dd5535 415 // Returns the alignment object for given volume ID
416 //
417 Int_t modId;
418 ELayerID layerId = VolUIDToLayer(voluid,modId);
419 return GetAlignObj(layerId,modId);
420}
421
422//_____________________________________________________________________________
423AliAlignObj* AliGeomManager::GetAlignObj(ELayerID layerId, Int_t modId)
424{
425 // Returns pointer to alignment object given its layer and module ID
426 //
427 if(modId<0 || modId>=fgLayerSize[layerId-kFirstLayer]){
428 AliWarningClass(Form("Module number %d not in the valid range (0->%d) !",modId,fgLayerSize[layerId-kFirstLayer]-1));
429 return NULL;
430 }
431 InitAlignObjFromGeometry();
432
433 return fgAlignObjs[layerId-kFirstLayer][modId];
434}
435
436//_____________________________________________________________________________
5aedd709 437const char* AliGeomManager::SymName(UShort_t voluid)
438{
67dd5535 439 // Returns the symbolic volume name for given volume ID
440 //
441 Int_t modId;
442 ELayerID layerId = VolUIDToLayer(voluid,modId);
443 return SymName(layerId,modId);
444}
445
446//_____________________________________________________________________________
447const char* AliGeomManager::SymName(ELayerID layerId, Int_t modId)
448{
449 // Returns the symbolic volume name given for a given layer
450 // and module ID
451 //
ff5970a3 452 if(!fgGeometry){
453 AliErrorClass("No geometry instance loaded yet!");
454 return NULL;
455 }
67dd5535 456 if(modId<0 || modId>=fgLayerSize[layerId-kFirstLayer]){
457 AliWarningClass(Form("Module number %d not in the valid range (0->%d) !",modId,fgLayerSize[layerId-kFirstLayer]-1));
458 return NULL;
459 }
67dd5535 460
a8629c62 461 TGeoPNEntry* pne = fgPNEntry[layerId-kFirstLayer][modId];
462 if(!pne)
463 {
464 AliWarningClass(Form("Module %d of layer %s is not activated!",modId,LayerName(layerId)));
465 return NULL;
466 }
467 return pne->GetName();
468
67dd5535 469}
470
471//_____________________________________________________________________________
9257a1bd 472Bool_t AliGeomManager::CheckSymNamesLUT(const char* /*detsToBeChecked*/)
67dd5535 473{
0bf7aade 474 // Check the look-up table which associates the unique numerical identity of
475 // each alignable volume to the corresponding symbolic volume name.
476 // The LUT is now hold inside the geometry and handled by TGeo.
477 // The method is meant to be launched when loading a geometry to verify that
478 // no changes in the symbolic names have been introduced, which would prevent
479 // backward compatibility with alignment objects.
480 // To accept both complete and partial geometry, this method skips the check
481 // for TRD and TOF volumes which are missing in the partial geometry.
482 //
67dd5535 483
ff5970a3 484// TString detsString(detsToBeChecked);
485// if(detsString.Contains("ALL")) detsString="ITS TPC TOF TRD HMPID PHOS EMCAL";
486
487 // Temporary measure to face the case of reconstruction over detectors not present in the geometry
488 TString detsString = "";
489 if(fgGeometry->CheckPath("ALIC_1/ITSV_1")) detsString+="ITS ";
490 if(fgGeometry->CheckPath("ALIC_1/TPC_M_1")) detsString+="TPC ";
83364444 491
492 TString tofsm;
493 TString baseTof("ALIC_1/B077_1/BSEGMO");
494 TString middleTof("_1/BTOF");
495 TString trailTof("_1/FTOA_0");
496 Bool_t tofActive=kFALSE;
497 Bool_t tofSMs[18];
498 for(Int_t sm=0; sm<18; sm++)
499 {
500 tofSMs[sm]=kFALSE;
501 tofsm=baseTof;
502 tofsm += sm;
503 tofsm += middleTof;
504 tofsm += sm;
505 tofsm += trailTof;
506 if(fgGeometry->CheckPath(tofsm.Data()))
507 {
508 tofActive=kTRUE;
509 tofSMs[sm]=kTRUE;
510 }
511 }
512 if(tofActive) detsString+="TOF ";
513
514 TString trdsm;
515 TString baseTrd("ALIC_1/B077_1/BSEGMO");
516 TString middleTrd("_1/BTRD");
517 TString trailTrd("_1/UTR1_1");
518 Bool_t trdActive=kFALSE;
519 Bool_t trdSMs[18];
520 for(Int_t sm=0; sm<18; sm++)
521 {
522 trdSMs[sm]=kFALSE;
523 trdsm=baseTrd;
524 trdsm += sm;
525 trdsm += middleTrd;
526 trdsm += sm;
527 trdsm += trailTrd;
528 if(fgGeometry->CheckPath(trdsm.Data()))
529 {
530 trdActive=kTRUE;
531 trdSMs[sm]=kTRUE;
532 }
533 }
534 if(trdActive) detsString+="TRD ";
535
ff5970a3 536 if(fgGeometry->CheckPath("ALIC_1/Hmp0_0")) detsString+="HMPID ";
6ead0654 537
538 TString phosMod, cpvMod;
539 TString basePhos("ALIC_1/PHOS_");
540 Bool_t phosActive=kFALSE;
541 Bool_t cpvActive=kFALSE;
542 Bool_t phosMods[5];
543 for(Int_t pmod=0; pmod<5; pmod++)
544 {
545 phosMods[pmod]=kFALSE;
546 phosMod = basePhos;
547 phosMod += (pmod+1);
548 cpvMod = phosMod;
549 cpvMod += "/PCPV_1";
550 if(fgGeometry->CheckPath(phosMod.Data()))
551 {
552 phosActive=kTRUE;
553 phosMods[pmod]=kTRUE;
554 if(fgGeometry->CheckPath(cpvMod.Data())) cpvActive=kTRUE;
555 }
556 }
557 if(phosActive) detsString+="PHOS ";
558
ff5970a3 559 if(fgGeometry->CheckPath("ALIC_1/XEN1_1")) detsString+="EMCAL";
560
67dd5535 561 TString symname;
0bf7aade 562 const char* sname;
563 TGeoPNEntry* pne = 0x0;
564 Int_t uid; // global unique identity
565 Int_t modnum; // unique id inside layer; in the following, set it to 0 at the start of each layer
67dd5535 566
ff5970a3 567 if(detsString.Contains("ITS")){
67dd5535 568 /********************* ITS layers ***********************/
ff5970a3 569 AliDebugClass(2,"Checking consistency of symbolic names for ITS layers");
570 TString strSPD = "ITS/SPD";
571 TString strSDD = "ITS/SDD";
572 TString strSSD = "ITS/SSD";
573 TString strStave = "/Stave";
574 TString strHalfStave = "/HalfStave";
575 TString strLadder = "/Ladder";
576 TString strSector = "/Sector";
577 TString strSensor = "/Sensor";
578 TString strEntryName1;
579 TString strEntryName2;
580 TString strEntryName3;
581
582 /********************* SPD layer1 ***********************/
583 {
584 modnum = 0;
585
586 for(Int_t cSect = 0; cSect<10; cSect++){
587 strEntryName1 = strSPD;
588 strEntryName1 += 0;
589 strEntryName1 += strSector;
590 strEntryName1 += cSect;
591
592 for(Int_t cStave =0; cStave<2; cStave++){
593 strEntryName2 = strEntryName1;
594 strEntryName2 += strStave;
595 strEntryName2 += cStave;
596
597 for (Int_t cHS=0; cHS<2; cHS++) {
598 strEntryName3 = strEntryName2;
599 strEntryName3 += strHalfStave;
600 strEntryName3 += cHS;
601
602 for(Int_t cLad =0; cLad<2; cLad++){
603 symname = strEntryName3;
604 symname += strLadder;
605 symname += cLad+cHS*2;
606 uid = LayerToVolUID(kSPD1,modnum++);
607 pne = fgGeometry->GetAlignableEntryByUID(uid);
608 if(!pne)
609 {
610 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
611 return kFALSE;
612 }
613 sname = pne->GetName();
614 if(symname.CompareTo(sname))
615 {
616 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d."
617 "Expected was %s, found was %s!", uid, symname.Data(), sname));
618 return kFALSE;
619 }
0bf7aade 620 }
8f8273a4 621 }
67dd5535 622 }
623 }
624 }
ff5970a3 625
626 /********************* SPD layer2 ***********************/
627 {
628 modnum = 0;
629
630 for(Int_t cSect = 0; cSect<10; cSect++){
631 strEntryName1 = strSPD;
632 strEntryName1 += 1;
633 strEntryName1 += strSector;
634 strEntryName1 += cSect;
635
636 for(Int_t cStave =0; cStave<4; cStave++){
637 strEntryName2 = strEntryName1;
638 strEntryName2 += strStave;
639 strEntryName2 += cStave;
640
641 for (Int_t cHS=0; cHS<2; cHS++) {
642 strEntryName3 = strEntryName2;
643 strEntryName3 += strHalfStave;
644 strEntryName3 += cHS;
645
646 for(Int_t cLad =0; cLad<2; cLad++){
647 symname = strEntryName3;
648 symname += strLadder;
649 symname += cLad+cHS*2;
650 uid = LayerToVolUID(kSPD2,modnum++);
651 pne = fgGeometry->GetAlignableEntryByUID(uid);
652 if(!pne)
653 {
654 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
655 return kFALSE;
656 }
657 sname = pne->GetName();
658 if(symname.CompareTo(sname))
659 {
660 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d."
661 "Expected was %s, found was %s!", uid, symname.Data(), sname));
662 return kFALSE;
663 }
0bf7aade 664 }
8f8273a4 665 }
67dd5535 666 }
667 }
668 }
ff5970a3 669
670 /********************* SDD layer1 ***********************/
671 {
672 modnum=0;
673
674 for(Int_t c1 = 1; c1<=14; c1++){
675 strEntryName1 = strSDD;
676 strEntryName1 += 2;
677 strEntryName1 +=strLadder;
678 strEntryName1 += (c1-1);
679 for(Int_t c2 =1; c2<=6; c2++){
680 symname = strEntryName1;
681 symname += strSensor;
682 symname += (c2-1);
683 uid = LayerToVolUID(kSDD1,modnum++);
684 pne = fgGeometry->GetAlignableEntryByUID(uid);
685 if(!pne)
686 {
687 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
688 return kFALSE;
689 }
690 sname = pne->GetName();
691 if(symname.CompareTo(sname))
692 {
693 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
694 "Expected was %s, found was %s!", uid, symname.Data(), sname));
695 return kFALSE;
696 }
697 }
698 }
699 }
700
701 /********************* SDD layer2 ***********************/
702 {
703 modnum=0;
704
705 for(Int_t c1 = 1; c1<=22; c1++){
706 strEntryName1 = strSDD;
707 strEntryName1 += 3;
708 strEntryName1 +=strLadder;
709 strEntryName1 += (c1-1);
710 for(Int_t c2 = 1; c2<=8; c2++){
711 symname = strEntryName1;
712 symname += strSensor;
713 symname += (c2-1);
714 uid = LayerToVolUID(kSDD2,modnum++);
715 pne = fgGeometry->GetAlignableEntryByUID(uid);
716 if(!pne)
717 {
718 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
719 return kFALSE;
720 }
721 sname = pne->GetName();
722 if(symname.CompareTo(sname))
723 {
724 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
725 "Expected was %s, found was %s!", uid, symname.Data(), sname));
726 return kFALSE;
727 }
728 }
729 }
730 }
731
732 /********************* SSD layer1 ***********************/
733 {
734 modnum=0;
735
736 for(Int_t c1 = 1; c1<=34; c1++){
737 strEntryName1 = strSSD;
738 strEntryName1 += 4;
739 strEntryName1 +=strLadder;
740 strEntryName1 += (c1-1);
741 for(Int_t c2 = 1; c2<=22; c2++){
742 symname = strEntryName1;
743 symname += strSensor;
744 symname += (c2-1);
745 uid = LayerToVolUID(kSSD1,modnum++);
746 pne = fgGeometry->GetAlignableEntryByUID(uid);
747 if(!pne)
748 {
749 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
750 return kFALSE;
751 }
752 sname = pne->GetName();
753 if(symname.CompareTo(sname))
754 {
755 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
756 "Expected was %s, found was %s!", uid, symname.Data(), sname));
757 return kFALSE;
758 }
759 }
760 }
761 }
762
763 /********************* SSD layer2 ***********************/
764 {
765 modnum=0;
766
767 for(Int_t c1 = 1; c1<=38; c1++){
768 strEntryName1 = strSSD;
769 strEntryName1 += 5;
770 strEntryName1 +=strLadder;
771 strEntryName1 += (c1-1);
772 for(Int_t c2 = 1; c2<=25; c2++){
773 symname = strEntryName1;
774 symname += strSensor;
775 symname += (c2-1);
776 uid = LayerToVolUID(kSSD2,modnum++);
777 pne = fgGeometry->GetAlignableEntryByUID(uid);
778 if(!pne)
779 {
780 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
781 return kFALSE;
782 }
783 sname = pne->GetName();
784 if(symname.CompareTo(sname))
785 {
786 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
787 "Expected was %s, found was %s!", uid, symname.Data(), sname));
788 return kFALSE;
789 }
790 }
791 }
792 }
793
794 AliDebugClass(2,"Consistency check for ITS symbolic names finished successfully.");
67dd5535 795 }
796
ff5970a3 797 if(detsString.Contains("TPC"))
67dd5535 798 {
ff5970a3 799 /*************** TPC inner and outer layers ****************/
800
801 AliDebugClass(2,"Checking consistency of symbolic names for TPC layers");
802 TString sAsector="TPC/EndcapA/Sector";
803 TString sCsector="TPC/EndcapC/Sector";
804 TString sInner="/InnerChamber";
805 TString sOuter="/OuterChamber";
806
807 /*************** TPC inner chambers' layer ****************/
808 {
809 modnum = 0;
67dd5535 810
ff5970a3 811 for(Int_t cnt=1; cnt<=18; cnt++)
812 {
813 symname = sAsector;
814 symname += cnt;
815 symname += sInner;
816 uid = LayerToVolUID(kTPC1,modnum++);
0bf7aade 817 pne = fgGeometry->GetAlignableEntryByUID(uid);
818 if(!pne)
819 {
820 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
821 return kFALSE;
822 }
823 sname = pne->GetName();
824 if(symname.CompareTo(sname))
825 {
826 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
827 "Expected was %s, found was %s!", uid, symname.Data(), sname));
828 return kFALSE;
829 }
67dd5535 830 }
67dd5535 831
ff5970a3 832 for(Int_t cnt=1; cnt<=18; cnt++)
833 {
834 symname = sCsector;
835 symname += cnt;
836 symname += sInner;
837 uid = LayerToVolUID(kTPC1,modnum++);
0bf7aade 838 pne = fgGeometry->GetAlignableEntryByUID(uid);
839 if(!pne)
840 {
841 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
842 return kFALSE;
843 }
844 sname = pne->GetName();
845 if(symname.CompareTo(sname))
846 {
847 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
848 "Expected was %s, found was %s!", uid, symname.Data(), sname));
849 return kFALSE;
850 }
67dd5535 851 }
852 }
67dd5535 853
ff5970a3 854 /*************** TPC outer chambers' layer ****************/
855 {
856 modnum = 0;
67dd5535 857
ff5970a3 858 for(Int_t cnt=1; cnt<=18; cnt++)
859 {
860 symname = sAsector;
861 symname += cnt;
862 symname += sOuter;
863 uid = LayerToVolUID(kTPC2,modnum++);
0bf7aade 864 pne = fgGeometry->GetAlignableEntryByUID(uid);
865 if(!pne)
866 {
867 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
868 return kFALSE;
869 }
870 sname = pne->GetName();
871 if(symname.CompareTo(sname))
872 {
873 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
874 "Expected was %s, found was %s!", uid, symname.Data(), sname));
875 return kFALSE;
876 }
67dd5535 877 }
67dd5535 878
ff5970a3 879 for(Int_t cnt=1; cnt<=18; cnt++)
880 {
881 symname = sCsector;
882 symname += cnt;
883 symname += sOuter;
884 uid = LayerToVolUID(kTPC2,modnum++);
0bf7aade 885 pne = fgGeometry->GetAlignableEntryByUID(uid);
886 if(!pne)
887 {
888 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
889 return kFALSE;
890 }
891 sname = pne->GetName();
892 if(symname.CompareTo(sname))
893 {
894 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
895 "Expected was %s, found was %s!", uid, symname.Data(), sname));
896 return kFALSE;
897 }
67dd5535 898 }
899 }
67dd5535 900
ff5970a3 901 AliDebugClass(2,"Consistency check for TPC symbolic names finished successfully.");
67dd5535 902 }
903
ff5970a3 904 if(detsString.Contains("TOF"))
67dd5535 905 {
ff5970a3 906 /********************* TOF layer ***********************/
67dd5535 907
ff5970a3 908 AliDebugClass(2,"Checking consistency of symbolic names for TOF layers");
67dd5535 909 modnum=0;
ff5970a3 910
67dd5535 911 Int_t nstrA=15;
912 Int_t nstrB=19;
913 Int_t nstrC=19;
914 Int_t nSectors=18;
915 Int_t nStrips=nstrA+2*nstrB+2*nstrC;
0bf7aade 916
67dd5535 917 TString snSM = "TOF/sm";
918 TString snSTRIP = "/strip";
919
920 for (Int_t isect = 0; isect < nSectors; isect++) {
921 for (Int_t istr = 1; istr <= nStrips; istr++) {
922 symname = snSM;
923 symname += Form("%02d",isect);
924 symname += snSTRIP;
925 symname += Form("%02d",istr);
0bf7aade 926 uid = LayerToVolUID(kTOF,modnum++);
83364444 927 if(!tofSMs[isect]) continue; // taking possible missing TOF sectors (partial geometry) into account
928 AliDebugClass(2,Form("Consistency check for symnames of TOF supermodule %d.",isect));
0bf7aade 929 if ((isect==13 || isect==14 || isect==15) && (istr >= 39 && istr <= 53)) continue; //taking holes into account
930 pne = fgGeometry->GetAlignableEntryByUID(uid);
931 if(!pne)
932 {
933 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
934 return kFALSE;
935 }
936 sname = pne->GetName();
937 if(symname.CompareTo(sname))
938 {
939 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
940 "Expected was %s, found was %s!", uid, symname.Data(), sname));
941 return kFALSE;
942 }
67dd5535 943 }
944 }
ff5970a3 945
946 AliDebugClass(2,"Consistency check for TOF symbolic names finished successfully.");
67dd5535 947 }
948
ff5970a3 949 if(detsString.Contains("HMPID"))
67dd5535 950 {
ff5970a3 951 /********************* HMPID layer ***********************/
952
953 AliDebugClass(2,"Checking consistency of symbolic names for HMPID layers");
67dd5535 954 TString str = "/HMPID/Chamber";
955
956 for (modnum=0; modnum < 7; modnum++) {
957 symname = str;
958 symname += modnum;
0bf7aade 959 uid = LayerToVolUID(kHMPID,modnum);
960 pne = fgGeometry->GetAlignableEntryByUID(uid);
961 if(!pne)
962 {
963 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
964 return kFALSE;
965 }
966 sname = pne->GetName();
967 if(symname.CompareTo(sname))
968 {
969 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
970 "Expected was %s, found was %s!", uid, symname.Data(), sname));
971 return kFALSE;
972 }
67dd5535 973 }
ff5970a3 974
975 AliDebugClass(2,"Consistency check for HMPID symbolic names finished successfully.");
67dd5535 976 }
977
ff5970a3 978 if(detsString.Contains("TRD"))
67dd5535 979 {
ff5970a3 980 /********************* TRD layers 1-6 *******************/
981 //!! 6 layers with index increasing in outwards direction
982
983 AliDebugClass(2,"Checking consistency of symbolic names for TRD layers");
67dd5535 984 Int_t arTRDlayId[6] = {kTRD1, kTRD2, kTRD3, kTRD4, kTRD5, kTRD6};
985
986 TString snStr = "TRD/sm";
987 TString snApp1 = "/st";
988 TString snApp2 = "/pl";
989
990 for(Int_t layer=0; layer<6; layer++){
991 modnum=0;
992 for (Int_t isect = 0; isect < 18; isect++) {
993 for (Int_t icham = 0; icham < 5; icham++) {
994 symname = snStr;
995 symname += Form("%02d",isect);
996 symname += snApp1;
997 symname += icham;
998 symname += snApp2;
999 symname += layer;
0bf7aade 1000 uid = LayerToVolUID(arTRDlayId[layer],modnum++);
83364444 1001 if(!trdSMs[isect]) continue;
1002 AliDebugClass(2,Form("Consistency check for symnames of TRD supermodule %d.",isect));
0bf7aade 1003 if ((isect==13 || isect==14 || isect==15) && icham==2) continue; //keeping holes into account
1004 pne = fgGeometry->GetAlignableEntryByUID(uid);
1005 if(!pne)
1006 {
1007 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
1008 return kFALSE;
1009 }
1010 sname = pne->GetName();
1011 if(symname.CompareTo(sname))
1012 {
1013 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
1014 "Expected was %s, found was %s!", uid, symname.Data(), sname));
1015 return kFALSE;
1016 }
67dd5535 1017 }
1018 }
1019 }
ff5970a3 1020
1021 AliDebugClass(2,"Consistency check for TRD symbolic names finished successfully.");
67dd5535 1022 }
df117114 1023
ff5970a3 1024 if(detsString.Contains("PHOS"))
df117114 1025 {
ff5970a3 1026 /********************* PHOS EMC layer ***********************/
df117114 1027
ff5970a3 1028 AliDebugClass(2,"Checking consistency of symbolic names for PHOS layers");
1029
ff5970a3 1030 TString str = "PHOS/Module";
1031 modnum=0;
1032
6ead0654 1033 for (Int_t iModule=0; iModule < 5; iModule++) {
1034 if(!phosMods[iModule]) continue;
ff5970a3 1035 symname = str;
6ead0654 1036 symname += (iModule+1);
1037 uid = LayerToVolUID(kPHOS1,iModule);
ff5970a3 1038 pne = fgGeometry->GetAlignableEntryByUID(uid);
1039 if(!pne)
1040 {
1041 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
1042 return kFALSE;
1043 }
1044 sname = pne->GetName();
1045 if(symname.CompareTo(sname))
1046 {
1047 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
1048 "Expected was %s, found was %s!", uid, symname.Data(), sname));
1049 return kFALSE;
1050 }
6ead0654 1051 /********************* PHOS CPV layer ***********************/
1052 if(!cpvActive) continue;
ff5970a3 1053 symname += "/CPV";
6ead0654 1054 uid = LayerToVolUID(kPHOS2,iModule);
ff5970a3 1055 pne = fgGeometry->GetAlignableEntryByUID(uid);
1056 if(!pne)
1057 {
1058 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
1059 return kFALSE;
1060 }
1061 sname = pne->GetName();
1062 if(symname.CompareTo(sname))
1063 {
1064 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
1065 "Expected was %s, found was %s!", uid, symname.Data(), sname));
1066 return kFALSE;
1067 }
0bf7aade 1068 }
ff5970a3 1069 AliDebugClass(2,"Consistency check for PHOS symbolic names finished successfully.");
f47b9233 1070 }
1071
ff5970a3 1072 if(detsString.Contains("EMCAL"))
3dfc15c0 1073 {
ff5970a3 1074 /********************* EMCAL layer ***********************/
1075
1076 AliDebugClass(2,"Checking consistency of symbolic names for EMCAL layers");
3dfc15c0 1077 TString str = "EMCAL/FullSupermodule";
1078 modnum=0;
1079
1080 for (Int_t iModule=1; iModule <= 12; iModule++) {
1081 symname = str;
1082 symname += iModule;
1083 if(iModule >10) {
1084 symname = "EMCAL/HalfSupermodule";
1085 symname += iModule-10;
1086 }
1087 modnum = iModule-1;
0bf7aade 1088 uid = LayerToVolUID(kEMCAL,modnum);
1089 pne = fgGeometry->GetAlignableEntryByUID(uid);
1090 if(!pne)
1091 {
1092 AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
1093 return kFALSE;
1094 }
1095 sname = pne->GetName();
1096 if(symname.CompareTo(sname))
1097 {
1098 AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
1099 "Expected was %s, found was %s!", uid, symname.Data(), sname));
1100 return kFALSE;
1101 }
3dfc15c0 1102 }
ff5970a3 1103
1104 AliDebugClass(2,"Consistency check for EMCAL symbolic names finished successfully.");
3dfc15c0 1105 }
0bf7aade 1106
1107 return kTRUE;
f47b9233 1108
67dd5535 1109}
1110
1111//_____________________________________________________________________________
1112void AliGeomManager::InitPNEntriesLUT()
1113{
1114 // Initialize the look-up table which associates the unique
1115 // numerical identity of each alignable volume to the
1116 // corresponding TGeoPNEntry.
1117 // The LUTs are static; they are created at the creation of the
1118 // AliGeomManager instance and recreated if the geometry has changed
1119 //
36b010bf 1120 if(!fgGeometry) {
1121 AliErrorClass("Impossible to initialize PNEntries LUT without an active geometry");
1122 return;
1123 }
25fad4e5 1124
67dd5535 1125 for (Int_t iLayer = 0; iLayer < (kLastLayer - kFirstLayer); iLayer++){
3564f2da 1126 if (!fgPNEntry[iLayer]) fgPNEntry[iLayer] = new TGeoPNEntry*[fgLayerSize[iLayer]];
36b010bf 1127 for(Int_t modnum=0; modnum<fgLayerSize[iLayer]; modnum++){
0bf7aade 1128 fgPNEntry[iLayer][modnum] = fgGeometry->GetAlignableEntryByUID(LayerToVolUID(iLayer+1,modnum));
36b010bf 1129 }
1130 }
1131}
1132
67dd5535 1133//______________________________________________________________________
53dd673d 1134TGeoHMatrix* AliGeomManager::GetMatrix(TGeoPNEntry * const pne)
67dd5535 1135{
5aedd709 1136 // Get the global transformation matrix for a given PNEntry
67dd5535 1137 // by quering the TGeoManager
1138
36b010bf 1139 if (!fgGeometry || !fgGeometry->IsClosed()) {
25fad4e5 1140 AliErrorClass("Can't get the global matrix! gGeoManager doesn't exist or it is still opened!");
1141 return NULL;
1142 }
5aedd709 1143
67dd5535 1144 TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
1145 if (pnode) return pnode->GetMatrix();
1146
1147 const char* path = pne->GetTitle();
36b010bf 1148 if (!fgGeometry->cd(path)) {
67dd5535 1149 AliErrorClass(Form("Volume path %s not valid!",path));
1150 return NULL;
1151 }
36b010bf 1152 return fgGeometry->GetCurrentMatrix();
67dd5535 1153}
1154
1155//______________________________________________________________________
1156TGeoHMatrix* AliGeomManager::GetMatrix(Int_t index)
1157{
1158 // Get the global transformation matrix for a given alignable volume
1159 // identified by its unique ID 'index' by quering the TGeoManager
1160
67dd5535 1161 TGeoPNEntry *pne = GetPNEntry(index);
1162 if (!pne) return NULL;
1163
1164 return GetMatrix(pne);
1165}
1166
1167//______________________________________________________________________
1168TGeoHMatrix* AliGeomManager::GetMatrix(const char* symname)
1169{
1170 // Get the global transformation matrix for a given alignable volume
1171 // identified by its symbolic name 'symname' by quering the TGeoManager
1172
36b010bf 1173 if (!fgGeometry || !fgGeometry->IsClosed()) {
1174 AliErrorClass("No active geometry or geometry not yet closed!");
1175 return NULL;
1176 }
1177
1178 TGeoPNEntry* pne = fgGeometry->GetAlignableEntry(symname);
67dd5535 1179 if (!pne) return NULL;
1180
1181 return GetMatrix(pne);
1182}
1183
1184//______________________________________________________________________
1185Bool_t AliGeomManager::GetTranslation(Int_t index, Double_t t[3])
1186{
1187 // Get the translation vector for a given module 'index'
1188 // by quering the TGeoManager
1189
1190 TGeoHMatrix *m = GetMatrix(index);
1191 if (!m) return kFALSE;
1192
1193 Double_t *trans = m->GetTranslation();
1194 for (Int_t i = 0; i < 3; i++) t[i] = trans[i];
1195
1196 return kTRUE;
1197}
1198
1199//______________________________________________________________________
1200Bool_t AliGeomManager::GetRotation(Int_t index, Double_t r[9])
1201{
1202 // Get the rotation matrix for a given module 'index'
1203 // by quering the TGeoManager
1204
1205 TGeoHMatrix *m = GetMatrix(index);
1206 if (!m) return kFALSE;
1207
1208 Double_t *rot = m->GetRotationMatrix();
1209 for (Int_t i = 0; i < 9; i++) r[i] = rot[i];
1210
1211 return kTRUE;
1212}
1213
5d534fe3 1214//_____________________________________________________________________________
1215Bool_t AliGeomManager::GetDeltaForBranch(Int_t index, TGeoHMatrix &inclusiveD)
1216{
1217 // The method sets the matrix passed as argument as the global delta
1218 // (for the volume referred by the unique index) including the displacements
1219 // of all parent volumes in the branch.
1220 //
5d534fe3 1221
1222 TGeoHMatrix go,invgo;
1223 go = *GetOrigGlobalMatrix(index);
1224 invgo = go.Inverse();
5aedd709 1225 inclusiveD = *GetMatrix(index);
5d534fe3 1226 inclusiveD.Multiply(&invgo);
1227
1228 return kTRUE;
1229}
1230
1231//_____________________________________________________________________________
1232Bool_t AliGeomManager::GetDeltaForBranch(AliAlignObj& aao, TGeoHMatrix &inclusiveD)
1233{
1234 // The method sets the matrix passed as argument as the global delta
1235 // (for the volume referred by the alignment object) including the displacements
1236 // of all parent volumes in the brach.
1237 //
1238 Int_t index = aao.GetVolUID();
1239 if(!index){
1240 AliErrorClass("Either the alignment object or its index are not valid");
1241 return kFALSE;
1242 }
1243 return GetDeltaForBranch(index, inclusiveD);
1244}
1245
36b010bf 1246//______________________________________________________________________
1247Bool_t AliGeomManager::GetOrigGlobalMatrix(const char* symname, TGeoHMatrix &m)
67dd5535 1248{
36b010bf 1249 // Get the global transformation matrix (ideal geometry) for a given alignable volume
0bf7aade 1250 // The alignable volume is identified by 'symname' which has to be either a valid symbolic
1251 // name, the query being performed after alignment, or a valid volume path if the query is
1252 // performed before alignment.
1253 //
36b010bf 1254 m.Clear();
67dd5535 1255
36b010bf 1256 if (!fgGeometry || !fgGeometry->IsClosed()) {
1257 AliErrorClass("No active geometry or geometry not yet closed!");
67dd5535 1258 return kFALSE;
1259 }
36b010bf 1260 if (!fgGeometry->GetListOfPhysicalNodes()) {
67dd5535 1261 AliWarningClass("gGeoManager doesn't contain any aligned nodes!");
36b010bf 1262 if (!fgGeometry->cd(symname)) {
67dd5535 1263 AliErrorClass(Form("Volume path %s not valid!",symname));
1264 return kFALSE;
1265 }
1266 else {
36b010bf 1267 m = *fgGeometry->GetCurrentMatrix();
67dd5535 1268 return kTRUE;
1269 }
1270 }
1271
36b010bf 1272 TGeoPNEntry* pne = fgGeometry->GetAlignableEntry(symname);
67dd5535 1273 const char* path = NULL;
67dd5535 1274 if(pne){
0bf7aade 1275 m = *pne->GetGlobalOrig();
1276 return kTRUE;
67dd5535 1277 }else{
1278 AliWarningClass(Form("The symbolic volume name %s does not correspond to a physical entry. Using it as a volume path!",symname));
1279 path=symname;
1280 }
1281
36b010bf 1282 return GetOrigGlobalMatrixFromPath(path,m);
1283}
1284
1285//_____________________________________________________________________________
1286Bool_t AliGeomManager::GetOrigGlobalMatrixFromPath(const char *path, TGeoHMatrix &m)
1287{
5aedd709 1288 // The method returns the global matrix for the volume identified by
1289 // 'path' in the ideal detector geometry.
1290 // The output global matrix is stored in 'm'.
1291 // Returns kFALSE in case TGeo has not been initialized or the volume
1292 // path is not valid.
36b010bf 1293 //
1294 m.Clear();
1295
1296 if (!fgGeometry || !fgGeometry->IsClosed()) {
1297 AliErrorClass("Can't get the original global matrix! gGeoManager doesn't exist or it is still opened!");
67dd5535 1298 return kFALSE;
1299 }
1300
36b010bf 1301 if (!fgGeometry->CheckPath(path)) {
1302 AliErrorClass(Form("Volume path %s not valid!",path));
1303 return kFALSE;
1304 }
67dd5535 1305
36b010bf 1306 TIter next(fgGeometry->GetListOfPhysicalNodes());
1307 fgGeometry->cd(path);
67dd5535 1308
36b010bf 1309 while(fgGeometry->GetLevel()){
67dd5535 1310
1311 TGeoPhysicalNode *physNode = NULL;
1312 next.Reset();
36b010bf 1313 TGeoNode *node = fgGeometry->GetCurrentNode();
67dd5535 1314 while ((physNode=(TGeoPhysicalNode*)next()))
1315 if (physNode->GetNode() == node) break;
1316
1317 TGeoMatrix *lm = NULL;
1318 if (physNode) {
5aedd709 1319 lm = physNode->GetOriginalMatrix();
1320 if (!lm) lm = node->GetMatrix();
67dd5535 1321 } else
1322 lm = node->GetMatrix();
1323
1324 m.MultiplyLeft(lm);
1325
36b010bf 1326 fgGeometry->CdUp();
67dd5535 1327 }
1328
1329 return kTRUE;
1330}
1331
36b010bf 1332//_____________________________________________________________________________
53dd673d 1333TGeoHMatrix* AliGeomManager::GetOrigGlobalMatrix(TGeoPNEntry * const pne)
36b010bf 1334{
1335 // The method returns global matrix for the ideal detector geometry
1336 // using the corresponding TGeoPNEntry as an input.
5aedd709 1337 // The returned pointer should be copied by the user, since its content could
1338 // be overwritten by a following call to the method.
1339 // In case of missing TGeoManager the method returns NULL.
1340 //
36b010bf 1341 if (!fgGeometry || !fgGeometry->IsClosed()) {
1342 AliErrorClass("Can't get the global matrix! gGeoManager doesn't exist or it is still opened!");
1343 return NULL;
1344 }
1345
0bf7aade 1346 return pne->GetGlobalOrig();
36b010bf 1347}
1348
67dd5535 1349//______________________________________________________________________
36b010bf 1350TGeoHMatrix* AliGeomManager::GetOrigGlobalMatrix(Int_t index)
67dd5535 1351{
5aedd709 1352 // The method returns global matrix from the ideal detector geometry
1353 // for the volume identified by its index.
1354 // The returned pointer should be copied by the user, since its content could
1355 // be overwritten by a following call to the method.
1356 // In case of missing TGeoManager the method returns NULL.
1357 // If possible, the method uses the LUT of original ideal matrices
1358 // for fast access. The LUT is reset in case a
36b010bf 1359 // new geometry is loaded.
5aedd709 1360 //
0bf7aade 1361 TGeoPNEntry* pne = GetPNEntry(index);
1362 return pne->GetGlobalOrig();
67dd5535 1363}
1364
1365//______________________________________________________________________
1366Bool_t AliGeomManager::GetOrigTranslation(Int_t index, Double_t t[3])
1367{
1368 // Get the original translation vector (ideal geometry)
1369 // for a given module 'index' by quering the TGeoManager
1370
36b010bf 1371 TGeoHMatrix *m = GetOrigGlobalMatrix(index);
1372 if (!m) return kFALSE;
67dd5535 1373
36b010bf 1374 Double_t *trans = m->GetTranslation();
67dd5535 1375 for (Int_t i = 0; i < 3; i++) t[i] = trans[i];
1376
1377 return kTRUE;
1378}
1379
1380//______________________________________________________________________
1381Bool_t AliGeomManager::GetOrigRotation(Int_t index, Double_t r[9])
1382{
1383 // Get the original rotation matrix (ideal geometry)
1384 // for a given module 'index' by quering the TGeoManager
1385
36b010bf 1386 TGeoHMatrix *m = GetOrigGlobalMatrix(index);
1387 if (!m) return kFALSE;
67dd5535 1388
36b010bf 1389 Double_t *rot = m->GetRotationMatrix();
67dd5535 1390 for (Int_t i = 0; i < 9; i++) r[i] = rot[i];
1391
1392 return kTRUE;
1393}
1394
1395//______________________________________________________________________
1396const TGeoHMatrix* AliGeomManager::GetTracking2LocalMatrix(Int_t index)
1397{
25fad4e5 1398 // Get the matrix which transforms from the tracking to the local RS
67dd5535 1399 // The method queries directly the TGeoPNEntry
1400
67dd5535 1401 TGeoPNEntry *pne = GetPNEntry(index);
1402 if (!pne) return NULL;
1403
1404 const TGeoHMatrix *m = pne->GetMatrix();
1405 if (!m)
5aedd709 1406 AliErrorClass(Form("TGeoPNEntry (%s) contains no tracking-to-local matrix !",pne->GetName()));
67dd5535 1407
1408 return m;
1409}
1410
1411//______________________________________________________________________
1412Bool_t AliGeomManager::GetTrackingMatrix(Int_t index, TGeoHMatrix &m)
1413{
1414 // Get the matrix which transforms from the tracking r.s. to
1415 // the global one.
1416 // Returns kFALSE in case of error.
1417
1418 m.Clear();
1419
1420 TGeoHMatrix *m1 = GetMatrix(index);
1421 if (!m1) return kFALSE;
1422
1423 const TGeoHMatrix *m2 = GetTracking2LocalMatrix(index);
1424 if (!m2) return kFALSE;
1425
1426 m = *m1;
1427 m.Multiply(m2);
1428
1429 return kTRUE;
1430}
1431
1432//_____________________________________________________________________________
1433TGeoPNEntry* AliGeomManager::GetPNEntry(Int_t voluid) {
1434 // Returns the TGeoPNEntry for the given global volume ID "voluid"
1435 //
1436 Int_t modId;
1437 ELayerID layerId = VolUIDToLayer(voluid,modId);
1438 return GetPNEntry(layerId,modId);
1439}
1440
1441//_____________________________________________________________________________
67dd5535 1442TGeoPNEntry* AliGeomManager::GetPNEntry(ELayerID layerId, Int_t modId)
1443{
1444 // Returns the TGeoPNEntry for a given layer
1445 // and module ID
1446 //
25fad4e5 1447
67dd5535 1448 if(modId<0 || modId>=fgLayerSize[layerId-kFirstLayer]){
1449 AliWarningClass(Form("Module number %d not in the valid range (0->%d) !",modId,fgLayerSize[layerId-kFirstLayer]-1));
1450 return NULL;
1451 }
1452
1453 return fgPNEntry[layerId-kFirstLayer][modId];
1454}
1455
1456//_____________________________________________________________________________
5590c6c3 1457void AliGeomManager::CheckOverlapsOverPNs(Double_t threshold)
1458{
1459 // Check for overlaps/extrusions on physical nodes only;
1460 // this overlap-checker is meant to be used to check overlaps/extrusions
1461 // originated by the application of alignment objects.
1462 //
1463
1464 TObjArray* ovexlist = new TObjArray(64);
1465
1466 AliInfoClass("********* Checking overlaps/extrusions over physical nodes only *********");
1467 TObjArray* pnList = gGeoManager->GetListOfPhysicalNodes();
0cd61c1d 1468 TGeoVolume* mvol = 0;
5590c6c3 1469 TGeoPhysicalNode* pn;
1470 TObjArray* overlaps = new TObjArray(64);
1471 overlaps->SetOwner();
1472
1473 TStopwatch timer2;
1474 timer2.Start();
1475 for(Int_t pni=0; pni<pnList->GetEntriesFast(); pni++){
1476 pn = (TGeoPhysicalNode*) pnList->UncheckedAt(pni);
1477 // checking the volume of the mother (go upper in the tree in case it is an assembly)
1478 Int_t levup=1;
1479 while(((TGeoVolume*)pn->GetVolume(pn->GetLevel()-levup))->IsAssembly()) levup++;
1480 //Printf("Going to upper level");
1481 mvol = pn->GetVolume(pn->GetLevel()-levup);
1482 if(!mvol->IsSelected()){
1483 AliInfoClass(Form("Checking overlaps for volume %s",mvol->GetName()));
1484 mvol->CheckOverlaps(threshold);
1485 ovexlist = gGeoManager->GetListOfOverlaps();
1486 TIter next(ovexlist);
1487 TGeoOverlap *ov;
1488 while ((ov=(TGeoOverlap*)next())) overlaps->Add(ov->Clone());
1489 mvol->SelectVolume();
1490 }
1491 }
1492 mvol->SelectVolume(kTRUE); // clears the list of selected volumes
1493
1494 AliInfoClass(Form("Number of overlapping/extruding PNs: %d",overlaps->GetEntriesFast()));
1495 timer2.Stop();
1496 timer2.Print();
1497
1498 TIter nextN(overlaps);
1499 TGeoOverlap *ovlp;
1500 while ((ovlp=(TGeoOverlap*)nextN())) ovlp->PrintInfo();
1501
1502 overlaps->Delete();
1503 delete overlaps;
1504}
1505
1506//_____________________________________________________________________________
4fbb8e9d 1507Int_t AliGeomManager::GetNalignable(const char* module)
8cb26cdf 1508{
4fbb8e9d 1509 // Get number of declared alignable volumes for given detector in current geometry
8cb26cdf 1510 //
1511
4fbb8e9d 1512 // return the detector index corresponding to detector
1513 Int_t index = -1 ;
1514 for (index = 0; index < fgkNDetectors ; index++) {
1515 if ( strcmp(module, fgkDetectorName[index]) == 0 )
1516 break ;
1517 }
1518 return fgNalignable[index];
8cb26cdf 1519}
4fbb8e9d 1520
1521//_____________________________________________________________________________
1522void AliGeomManager::InitNalignable()
1523{
1524 // Set number of declared alignable volumes for given detector in current geometry
1525 // by looping on the list of PNEntries
1526 //
1527
1528 Int_t nAlE = gGeoManager->GetNAlignable(); // total number of alignable entries
1529 TGeoPNEntry *pne = 0;
4fbb8e9d 1530 const char* detName;
1531
1532 for (Int_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
1533 detName = fgkDetectorName[iDet];
1534 Int_t nAlDet = 0;
1535
1536 for(Int_t iE = 0; iE < nAlE; iE++)
1537 {
1538 pne = gGeoManager->GetAlignableEntry(iE);
3564f2da 1539 TString pneName = pne->GetName();
1540 if(pneName.Contains(detName)) nAlDet++;
1541 if(!strcmp(detName,"GRP")) if(pneName.Contains("ABSO") || pneName.Contains("DIPO") ||
1542 pneName.Contains("FRAME") || pneName.Contains("PIPE") ||
1543 pneName.Contains("SHIL")) nAlDet++;
4fbb8e9d 1544 }
1545 fgNalignable[iDet] = nAlDet;
1546 }
8cb26cdf 1547
4fbb8e9d 1548}
1549
8cb26cdf 1550//_____________________________________________________________________________
67dd5535 1551Bool_t AliGeomManager::ApplyAlignObjsFromCDB(const char* AlignDetsList)
1552{
1553 // Calls AddAlignObjsFromCDBSingleDet for the detectors appearing in
1554 // the list passed as argument (called by AliSimulation and
1555 // AliReconstruction)
1556 // Read the alignment objects from CDB.
1557 // Each detector is supposed to have the
1558 // alignment objects in DET/Align/Data CDB path.
1559 // All the detector objects are then collected,
1560 // sorted by geometry level (starting from ALIC) and
1561 // then applied to the TGeo geometry.
1562 // Finally an overlaps check is performed.
1563 //
1564
36b010bf 1565 TObjArray alignObjArray;
1566 alignObjArray.Clear();
1567 alignObjArray.SetOwner(0);
67dd5535 1568
1569 TString alObjsNotLoaded="";
1570 TString alObjsLoaded="";
1571
1572 TString AlignDetsString(AlignDetsList);
1573 TObjArray *detsarr = AlignDetsString.Tokenize(' ');
1574 TIter iter(detsarr);
1575 TObjString *str = 0;
1576
1577 while((str = (TObjString*) iter.Next())){
1578 TString det(str->String());
36b010bf 1579 AliInfoClass(Form("Loading alignment objs for %s",det.Data()));
1580 if(!LoadAlignObjsFromCDBSingleDet(det.Data(),alignObjArray)){
67dd5535 1581 alObjsNotLoaded += det.Data();
1582 alObjsNotLoaded += " ";
1583 } else {
1584 alObjsLoaded += det.Data();
1585 alObjsLoaded += " ";
1586 }
1587 }
b80b98e1 1588 detsarr->Delete();
1589 delete detsarr;
67dd5535 1590
36b010bf 1591 if(!alObjsLoaded.IsNull()) AliInfoClass(Form("Alignment objects loaded for: %s",
1592 alObjsLoaded.Data()));
1593 if(!alObjsNotLoaded.IsNull()) AliInfoClass(Form("Didn't/couldn't load alignment objects for: %s",
1594 alObjsNotLoaded.Data()));
67dd5535 1595
9cb4fe0b 1596 return ApplyAlignObjsToGeom(alignObjArray);
67dd5535 1597}
1598
1599//_____________________________________________________________________________
36b010bf 1600Bool_t AliGeomManager::LoadAlignObjsFromCDBSingleDet(const char* detName, TObjArray& alignObjArray)
67dd5535 1601{
1602 // Adds the alignable objects found in the CDBEntry for the detector
1603 // passed as argument to the array of all alignment objects to be applyed
1604 // to geometry
1605 //
1606 // Fills array of single detector's alignable objects from CDB
1607
36b010bf 1608 AliDebugClass(2, Form("Loading alignment objs for detector: %s",detName));
67dd5535 1609
1610 AliCDBEntry *entry;
1611
1612 AliCDBPath path(detName,"Align","Data");
1613
1614 entry=AliCDBManager::Instance()->Get(path.GetPath());
1615 if(!entry){
36b010bf 1616 AliDebugClass(2,Form("Couldn't load alignment data for detector %s",detName));
67dd5535 1617 return kFALSE;
1618 }
1619 entry->SetOwner(1);
1620 TClonesArray *alignArray = (TClonesArray*) entry->GetObject();
1621 alignArray->SetOwner(0);
4fbb8e9d 1622 Int_t nAlObjs = alignArray->GetEntries();
1623 AliDebugClass(2,Form("Found %d alignment objects for %s",nAlObjs,detName));
1624 Int_t nAlVols = GetNalignable(detName);
1625 if(nAlObjs!=nAlVols) AliWarningClass(Form("%d alignment objects loaded for %s, which has %d alignable volumes",nAlObjs,detName,GetNalignable(detName)));
67dd5535 1626
1627 AliAlignObj *alignObj=0;
1628 TIter iter(alignArray);
1629
1630 // loop over align objects in detector
1631 while( ( alignObj=(AliAlignObj *) iter.Next() ) ){
36b010bf 1632 alignObjArray.Add(alignObj);
67dd5535 1633 }
1634 // delete entry --- Don't delete, it is cached!
1635
36b010bf 1636 AliDebugClass(2, Form("fAlignObjArray entries: %d",alignObjArray.GetEntries() ));
67dd5535 1637 return kTRUE;
1638
1639}
1640
1641//_____________________________________________________________________________
5590c6c3 1642Bool_t AliGeomManager::ApplyAlignObjsToGeom(TObjArray& alignObjArray, Bool_t ovlpcheck)
67dd5535 1643{
1644 // Read collection of alignment objects (AliAlignObj derived) saved
1645 // in the TClonesArray alObjArray and apply them to gGeoManager
1646 //
36b010bf 1647 alignObjArray.Sort();
1648 Int_t nvols = alignObjArray.GetEntriesFast();
67dd5535 1649
1650 Bool_t flag = kTRUE;
1651
1652 for(Int_t j=0; j<nvols; j++)
bb1970d8 1653 {
1654 AliAlignObj* alobj = (AliAlignObj*) alignObjArray.UncheckedAt(j);
1655 flag = alobj->ApplyToGeometry(ovlpcheck);
1656 if(!flag)
67dd5535 1657 {
4fbb8e9d 1658 AliDebugClass(5,Form("Error applying alignment object for volume %s !",alobj->GetSymName()));
bb1970d8 1659 }else{
1660 AliDebugClass(5,Form("Alignment object for volume %s applied successfully",alobj->GetSymName()));
67dd5535 1661 }
1662
bb1970d8 1663 }
1664
1665 if (AliDebugLevelClass() > 5) {
1666 fgGeometry->CheckOverlaps(0.001);
36b010bf 1667 TObjArray* ovexlist = fgGeometry->GetListOfOverlaps();
67dd5535 1668 if(ovexlist->GetEntriesFast()){
36b010bf 1669 AliErrorClass("The application of alignment objects to the geometry caused huge overlaps/extrusions!");
bb1970d8 1670 fgGeometry->PrintOverlaps();
67dd5535 1671 }
1672 }
1673
36b010bf 1674 // Update the TGeoPhysicalNodes
1675 fgGeometry->RefreshPhysicalNodes();
1676
67dd5535 1677 return flag;
1678
1679}
1680
1681//_____________________________________________________________________________
1682Bool_t AliGeomManager::ApplyAlignObjsToGeom(const char* fileName, const char* clArrayName)
1683{
1684 // read collection of alignment objects (AliAlignObj derived) saved
1685 // in the TClonesArray ClArrayName in the file fileName and apply
1686 // them to the geometry
1687 //
1688
1689 TFile* inFile = TFile::Open(fileName,"READ");
1690 if (!inFile || !inFile->IsOpen()) {
1691 AliErrorClass(Form("Could not open file %s !",fileName));
1692 return kFALSE;
1693 }
1694
36b010bf 1695 TClonesArray* alignObjArray = ((TClonesArray*) inFile->Get(clArrayName));
67dd5535 1696 inFile->Close();
36b010bf 1697 if (!alignObjArray) {
67dd5535 1698 AliErrorClass(Form("Could not get array (%s) from file (%s) !",clArrayName,fileName));
1699 return kFALSE;
1700 }
1701
36b010bf 1702 return ApplyAlignObjsToGeom(*alignObjArray);
67dd5535 1703
1704}
1705
1706//_____________________________________________________________________________
1707Bool_t AliGeomManager::ApplyAlignObjsToGeom(AliCDBParam* param, AliCDBId& Id)
1708{
1709 // read collection of alignment objects (AliAlignObj derived) saved
1710 // in the TClonesArray ClArrayName in the AliCDBEntry identified by
1711 // param (to get the AliCDBStorage) and Id; apply the alignment objects
1712 // to the geometry
1713 //
1714
1715 AliCDBStorage* storage = AliCDBManager::Instance()->GetStorage(param);
1716 AliCDBEntry* entry = storage->Get(Id);
36b010bf 1717 TClonesArray* alignObjArray = ((TClonesArray*) entry->GetObject());
67dd5535 1718
36b010bf 1719 return ApplyAlignObjsToGeom(*alignObjArray);
67dd5535 1720
1721}
1722
1723//_____________________________________________________________________________
1724Bool_t AliGeomManager::ApplyAlignObjsToGeom(const char* uri, const char* path, Int_t runnum, Int_t version, Int_t sversion)
1725{
1726 // read collection of alignment objects (AliAlignObj derived) saved
1727 // in the TClonesArray ClArrayName in the AliCDBEntry identified by
1728 // param (to get the AliCDBStorage) and Id; apply the alignment objects
1729 // to the geometry
1730 //
1731
1732 AliCDBParam* param = AliCDBManager::Instance()->CreateParameter(uri);
1733 AliCDBId id(path, runnum, runnum, version, sversion);
1734
1735 return ApplyAlignObjsToGeom(param, id);
1736
1737}
1738
1739//_____________________________________________________________________________
1740Bool_t AliGeomManager::ApplyAlignObjsToGeom(const char* detName, Int_t runnum, Int_t version, Int_t sversion)
1741{
1742 // read collection of alignment objects (AliAlignObj derived) saved
1743 // in the TClonesArray ClArrayName in the AliCDBEntry identified by
1744 // param (to get the AliCDBStorage) and Id; apply the alignment objects
1745 // to the geometry
1746 //
1747
1748 AliCDBPath path(detName,"Align","Data");
1749 AliCDBEntry* entry = AliCDBManager::Instance()->Get(path.GetPath(),runnum,version,sversion);
1750
1751 if(!entry) return kFALSE;
36b010bf 1752 TClonesArray* alignObjArray = ((TClonesArray*) entry->GetObject());
25fad4e5 1753
36b010bf 1754 return ApplyAlignObjsToGeom(*alignObjArray);
67dd5535 1755}
171c4ef9 1756
3564f2da 1757//_____________________________________________________________________________
1758void AliGeomManager::ResetPNEntriesLUT()
1759{
1760 // cleans static arrays containing the information on currently loaded geometry
1761 //
1762 for (Int_t iLayer = 0; iLayer < (kLastLayer - kFirstLayer); iLayer++){
1763 if (!fgPNEntry[iLayer]) continue;
1764 for (Int_t modnum=0; modnum<fgLayerSize[iLayer]; modnum++) fgPNEntry[iLayer][modnum] = 0;
1765 }
1766 //
1767}
1768