47 #include <Riostream.h> 49 #include <TClonesArray.h> 50 #include <TGeoManager.h> 51 #include <TGeoPhysicalNode.h> 61 using std::setprecision;
74 static const TString kDefaultDetectorName =
"MUON";
75 return kDefaultDetectorName;
86 fDetectorName(GetDefaultDetectorName()),
87 fModuleTransformers(0),
154 if ( !
HasDE(detElemId) )
continue;
162 Double_t xl(0.0), yl(0.0), zl(0.0);
168 Double_t xmin(FLT_MAX);
169 Double_t xmax(-FLT_MAX);
170 Double_t ymin(FLT_MAX);
171 Double_t ymax(-FLT_MAX);
173 for ( Int_t icathode = 0; icathode < 2; ++icathode )
187 xmin = TMath::Min(xmin,a.LeftBorder());
188 xmax = TMath::Max(xmax,a.RightBorder());
189 ymin = TMath::Min(ymin,a.DownBorder());
190 ymax = TMath::Max(ymax,a.UpBorder());
197 xl = (xmin+xmax)/2.0;
198 yl = (ymin+ymax)/2.0;
199 dx = (xmax-xmin)/2.0;
200 dy = (ymax-ymin)/2.0;
222 AliFatal(
"Could not access mapping from OCDB !");
232 Int_t index, Bool_t warn)
const 239 <<
"Index: " << index <<
" outside limits" << std::endl;
249 Double_t x, Double_t y, Double_t z,
250 Double_t a1, Double_t a2, Double_t a3,
251 Double_t a4, Double_t a5, Double_t a6)
const 256 return TGeoCombiTrans(TGeoTranslation(x, y, z),
257 TGeoRotation(
"rot", a1, a2, a3, a4, a5, a6));
263 Double_t x, Double_t y, Double_t z,
264 Double_t a1, Double_t a2, Double_t a3,
265 Double_t a4, Double_t a5, Double_t a6)
272 if ( !moduleTransformer) {
274 <<
"Module " << moduleId <<
" has not volume path defined." << endl;
279 TGeoHMatrix transform
288 Double_t x, Double_t y, Double_t z,
289 Double_t a1, Double_t a2, Double_t a3,
290 Double_t a4, Double_t a5, Double_t a6)
301 if ( ! kModuleTransformer ) {
302 AliFatal(Form(
"Module transformer not defined, detElemId: %d", detElemId));
310 if ( ! detElement ) {
311 AliFatal(Form(
"Det element %d has not volume path defined", detElemId));
316 TGeoHMatrix localTransform
321 TGeoHMatrix globalTransform
338 Double_t a1, a2, a3, a4, a5, a6;
382 Double_t a1, a2, a3, a4, a5, a6;
422 TString filePath = gSystem->Getenv(
"ALICE_ROOT");
423 filePath +=
"/MUON/data/";
427 ifstream in(filePath, ios::in);
429 cerr << filePath << endl;
436 while ( !in.eof() ) {
442 AliFatal(Form(
"%s key not recognized", key.Data()));
452 const TGeoMatrix* transform)
const 457 const Double_t* xyz = transform->GetTranslation();
458 out << setw(10) << setprecision(4) << xyz[0] <<
" " 459 << setw(10) << setprecision(4) << xyz[1] <<
" " 460 << setw(10) << setprecision(4) << xyz[2];
463 const Double_t* rm = transform->GetRotationMatrix();
464 TGeoRotation rotation;
465 rotation.SetMatrix(const_cast<Double_t*>(rm));
466 Double_t a1, a2, a3, a4, a5, a6;
467 rotation.GetAngles(a1, a2, a3, a4, a5, a6);
469 out << setw(8) << setprecision(4) << a1 <<
" " 470 << setw(8) << setprecision(4) << a2 <<
" " 471 << setw(8) << setprecision(4) << a3 <<
" " 472 << setw(8) << setprecision(4) << a4 <<
" " 473 << setw(8) << setprecision(4) << a5 <<
" " 474 << setw(8) << setprecision(4) << a6 <<
" " << endl;
485 const TGeoMatrix* transform
509 while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
511 const TGeoMatrix* transform
516 << setw(4) << detElement->GetId();
557 AliFatal(
"Geometry has to be laoded in AliGeomManager first.");
581 while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
588 if ( ! globalMatrix ) {
589 AliErrorStream() <<
"Detection element matrix not found." << endl;
592 detElement->SetGlobalTransformation(*globalMatrix,
false);
595 TGeoHMatrix localMatrix =
597 (*matrix).Inverse(), (*globalMatrix) );
598 detElement->SetLocalTransformation(localMatrix,
false);
614 std::string fileName2 = fileName.Data();
615 std::string rootExt = fileName2.substr(fileName2.size()-5, fileName2.size());
617 if ( rootExt !=
".root" )
633 AliErrorStream() <<
"Geometry has not been loaded in AliGeomManager" << endl;
654 TString filePath = gSystem->Getenv(
"ALICE_ROOT");
655 filePath +=
"/MUON/data/";
659 ofstream out(filePath, ios::out);
661 cerr << filePath << endl;
665 #if !defined (__DECCXX) 666 out.setf(std::ios::fixed);
696 TString filePath = gSystem->Getenv(
"ALICE_ROOT");
697 filePath +=
"/MUON/data/";
701 TFile file(fileName.Data(),
"RECREATE");
724 const TGeoHMatrix& matrix, Bool_t bGlobal)
734 if ( ! kTransformer ) {
735 AliErrorStream() <<
"Module " << moduleId <<
" not found." << endl;
746 const_cast<TGeoHMatrix&
>(matrix),bGlobal);
751 const TGeoHMatrix& matrix, Bool_t bGlobal)
762 if ( ! kDetElement ) {
763 AliErrorStream() <<
"Det element " << detElemId <<
" not found." << endl;
774 const_cast<TGeoHMatrix&
>(matrix),bGlobal);
813 detElements->
Add(detElemId, detElement);
839 <<
" for geometry module " << module->
GetModuleId() <<
" " << module
840 <<
" not found in geometry." << endl;
853 while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
856 TGeoPNEntry* pnEntryDE
858 detElement->GetVolumePath());
862 << detElement->GetVolumePath().Data()
863 <<
" for detection element " << detElement->GetId()
864 <<
" not found in geometry." << endl;
868 pnEntryDE->SetMatrix(
new TGeoHMatrix(*detElement->GetGlobalTransformation()));
881 TClonesArray*
array =
new TClonesArray(
"AliAlignObjMatrix", 200);
882 TClonesArray& refArray =*
array;
883 array->SetOwner(
true);
899 Int_t pos = array->GetEntriesFast();
912 while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
914 Int_t detElemId = detElement->
GetId();
920 Int_t pos = array->GetEntriesFast();
940 Float_t xg, Float_t yg, Float_t zg,
941 Float_t& xl, Float_t& yl, Float_t& zl)
const 951 kTransformer->
Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
956 Double_t xg, Double_t yg, Double_t zg,
957 Double_t& xl, Double_t& yl, Double_t& zl)
const 967 kTransformer->
Global2Local(detElemId, xg, yg, zg, xl, yl, zl);
972 Float_t xl, Float_t yl, Float_t zl,
973 Float_t& xg, Float_t& yg, Float_t& zg)
const 982 kTransformer->
Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
987 Double_t xl, Double_t yl, Double_t zl,
988 Double_t& xg, Double_t& yg, Double_t& zg)
const 997 kTransformer->
Local2Global(detElemId, xl, yl, zl, xg, yg, zg);
1031 if (!kTransformer)
return 0;
1044 if (!kTransformer)
return false;
1046 return ( kTransformer->
GetDetElement(detElemId,
false) != 0 );
The iterator over detection elements.
const AliMpVSegmentation * GetMpSegmentation(Int_t detElemId, AliMp::CathodType cath, Bool_t warn=true) const
static AliMpSegmentation * Instance(Bool_t warn=true)
A rectangle area positioned in plane..
static Int_t GetGeomModuleId(Int_t detElemId, Bool_t warn=true)
static TGeoHMatrix * GetMatrix(Int_t index)
Int_t GetId() const
Return detection element ID.
Int_t CurrentDEId() const
virtual AliMpVPadIterator * CreateIterator(const AliMpArea &area) const =0
Create iterator over pads in the given area.
virtual Bool_t IsDone() const =0
Is iterator done.
virtual Double_t GetDimensionY() const =0
Return the y half-sizes of the detection element.
TString fileName(const char *dir, int runNumber, const char *da, int i, const char *type)
#define AliWarning(message)
void SetGlobalTransformation(const TGeoHMatrix &transform, Bool_t warn=true)
static Int_t NofGeomModules()
Return number of geometry modules.
virtual void Next()=0
Set iterator to the next pad.
An interface for an iterator over pads.
Double_t GetPositionY() const
Return the pad x position (in cm)
TGeoManager * gGeoManager
static AliMp::StationType GetStationType(Int_t detElemId)
static TGeoHMatrix Multiply(const TGeoMatrix &m1, const TGeoMatrix &m2)
TString GetDEName() const
Return detection element ID.
TObject * GetValue(Int_t keyFirst, Int_t keySecond) const
virtual Double_t GetDimensionX() const =0
Return the x half-sizes of the detection element.
AliMp::CathodType GetCathodType(Int_t cathodNumber)
Convert integer number in enum;.
virtual AliMpPad CurrentItem() const =0
Return current pad.
void Add(Int_t keyFirst, Int_t keySecond, TObject *object)
#define AliFatal(message)
static const TString & GetDENamePrefix()
The abstract base class for the segmentation.
Double_t GetDimensionY() const
Return the y pad dimension - half length (in cm)
void SetLocalTransformation(const TGeoHMatrix &transform, Bool_t warn=true)
virtual void First()=0
Set iterator to the first pad.
static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId)
Class which encapsuate all information about a pad.
#define AliWarningStream()
Double_t GetPositionX() const
Return the pad x position (in cm)
#define AliError(message)
Class for storing detection element transformations.
static TGeoManager * GetGeometry()
Double_t GetDimensionX() const
Return the x pad dimension - half length (in cm)
static Bool_t LoadMpSegmentation(Bool_t warn=false)
static void LoadGeometry(const char *geomFileName=NULL)
Helper class making Root persistent TExMap.
AliMpExMapIterator * CreateIterator() const
const TGeoHMatrix * GetLocalTransformation() const
Return the detection element transformation wrt module.