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
377 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
378 AliMUONGeometryModuleTransformer* moduleTransformer
379 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
382 TString path = moduleTransformer->GetVolumePath();
384 // Make physical node
385 TGeoPhysicalNode* moduleNode = tgeoManager->MakePhysicalNode(path);
386 if ( ! moduleNode ) {
388 << "Module id: " << moduleTransformer->GetModuleId()
389 << " volume path: " << path << " not found in geometry." << endl;
393 // Set matrix from physical node
394 TGeoHMatrix matrix = *moduleNode->GetMatrix();
395 moduleTransformer->SetTransformation(matrix);
397 // Loop over detection elements
398 AliMUONGeometryStore* detElements
399 = moduleTransformer->GetDetElementStore();
401 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
402 AliMUONGeometryDetElement* detElement
403 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
406 TString dePath = detElement->GetVolumePath();
408 // Make physical node
409 TGeoPhysicalNode* deNode = tgeoManager->MakePhysicalNode(dePath);
412 << "Det element id: " << detElement->GetId()
413 << " volume path: " << path << " not found in geometry." << endl;
417 // Set global matrix from physical node
418 TGeoHMatrix globalMatrix = *deNode->GetMatrix();
419 detElement->SetGlobalTransformation(globalMatrix);
422 TGeoHMatrix localMatrix =
423 AliMUONGeometryBuilder::Multiply(
424 matrix.Inverse(), globalMatrix );
425 detElement->SetLocalTransformation(localMatrix);
431 //______________________________________________________________________________
433 AliMUONGeometryTransformer::ReadVolPaths(const TString& fileName)
435 // Reads detection element volume paths from a file
436 // Returns true, if reading finished correctly.
440 TString filePath = gSystem->Getenv("ALICE_ROOT");
441 filePath += "/MUON/data/";
442 filePath += fileName;
445 ifstream in(filePath, ios::in);
447 cerr << filePath << endl;
448 AliFatal("File not found.");
456 //______________________________________________________________________________
458 AliMUONGeometryTransformer::ReadTransformations(const TString& fileName)
460 // Reads transformations from a file
461 // Returns true, if reading finished correctly.
465 TString filePath = gSystem->Getenv("ALICE_ROOT");
466 filePath += "/MUON/data/";
467 filePath += fileName;
470 ifstream in(filePath, ios::in);
472 cerr << filePath << endl;
473 AliFatal("File not found.");
479 while ( !in.eof() ) {
480 if (key == TString("CH"))
481 key = ReadModuleTransforms(in);
482 else if (key == TString("DE"))
483 key = ReadDetElemTransforms(in);
485 AliFatal(Form("%s key not recognized", key.Data()));
493 //______________________________________________________________________________
495 AliMUONGeometryTransformer::ReadTransformations2(const TString& fileName)
497 // Reads transformations from root geometry file
498 // Returns true, if reading finished correctly.
502 TString filePath = gSystem->Getenv("ALICE_ROOT");
503 filePath += "/MUON/data/";
504 filePath += fileName;
506 // Load root geometry
507 TGeoManager* tgeoManager = TGeoManager::Import(fileName);
510 LoadTransforms(tgeoManager);
515 //______________________________________________________________________________
516 void AliMUONGeometryTransformer::WriteTransform(ofstream& out,
517 const TGeoMatrix* transform) const
519 // Writes the transformations
523 const Double_t* xyz = transform->GetTranslation();
524 out << setw(10) << setprecision(4) << xyz[0] << " "
525 << setw(10) << setprecision(4) << xyz[1] << " "
526 << setw(10) << setprecision(4) << xyz[2];
529 const Double_t* rm = transform->GetRotationMatrix();
530 TGeoRotation rotation;
531 rotation.SetMatrix(const_cast<Double_t*>(rm));
532 Double_t a1, a2, a3, a4, a5, a6;
533 rotation.GetAngles(a1, a2, a3, a4, a5, a6);
535 out << setw(8) << setprecision(4) << a1 << " "
536 << setw(8) << setprecision(4) << a2 << " "
537 << setw(8) << setprecision(4) << a3 << " "
538 << setw(8) << setprecision(4) << a4 << " "
539 << setw(8) << setprecision(4) << a5 << " "
540 << setw(8) << setprecision(4) << a6 << " " << endl;
543 //______________________________________________________________________________
544 void AliMUONGeometryTransformer::WriteModuleVolPaths(ofstream& out) const
546 // Write modules volume paths
548 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
549 AliMUONGeometryModuleTransformer* moduleTransformer
550 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
554 << setw(4) << moduleTransformer->GetModuleId() << " "
555 << moduleTransformer->GetVolumePath() << endl;
560 //______________________________________________________________________________
561 void AliMUONGeometryTransformer::WriteDetElemVolPaths(ofstream& out) const
563 // Write detection elements volume paths
565 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
566 AliMUONGeometryModuleTransformer* moduleTransformer
567 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
568 AliMUONGeometryStore* detElements
569 = moduleTransformer->GetDetElementStore();
571 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
572 AliMUONGeometryDetElement* detElement
573 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
577 << setw(4) << detElement->GetId() << " "
578 << detElement->GetVolumePath() << endl;
584 //______________________________________________________________________________
585 void AliMUONGeometryTransformer::WriteModuleTransforms(ofstream& out) const
587 // Write modules transformations
589 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
590 AliMUONGeometryModuleTransformer* moduleTransformer
591 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
592 const TGeoMatrix* transform
593 = moduleTransformer->GetTransformation();
597 << setw(4) << moduleTransformer->GetModuleId() + 1;
599 WriteTransform(out, transform);
604 //______________________________________________________________________________
605 void AliMUONGeometryTransformer::WriteDetElemTransforms(ofstream& out) const
607 // Writes detection elements transformations
610 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
611 AliMUONGeometryModuleTransformer* moduleTransformer
612 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
613 AliMUONGeometryStore* detElements
614 = moduleTransformer->GetDetElementStore();
616 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
617 AliMUONGeometryDetElement* detElement
618 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
619 const TGeoMatrix* transform
620 = detElement->GetLocalTransformation();
623 out << "DE " << setw(4) << detElement->GetId();
625 WriteTransform(out, transform);
635 //______________________________________________________________________________
637 AliMUONGeometryTransformer::ReadGeometryData(
638 const TString& volPathFileName,
639 const TString& transformFileName)
641 /// Read geometry data from given files;
642 /// if transformFileName has ".root" extension, the transformations
643 /// are loaded from root geometry file, otherwise ASCII file
644 /// format is supposed
646 Bool_t result1 = ReadVolPaths(volPathFileName);
648 // Get file extension
649 std::string fileName = transformFileName.Data();
650 std::string rootExt = fileName.substr(fileName.size()-5, fileName.size());
652 if ( rootExt != ".root" )
653 result2 = ReadTransformations(transformFileName);
655 result2 = ReadTransformations2(transformFileName);
657 return result1 && result2;
660 //______________________________________________________________________________
662 AliMUONGeometryTransformer::ReadGeometryData(
663 const TString& volPathFileName,
664 TGeoManager* tgeoManager)
666 /// Load geometry data from root geometry using defined
667 /// voluem paths from file
669 Bool_t result1 = ReadVolPaths(volPathFileName);
671 Bool_t result2 = LoadTransforms(tgeoManager);
673 return result1 && result2;
676 //______________________________________________________________________________
678 AliMUONGeometryTransformer::WriteGeometryData(
679 const TString& volPathFileName,
680 const TString& transformFileName,
681 const TString& misalignFileName) const
683 /// Write geometry data into given files
685 Bool_t result1 = WriteVolumePaths(volPathFileName);
686 Bool_t result2 = WriteTransformations(transformFileName);
688 Bool_t result3 = true;
689 if ( misalignFileName != "" )
690 result3 = WriteMisAlignmentData(misalignFileName);
692 return result1 && result2 && result3;
695 //______________________________________________________________________________
697 AliMUONGeometryTransformer::WriteVolumePaths(const TString& fileName) const
699 // Writes volume paths for modules and detection element volumes into a file
700 // Returns true, if writing finished correctly.
704 // if builder is not associated with any geometry module
705 if (fModuleTransformers->GetEntriesFast() == 0) return false;
708 TString filePath = gSystem->Getenv("ALICE_ROOT");
709 filePath += "/MUON/data/";
710 filePath += fileName;
713 ofstream out(filePath, ios::out);
715 cerr << filePath << endl;
716 AliError("File not found.");
719 #if !defined (__DECCXX)
720 out.setf(std::ios::fixed);
722 WriteModuleVolPaths(out);
723 WriteDetElemVolPaths(out);
728 //______________________________________________________________________________
730 AliMUONGeometryTransformer::WriteTransformations(const TString& fileName) const
732 // Writes transformations into a file
733 // Returns true, if writing finished correctly.
737 // if builder is not associated with any geometry module
738 if (fModuleTransformers->GetEntriesFast() == 0) return false;
741 TString filePath = gSystem->Getenv("ALICE_ROOT");
742 filePath += "/MUON/data/";
743 filePath += fileName;
746 ofstream out(filePath, ios::out);
748 cerr << filePath << endl;
749 AliError("File not found.");
752 #if !defined (__DECCXX)
753 out.setf(std::ios::fixed);
755 WriteModuleTransforms(out);
756 WriteDetElemTransforms(out);
761 //______________________________________________________________________________
763 AliMUONGeometryTransformer::WriteMisAlignmentData(const TString& fileName) const
765 // Writes misalignment data into a file
766 // Returns true, if writing finished correctly.
770 // if builder is not associated with any geometry module
771 if ( fModuleTransformers->GetEntriesFast() == 0 ) {
772 AliWarningStream() << "No geometry modules defined." << endl;
777 // if builder has no mis-alignment data
778 if ( ! fMisAlignArray ) {
779 AliWarningStream() << "No mis-alignment data defined." << endl;
784 TString filePath = gSystem->Getenv("ALICE_ROOT");
785 filePath += "/MUON/data/";
786 filePath += fileName;
788 // Write mis-alignment data in the root file
789 TFile file(fileName.Data(), "RECREATE");
790 fMisAlignArray->Write();
796 //_____________________________________________________________________________
797 void AliMUONGeometryTransformer::AddModuleTransformer(
798 AliMUONGeometryModuleTransformer* moduleTransformer)
800 /// Add the geometrymodule to the array
802 fModuleTransformers->AddAt(moduleTransformer,
803 moduleTransformer->GetModuleId());
806 //_____________________________________________________________________________
807 void AliMUONGeometryTransformer::AddMisAlignModule(Int_t moduleId,
808 const TGeoHMatrix& matrix)
810 /// Build AliAlignObjMatrix with module ID, its volumePaths
811 /// and the given delta transformation matrix
813 if ( ! fMisAlignArray )
814 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
816 const AliMUONGeometryModuleTransformer* kTransformer
817 = GetModuleTransformer(moduleId);
818 if ( ! kTransformer ) {
819 AliErrorStream() << "Module " << moduleId << " not found." << endl;
824 TString path = kTransformer->GetVolumePath();
826 // Get unique align object ID
827 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, moduleId);
829 // Create mis align matrix
830 TClonesArray& refArray =*fMisAlignArray;
831 Int_t pos = fMisAlignArray->GetEntriesFast();
832 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId,
833 const_cast<TGeoHMatrix&>(matrix));
836 //_____________________________________________________________________________
837 void AliMUONGeometryTransformer::AddMisAlignDetElement(Int_t detElemId,
838 const TGeoHMatrix& matrix)
840 /// Build AliAlignObjMatrix with detection element ID, its volumePaths
841 /// and the given delta transformation matrix
843 if ( ! fMisAlignArray )
844 fMisAlignArray = new TClonesArray("AliAlignObjMatrix", 200);
846 const AliMUONGeometryDetElement* kDetElement
847 = GetDetElement(detElemId);
849 if ( ! kDetElement ) {
850 AliErrorStream() << "Det element " << detElemId << " not found." << endl;
855 TString path = kDetElement->GetVolumePath();
857 // Get unique align object ID
858 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, detElemId);
860 // Create mis align matrix
861 TClonesArray& refArray =*fMisAlignArray;
862 Int_t pos = fMisAlignArray->GetEntriesFast();
863 new(refArray[pos]) AliAlignObjMatrix(path.Data(), volId,
864 const_cast<TGeoHMatrix&>(matrix));
867 //_____________________________________________________________________________
868 TClonesArray* AliMUONGeometryTransformer::CreateZeroAlignmentData() const
870 /// Create array with zero alignment data
872 // Create array for zero-alignment objects
873 TClonesArray* array = new TClonesArray("AliAlignObjMatrix", 200);
874 TClonesArray& refArray =*array;
875 array->SetOwner(true);
881 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
882 AliMUONGeometryModuleTransformer* module
883 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
885 TString path = module->GetVolumePath();
886 Int_t moduleId = module->GetModuleId();
889 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, moduleId);
891 // Create mis align matrix
892 Int_t pos = array->GetEntriesFast();
893 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId, matrix);
896 // Detection elements
897 for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
898 AliMUONGeometryModuleTransformer* moduleTransformer
899 = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
900 AliMUONGeometryStore* detElements
901 = moduleTransformer->GetDetElementStore();
903 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
904 AliMUONGeometryDetElement* detElement
905 = (AliMUONGeometryDetElement*)detElements->GetEntry(j);
907 TString path = detElement->GetVolumePath();
908 Int_t detElemId = detElement->GetId();
911 Int_t volId = AliAlignObj::LayerToVolUID(AliAlignObj::kMUON, detElemId);
913 // Create mis align matrix
914 Int_t pos = array->GetEntriesFast();
915 new (refArray[pos]) AliAlignObjMatrix(path.Data(), volId, matrix);
922 //_____________________________________________________________________________
923 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
924 Float_t xg, Float_t yg, Float_t zg,
925 Float_t& xl, Float_t& yl, Float_t& zl) const
927 /// Transform point from the global reference frame (ALIC)
928 /// to the local reference frame of the detection element specified
931 const AliMUONGeometryModuleTransformer* kTransformer
932 = GetModuleTransformerByDEId(detElemId);
935 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
938 //_____________________________________________________________________________
939 void AliMUONGeometryTransformer::Global2Local(Int_t detElemId,
940 Double_t xg, Double_t yg, Double_t zg,
941 Double_t& xl, Double_t& yl, Double_t& zl) const
943 /// Transform point from the global reference frame (ALIC)
944 /// to the local reference frame of the detection element specified
947 const AliMUONGeometryModuleTransformer* kTransformer
948 = GetModuleTransformerByDEId(detElemId);
951 kTransformer->Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
954 //_____________________________________________________________________________
955 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
956 Float_t xl, Float_t yl, Float_t zl,
957 Float_t& xg, Float_t& yg, Float_t& zg) const
959 /// Transform point from the local reference frame of the detection element
960 /// specified by detElemId to the global reference frame (ALIC).
962 const AliMUONGeometryModuleTransformer* kTransformer
963 = GetModuleTransformerByDEId(detElemId);
966 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
969 //_____________________________________________________________________________
970 void AliMUONGeometryTransformer::Local2Global(Int_t detElemId,
971 Double_t xl, Double_t yl, Double_t zl,
972 Double_t& xg, Double_t& yg, Double_t& zg) const
974 /// Transform point from the local reference frame of the detection element
975 /// specified by detElemId to the global reference frame (ALIC).
977 const AliMUONGeometryModuleTransformer* kTransformer
978 = GetModuleTransformerByDEId(detElemId);
981 kTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
984 //_____________________________________________________________________________
985 const AliMUONGeometryModuleTransformer*
986 AliMUONGeometryTransformer::GetModuleTransformer(Int_t index, Bool_t warn) const
988 /// Return the geometry module specified by index
990 return GetModuleTransformerNonConst(index, warn);
993 //_____________________________________________________________________________
994 const AliMUONGeometryModuleTransformer*
995 AliMUONGeometryTransformer::GetModuleTransformerByDEId(Int_t detElemId,
998 /// Return the geometry module specified by index
1001 Int_t index = AliMUONGeometryStore::GetModuleId(detElemId);
1003 return GetModuleTransformer(index, warn);
1006 //_____________________________________________________________________________
1007 const AliMUONGeometryDetElement*
1008 AliMUONGeometryTransformer::GetDetElement(Int_t detElemId, Bool_t warn) const
1010 /// Return detection ellemnt with given detElemId
1012 const AliMUONGeometryModuleTransformer* kTransformer
1013 = GetModuleTransformerByDEId(detElemId, warn);
1015 if (!kTransformer) return 0;
1017 return kTransformer->GetDetElement(detElemId, warn);
1020 //_____________________________________________________________________________
1021 Bool_t AliMUONGeometryTransformer::HasDE(Int_t detElemId) const
1023 /// Return true if detection element with given detElemId is defined
1025 const AliMUONGeometryModuleTransformer* kTransformer
1026 = GetModuleTransformerByDEId(detElemId, false);
1028 if (!kTransformer) return false;
1030 return ( kTransformer->GetDetElement(detElemId, false) != 0 );