]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometryTransformer.cxx
Update of ACORDE-QA-Raw data histograms (now they go from -0.5 to 59.5)
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryTransformer.cxx
index 19c0564246ec8e951371404466d97a35dc765c88..8979695c45ac34e8a723baf11e0ce6e3aa441871 100644 (file)
@@ -141,10 +141,10 @@ AliMUONGeometryTransformer::CreateDEAreas() const
     AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
     
     Double_t xl(0.0), yl(0.0), zl(0.0);
-    Double_t dx(seg->Dimensions().X());
-    Double_t dy(seg->Dimensions().Y());
+    Double_t dx(seg->GetDimensionX());
+    Double_t dy(seg->GetDimensionY());
     
-    if ( stationType == AliMp::kStation1 || stationType == AliMp::kStation2 ) 
+    if ( stationType == AliMp::kStation12 ) 
     {
       Double_t xmin(FLT_MAX);
       Double_t xmax(-FLT_MAX);
@@ -163,7 +163,8 @@ AliMUONGeometryTransformer::CreateDEAreas() const
         while ( !itp->IsDone() ) 
         {
           AliMpPad pad = itp->CurrentItem();
-          AliMpArea a(pad.Position(),pad.Dimensions());
+          AliMpArea a(pad.GetPositionX(),pad.GetPositionY(),
+                      pad.GetDimensionX(), pad.GetDimensionY());
           xmin = TMath::Min(xmin,a.LeftBorder());
           xmax = TMath::Max(xmax,a.RightBorder());
           ymin = TMath::Min(ymin,a.DownBorder());
@@ -186,7 +187,7 @@ AliMUONGeometryTransformer::CreateDEAreas() const
       Local2Global(detElemId,xl,yl,zl,xg,yg,zg);
     }
     
-    fDEAreas->Add(detElemId,new AliMpArea(TVector2(xg,yg),TVector2(dx,dy)));
+    fDEAreas->Add(detElemId,new AliMpArea(xg,yg,dx,dy));
     
     it.Next();
   }
@@ -426,61 +427,6 @@ AliMUONGeometryTransformer::ReadTransformations(const TString& fileName)
   return true;
 }
 
-//______________________________________________________________________________
-Bool_t  
-AliMUONGeometryTransformer::LoadTransformations()
-{
-/// Load transformations for defined modules and detection elements
-/// using AliGeomManager
-
-  if ( ! AliGeomManager::GetGeometry() ) {
-    AliFatal("Geometry has to be laoded in AliGeomManager first.");
-    return false;
-  }   
-
-  for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
-    AliMUONGeometryModuleTransformer* moduleTransformer 
-      = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
-
-    // Module symbolic name
-    TString symname = GetModuleSymName(moduleTransformer->GetModuleId());
-    
-    // Set matrix from physical node
-    TGeoHMatrix* matrix = AliGeomManager::GetMatrix(symname);
-    if ( ! matrix ) {
-      AliErrorStream() << "Geometry module matrix not found." << endl;
-      return false;
-    }  
-    moduleTransformer->SetTransformation(*matrix);
-    
-    // Loop over detection elements
-    AliMpExMap* detElements = moduleTransformer->GetDetElementStore();    
-    TIter next(detElements->CreateIterator());    
-    AliMUONGeometryDetElement* detElement;
-    
-    while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
-    {
-      // Det element  symbolic name
-      TString symnameDE = GetDESymName(detElement->GetId());
-    
-      // Set global matrix from physical node
-      TGeoHMatrix* globalMatrix = AliGeomManager::GetMatrix(symnameDE);
-      if ( ! globalMatrix ) {
-        AliErrorStream() << "Detection element matrix not found." << endl;
-        return false;
-      }  
-      detElement->SetGlobalTransformation(*globalMatrix);
-
-      // Set local matrix
-      TGeoHMatrix localMatrix = 
-        AliMUONGeometryBuilder::Multiply(
-          (*matrix).Inverse(), (*globalMatrix) );
-      detElement->SetLocalTransformation(localMatrix);
-    }  
-  } 
-  return true;    
-}  
-
 //______________________________________________________________________________
 void AliMUONGeometryTransformer::WriteTransform(ofstream& out,
                                    const TGeoMatrix* transform) const
@@ -580,6 +526,61 @@ TString AliMUONGeometryTransformer::GetDESymName(Int_t detElemId) const
 // public functions
 //
 
+//______________________________________________________________________________
+Bool_t  
+AliMUONGeometryTransformer::LoadTransformations()
+{
+/// Load transformations for defined modules and detection elements
+/// using AliGeomManager
+
+  if ( ! AliGeomManager::GetGeometry() ) {
+    AliFatal("Geometry has to be laoded in AliGeomManager first.");
+    return false;
+  }   
+
+  for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
+    AliMUONGeometryModuleTransformer* moduleTransformer 
+      = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
+
+    // Module symbolic name
+    TString symname = GetModuleSymName(moduleTransformer->GetModuleId());
+    
+    // Set matrix from physical node
+    TGeoHMatrix* matrix = AliGeomManager::GetMatrix(symname);
+    if ( ! matrix ) {
+      AliErrorStream() << "Geometry module matrix not found." << endl;
+      return false;
+    }  
+    moduleTransformer->SetTransformation(*matrix);
+    
+    // Loop over detection elements
+    AliMpExMap* detElements = moduleTransformer->GetDetElementStore();    
+    TIter next(detElements->CreateIterator());    
+    AliMUONGeometryDetElement* detElement;
+    
+    while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
+    {
+      // Det element  symbolic name
+      TString symnameDE = GetDESymName(detElement->GetId());
+    
+      // Set global matrix from physical node
+      TGeoHMatrix* globalMatrix = AliGeomManager::GetMatrix(symnameDE);
+      if ( ! globalMatrix ) {
+        AliErrorStream() << "Detection element matrix not found." << endl;
+        return false;
+      }  
+      detElement->SetGlobalTransformation(*globalMatrix, false);
+
+      // Set local matrix
+      TGeoHMatrix localMatrix = 
+        AliMUONGeometryBuilder::Multiply(
+          (*matrix).Inverse(), (*globalMatrix) );
+      detElement->SetLocalTransformation(localMatrix, false);
+    }  
+  } 
+  return true;    
+}  
+
 //______________________________________________________________________________
 Bool_t  
 AliMUONGeometryTransformer::LoadGeometryData(const TString& fileName)
@@ -762,14 +763,18 @@ void AliMUONGeometryTransformer::CreateModules()
   // Load mapping as its info is used to define modules & DEs
   LoadMapping();
 
-  // Loop over geometry module
-  for (Int_t moduleId = 0; moduleId < AliMpConstants::NofGeomModules(); ++moduleId ) {
+  if ( fModuleTransformers->GetEntriesFast() == 0 ) {
+    // Create modules only if they do not yet exist
+
+    // Loop over geometry module
+    for (Int_t moduleId = 0; moduleId < AliMpConstants::NofGeomModules(); ++moduleId ) {
     
-    // Create geometry module transformer
-    AliMUONGeometryModuleTransformer* moduleTransformer
-      = new AliMUONGeometryModuleTransformer(moduleId);
-    AddModuleTransformer(moduleTransformer);
-  }   
+      // Create geometry module transformer
+      AliMUONGeometryModuleTransformer* moduleTransformer
+        = new AliMUONGeometryModuleTransformer(moduleId);
+      AddModuleTransformer(moduleTransformer);
+    }
+  }     
     
   // Loop over detection elements
   AliMpDEIterator it;
@@ -810,8 +815,8 @@ void AliMUONGeometryTransformer::AddAlignableVolumes() const
                                        module->GetVolumePath());
     if ( ! pnEntry ) {
       AliErrorStream() 
-        << "Volume path for geometry module "
-        << module->GetModuleId()
+        << "Volume path " << module->GetVolumePath().Data()
+        << " for geometry module " << module->GetModuleId() << " " << module
         << " not found in geometry." << endl;
     }
     else {
@@ -833,8 +838,9 @@ void AliMUONGeometryTransformer::AddAlignableVolumes() const
                                          detElement->GetVolumePath());
       if ( ! pnEntryDE ) {
         AliErrorStream() 
-          << "Volume path for detection element "
-          << detElement->GetId()
+          << "Volume path " 
+          << detElement->GetVolumePath().Data() 
+          << " for detection element " << detElement->GetId()
           << " not found in geometry." << endl;
       }
       else {