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>
43 ClassImp(AliMUONGeometryTransformer)
45 //______________________________________________________________________________
46 AliMUONGeometryTransformer::AliMUONGeometryTransformer(Bool_t isOwner)
48 fModuleTransformers(0),
51 /// Standard constructor
53 // Create array for geometry modules
54 fModuleTransformers = new TObjArray();
55 fModuleTransformers->SetOwner(isOwner);
58 //______________________________________________________________________________
59 AliMUONGeometryTransformer::AliMUONGeometryTransformer()
61 fModuleTransformers(0),
64 /// Default constructor
67 //______________________________________________________________________________
68 AliMUONGeometryTransformer::AliMUONGeometryTransformer(
69 const AliMUONGeometryTransformer& right)
72 /// Copy constructor (not implemented)
74 AliFatal("Copy constructor not provided.");
77 //______________________________________________________________________________
78 AliMUONGeometryTransformer::~AliMUONGeometryTransformer()
82 delete fModuleTransformers;
83 delete fMisAlignArray;
86 //______________________________________________________________________________
87 AliMUONGeometryTransformer&
88 AliMUONGeometryTransformer::operator=(const AliMUONGeometryTransformer& right)
90 /// Assignement operator (not implemented)
92 // check assignement to self
93 if (this == &right) return *this;
95 AliFatal("Assignement operator not provided.");
104 //_____________________________________________________________________________
105 AliMUONGeometryModuleTransformer*
106 AliMUONGeometryTransformer::GetModuleTransformerNonConst(
107 Int_t index, Bool_t warn) const
109 /// Return the geometry module specified by index
111 if (index < 0 || index >= fModuleTransformers->GetEntriesFast()) {
114 << "Index: " << index << " outside limits" << std::endl;
119 return (AliMUONGeometryModuleTransformer*) fModuleTransformers->At(index);
122 //______________________________________________________________________________
123 TGeoHMatrix AliMUONGeometryTransformer::GetTransform(
124 Double_t x, Double_t y, Double_t z,
125 Double_t a1, Double_t a2, Double_t a3,
126 Double_t a4, Double_t a5, Double_t a6) const
128 // Builds the transformation from the given parameters
132 return TGeoCombiTrans(TGeoTranslation(x, y, z),
133 TGeoRotation("rot", a1, a2, a3, a4, a5, a6));
137 //______________________________________________________________________________
138 void AliMUONGeometryTransformer::FillModuleVolPath(Int_t moduleId,
139 const TString& volPath)
141 // Create module with the given moduleId and volPath
144 // Get/Create geometry module transformer
145 AliMUONGeometryModuleTransformer* moduleTransformer
146 = GetModuleTransformerNonConst(moduleId, false);
148 if ( !moduleTransformer ) {
149 moduleTransformer = new AliMUONGeometryModuleTransformer(moduleId);
150 AddModuleTransformer(moduleTransformer);
152 moduleTransformer->SetVolumePath(volPath);
155 //______________________________________________________________________________
156 void AliMUONGeometryTransformer::FillDetElemVolPath(Int_t detElemId,
157 const TString& volPath)
159 // Create detection element with the given detElemId and volPath
162 Int_t moduleId = AliMUONGeometryStore::GetModuleId(detElemId);
164 // Get detection element store
165 AliMUONGeometryStore* detElements =
166 GetModuleTransformer(moduleId)->GetDetElementStore();
168 // Add detection element
169 AliMUONGeometryDetElement* detElement
170 = new AliMUONGeometryDetElement(detElemId, volPath);
171 detElements->Add(detElemId, detElement);
175 //______________________________________________________________________________
176 void AliMUONGeometryTransformer::FillModuleTransform(Int_t moduleId,
177 Double_t x, Double_t y, Double_t z,
178 Double_t a1, Double_t a2, Double_t a3,
179 Double_t a4, Double_t a5, Double_t a6)
181 // Fill the transformation of the module.
184 // Get/Create geometry module transformer
186 // Modules numbers in the file are starting from 1
188 AliMUONGeometryModuleTransformer* moduleTransformer
189 = GetModuleTransformerNonConst(moduleId, false);
191 if ( !moduleTransformer) {
193 << "Module " << moduleId << " has not volume path defined." << endl;
196 // Build the transformation from the parameters
197 TGeoHMatrix transform
198 = GetTransform(x, y, z, a1, a2, a3, a4, a5, a6);
200 moduleTransformer->SetTransformation(transform);
203 //______________________________________________________________________________
204 void AliMUONGeometryTransformer::FillDetElemTransform(
206 Double_t x, Double_t y, Double_t z,
207 Double_t a1, Double_t a2, Double_t a3,
208 Double_t a4, Double_t a5, Double_t a6)
210 // Fill the transformation of the detection element.
214 Int_t moduleId = AliMUONGeometryStore::GetModuleId(detElemId);
216 // Get module transformer
217 const AliMUONGeometryModuleTransformer* kModuleTransformer
218 = GetModuleTransformer(moduleId);
220 if ( ! kModuleTransformer ) {
221 AliFatal(Form("Module transformer not defined, detElemId: %d", detElemId));
225 // Get detection element
226 AliMUONGeometryDetElement* detElement
227 = kModuleTransformer->GetDetElement(detElemId);
229 if ( ! detElement ) {
230 AliFatal(Form("Det element %d has not volume path defined", detElemId));
234 // Build the transformation from the parameters
235 TGeoHMatrix localTransform
236 = GetTransform(x, y, z, a1, a2, a3, a4, a5, a6);
237 detElement->SetLocalTransformation(localTransform);
239 // Compute global transformation
240 TGeoHMatrix globalTransform
241 = AliMUONGeometryBuilder::Multiply(
242 *kModuleTransformer->GetTransformation(),
244 detElement->SetGlobalTransformation(globalTransform);
247 //______________________________________________________________________________
249 AliMUONGeometryTransformer::ReadVolPaths(ifstream& in)
251 // Reads modules and detection element volume paths from stream
255 TString key, volumePath;
258 while ( !in.eof() ) {
260 in >> id >> volumePath;
262 // cout << "id=" << id << " "
263 // << "volPath= " << volumePath
266 if ( key == TString("CH") )
267 FillModuleVolPath(id, volumePath);
269 else if ( key == TString("DE") )
270 FillDetElemVolPath(id, volumePath);
273 AliFatal(Form("%s key not recognized", key.Data()));
282 //______________________________________________________________________________
283 TString AliMUONGeometryTransformer::ReadModuleTransforms(ifstream& in)
285 // Reads and fills modules transformations from a file
286 // Returns true, if reading finished correctly.
290 while ( key == TString("CH") ) {
293 Double_t a1, a2, a3, a4, a5, a6;
309 //cout << "moduleId=" << id << " "
310 // << "position= " << x << ", " << y << ", " << z << " "
311 // << "rotation= " << a1 << ", " << a2 << ", " << a3 << ", "
312 // << a4 << ", " << a5 << ", " << a6
316 FillModuleTransform(id, x, y, z, a1, a2, a3, a4, a5, a6);
325 //______________________________________________________________________________
326 TString AliMUONGeometryTransformer::ReadDetElemTransforms(ifstream& in)
328 // Reads detection elements transformations from a file
329 // Returns true, if reading finished correctly.
333 while ( key == TString("DE") ) {
338 Double_t a1, a2, a3, a4, a5, a6;
354 //cout << "detElemId=" << detElemId << " "
355 // << "position= " << x << ", " << y << ", " << z << " "
356 // << "rotation= " << a1 << ", " << a2 << ", " << a3 << ", "
357 // << a4 << ", " << a5 << ", " << a6
361 FillDetElemTransform(detElemId, x, y, z, a1, a2, a3, a4, a5, a6);
370 //______________________________________________________________________________
372 AliMUONGeometryTransformer::LoadTransforms(TGeoManager* tgeoManager)
374 /// Loads transformations for defined modules and detection elements
375 /// from the root file
378 AliFatal("No TGeoManager defined.");
382 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
383 AliMUONGeometryModuleTransformer* moduleTransformer
384 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
387 TString path = moduleTransformer->GetVolumePath();
389 // Make physical node
390 TGeoPhysicalNode* moduleNode = tgeoManager->MakePhysicalNode(path);
391 if ( ! moduleNode ) {
393 << "Module id: " << moduleTransformer->GetModuleId()
394 << " volume path: " << path << " not found in geometry." << endl;
398 // Set matrix from physical node
399 TGeoHMatrix matrix = *moduleNode->GetMatrix();
400 moduleTransformer->SetTransformation(matrix);
402 // Loop over detection elements
403 AliMUONGeometryStore* detElements
404 = moduleTransformer->GetDetElementStore();
406 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
407 AliMUONGeometryDetElement* detElement
408 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
411 TString dePath = detElement->GetVolumePath();
413 // Make physical node
414 TGeoPhysicalNode* deNode = tgeoManager->MakePhysicalNode(dePath);
417 << "Det element id: " << detElement->GetId()
418 << " volume path: " << path << " not found in geometry." << endl;
422 // Set global matrix from physical node
423 TGeoHMatrix globalMatrix = *deNode->GetMatrix();
424 detElement->SetGlobalTransformation(globalMatrix);
427 TGeoHMatrix localMatrix =
428 AliMUONGeometryBuilder::Multiply(
429 matrix.Inverse(), globalMatrix );
430 detElement->SetLocalTransformation(localMatrix);
436 //______________________________________________________________________________
438 AliMUONGeometryTransformer::ReadVolPaths(const TString& fileName)
440 // Reads detection element volume paths from a file
441 // Returns true, if reading finished correctly.
445 TString filePath = gSystem->Getenv("ALICE_ROOT");
446 filePath += "/MUON/data/";
447 filePath += fileName;
450 ifstream in(filePath, ios::in);
452 cerr << filePath << endl;
453 AliFatal("File not found.");
461 //______________________________________________________________________________
463 AliMUONGeometryTransformer::ReadTransformations(const TString& fileName)
465 // Reads transformations from a file
466 // Returns true, if reading finished correctly.
470 TString filePath = gSystem->Getenv("ALICE_ROOT");
471 filePath += "/MUON/data/";
472 filePath += fileName;
475 ifstream in(filePath, ios::in);
477 cerr << filePath << endl;
478 AliFatal("File not found.");
484 while ( !in.eof() ) {
485 if (key == TString("CH"))
486 key = ReadModuleTransforms(in);
487 else if (key == TString("DE"))
488 key = ReadDetElemTransforms(in);
490 AliFatal(Form("%s key not recognized", key.Data()));
498 //______________________________________________________________________________
500 AliMUONGeometryTransformer::ReadTransformations2(const TString& fileName)
502 // Reads transformations from root geometry file
503 // Returns true, if reading finished correctly.
507 TString filePath = gSystem->Getenv("ALICE_ROOT");
508 filePath += "/MUON/data/";
509 filePath += fileName;
511 // Load root geometry
512 TGeoManager* tgeoManager = TGeoManager::Import(fileName);
515 LoadTransforms(tgeoManager);
520 //______________________________________________________________________________
521 void AliMUONGeometryTransformer::WriteTransform(ofstream& out,
522 const TGeoMatrix* transform) const
524 // Writes the transformations
528 const Double_t* xyz = transform->GetTranslation();
529 out << setw(10) << setprecision(4) << xyz[0] << " "
530 << setw(10) << setprecision(4) << xyz[1] << " "
531 << setw(10) << setprecision(4) << xyz[2];
534 const Double_t* rm = transform->GetRotationMatrix();
535 TGeoRotation rotation;
536 rotation.SetMatrix(const_cast<Double_t*>(rm));
537 Double_t a1, a2, a3, a4, a5, a6;
538 rotation.GetAngles(a1, a2, a3, a4, a5, a6);
540 out << setw(8) << setprecision(4) << a1 << " "
541 << setw(8) << setprecision(4) << a2 << " "
542 << setw(8) << setprecision(4) << a3 << " "
543 << setw(8) << setprecision(4) << a4 << " "
544 << setw(8) << setprecision(4) << a5 << " "
545 << setw(8) << setprecision(4) << a6 << " " << endl;
548 //______________________________________________________________________________
549 void AliMUONGeometryTransformer::WriteModuleVolPaths(ofstream& out) const
551 // Write modules volume paths
553 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
554 AliMUONGeometryModuleTransformer* moduleTransformer
555 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
559 << setw(4) << moduleTransformer->GetModuleId() << " "
560 << moduleTransformer->GetVolumePath() << endl;
565 //______________________________________________________________________________
566 void AliMUONGeometryTransformer::WriteDetElemVolPaths(ofstream& out) const
568 // Write detection elements volume paths
570 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
571 AliMUONGeometryModuleTransformer* moduleTransformer
572 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
573 AliMUONGeometryStore* detElements
574 = moduleTransformer->GetDetElementStore();
576 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
577 AliMUONGeometryDetElement* detElement
578 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
582 << setw(4) << detElement->GetId() << " "
583 << detElement->GetVolumePath() << endl;
589 //______________________________________________________________________________
590 void AliMUONGeometryTransformer::WriteModuleTransforms(ofstream& out) const
592 // Write modules transformations
594 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
595 AliMUONGeometryModuleTransformer* moduleTransformer
596 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
597 const TGeoMatrix* transform
598 = moduleTransformer->GetTransformation();
602 << setw(4) << moduleTransformer->GetModuleId() + 1;
604 WriteTransform(out, transform);
609 //______________________________________________________________________________
610 void AliMUONGeometryTransformer::WriteDetElemTransforms(ofstream& out) const
612 // Writes detection elements transformations
615 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
616 AliMUONGeometryModuleTransformer* moduleTransformer
617 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
618 AliMUONGeometryStore* detElements
619 = moduleTransformer->GetDetElementStore();
621 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
622 AliMUONGeometryDetElement* detElement
623 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
624 const TGeoMatrix* transform
625 = detElement->GetLocalTransformation();
628 out << "DE " << setw(4) << detElement->GetId();
630 WriteTransform(out, transform);
640 //______________________________________________________________________________
642 AliMUONGeometryTransformer::ReadGeometryData(
643 const TString& volPathFileName,
644 const TString& transformFileName)
646 /// Read geometry data from given files;
647 /// if transformFileName has ".root" extension, the transformations
648 /// are loaded from root geometry file, otherwise ASCII file
649 /// format is supposed
651 Bool_t result1 = ReadVolPaths(volPathFileName);
653 // Get file extension
654 std::string fileName = transformFileName.Data();
655 std::string rootExt = fileName.substr(fileName.size()-5, fileName.size());
657 if ( rootExt != ".root" )
658 result2 = ReadTransformations(transformFileName);
660 result2 = ReadTransformations2(transformFileName);
662 return result1 && result2;
665 //______________________________________________________________________________
667 AliMUONGeometryTransformer::ReadGeometryData(
668 const TString& volPathFileName,
669 TGeoManager* tgeoManager)
671 /// Load geometry data from root geometry using defined
672 /// voluem paths from file
674 Bool_t result1 = ReadVolPaths(volPathFileName);
676 Bool_t result2 = LoadTransforms(tgeoManager);
678 return result1 && result2;
681 //______________________________________________________________________________
683 AliMUONGeometryTransformer::WriteGeometryData(
684 const TString& volPathFileName,
685 const TString& transformFileName,
686 const TString& misalignFileName) const
688 /// Write geometry data into given files
690 Bool_t result1 = WriteVolumePaths(volPathFileName);
691 Bool_t result2 = WriteTransformations(transformFileName);
693 Bool_t result3 = true;
694 if ( misalignFileName != "" )
695 result3 = WriteMisAlignmentData(misalignFileName);
697 return result1 && result2 && result3;
700 //______________________________________________________________________________
702 AliMUONGeometryTransformer::WriteVolumePaths(const TString& fileName) const
704 // Writes volume paths for modules and detection element volumes into a file
705 // Returns true, if writing finished correctly.
709 // if builder is not associated with any geometry module
710 if (fModuleTransformers->GetEntriesFast() == 0) return false;
713 TString filePath = gSystem->Getenv("ALICE_ROOT");
714 filePath += "/MUON/data/";
715 filePath += fileName;
718 ofstream out(filePath, ios::out);
720 cerr << filePath << endl;
721 AliError("File not found.");
724 #if !defined (__DECCXX)
725 out.setf(std::ios::fixed);
727 WriteModuleVolPaths(out);
728 WriteDetElemVolPaths(out);
733 //______________________________________________________________________________
735 AliMUONGeometryTransformer::WriteTransformations(const TString& fileName) const
737 // Writes transformations into a file
738 // Returns true, if writing finished correctly.
742 // if builder is not associated with any geometry module
743 if (fModuleTransformers->GetEntriesFast() == 0) return false;
746 TString filePath = gSystem->Getenv("ALICE_ROOT");
747 filePath += "/MUON/data/";
748 filePath += fileName;
751 ofstream out(filePath, ios::out);
753 cerr << filePath << endl;
754 AliError("File not found.");
757 #if !defined (__DECCXX)
758 out.setf(std::ios::fixed);
760 WriteModuleTransforms(out);
761 WriteDetElemTransforms(out);
766 //______________________________________________________________________________
768 AliMUONGeometryTransformer::WriteMisAlignmentData(const TString& fileName) const
770 // Writes misalignment data into a file
771 // Returns true, if writing finished correctly.
775 // if builder is not associated with any geometry module
776 if ( fModuleTransformers->GetEntriesFast() == 0 ) {
777 AliWarningStream() << "No geometry modules defined." << endl;
782 // if builder has no mis-alignment data
783 if ( ! fMisAlignArray ) {
784 AliWarningStream() << "No mis-alignment data defined." << endl;
789 TString filePath = gSystem->Getenv("ALICE_ROOT");
790 filePath += "/MUON/data/";
791 filePath += fileName;
793 // Write mis-alignment data in the root file
794 TFile file(fileName.Data(), "RECREATE");
795 fMisAlignArray->Write();
801 //_____________________________________________________________________________
802 void AliMUONGeometryTransformer::AddModuleTransformer(
803 AliMUONGeometryModuleTransformer* moduleTransformer)
805 /// Add the geometrymodule to the array
807 fModuleTransformers->AddAt(moduleTransformer,
808 moduleTransformer->GetModuleId());
811 //_____________________________________________________________________________
812 void AliMUONGeometryTransformer::AddMisAlignModule(Int_t moduleId,
813 const TGeoHMatrix& matrix)
815 /// Build AliAlignObjMatrix with module ID, its volumePaths
816 /// and the given delta transformation matrix
818 if ( ! fMisAlignArray )
819 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
821 const AliMUONGeometryModuleTransformer* kTransformer
822 = GetModuleTransformer(moduleId);
823 if ( ! kTransformer ) {
824 AliErrorStream() << "Module " << moduleId << " not found." << endl;
829 TString path = kTransformer->GetVolumePath();
831 // Get unique align object ID
832 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, moduleId);
834 // Create mis align matrix
835 TClonesArray& refArray =*fMisAlignArray;
836 Int_t pos = fMisAlignArray->GetEntriesFast();
837 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId,
838 const_cast<TGeoHMatrix&>(matrix));
841 //_____________________________________________________________________________
842 void AliMUONGeometryTransformer::AddMisAlignDetElement(Int_t detElemId,
843 const TGeoHMatrix& matrix)
845 /// Build AliAlignObjMatrix with detection element ID, its volumePaths
846 /// and the given delta transformation matrix
848 if ( ! fMisAlignArray )
849 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
851 const AliMUONGeometryDetElement* kDetElement
852 = GetDetElement(detElemId);
854 if ( ! kDetElement ) {
855 AliErrorStream() << "Det element " << detElemId << " not found." << endl;
860 TString path = kDetElement->GetVolumePath();
862 // Get unique align object ID
863 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, detElemId);
865 // Create mis align matrix
866 TClonesArray& refArray =*fMisAlignArray;
867 Int_t pos = fMisAlignArray->GetEntriesFast();
868 new(refArray[pos]) AliAlignObjMatrix(path.Data(), volId,
869 const_cast<TGeoHMatrix&>(matrix));
872 //_____________________________________________________________________________
873 TClonesArray* AliMUONGeometryTransformer::CreateZeroAlignmentData() const
875 /// Create array with zero alignment data
877 // Create array for zero-alignment objects
878 TClonesArray* array = new TClonesArray("AliAlignObjMatrix", 200);
879 TClonesArray& refArray =*array;
880 array->SetOwner(true);
886 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
887 AliMUONGeometryModuleTransformer* module
888 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
890 TString path = module->GetVolumePath();
891 Int_t moduleId = module->GetModuleId();
894 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, moduleId);
896 // Create mis align matrix
897 Int_t pos = array->GetEntriesFast();
898 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId, matrix);
901 // Detection elements
902 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
903 AliMUONGeometryModuleTransformer* moduleTransformer
904 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
905 AliMUONGeometryStore* detElements
906 = moduleTransformer->GetDetElementStore();
908 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
909 AliMUONGeometryDetElement* detElement
910 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
912 TString path = detElement->GetVolumePath();
913 Int_t detElemId = detElement->GetId();
916 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, detElemId);
918 // Create mis align matrix
919 Int_t pos = array->GetEntriesFast();
920 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId, matrix);
927 //_____________________________________________________________________________
928 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
929 Float_t xg, Float_t yg, Float_t zg,
930 Float_t& xl, Float_t& yl, Float_t& zl) const
932 /// Transform point from the global reference frame (ALIC)
933 /// to the local reference frame of the detection element specified
936 const AliMUONGeometryModuleTransformer* kTransformer
937 = GetModuleTransformerByDEId(detElemId);
940 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
943 //_____________________________________________________________________________
944 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
945 Double_t xg, Double_t yg, Double_t zg,
946 Double_t& xl, Double_t& yl, Double_t& zl) const
948 /// Transform point from the global reference frame (ALIC)
949 /// to the local reference frame of the detection element specified
952 const AliMUONGeometryModuleTransformer* kTransformer
953 = GetModuleTransformerByDEId(detElemId);
956 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
959 //_____________________________________________________________________________
960 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
961 Float_t xl, Float_t yl, Float_t zl,
962 Float_t& xg, Float_t& yg, Float_t& zg) const
964 /// Transform point from the local reference frame of the detection element
965 /// specified by detElemId to the global reference frame (ALIC).
967 const AliMUONGeometryModuleTransformer* kTransformer
968 = GetModuleTransformerByDEId(detElemId);
971 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
974 //_____________________________________________________________________________
975 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
976 Double_t xl, Double_t yl, Double_t zl,
977 Double_t& xg, Double_t& yg, Double_t& zg) const
979 /// Transform point from the local reference frame of the detection element
980 /// specified by detElemId to the global reference frame (ALIC).
982 const AliMUONGeometryModuleTransformer* kTransformer
983 = GetModuleTransformerByDEId(detElemId);
986 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
989 //_____________________________________________________________________________
990 const AliMUONGeometryModuleTransformer*
991 AliMUONGeometryTransformer::GetModuleTransformer(Int_t index, Bool_t warn) const
993 /// Return the geometry module specified by index
995 return GetModuleTransformerNonConst(index, warn);
998 //_____________________________________________________________________________
999 const AliMUONGeometryModuleTransformer*
1000 AliMUONGeometryTransformer::GetModuleTransformerByDEId(Int_t detElemId,
1003 /// Return the geometry module specified by index
1006 Int_t index = AliMUONGeometryStore::GetModuleId(detElemId);
1008 return GetModuleTransformer(index, warn);
1011 //_____________________________________________________________________________
1012 const AliMUONGeometryDetElement*
1013 AliMUONGeometryTransformer::GetDetElement(Int_t detElemId, Bool_t warn) const
1015 /// Return detection ellemnt with given detElemId
1017 const AliMUONGeometryModuleTransformer* kTransformer
1018 = GetModuleTransformerByDEId(detElemId, warn);
1020 if (!kTransformer) return 0;
1022 return kTransformer->GetDetElement(detElemId, warn);
1025 //_____________________________________________________________________________
1026 Bool_t AliMUONGeometryTransformer::HasDE(Int_t detElemId) const
1028 /// Return true if detection element with given detElemId is defined
1030 const AliMUONGeometryModuleTransformer* kTransformer
1031 = GetModuleTransformerByDEId(detElemId, false);
1033 if (!kTransformer) return false;
1035 return ( kTransformer->GetDetElement(detElemId, false) != 0 );