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 "AliMUONGeometryStore.h"
28 #include "AliMUONGeometryBuilder.h"
31 #include "AliAlignObjMatrix.h"
32 #include "AliAlignObj.h"
34 #include <Riostream.h>
36 #include <TClonesArray.h>
37 #include <TGeoManager.h>
38 #include <TGeoPhysicalNode.h>
44 ClassImp(AliMUONGeometryTransformer)
47 //______________________________________________________________________________
48 AliMUONGeometryTransformer::AliMUONGeometryTransformer(Bool_t isOwner)
50 fModuleTransformers(0),
53 /// Standard constructor
55 // Create array for geometry modules
56 fModuleTransformers = new TObjArray();
57 fModuleTransformers->SetOwner(isOwner);
60 //______________________________________________________________________________
61 AliMUONGeometryTransformer::AliMUONGeometryTransformer()
63 fModuleTransformers(0),
66 /// Default constructor
69 //______________________________________________________________________________
70 AliMUONGeometryTransformer::~AliMUONGeometryTransformer()
74 delete fModuleTransformers;
75 delete fMisAlignArray;
82 //_____________________________________________________________________________
83 AliMUONGeometryModuleTransformer*
84 AliMUONGeometryTransformer::GetModuleTransformerNonConst(
85 Int_t index, Bool_t warn) const
87 /// Return the geometry module specified by index
89 if (index < 0 || index >= fModuleTransformers->GetEntriesFast()) {
92 << "Index: " << index << " outside limits" << std::endl;
97 return (AliMUONGeometryModuleTransformer*) fModuleTransformers->At(index);
100 //______________________________________________________________________________
101 TGeoHMatrix AliMUONGeometryTransformer::GetTransform(
102 Double_t x, Double_t y, Double_t z,
103 Double_t a1, Double_t a2, Double_t a3,
104 Double_t a4, Double_t a5, Double_t a6) const
106 /// Build the transformation from the given parameters
109 return TGeoCombiTrans(TGeoTranslation(x, y, z),
110 TGeoRotation("rot", a1, a2, a3, a4, a5, a6));
114 //______________________________________________________________________________
115 void AliMUONGeometryTransformer::FillModuleVolPath(Int_t moduleId,
116 const TString& volPath)
118 /// Create module with the given moduleId and volPath
120 // Get/Create geometry module transformer
121 AliMUONGeometryModuleTransformer* moduleTransformer
122 = GetModuleTransformerNonConst(moduleId, false);
124 if ( !moduleTransformer ) {
125 moduleTransformer = new AliMUONGeometryModuleTransformer(moduleId);
126 AddModuleTransformer(moduleTransformer);
128 moduleTransformer->SetVolumePath(volPath);
131 //______________________________________________________________________________
132 void AliMUONGeometryTransformer::FillDetElemVolPath(Int_t detElemId,
133 const TString& volPath)
135 /// Create detection element with the given detElemId and volPath
138 Int_t moduleId = AliMUONGeometryStore::GetModuleId(detElemId);
140 // Get detection element store
141 AliMUONGeometryStore* detElements =
142 GetModuleTransformer(moduleId)->GetDetElementStore();
144 // Add detection element
145 AliMUONGeometryDetElement* detElement
146 = new AliMUONGeometryDetElement(detElemId, volPath);
147 detElements->Add(detElemId, detElement);
151 //______________________________________________________________________________
152 void AliMUONGeometryTransformer::FillModuleTransform(Int_t moduleId,
153 Double_t x, Double_t y, Double_t z,
154 Double_t a1, Double_t a2, Double_t a3,
155 Double_t a4, Double_t a5, Double_t a6)
157 /// Fill the transformation of the module.
159 // Get/Create geometry module transformer
161 // Modules numbers in the file are starting from 1
163 AliMUONGeometryModuleTransformer* moduleTransformer
164 = GetModuleTransformerNonConst(moduleId, false);
166 if ( !moduleTransformer) {
168 << "Module " << moduleId << " has not volume path defined." << endl;
171 // Build the transformation from the parameters
172 TGeoHMatrix transform
173 = GetTransform(x, y, z, a1, a2, a3, a4, a5, a6);
175 moduleTransformer->SetTransformation(transform);
178 //______________________________________________________________________________
179 void AliMUONGeometryTransformer::FillDetElemTransform(
181 Double_t x, Double_t y, Double_t z,
182 Double_t a1, Double_t a2, Double_t a3,
183 Double_t a4, Double_t a5, Double_t a6)
185 /// Fill the transformation of the detection element.
188 Int_t moduleId = AliMUONGeometryStore::GetModuleId(detElemId);
190 // Get module transformer
191 const AliMUONGeometryModuleTransformer* kModuleTransformer
192 = GetModuleTransformer(moduleId);
194 if ( ! kModuleTransformer ) {
195 AliFatal(Form("Module transformer not defined, detElemId: %d", detElemId));
199 // Get detection element
200 AliMUONGeometryDetElement* detElement
201 = kModuleTransformer->GetDetElement(detElemId);
203 if ( ! detElement ) {
204 AliFatal(Form("Det element %d has not volume path defined", detElemId));
208 // Build the transformation from the parameters
209 TGeoHMatrix localTransform
210 = GetTransform(x, y, z, a1, a2, a3, a4, a5, a6);
211 detElement->SetLocalTransformation(localTransform);
213 // Compute global transformation
214 TGeoHMatrix globalTransform
215 = AliMUONGeometryBuilder::Multiply(
216 *kModuleTransformer->GetTransformation(),
218 detElement->SetGlobalTransformation(globalTransform);
221 //______________________________________________________________________________
223 AliMUONGeometryTransformer::ReadVolPaths(ifstream& in)
225 /// Read modules and detection element volume paths from stream
228 TString key, volumePath;
231 while ( !in.eof() ) {
233 in >> id >> volumePath;
235 // cout << "id=" << id << " "
236 // << "volPath= " << volumePath
239 if ( key == TString("CH") )
240 FillModuleVolPath(id, volumePath);
242 else if ( key == TString("DE") )
243 FillDetElemVolPath(id, volumePath);
246 AliFatal(Form("%s key not recognized", key.Data()));
255 //______________________________________________________________________________
256 TString AliMUONGeometryTransformer::ReadModuleTransforms(ifstream& in)
258 /// Read and fill modules transformations from the stream.
259 /// Return true, if reading finished correctly.
262 while ( key == TString("CH") ) {
265 Double_t a1, a2, a3, a4, a5, a6;
281 //cout << "moduleId=" << id << " "
282 // << "position= " << x << ", " << y << ", " << z << " "
283 // << "rotation= " << a1 << ", " << a2 << ", " << a3 << ", "
284 // << a4 << ", " << a5 << ", " << a6
288 FillModuleTransform(id, x, y, z, a1, a2, a3, a4, a5, a6);
297 //______________________________________________________________________________
298 TString AliMUONGeometryTransformer::ReadDetElemTransforms(ifstream& in)
300 /// Read detection elements transformations from the stream.
301 /// Return true, if reading finished correctly.
304 while ( key == TString("DE") ) {
309 Double_t a1, a2, a3, a4, a5, a6;
325 //cout << "detElemId=" << detElemId << " "
326 // << "position= " << x << ", " << y << ", " << z << " "
327 // << "rotation= " << a1 << ", " << a2 << ", " << a3 << ", "
328 // << a4 << ", " << a5 << ", " << a6
332 FillDetElemTransform(detElemId, x, y, z, a1, a2, a3, a4, a5, a6);
341 //______________________________________________________________________________
343 AliMUONGeometryTransformer::LoadTransforms(TGeoManager* tgeoManager)
345 /// Load transformations for defined modules and detection elements
346 /// from the root file
349 AliFatal("No TGeoManager defined.");
353 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
354 AliMUONGeometryModuleTransformer* moduleTransformer
355 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
358 TString path = moduleTransformer->GetVolumePath();
360 // Make physical node
361 TGeoPhysicalNode* moduleNode = tgeoManager->MakePhysicalNode(path);
362 if ( ! moduleNode ) {
364 << "Module id: " << moduleTransformer->GetModuleId()
365 << " volume path: " << path << " not found in geometry." << endl;
369 // Set matrix from physical node
370 TGeoHMatrix matrix = *moduleNode->GetMatrix();
371 moduleTransformer->SetTransformation(matrix);
373 // Loop over detection elements
374 AliMUONGeometryStore* detElements
375 = moduleTransformer->GetDetElementStore();
377 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
378 AliMUONGeometryDetElement* detElement
379 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
382 TString dePath = detElement->GetVolumePath();
384 // Make physical node
385 TGeoPhysicalNode* deNode = tgeoManager->MakePhysicalNode(dePath);
388 << "Det element id: " << detElement->GetId()
389 << " volume path: " << path << " not found in geometry." << endl;
393 // Set global matrix from physical node
394 TGeoHMatrix globalMatrix = *deNode->GetMatrix();
395 detElement->SetGlobalTransformation(globalMatrix);
398 TGeoHMatrix localMatrix =
399 AliMUONGeometryBuilder::Multiply(
400 matrix.Inverse(), globalMatrix );
401 detElement->SetLocalTransformation(localMatrix);
407 //______________________________________________________________________________
409 AliMUONGeometryTransformer::ReadVolPaths(const TString& fileName)
411 /// Read detection element volume paths from a file.
412 /// Return true, if reading finished correctly.
415 TString filePath = gSystem->Getenv("ALICE_ROOT");
416 filePath += "/MUON/data/";
417 filePath += fileName;
420 ifstream in(filePath, ios::in);
422 cerr << filePath << endl;
423 AliFatal("File not found.");
431 //______________________________________________________________________________
433 AliMUONGeometryTransformer::ReadTransformations(const TString& fileName)
435 /// Read transformations from a file.
436 /// Return true, if reading finished correctly.
439 TString filePath = gSystem->Getenv("ALICE_ROOT");
440 filePath += "/MUON/data/";
441 filePath += fileName;
444 ifstream in(filePath, ios::in);
446 cerr << filePath << endl;
447 AliFatal("File not found.");
453 while ( !in.eof() ) {
454 if (key == TString("CH"))
455 key = ReadModuleTransforms(in);
456 else if (key == TString("DE"))
457 key = ReadDetElemTransforms(in);
459 AliFatal(Form("%s key not recognized", key.Data()));
467 //______________________________________________________________________________
469 AliMUONGeometryTransformer::ReadTransformations2(const TString& fileName)
471 /// Read transformations from root geometry file.
472 /// Return true, if reading finished correctly.
475 TString filePath = gSystem->Getenv("ALICE_ROOT");
476 filePath += "/MUON/data/";
477 filePath += fileName;
479 // Load root geometry
480 TGeoManager* tgeoManager = TGeoManager::Import(fileName);
483 LoadTransforms(tgeoManager);
488 //______________________________________________________________________________
489 void AliMUONGeometryTransformer::WriteTransform(ofstream& out,
490 const TGeoMatrix* transform) const
492 /// Write given transformation
495 const Double_t* xyz = transform->GetTranslation();
496 out << setw(10) << setprecision(4) << xyz[0] << " "
497 << setw(10) << setprecision(4) << xyz[1] << " "
498 << setw(10) << setprecision(4) << xyz[2];
501 const Double_t* rm = transform->GetRotationMatrix();
502 TGeoRotation rotation;
503 rotation.SetMatrix(const_cast<Double_t*>(rm));
504 Double_t a1, a2, a3, a4, a5, a6;
505 rotation.GetAngles(a1, a2, a3, a4, a5, a6);
507 out << setw(8) << setprecision(4) << a1 << " "
508 << setw(8) << setprecision(4) << a2 << " "
509 << setw(8) << setprecision(4) << a3 << " "
510 << setw(8) << setprecision(4) << a4 << " "
511 << setw(8) << setprecision(4) << a5 << " "
512 << setw(8) << setprecision(4) << a6 << " " << endl;
515 //______________________________________________________________________________
516 void AliMUONGeometryTransformer::WriteModuleVolPaths(ofstream& out) const
518 /// Write module volume paths for all module transformers
520 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
521 AliMUONGeometryModuleTransformer* moduleTransformer
522 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
526 << setw(4) << moduleTransformer->GetModuleId() << " "
527 << moduleTransformer->GetVolumePath() << endl;
532 //______________________________________________________________________________
533 void AliMUONGeometryTransformer::WriteDetElemVolPaths(ofstream& out) const
535 /// Write detection element volume paths for all detection elements in all
536 /// module transformers
538 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
539 AliMUONGeometryModuleTransformer* moduleTransformer
540 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
541 AliMUONGeometryStore* detElements
542 = moduleTransformer->GetDetElementStore();
544 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
545 AliMUONGeometryDetElement* detElement
546 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
550 << setw(4) << detElement->GetId() << " "
551 << detElement->GetVolumePath() << endl;
557 //______________________________________________________________________________
558 void AliMUONGeometryTransformer::WriteModuleTransforms(ofstream& out) const
560 /// Write module transformations for all module transformers
562 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
563 AliMUONGeometryModuleTransformer* moduleTransformer
564 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
565 const TGeoMatrix* transform
566 = moduleTransformer->GetTransformation();
570 << setw(4) << moduleTransformer->GetModuleId() + 1;
572 WriteTransform(out, transform);
577 //______________________________________________________________________________
578 void AliMUONGeometryTransformer::WriteDetElemTransforms(ofstream& out) const
580 /// Write detection element transformations for all detection elements in all
581 /// module transformers
583 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
584 AliMUONGeometryModuleTransformer* moduleTransformer
585 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
586 AliMUONGeometryStore* detElements
587 = moduleTransformer->GetDetElementStore();
589 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
590 AliMUONGeometryDetElement* detElement
591 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
592 const TGeoMatrix* transform
593 = detElement->GetLocalTransformation();
596 out << "DE " << setw(4) << detElement->GetId();
598 WriteTransform(out, transform);
608 //______________________________________________________________________________
610 AliMUONGeometryTransformer::ReadGeometryData(
611 const TString& volPathFileName,
612 const TString& transformFileName)
614 /// Read geometry data from given files;
615 /// if transformFileName has ".root" extension, the transformations
616 /// are loaded from root geometry file, otherwise ASCII file
617 /// format is supposed
619 Bool_t result1 = ReadVolPaths(volPathFileName);
621 // Get file extension
622 std::string fileName = transformFileName.Data();
623 std::string rootExt = fileName.substr(fileName.size()-5, fileName.size());
625 if ( rootExt != ".root" )
626 result2 = ReadTransformations(transformFileName);
628 result2 = ReadTransformations2(transformFileName);
630 return result1 && result2;
633 //______________________________________________________________________________
635 AliMUONGeometryTransformer::ReadGeometryData(
636 const TString& volPathFileName,
637 TGeoManager* tgeoManager)
639 /// Load geometry data from root geometry using defined
640 /// volume paths from file
642 Bool_t result1 = ReadVolPaths(volPathFileName);
644 Bool_t result2 = LoadTransforms(tgeoManager);
646 return result1 && result2;
649 //______________________________________________________________________________
651 AliMUONGeometryTransformer::WriteGeometryData(
652 const TString& volPathFileName,
653 const TString& transformFileName,
654 const TString& misalignFileName) const
656 /// Write geometry data into given files
658 Bool_t result1 = WriteVolumePaths(volPathFileName);
659 Bool_t result2 = WriteTransformations(transformFileName);
661 Bool_t result3 = true;
662 if ( misalignFileName != "" )
663 result3 = WriteMisAlignmentData(misalignFileName);
665 return result1 && result2 && result3;
668 //______________________________________________________________________________
670 AliMUONGeometryTransformer::WriteVolumePaths(const TString& fileName) const
672 /// Write volume paths for modules and detection element volumes into a file.
673 /// Return true, if writing finished correctly.
676 // if builder is not associated with any geometry module
677 if (fModuleTransformers->GetEntriesFast() == 0) return false;
680 TString filePath = gSystem->Getenv("ALICE_ROOT");
681 filePath += "/MUON/data/";
682 filePath += fileName;
685 ofstream out(filePath, ios::out);
687 cerr << filePath << endl;
688 AliError("File not found.");
691 #if !defined (__DECCXX)
692 out.setf(std::ios::fixed);
694 WriteModuleVolPaths(out);
695 WriteDetElemVolPaths(out);
700 //______________________________________________________________________________
702 AliMUONGeometryTransformer::WriteTransformations(const TString& fileName) const
704 /// Write transformations into a file.
705 /// Return true, if writing finished correctly.
708 // if builder is not associated with any geometry module
709 if (fModuleTransformers->GetEntriesFast() == 0) return false;
712 TString filePath = gSystem->Getenv("ALICE_ROOT");
713 filePath += "/MUON/data/";
714 filePath += fileName;
717 ofstream out(filePath, ios::out);
719 cerr << filePath << endl;
720 AliError("File not found.");
723 #if !defined (__DECCXX)
724 out.setf(std::ios::fixed);
726 WriteModuleTransforms(out);
727 WriteDetElemTransforms(out);
732 //______________________________________________________________________________
734 AliMUONGeometryTransformer::WriteMisAlignmentData(const TString& fileName) const
736 /// Write misalignment data into a file
737 /// Return true, if writing finished correctly.
740 // if builder is not associated with any geometry module
741 if ( fModuleTransformers->GetEntriesFast() == 0 ) {
742 AliWarningStream() << "No geometry modules defined." << endl;
747 // if builder has no mis-alignment data
748 if ( ! fMisAlignArray ) {
749 AliWarningStream() << "No mis-alignment data defined." << endl;
754 TString filePath = gSystem->Getenv("ALICE_ROOT");
755 filePath += "/MUON/data/";
756 filePath += fileName;
758 // Write mis-alignment data in the root file
759 TFile file(fileName.Data(), "RECREATE");
760 fMisAlignArray->Write();
766 //_____________________________________________________________________________
767 void AliMUONGeometryTransformer::AddModuleTransformer(
768 AliMUONGeometryModuleTransformer* moduleTransformer)
770 /// Add the module transformer to the array
772 fModuleTransformers->AddAt(moduleTransformer,
773 moduleTransformer->GetModuleId());
776 //_____________________________________________________________________________
777 void AliMUONGeometryTransformer::AddMisAlignModule(Int_t moduleId,
778 const TGeoHMatrix& matrix)
780 /// Build AliAlignObjMatrix with module ID, its volumePath
781 /// and the given delta transformation matrix
783 if ( ! fMisAlignArray )
784 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
786 const AliMUONGeometryModuleTransformer* kTransformer
787 = GetModuleTransformer(moduleId);
788 if ( ! kTransformer ) {
789 AliErrorStream() << "Module " << moduleId << " not found." << endl;
794 TString path = kTransformer->GetVolumePath();
796 // Get unique align object ID
797 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, moduleId);
799 // Create mis align matrix
800 TClonesArray& refArray =*fMisAlignArray;
801 Int_t pos = fMisAlignArray->GetEntriesFast();
802 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId,
803 const_cast<TGeoHMatrix&>(matrix));
806 //_____________________________________________________________________________
807 void AliMUONGeometryTransformer::AddMisAlignDetElement(Int_t detElemId,
808 const TGeoHMatrix& matrix)
810 /// Build AliAlignObjMatrix with detection element ID, its volumePath
811 /// and the given delta transformation matrix
813 if ( ! fMisAlignArray )
814 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
816 const AliMUONGeometryDetElement* kDetElement
817 = GetDetElement(detElemId);
819 if ( ! kDetElement ) {
820 AliErrorStream() << "Det element " << detElemId << " not found." << endl;
825 TString path = kDetElement->GetVolumePath();
827 // Get unique align object ID
828 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, detElemId);
830 // Create mis align matrix
831 TClonesArray& refArray =*fMisAlignArray;
832 Int_t pos = fMisAlignArray->GetEntriesFast();
833 new(refArray[pos]) AliAlignObjMatrix(path.Data(), volId,
834 const_cast<TGeoHMatrix&>(matrix));
837 //_____________________________________________________________________________
838 TClonesArray* AliMUONGeometryTransformer::CreateZeroAlignmentData() const
840 /// Create array with zero alignment data
842 // Create array for zero-alignment objects
843 TClonesArray* array = new TClonesArray("AliAlignObjMatrix", 200);
844 TClonesArray& refArray =*array;
845 array->SetOwner(true);
851 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
852 AliMUONGeometryModuleTransformer* module
853 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
855 TString path = module->GetVolumePath();
856 Int_t moduleId = module->GetModuleId();
859 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, moduleId);
861 // Create mis align matrix
862 Int_t pos = array->GetEntriesFast();
863 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId, matrix);
866 // Detection elements
867 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
868 AliMUONGeometryModuleTransformer* moduleTransformer
869 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
870 AliMUONGeometryStore* detElements
871 = moduleTransformer->GetDetElementStore();
873 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
874 AliMUONGeometryDetElement* detElement
875 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
877 TString path = detElement->GetVolumePath();
878 Int_t detElemId = detElement->GetId();
881 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, detElemId);
883 // Create mis align matrix
884 Int_t pos = array->GetEntriesFast();
885 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId, matrix);
892 //_____________________________________________________________________________
893 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
894 Float_t xg, Float_t yg, Float_t zg,
895 Float_t& xl, Float_t& yl, Float_t& zl) const
897 /// Transform point from the global reference frame (ALIC)
898 /// to the local reference frame of the detection element specified
901 const AliMUONGeometryModuleTransformer* kTransformer
902 = GetModuleTransformerByDEId(detElemId);
905 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
908 //_____________________________________________________________________________
909 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
910 Double_t xg, Double_t yg, Double_t zg,
911 Double_t& xl, Double_t& yl, Double_t& zl) const
913 /// Transform point from the global reference frame (ALIC)
914 /// to the local reference frame of the detection element specified
917 const AliMUONGeometryModuleTransformer* kTransformer
918 = GetModuleTransformerByDEId(detElemId);
921 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
924 //_____________________________________________________________________________
925 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
926 Float_t xl, Float_t yl, Float_t zl,
927 Float_t& xg, Float_t& yg, Float_t& zg) const
929 /// Transform point from the local reference frame of the detection element
930 /// specified by detElemId to the global reference frame (ALIC).
932 const AliMUONGeometryModuleTransformer* kTransformer
933 = GetModuleTransformerByDEId(detElemId);
936 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
939 //_____________________________________________________________________________
940 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
941 Double_t xl, Double_t yl, Double_t zl,
942 Double_t& xg, Double_t& yg, Double_t& zg) const
944 /// Transform point from the local reference frame of the detection element
945 /// specified by detElemId to the global reference frame (ALIC).
947 const AliMUONGeometryModuleTransformer* kTransformer
948 = GetModuleTransformerByDEId(detElemId);
951 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
954 //_____________________________________________________________________________
955 const AliMUONGeometryModuleTransformer*
956 AliMUONGeometryTransformer::GetModuleTransformer(Int_t index, Bool_t warn) const
958 /// Return the geometry module transformer specified by index
960 return GetModuleTransformerNonConst(index, warn);
963 //_____________________________________________________________________________
964 const AliMUONGeometryModuleTransformer*
965 AliMUONGeometryTransformer::GetModuleTransformerByDEId(Int_t detElemId,
968 /// Return the geometry module transformer specified by detection element ID
971 Int_t index = AliMUONGeometryStore::GetModuleId(detElemId);
973 return GetModuleTransformer(index, warn);
976 //_____________________________________________________________________________
977 const AliMUONGeometryDetElement*
978 AliMUONGeometryTransformer::GetDetElement(Int_t detElemId, Bool_t warn) const
980 /// Return detection element with given detElemId
982 const AliMUONGeometryModuleTransformer* kTransformer
983 = GetModuleTransformerByDEId(detElemId, warn);
985 if (!kTransformer) return 0;
987 return kTransformer->GetDetElement(detElemId, warn);
990 //_____________________________________________________________________________
991 Bool_t AliMUONGeometryTransformer::HasDE(Int_t detElemId) const
993 /// Return true if detection element with given detElemId is defined
995 const AliMUONGeometryModuleTransformer* kTransformer
996 = GetModuleTransformerByDEId(detElemId, false);
998 if (!kTransformer) return false;
1000 return ( kTransformer->GetDetElement(detElemId, false) != 0 );