X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONVGeometryBuilder.cxx;h=74f3538b363799a18459e60d0b611dacd2b79592;hb=d20bc070e82f2a74897b3fff05dbcab2b529731e;hp=7c55f6dcdd5ba2d51b1fc6d4ee57f47521e7e442;hpb=14a022076e9fa0aa73f44998b6670f8653bb1986;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONVGeometryBuilder.cxx b/MUON/AliMUONVGeometryBuilder.cxx index 7c55f6dcdd5..74f3538b363 100644 --- a/MUON/AliMUONVGeometryBuilder.cxx +++ b/MUON/AliMUONVGeometryBuilder.cxx @@ -350,12 +350,14 @@ void AliMUONVGeometryBuilder::SetReferenceFrame( } } - //______________________________________________________________________________ -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; iGetEntriesFast(); i++) { AliMUONGeometryModule* geometry @@ -381,29 +383,39 @@ void AliMUONVGeometryBuilder::CreateDetElements() const 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 { @@ -435,13 +447,17 @@ void AliMUONVGeometryBuilder::RebuildSVMaps(Bool_t withEnvelopes) const if ( ! withEnvelopes && geometry->IsVirtual() ) { std::string vName = geometry->GetTransformer()->GetVolumeName().Data(); std::string vPath = ComposePath(vName, 1).Data(); - path0.erase(path0.find(vPath), vPath.size()); + std::string::size_type vPathPos = path0.find(vPath); + if ( vPathPos != std::string::npos ) + path0.erase(vPathPos, vPath.size()); } if ( ! withEnvelopes && envelope->IsVirtual()) { std::string eName = envelope->GetName(); std::string ePath = ComposePath(eName, envelope->GetCopyNo()).Data(); - path0.erase(path0.find(ePath), ePath.size()); + std::string::size_type ePathPos = path0.find(ePath); + if ( ePathPos != std::string::npos ) + path0.erase(ePathPos, ePath.size()); } if ( ! envelope->IsVirtual() )