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"
35 #include "AliAlignObjMatrix.h"
36 #include "AliAlignObj.h"
38 #include <Riostream.h>
40 #include <TClonesArray.h>
41 #include <TGeoManager.h>
42 #include <TGeoPhysicalNode.h>
49 ClassImp(AliMUONGeometryTransformer)
52 const TString AliMUONGeometryTransformer::fgkDefaultDetectorName = "MUON";
54 //______________________________________________________________________________
55 AliMUONGeometryTransformer::AliMUONGeometryTransformer()
58 fDetectorName(fgkDefaultDetectorName),
59 fModuleTransformers(0),
62 /// Standard constructor
64 // Create array for geometry modules
65 fModuleTransformers = new TObjArray(100);
66 fModuleTransformers->SetOwner(true);
69 //______________________________________________________________________________
70 AliMUONGeometryTransformer::AliMUONGeometryTransformer(TRootIOCtor* /*ioCtor*/)
73 fModuleTransformers(0),
76 /// Default constructor
79 //______________________________________________________________________________
80 AliMUONGeometryTransformer::~AliMUONGeometryTransformer()
84 delete fModuleTransformers;
85 delete fMisAlignArray;
92 //_____________________________________________________________________________
93 Bool_t AliMUONGeometryTransformer::LoadMapping() const
95 /// Load mapping from CDB
97 if ( ! AliMpCDB::LoadMpSegmentation() )
99 AliFatal("Could not access mapping from OCDB !");
106 //_____________________________________________________________________________
107 AliMUONGeometryModuleTransformer*
108 AliMUONGeometryTransformer::GetModuleTransformerNonConst(
109 Int_t index, Bool_t warn) const
111 /// Return the geometry module specified by index
113 if (index < 0 || index >= fModuleTransformers->GetEntriesFast()) {
116 << "Index: " << index << " outside limits" << std::endl;
121 return (AliMUONGeometryModuleTransformer*) fModuleTransformers->At(index);
124 //______________________________________________________________________________
125 TGeoHMatrix AliMUONGeometryTransformer::GetTransform(
126 Double_t x, Double_t y, Double_t z,
127 Double_t a1, Double_t a2, Double_t a3,
128 Double_t a4, Double_t a5, Double_t a6) const
130 /// Build the transformation from the given parameters
133 return TGeoCombiTrans(TGeoTranslation(x, y, z),
134 TGeoRotation("rot", a1, a2, a3, a4, a5, a6));
138 //______________________________________________________________________________
139 void AliMUONGeometryTransformer::FillModuleTransform(Int_t moduleId,
140 Double_t x, Double_t y, Double_t z,
141 Double_t a1, Double_t a2, Double_t a3,
142 Double_t a4, Double_t a5, Double_t a6)
144 /// Fill the transformation of the module.
146 AliMUONGeometryModuleTransformer* moduleTransformer
147 = GetModuleTransformerNonConst(moduleId, false);
149 if ( !moduleTransformer) {
151 << "Module " << moduleId << " has not volume path defined." << endl;
154 // Build the transformation from the parameters
155 TGeoHMatrix transform
156 = GetTransform(x, y, z, a1, a2, a3, a4, a5, a6);
158 moduleTransformer->SetTransformation(transform);
161 //______________________________________________________________________________
162 void AliMUONGeometryTransformer::FillDetElemTransform(
164 Double_t x, Double_t y, Double_t z,
165 Double_t a1, Double_t a2, Double_t a3,
166 Double_t a4, Double_t a5, Double_t a6)
168 /// Fill the transformation of the detection element.
171 Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
173 // Get module transformer
174 const AliMUONGeometryModuleTransformer* kModuleTransformer
175 = GetModuleTransformer(moduleId);
177 if ( ! kModuleTransformer ) {
178 AliFatal(Form("Module transformer not defined, detElemId: %d", detElemId));
182 // Get detection element
183 AliMUONGeometryDetElement* detElement
184 = kModuleTransformer->GetDetElement(detElemId);
186 if ( ! detElement ) {
187 AliFatal(Form("Det element %d has not volume path defined", detElemId));
191 // Build the transformation from the parameters
192 TGeoHMatrix localTransform
193 = GetTransform(x, y, z, a1, a2, a3, a4, a5, a6);
194 detElement->SetLocalTransformation(localTransform);
196 // Compute global transformation
197 TGeoHMatrix globalTransform
198 = AliMUONGeometryBuilder::Multiply(
199 *kModuleTransformer->GetTransformation(),
201 detElement->SetGlobalTransformation(globalTransform);
204 //______________________________________________________________________________
205 TString AliMUONGeometryTransformer::ReadModuleTransforms(ifstream& in)
207 /// Read and fill modules transformations from the stream.
208 /// Return true, if reading finished correctly.
210 TString key(AliMUONGeometryModuleTransformer::GetModuleNamePrefix());
211 while ( key == AliMUONGeometryModuleTransformer::GetModuleNamePrefix() ) {
214 Double_t a1, a2, a3, a4, a5, a6;
230 //cout << "moduleId=" << id << " "
231 // << "position= " << x << ", " << y << ", " << z << " "
232 // << "rotation= " << a1 << ", " << a2 << ", " << a3 << ", "
233 // << a4 << ", " << a5 << ", " << a6
237 FillModuleTransform(id, x, y, z, a1, a2, a3, a4, a5, a6);
246 //______________________________________________________________________________
247 TString AliMUONGeometryTransformer::ReadDetElemTransforms(ifstream& in)
249 /// Read detection elements transformations from the stream.
250 /// Return true, if reading finished correctly.
252 TString key(AliMUONGeometryDetElement::GetDENamePrefix());
253 while ( key == AliMUONGeometryDetElement::GetDENamePrefix() ) {
258 Double_t a1, a2, a3, a4, a5, a6;
274 //cout << "detElemId=" << detElemId << " "
275 // << "position= " << x << ", " << y << ", " << z << " "
276 // << "rotation= " << a1 << ", " << a2 << ", " << a3 << ", "
277 // << a4 << ", " << a5 << ", " << a6
281 FillDetElemTransform(detElemId, x, y, z, a1, a2, a3, a4, a5, a6);
290 //______________________________________________________________________________
292 AliMUONGeometryTransformer::ReadTransformations(const TString& fileName)
294 /// Read transformations from a file.
295 /// Return true, if reading finished correctly.
298 TString filePath = gSystem->Getenv("ALICE_ROOT");
299 filePath += "/MUON/data/";
300 filePath += fileName;
303 ifstream in(filePath, ios::in);
305 cerr << filePath << endl;
306 AliFatal("File not found.");
312 while ( !in.eof() ) {
313 if ( key == AliMUONGeometryModuleTransformer::GetModuleNamePrefix() )
314 key = ReadModuleTransforms(in);
315 else if ( key == AliMUONGeometryDetElement::GetDENamePrefix() )
316 key = ReadDetElemTransforms(in);
318 AliFatal(Form("%s key not recognized", key.Data()));
326 //______________________________________________________________________________
328 AliMUONGeometryTransformer::LoadTransformations()
330 /// Load transformations for defined modules and detection elements
331 /// using AliGeomManager
333 if ( ! AliGeomManager::GetGeometry() ) {
334 AliFatal("Geometry has to be laoded in AliGeomManager first.");
338 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
339 AliMUONGeometryModuleTransformer* moduleTransformer
340 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
342 // Module symbolic name
343 TString symname = GetModuleSymName(moduleTransformer->GetModuleId());
345 // Set matrix from physical node
346 TGeoHMatrix* matrix = AliGeomManager::GetMatrix(symname);
348 AliErrorStream() << "Geometry module matrix not found." << endl;
351 moduleTransformer->SetTransformation(*matrix);
353 // Loop over detection elements
354 AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
356 for (Int_t j=0; j<detElements->GetSize(); j++) {
357 AliMUONGeometryDetElement* detElement
358 = (AliMUONGeometryDetElement*)detElements->GetObject(j);
360 // Det element symbolic name
361 TString symname = GetDESymName(detElement->GetId());
363 // Set global matrix from physical node
364 TGeoHMatrix* globalMatrix = AliGeomManager::GetMatrix(symname);
365 if ( ! globalMatrix ) {
366 AliErrorStream() << "Detection element matrix not found." << endl;
369 detElement->SetGlobalTransformation(*globalMatrix);
372 TGeoHMatrix localMatrix =
373 AliMUONGeometryBuilder::Multiply(
374 (*matrix).Inverse(), (*globalMatrix) );
375 detElement->SetLocalTransformation(localMatrix);
381 //______________________________________________________________________________
382 void AliMUONGeometryTransformer::WriteTransform(ofstream& out,
383 const TGeoMatrix* transform) const
385 /// Write given transformation
388 const Double_t* xyz = transform->GetTranslation();
389 out << setw(10) << setprecision(4) << xyz[0] << " "
390 << setw(10) << setprecision(4) << xyz[1] << " "
391 << setw(10) << setprecision(4) << xyz[2];
394 const Double_t* rm = transform->GetRotationMatrix();
395 TGeoRotation rotation;
396 rotation.SetMatrix(const_cast<Double_t*>(rm));
397 Double_t a1, a2, a3, a4, a5, a6;
398 rotation.GetAngles(a1, a2, a3, a4, a5, a6);
400 out << setw(8) << setprecision(4) << a1 << " "
401 << setw(8) << setprecision(4) << a2 << " "
402 << setw(8) << setprecision(4) << a3 << " "
403 << setw(8) << setprecision(4) << a4 << " "
404 << setw(8) << setprecision(4) << a5 << " "
405 << setw(8) << setprecision(4) << a6 << " " << endl;
408 //______________________________________________________________________________
409 void AliMUONGeometryTransformer::WriteModuleTransforms(ofstream& out) const
411 /// Write module transformations for all module transformers
413 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
414 AliMUONGeometryModuleTransformer* moduleTransformer
415 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
416 const TGeoMatrix* transform
417 = moduleTransformer->GetTransformation();
420 out << AliMUONGeometryModuleTransformer::GetModuleNamePrefix() << " "
421 << setw(4) << moduleTransformer->GetModuleId();
423 WriteTransform(out, transform);
428 //______________________________________________________________________________
429 void AliMUONGeometryTransformer::WriteDetElemTransforms(ofstream& out) const
431 /// Write detection element transformations for all detection elements in all
432 /// module transformers
434 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
435 AliMUONGeometryModuleTransformer* moduleTransformer
436 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
437 AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
439 for (Int_t j=0; j<detElements->GetSize(); j++) {
440 AliMUONGeometryDetElement* detElement
441 = (AliMUONGeometryDetElement*)detElements->GetObject(j);
442 const TGeoMatrix* transform
443 = detElement->GetLocalTransformation();
446 out << AliMUONGeometryDetElement::GetDENamePrefix() << " "
447 << setw(4) << detElement->GetId();
449 WriteTransform(out, transform);
455 //______________________________________________________________________________
456 TString AliMUONGeometryTransformer::GetModuleSymName(Int_t moduleId) const
458 /// Return the module symbolic name (use for alignment)
460 return "/" + fDetectorName + "/"
461 + AliMUONGeometryModuleTransformer::GetModuleName(moduleId);
464 //______________________________________________________________________________
465 TString AliMUONGeometryTransformer::GetDESymName(Int_t detElemId) const
467 /// Return the detection element symbolic name (used for alignment)
470 Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
472 return GetModuleSymName(moduleId) + "/"
473 + AliMUONGeometryDetElement::GetDEName(detElemId);
480 //______________________________________________________________________________
482 AliMUONGeometryTransformer::LoadGeometryData(const TString& fileName)
484 /// Read geometry data either from ASCII file with transformations or
485 /// from root geometry file (if fileName has ".root" extension)
489 // Get file extension
490 std::string fileName2 = fileName.Data();
491 std::string rootExt = fileName2.substr(fileName2.size()-5, fileName2.size());
493 if ( rootExt != ".root" )
494 return ReadTransformations(fileName);
496 // Load root geometry
497 AliGeomManager::LoadGeometry(fileName.Data());
498 return LoadTransformations();
502 //______________________________________________________________________________
504 AliMUONGeometryTransformer::LoadGeometryData()
506 /// Load geometry data from already loaded Root geometry using AliGeomManager
508 if ( ! AliGeomManager::GetGeometry() ) {
509 AliErrorStream() << "Geometry has not been loaded in AliGeomManager" << endl;
515 return LoadTransformations();
518 //______________________________________________________________________________
520 AliMUONGeometryTransformer::WriteTransformations(const TString& fileName) const
522 /// Write transformations into a file.
523 /// Return true, if writing finished correctly.
526 // if builder is not associated with any geometry module
527 if (fModuleTransformers->GetEntriesFast() == 0) return false;
530 TString filePath = gSystem->Getenv("ALICE_ROOT");
531 filePath += "/MUON/data/";
532 filePath += fileName;
535 ofstream out(filePath, ios::out);
537 cerr << filePath << endl;
538 AliError("File not found.");
541 #if !defined (__DECCXX)
542 out.setf(std::ios::fixed);
544 WriteModuleTransforms(out);
545 WriteDetElemTransforms(out);
550 //______________________________________________________________________________
552 AliMUONGeometryTransformer::WriteMisAlignmentData(const TString& fileName) const
554 /// Write misalignment data into a file
555 /// Return true, if writing finished correctly.
558 // if builder is not associated with any geometry module
559 if ( fModuleTransformers->GetEntriesFast() == 0 ) {
560 AliWarningStream() << "No geometry modules defined." << endl;
565 // if builder has no mis-alignment data
566 if ( ! fMisAlignArray ) {
567 AliWarningStream() << "No mis-alignment data defined." << endl;
572 TString filePath = gSystem->Getenv("ALICE_ROOT");
573 filePath += "/MUON/data/";
574 filePath += fileName;
576 // Write mis-alignment data in the root file
577 TFile file(fileName.Data(), "RECREATE");
578 fMisAlignArray->Write();
584 //_____________________________________________________________________________
585 void AliMUONGeometryTransformer::AddModuleTransformer(
586 AliMUONGeometryModuleTransformer* moduleTransformer)
588 /// Add the module transformer to the array
590 // Expand the size if not sufficient
591 Int_t moduleId = moduleTransformer->GetModuleId();
592 if ( moduleId >= fModuleTransformers->GetSize() )
593 fModuleTransformers->Expand(moduleId+1);
595 fModuleTransformers->AddAt(moduleTransformer, moduleId);
598 //_____________________________________________________________________________
599 void AliMUONGeometryTransformer::AddMisAlignModule(Int_t moduleId,
600 const TGeoHMatrix& matrix)
602 /// Build AliAlignObjMatrix with module ID, its volumePath
603 /// and the given delta transformation matrix
605 if ( ! fMisAlignArray )
606 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
608 const AliMUONGeometryModuleTransformer* kTransformer
609 = GetModuleTransformer(moduleId);
610 if ( ! kTransformer ) {
611 AliErrorStream() << "Module " << moduleId << " not found." << endl;
615 // Get unique align object ID
616 Int_t volId = AliGeomManager::LayerToVolUID(AliGeomManager::kMUON, moduleId);
618 // Create mis align matrix
619 TClonesArray& refArray =*fMisAlignArray;
620 Int_t pos = fMisAlignArray->GetEntriesFast();
621 new (refArray[pos]) AliAlignObjMatrix(GetModuleSymName(moduleId), volId,
622 const_cast<TGeoHMatrix&>(matrix),kTRUE);
625 //_____________________________________________________________________________
626 void AliMUONGeometryTransformer::AddMisAlignDetElement(Int_t detElemId,
627 const TGeoHMatrix& matrix)
629 /// Build AliAlignObjMatrix with detection element ID, its volumePath
630 /// and the given delta transformation matrix
632 if ( ! fMisAlignArray )
633 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
635 const AliMUONGeometryDetElement* kDetElement
636 = GetDetElement(detElemId);
638 if ( ! kDetElement ) {
639 AliErrorStream() << "Det element " << detElemId << " not found." << endl;
643 // Get unique align object ID
644 Int_t volId = AliGeomManager::LayerToVolUID(AliGeomManager::kMUON, detElemId);
646 // Create mis align matrix
647 TClonesArray& refArray =*fMisAlignArray;
648 Int_t pos = fMisAlignArray->GetEntriesFast();
649 new(refArray[pos]) AliAlignObjMatrix(GetDESymName(detElemId), volId,
650 const_cast<TGeoHMatrix&>(matrix),kTRUE);
653 //______________________________________________________________________________
654 void AliMUONGeometryTransformer::CreateModules()
656 /// Create modules and their detection elements using info from mapping;
657 /// but do not fill matrices
659 // Load mapping as its info is used to define modules & DEs
662 // Loop over geometry module
663 for (Int_t moduleId = 0; moduleId < AliMpConstants::NofGeomModules(); ++moduleId ) {
665 // Create geometry module transformer
666 AliMUONGeometryModuleTransformer* moduleTransformer
667 = new AliMUONGeometryModuleTransformer(moduleId);
668 AddModuleTransformer(moduleTransformer);
671 // Loop over detection elements
673 for ( it.First(); ! it.IsDone(); it.Next() ) {
675 Int_t detElemId = it.CurrentDEId();
676 Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
678 // Get detection element store
679 AliMpExMap* detElements =
680 GetModuleTransformer(moduleId)->GetDetElementStore();
682 // Add detection element
683 AliMUONGeometryDetElement* detElement
684 = new AliMUONGeometryDetElement(detElemId);
685 detElements->Add(detElemId, detElement);
689 //_____________________________________________________________________________
690 void AliMUONGeometryTransformer::AddAlignableVolumes() const
692 /// Set symbolic names and matrices to alignable objects to TGeo
694 if ( ! gGeoManager ) {
695 AliWarning("TGeoManager not defined.");
700 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
701 AliMUONGeometryModuleTransformer* module
702 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
704 // Set module symbolic name
706 = gGeoManager->SetAlignableEntry(GetModuleSymName(module->GetModuleId()),
707 module->GetVolumePath());
710 << "Volume path for geometry module "
711 << module->GetModuleId()
712 << " not found in geometry." << endl;
716 pnEntry->SetMatrix(new TGeoHMatrix(*module->GetTransformation()));
717 // the matrix will be deleted via TGeoManager
720 // Detection elements
721 AliMpExMap* detElements = module->GetDetElementStore();
723 for (Int_t j=0; j<detElements->GetSize(); j++) {
724 AliMUONGeometryDetElement* detElement
725 = (AliMUONGeometryDetElement*)detElements->GetObject(j);
727 // Set detection element symbolic name
729 = gGeoManager->SetAlignableEntry(GetDESymName(detElement->GetId()),
730 detElement->GetVolumePath());
733 << "Volume path for detection element "
734 << detElement->GetId()
735 << " not found in geometry." << endl;
738 // Set detection element matrix
739 pnEntry->SetMatrix(new TGeoHMatrix(*detElement->GetGlobalTransformation()));
740 // the matrix will be deleted via TGeoManager
746 //_____________________________________________________________________________
747 TClonesArray* AliMUONGeometryTransformer::CreateZeroAlignmentData() const
749 /// Create array with zero alignment data
751 // Create array for zero-alignment objects
752 TClonesArray* array = new TClonesArray("AliAlignObjMatrix", 200);
753 TClonesArray& refArray =*array;
754 array->SetOwner(true);
760 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
761 AliMUONGeometryModuleTransformer* module
762 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
764 Int_t moduleId = module->GetModuleId();
767 Int_t volId = AliGeomManager::LayerToVolUID(AliGeomManager::kMUON, moduleId);
769 // Create mis align matrix
770 Int_t pos = array->GetEntriesFast();
771 new (refArray[pos]) AliAlignObjMatrix(GetModuleSymName(moduleId), volId, matrix, kTRUE);
774 // Detection elements
775 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
776 AliMUONGeometryModuleTransformer* moduleTransformer
777 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
778 AliMpExMap* detElements = moduleTransformer->GetDetElementStore();
780 for (Int_t j=0; j<detElements->GetSize(); j++) {
781 AliMUONGeometryDetElement* detElement
782 = (AliMUONGeometryDetElement*)detElements->GetObject(j);
784 Int_t detElemId = detElement->GetId();
787 Int_t volId = AliGeomManager::LayerToVolUID(AliGeomManager::kMUON, detElemId);
789 // Create mis align matrix
790 Int_t pos = array->GetEntriesFast();
791 new (refArray[pos]) AliAlignObjMatrix(GetDESymName(detElemId), volId, matrix, kTRUE);
798 //_____________________________________________________________________________
799 void AliMUONGeometryTransformer::ClearMisAlignmentData()
801 /// Clear the array of misalignment data
803 if ( ! fMisAlignArray ) return;
805 fMisAlignArray->Delete();
808 //_____________________________________________________________________________
809 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
810 Float_t xg, Float_t yg, Float_t zg,
811 Float_t& xl, Float_t& yl, Float_t& zl) const
813 /// Transform point from the global reference frame (ALIC)
814 /// to the local reference frame of the detection element specified
817 const AliMUONGeometryModuleTransformer* kTransformer
818 = GetModuleTransformerByDEId(detElemId);
821 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
824 //_____________________________________________________________________________
825 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
826 Double_t xg, Double_t yg, Double_t zg,
827 Double_t& xl, Double_t& yl, Double_t& zl) const
829 /// Transform point from the global reference frame (ALIC)
830 /// to the local reference frame of the detection element specified
833 const AliMUONGeometryModuleTransformer* kTransformer
834 = GetModuleTransformerByDEId(detElemId);
837 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
840 //_____________________________________________________________________________
841 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
842 Float_t xl, Float_t yl, Float_t zl,
843 Float_t& xg, Float_t& yg, Float_t& zg) const
845 /// Transform point from the local reference frame of the detection element
846 /// specified by detElemId to the global reference frame (ALIC).
848 const AliMUONGeometryModuleTransformer* kTransformer
849 = GetModuleTransformerByDEId(detElemId);
852 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
855 //_____________________________________________________________________________
856 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
857 Double_t xl, Double_t yl, Double_t zl,
858 Double_t& xg, Double_t& yg, Double_t& zg) const
860 /// Transform point from the local reference frame of the detection element
861 /// specified by detElemId to the global reference frame (ALIC).
863 const AliMUONGeometryModuleTransformer* kTransformer
864 = GetModuleTransformerByDEId(detElemId);
867 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
870 //_____________________________________________________________________________
871 const AliMUONGeometryModuleTransformer*
872 AliMUONGeometryTransformer::GetModuleTransformer(Int_t index, Bool_t warn) const
874 /// Return the geometry module transformer specified by index
876 return GetModuleTransformerNonConst(index, warn);
879 //_____________________________________________________________________________
880 const AliMUONGeometryModuleTransformer*
881 AliMUONGeometryTransformer::GetModuleTransformerByDEId(Int_t detElemId,
884 /// Return the geometry module transformer specified by detection element ID
887 Int_t index = AliMpDEManager::GetGeomModuleId(detElemId);
889 return GetModuleTransformer(index, warn);
892 //_____________________________________________________________________________
893 const AliMUONGeometryDetElement*
894 AliMUONGeometryTransformer::GetDetElement(Int_t detElemId, Bool_t warn) const
896 /// Return detection element with given detElemId
898 const AliMUONGeometryModuleTransformer* kTransformer
899 = GetModuleTransformerByDEId(detElemId, warn);
901 if (!kTransformer) return 0;
903 return kTransformer->GetDetElement(detElemId, warn);
906 //_____________________________________________________________________________
907 Bool_t AliMUONGeometryTransformer::HasDE(Int_t detElemId) const
909 /// Return true if detection element with given detElemId is defined
911 const AliMUONGeometryModuleTransformer* kTransformer
912 = GetModuleTransformerByDEId(detElemId, false);
914 if (!kTransformer) return false;
916 return ( kTransformer->GetDetElement(detElemId, false) != 0 );