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. *
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 **************************************************************************/
18 // ----------------------------
19 // Class AliMUONGeometryTransformer
20 // ----------------------------
21 // Top container class for geometry transformations
22 // Author: Ivana Hrivnacova, IPN Orsay
24 #include "AliMUONGeometryTransformer.h"
25 #include "AliMUONGeometryModuleTransformer.h"
26 #include "AliMUONGeometryDetElement.h"
27 #include "AliMUONGeometryBuilder.h"
29 #include "AliMpDEManager.h"
30 #include "AliMpConstants.h"
31 #include "AliMpExMap.h"
34 #include "AliAlignObjMatrix.h"
35 #include "AliAlignObj.h"
37 #include <Riostream.h>
39 #include <TClonesArray.h>
40 #include <TGeoManager.h>
41 #include <TGeoPhysicalNode.h>
48 ClassImp(AliMUONGeometryTransformer)
51 const TString AliMUONGeometryTransformer::fgkDefaultDetectorName = "MUON";
53 //______________________________________________________________________________
54 AliMUONGeometryTransformer::AliMUONGeometryTransformer()
57 fDetectorName(fgkDefaultDetectorName),
58 fModuleTransformers(0),
61 /// Standard constructor
63 // Create array for geometry modules
64 fModuleTransformers = new TObjArray(100);
65 fModuleTransformers->SetOwner(true);
68 //______________________________________________________________________________
69 AliMUONGeometryTransformer::AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/)
72 fModuleTransformers(0),
75 /// Default constructor
78 //______________________________________________________________________________
79 AliMUONGeometryTransformer::~AliMUONGeometryTransformer()
83 delete fModuleTransformers;
84 delete fMisAlignArray;
91 //_____________________________________________________________________________
92 AliMUONGeometryModuleTransformer*
93 AliMUONGeometryTransformer::GetModuleTransformerNonConst(
94 Int_t index, Bool_t warn) const
96 /// Return the geometry module specified by index
98 if (index < 0 || index >= fModuleTransformers->GetEntriesFast()) {
101 << "Index: " << index << " outside limits" << std::endl;
106 return (AliMUONGeometryModuleTransformer*) fModuleTransformers->At(index);
109 //______________________________________________________________________________
110 TGeoHMatrix AliMUONGeometryTransformer::GetTransform(
111 Double_t x, Double_t y, Double_t z,
112 Double_t a1, Double_t a2, Double_t a3,
113 Double_t a4, Double_t a5, Double_t a6) const
115 /// Build the transformation from the given parameters
118 return TGeoCombiTrans(TGeoTranslation(x, y, z),
119 TGeoRotation("rot", a1, a2, a3, a4, a5, a6));
123 //______________________________________________________________________________
124 void AliMUONGeometryTransformer::FillModuleTransform(Int_t moduleId,
125 Double_t x, Double_t y, Double_t z,
126 Double_t a1, Double_t a2, Double_t a3,
127 Double_t a4, Double_t a5, Double_t a6)
129 /// Fill the transformation of the module.
131 AliMUONGeometryModuleTransformer* moduleTransformer
132 = GetModuleTransformerNonConst(moduleId, false);
134 if ( !moduleTransformer) {
136 << "Module " << moduleId << " has not volume path defined." << endl;
139 // Build the transformation from the parameters
140 TGeoHMatrix transform
141 = GetTransform(x, y, z, a1, a2, a3, a4, a5, a6);
143 moduleTransformer->SetTransformation(transform);
146 //______________________________________________________________________________
147 void AliMUONGeometryTransformer::FillDetElemTransform(
149 Double_t x, Double_t y, Double_t z,
150 Double_t a1, Double_t a2, Double_t a3,
151 Double_t a4, Double_t a5, Double_t a6)
153 /// Fill the transformation of the detection element.
156 Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
158 // Get module transformer
159 const AliMUONGeometryModuleTransformer* kModuleTransformer
160 = GetModuleTransformer(moduleId);
162 if ( ! kModuleTransformer ) {
163 AliFatal(Form("Module transformer not defined, detElemId: %d", detElemId));
167 // Get detection element
168 AliMUONGeometryDetElement* detElement
169 = kModuleTransformer->GetDetElement(detElemId);
171 if ( ! detElement ) {
172 AliFatal(Form("Det element %d has not volume path defined", detElemId));
176 // Build the transformation from the parameters
177 TGeoHMatrix localTransform
178 = GetTransform(x, y, z, a1, a2, a3, a4, a5, a6);
179 detElement->SetLocalTransformation(localTransform);
181 // Compute global transformation
182 TGeoHMatrix globalTransform
183 = AliMUONGeometryBuilder::Multiply(
184 *kModuleTransformer->GetTransformation(),
186 detElement->SetGlobalTransformation(globalTransform);
189 //______________________________________________________________________________
190 TString AliMUONGeometryTransformer::ReadModuleTransforms(ifstream& in)
192 /// Read and fill modules transformations from the stream.
193 /// Return true, if reading finished correctly.
195 TString key(AliMUONGeometryModuleTransformer::GetModuleNamePrefix());
196 while ( key == AliMUONGeometryModuleTransformer::GetModuleNamePrefix() ) {
199 Double_t a1, a2, a3, a4, a5, a6;
215 //cout << "moduleId=" << id << " "
216 // << "position= " << x << ", " << y << ", " << z << " "
217 // << "rotation= " << a1 << ", " << a2 << ", " << a3 << ", "
218 // << a4 << ", " << a5 << ", " << a6
222 FillModuleTransform(id, x, y, z, a1, a2, a3, a4, a5, a6);
231 //______________________________________________________________________________
232 TString AliMUONGeometryTransformer::ReadDetElemTransforms(ifstream& in)
234 /// Read detection elements transformations from the stream.
235 /// Return true, if reading finished correctly.
237 TString key(AliMUONGeometryDetElement::GetDENamePrefix());
238 while ( key == AliMUONGeometryDetElement::GetDENamePrefix() ) {
243 Double_t a1, a2, a3, a4, a5, a6;
259 //cout << "detElemId=" << detElemId << " "
260 // << "position= " << x << ", " << y << ", " << z << " "
261 // << "rotation= " << a1 << ", " << a2 << ", " << a3 << ", "
262 // << a4 << ", " << a5 << ", " << a6
266 FillDetElemTransform(detElemId, x, y, z, a1, a2, a3, a4, a5, a6);
275 //______________________________________________________________________________
277 AliMUONGeometryTransformer::ReadTransformations(const TString& fileName)
279 /// Read transformations from a file.
280 /// Return true, if reading finished correctly.
283 TString filePath = gSystem->Getenv("ALICE_ROOT");
284 filePath += "/MUON/data/";
285 filePath += fileName;
288 ifstream in(filePath, ios::in);
290 cerr << filePath << endl;
291 AliFatal("File not found.");
297 while ( !in.eof() ) {
298 if ( key == AliMUONGeometryModuleTransformer::GetModuleNamePrefix() )
299 key = ReadModuleTransforms(in);
300 else if ( key == AliMUONGeometryDetElement::GetDENamePrefix() )
301 key = ReadDetElemTransforms(in);
303 AliFatal(Form("%s key not recognized", key.Data()));
311 //______________________________________________________________________________
313 AliMUONGeometryTransformer::LoadTransformations()
315 /// Load transformations for defined modules and detection elements
316 /// using AliGeomManager
318 if ( ! AliGeomManager::GetGeometry() ) {
319 AliFatal("Geometry has to be laoded in AliGeomManager first.");
323 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
324 AliMUONGeometryModuleTransformer* moduleTransformer
325 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
327 // Module symbolic name
328 TString symname = GetModuleSymName(moduleTransformer->GetModuleId());
330 // Set matrix from physical node
331 TGeoHMatrix* matrix = AliGeomManager::GetMatrix(symname);
333 AliErrorStream() << "Geometry module matrix not found." << endl;
336 moduleTransformer->SetTransformation(*matrix);
338 // Loop over detection elements
339 AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
341 for (Int_t j=0; j<detElements->GetSize(); j++) {
342 AliMUONGeometryDetElement* detElement
343 = (AliMUONGeometryDetElement*)detElements->GetObject(j);
345 // Det element symbolic name
346 TString symname = GetDESymName(detElement->GetId());
348 // Set global matrix from physical node
349 TGeoHMatrix* globalMatrix = AliGeomManager::GetMatrix(symname);
351 AliErrorStream() << "Detection element matrix not found." << endl;
354 detElement->SetGlobalTransformation(*globalMatrix);
357 TGeoHMatrix localMatrix =
358 AliMUONGeometryBuilder::Multiply(
359 (*matrix).Inverse(), (*globalMatrix) );
360 detElement->SetLocalTransformation(localMatrix);
366 //______________________________________________________________________________
367 void AliMUONGeometryTransformer::WriteTransform(ofstream& out,
368 const TGeoMatrix* transform) const
370 /// Write given transformation
373 const Double_t* xyz = transform->GetTranslation();
374 out << setw(10) << setprecision(4) << xyz[0] << " "
375 << setw(10) << setprecision(4) << xyz[1] << " "
376 << setw(10) << setprecision(4) << xyz[2];
379 const Double_t* rm = transform->GetRotationMatrix();
380 TGeoRotation rotation;
381 rotation.SetMatrix(const_cast<Double_t*>(rm));
382 Double_t a1, a2, a3, a4, a5, a6;
383 rotation.GetAngles(a1, a2, a3, a4, a5, a6);
385 out << setw(8) << setprecision(4) << a1 << " "
386 << setw(8) << setprecision(4) << a2 << " "
387 << setw(8) << setprecision(4) << a3 << " "
388 << setw(8) << setprecision(4) << a4 << " "
389 << setw(8) << setprecision(4) << a5 << " "
390 << setw(8) << setprecision(4) << a6 << " " << endl;
393 //______________________________________________________________________________
394 void AliMUONGeometryTransformer::WriteModuleTransforms(ofstream& out) const
396 /// Write module transformations for all module transformers
398 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
399 AliMUONGeometryModuleTransformer* moduleTransformer
400 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
401 const TGeoMatrix* transform
402 = moduleTransformer->GetTransformation();
405 out << AliMUONGeometryModuleTransformer::GetModuleNamePrefix() << " "
406 << setw(4) << moduleTransformer->GetModuleId();
408 WriteTransform(out, transform);
413 //______________________________________________________________________________
414 void AliMUONGeometryTransformer::WriteDetElemTransforms(ofstream& out) const
416 /// Write detection element transformations for all detection elements in all
417 /// module transformers
419 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
420 AliMUONGeometryModuleTransformer* moduleTransformer
421 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
422 AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
424 for (Int_t j=0; j<detElements->GetSize(); j++) {
425 AliMUONGeometryDetElement* detElement
426 = (AliMUONGeometryDetElement*)detElements->GetObject(j);
427 const TGeoMatrix* transform
428 = detElement->GetLocalTransformation();
431 out << AliMUONGeometryDetElement::GetDENamePrefix() << " "
432 << setw(4) << detElement->GetId();
434 WriteTransform(out, transform);
440 //______________________________________________________________________________
441 TString AliMUONGeometryTransformer::GetModuleSymName(Int_t moduleId) const
443 /// Return the module symbolic name (use for alignment)
445 return "/" + fDetectorName + "/"
446 + AliMUONGeometryModuleTransformer::GetModuleName(moduleId);
449 //______________________________________________________________________________
450 TString AliMUONGeometryTransformer::GetDESymName(Int_t detElemId) const
452 /// Return the detection element symbolic name (used for alignment)
455 Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
457 return GetModuleSymName(moduleId) + "/"
458 + AliMUONGeometryDetElement::GetDEName(detElemId);
465 //______________________________________________________________________________
467 AliMUONGeometryTransformer::LoadGeometryData(const TString& fileName)
469 /// Read geometry data either from ASCII file with transformations or
470 /// from root geometry file (if fileName has ".root" extension)
474 // Get file extension
475 std::string fileName2 = fileName.Data();
476 std::string rootExt = fileName2.substr(fileName2.size()-5, fileName2.size());
478 if ( rootExt != ".root" )
479 return ReadTransformations(fileName);
481 // Load root geometry
482 AliGeomManager::LoadGeometry(fileName.Data());
483 return LoadTransformations();
487 //______________________________________________________________________________
489 AliMUONGeometryTransformer::LoadGeometryData()
491 /// Load geometry data from already loaded Root geometry using AliGeomManager
493 if ( ! AliGeomManager::GetGeometry() ) {
494 AliErrorStream() << "Geometry has not been loaded in AliGeomManager" << endl;
500 return LoadTransformations();
503 //______________________________________________________________________________
505 AliMUONGeometryTransformer::WriteTransformations(const TString& fileName) const
507 /// Write transformations into a file.
508 /// Return true, if writing finished correctly.
511 // if builder is not associated with any geometry module
512 if (fModuleTransformers->GetEntriesFast() == 0) return false;
515 TString filePath = gSystem->Getenv("ALICE_ROOT");
516 filePath += "/MUON/data/";
517 filePath += fileName;
520 ofstream out(filePath, ios::out);
522 cerr << filePath << endl;
523 AliError("File not found.");
526 #if !defined (__DECCXX)
527 out.setf(std::ios::fixed);
529 WriteModuleTransforms(out);
530 WriteDetElemTransforms(out);
535 //______________________________________________________________________________
537 AliMUONGeometryTransformer::WriteMisAlignmentData(const TString& fileName) const
539 /// Write misalignment data into a file
540 /// Return true, if writing finished correctly.
543 // if builder is not associated with any geometry module
544 if ( fModuleTransformers->GetEntriesFast() == 0 ) {
545 AliWarningStream() << "No geometry modules defined." << endl;
550 // if builder has no mis-alignment data
551 if ( ! fMisAlignArray ) {
552 AliWarningStream() << "No mis-alignment data defined." << endl;
557 TString filePath = gSystem->Getenv("ALICE_ROOT");
558 filePath += "/MUON/data/";
559 filePath += fileName;
561 // Write mis-alignment data in the root file
562 TFile file(fileName.Data(), "RECREATE");
563 fMisAlignArray->Write();
569 //_____________________________________________________________________________
570 void AliMUONGeometryTransformer::AddModuleTransformer(
571 AliMUONGeometryModuleTransformer* moduleTransformer)
573 /// Add the module transformer to the array
575 // Expand the size if not sufficient
576 Int_t moduleId = moduleTransformer->GetModuleId();
577 if ( moduleId >= fModuleTransformers->GetSize() )
578 fModuleTransformers->Expand(moduleId+1);
580 fModuleTransformers->AddAt(moduleTransformer, moduleId);
583 //_____________________________________________________________________________
584 void AliMUONGeometryTransformer::AddMisAlignModule(Int_t moduleId,
585 const TGeoHMatrix& matrix)
587 /// Build AliAlignObjMatrix with module ID, its volumePath
588 /// and the given delta transformation matrix
590 if ( ! fMisAlignArray )
591 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
593 const AliMUONGeometryModuleTransformer* kTransformer
594 = GetModuleTransformer(moduleId);
595 if ( ! kTransformer ) {
596 AliErrorStream() << "Module " << moduleId << " not found." << endl;
600 // Get unique align object ID
601 Int_t volId = AliGeomManager::LayerToVolUID(AliGeomManager::kMUON, moduleId);
603 // Create mis align matrix
604 TClonesArray& refArray =*fMisAlignArray;
605 Int_t pos = fMisAlignArray->GetEntriesFast();
606 new (refArray[pos]) AliAlignObjMatrix(GetModuleSymName(moduleId), volId,
607 const_cast<TGeoHMatrix&>(matrix),kTRUE);
610 //_____________________________________________________________________________
611 void AliMUONGeometryTransformer::AddMisAlignDetElement(Int_t detElemId,
612 const TGeoHMatrix& matrix)
614 /// Build AliAlignObjMatrix with detection element ID, its volumePath
615 /// and the given delta transformation matrix
617 if ( ! fMisAlignArray )
618 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
620 const AliMUONGeometryDetElement* kDetElement
621 = GetDetElement(detElemId);
623 if ( ! kDetElement ) {
624 AliErrorStream() << "Det element " << detElemId << " not found." << endl;
628 // Get unique align object ID
629 Int_t volId = AliGeomManager::LayerToVolUID(AliGeomManager::kMUON, detElemId);
631 // Create mis align matrix
632 TClonesArray& refArray =*fMisAlignArray;
633 Int_t pos = fMisAlignArray->GetEntriesFast();
634 new(refArray[pos]) AliAlignObjMatrix(GetDESymName(detElemId), volId,
635 const_cast<TGeoHMatrix&>(matrix),kTRUE);
638 //______________________________________________________________________________
639 void AliMUONGeometryTransformer::CreateModules()
641 /// Create modules and their detection elements using info from mapping;
642 /// but do not fill matrices
645 // Loop over geometry module
646 for (Int_t moduleId = 0; moduleId < AliMpConstants::NofGeomModules(); ++moduleId ) {
648 // Create geometry module transformer
649 AliMUONGeometryModuleTransformer* moduleTransformer
650 = new AliMUONGeometryModuleTransformer(moduleId);
651 AddModuleTransformer(moduleTransformer);
654 // Loop over detection elements
656 for ( it.First(); ! it.IsDone(); it.Next() ) {
658 Int_t detElemId = it.CurrentDEId();
659 Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
661 // Get detection element store
662 AliMpExMap* detElements =
663 GetModuleTransformer(moduleId)->GetDetElementStore();
665 // Add detection element
666 AliMUONGeometryDetElement* detElement
667 = new AliMUONGeometryDetElement(detElemId);
668 detElements->Add(detElemId, detElement);
672 //_____________________________________________________________________________
673 void AliMUONGeometryTransformer::AddAlignableVolumes() const
675 /// Set symbolic names and matrices to alignable objects to TGeo
677 if ( ! gGeoManager ) {
678 AliWarning("TGeoManager not defined.");
683 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
684 AliMUONGeometryModuleTransformer* module
685 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
687 // Set module symbolic name
689 = gGeoManager->SetAlignableEntry(GetModuleSymName(module->GetModuleId()),
690 module->GetVolumePath());
693 << "Volume path for geometry module "
694 << module->GetModuleId()
695 << " not found in geometry." << endl;
699 pnEntry->SetMatrix(new TGeoHMatrix(*module->GetTransformation()));
700 // the matrix will be deleted via TGeoManager
703 // Detection elements
704 AliMpExMap* detElements = module->GetDetElementStore();
706 for (Int_t j=0; j<detElements->GetSize(); j++) {
707 AliMUONGeometryDetElement* detElement
708 = (AliMUONGeometryDetElement*)detElements->GetObject(j);
710 // Set detection element symbolic name
712 = gGeoManager->SetAlignableEntry(GetDESymName(detElement->GetId()),
713 detElement->GetVolumePath());
716 << "Volume path for detection element "
717 << detElement->GetId()
718 << " not found in geometry." << endl;
721 // Set detection element matrix
722 pnEntry->SetMatrix(new TGeoHMatrix(*detElement->GetGlobalTransformation()));
723 // the matrix will be deleted via TGeoManager
729 //_____________________________________________________________________________
730 TClonesArray* AliMUONGeometryTransformer::CreateZeroAlignmentData() const
732 /// Create array with zero alignment data
734 // Create array for zero-alignment objects
735 TClonesArray* array = new TClonesArray("AliAlignObjMatrix", 200);
736 TClonesArray& refArray =*array;
737 array->SetOwner(true);
743 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
744 AliMUONGeometryModuleTransformer* module
745 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
747 Int_t moduleId = module->GetModuleId();
750 Int_t volId = AliGeomManager::LayerToVolUID(AliGeomManager::kMUON, moduleId);
752 // Create mis align matrix
753 Int_t pos = array->GetEntriesFast();
754 new (refArray[pos]) AliAlignObjMatrix(GetModuleSymName(moduleId), volId, matrix, kTRUE);
757 // Detection elements
758 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
759 AliMUONGeometryModuleTransformer* moduleTransformer
760 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
761 AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
763 for (Int_t j=0; j<detElements->GetSize(); j++) {
764 AliMUONGeometryDetElement* detElement
765 = (AliMUONGeometryDetElement*)detElements->GetObject(j);
767 Int_t detElemId = detElement->GetId();
770 Int_t volId = AliGeomManager::LayerToVolUID(AliGeomManager::kMUON, detElemId);
772 // Create mis align matrix
773 Int_t pos = array->GetEntriesFast();
774 new (refArray[pos]) AliAlignObjMatrix(GetDESymName(detElemId), volId, matrix, kTRUE);
781 //_____________________________________________________________________________
782 void AliMUONGeometryTransformer::ClearMisAlignmentData()
784 /// Clear the array of misalignment data
786 if ( ! fMisAlignArray ) return;
788 fMisAlignArray->Delete();
791 //_____________________________________________________________________________
792 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
793 Float_t xg, Float_t yg, Float_t zg,
794 Float_t& xl, Float_t& yl, Float_t& zl) const
796 /// Transform point from the global reference frame (ALIC)
797 /// to the local reference frame of the detection element specified
800 const AliMUONGeometryModuleTransformer* kTransformer
801 = GetModuleTransformerByDEId(detElemId);
804 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
807 //_____________________________________________________________________________
808 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
809 Double_t xg, Double_t yg, Double_t zg,
810 Double_t& xl, Double_t& yl, Double_t& zl) const
812 /// Transform point from the global reference frame (ALIC)
813 /// to the local reference frame of the detection element specified
816 const AliMUONGeometryModuleTransformer* kTransformer
817 = GetModuleTransformerByDEId(detElemId);
820 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
823 //_____________________________________________________________________________
824 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
825 Float_t xl, Float_t yl, Float_t zl,
826 Float_t& xg, Float_t& yg, Float_t& zg) const
828 /// Transform point from the local reference frame of the detection element
829 /// specified by detElemId to the global reference frame (ALIC).
831 const AliMUONGeometryModuleTransformer* kTransformer
832 = GetModuleTransformerByDEId(detElemId);
835 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
838 //_____________________________________________________________________________
839 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
840 Double_t xl, Double_t yl, Double_t zl,
841 Double_t& xg, Double_t& yg, Double_t& zg) const
843 /// Transform point from the local reference frame of the detection element
844 /// specified by detElemId to the global reference frame (ALIC).
846 const AliMUONGeometryModuleTransformer* kTransformer
847 = GetModuleTransformerByDEId(detElemId);
850 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
853 //_____________________________________________________________________________
854 const AliMUONGeometryModuleTransformer*
855 AliMUONGeometryTransformer::GetModuleTransformer(Int_t index, Bool_t warn) const
857 /// Return the geometry module transformer specified by index
859 return GetModuleTransformerNonConst(index, warn);
862 //_____________________________________________________________________________
863 const AliMUONGeometryModuleTransformer*
864 AliMUONGeometryTransformer::GetModuleTransformerByDEId(Int_t detElemId,
867 /// Return the geometry module transformer specified by detection element ID
870 Int_t index = AliMpDEManager::GetGeomModuleId(detElemId);
872 return GetModuleTransformer(index, warn);
875 //_____________________________________________________________________________
876 const AliMUONGeometryDetElement*
877 AliMUONGeometryTransformer::GetDetElement(Int_t detElemId, Bool_t warn) const
879 /// Return detection element with given detElemId
881 const AliMUONGeometryModuleTransformer* kTransformer
882 = GetModuleTransformerByDEId(detElemId, warn);
884 if (!kTransformer) return 0;
886 return kTransformer->GetDetElement(detElemId, warn);
889 //_____________________________________________________________________________
890 Bool_t AliMUONGeometryTransformer::HasDE(Int_t detElemId) const
892 /// Return true if detection element with given detElemId is defined
894 const AliMUONGeometryModuleTransformer* kTransformer
895 = GetModuleTransformerByDEId(detElemId, false);
897 if (!kTransformer) return false;
899 return ( kTransformer->GetDetElement(detElemId, false) != 0 );