**************************************************************************/
// $Id$
-//
+
+//-----------------------------------------------------------------------------
// Class AliMUONVGeometryBuilder
// -----------------------------
// Abstract base class for geometry construction per geometry module(s).
// Author: Ivana Hrivnacova, IPN Orsay
// 23/01/2004
+//-----------------------------------------------------------------------------
#include "AliMUONVGeometryBuilder.h"
#include "AliMUONGeometryModule.h"
// Create the module geometries array
fGeometryModules = new TObjArray();
-
+ fGeometryModules->SetOwner(kFALSE);
+
for (Int_t i=0; i<nofModules; i++ )
fGeometryModules->Add(new AliMUONGeometryModule(firstModuleId++));
}
// Get the name of the last volume in the path
Ssiz_t npos1 = path0.Last('/')+1;
Ssiz_t npos2 = path0.Last('_');
- TString volName(path0(npos1, npos2-npos1));
+ TString volName0(path0(npos1, npos2-npos1));
// Check if it is sensitive volume
- Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
AliMUONGeometryModule* geometry = GetGeometry(moduleId);
- if ( geometry->IsSensitiveVolume(volName) &&
+ if ( geometry->IsSensitiveVolume(volName0) &&
! svMap->Get(path0) ) {
//cout << ".. adding to the map "
// << path0 << " " << detElemId << endl;
}
}
-
//______________________________________________________________________________
-void AliMUONVGeometryBuilder::CreateDetElements() const
+void AliMUONVGeometryBuilder::UpdateDetElements(Bool_t create) const
{
-/// Create detection elements and fill their global and
-/// local transformations from geometry.
+/// Create or update detection elements:
+/// - if parameter create is true: detection elements are
+/// created and their global and local transformations are filled from geometry.
+/// - otherwise: only the volume path is passed from geometry
+/// to detection elements
for (Int_t i=0; i<fGeometryModules->GetEntriesFast(); i++) {
AliMUONGeometryModule* geometry
TString volPath = geometry->GetVolumePath();
volPath += ComposePath(envelope->GetName(), envelope->GetCopyNo());
- // Create detection element
- AliMUONGeometryDetElement* detElement
- = new AliMUONGeometryDetElement(detElemId, volPath);
- detElements->Add(detElemId, detElement);
+ if ( create ) {
+ // Create detection element
+ AliMUONGeometryDetElement* detElement
+ = new AliMUONGeometryDetElement(detElemId, volPath);
+ detElements->Add(detElemId, detElement);
- // Compose local transformation
- const TGeoCombiTrans* transform = envelope->GetTransformation();
- // Apply frame transform
- TGeoHMatrix localTransform = ConvertDETransform(*transform);
- detElement->SetLocalTransformation(localTransform);
-
- // Compose global transformation
- TGeoHMatrix globalTransform
- = AliMUONGeometryBuilder::Multiply(
+ // Compose local transformation
+ const TGeoCombiTrans* transform = envelope->GetTransformation();
+ // Apply frame transform
+ TGeoHMatrix localTransform = ConvertDETransform(*transform);
+ detElement->SetLocalTransformation(localTransform);
+
+ // Compose global transformation
+ TGeoHMatrix globalTransform
+ = AliMUONGeometryBuilder::Multiply(
(*geometry->GetTransformer()->GetTransformation()),
localTransform );
;
- // Set the global transformation to detection element
- detElement->SetGlobalTransformation(globalTransform);
-
- }
+ // Set the global transformation to detection element
+ detElement->SetGlobalTransformation(globalTransform);
+ }
+ else {
+ // Get existing det elements
+ AliMUONGeometryDetElement* detElement
+ = (AliMUONGeometryDetElement*)detElements->GetValue(detElemId);
+
+ // Set volume path
+ detElement->SetVolumePath(volPath);
+ }
+ }
}
}
+
//_____ _________________________________________________________________________
void AliMUONVGeometryBuilder::RebuildSVMaps(Bool_t withEnvelopes) const
{