Commit 61aa05f5 authored by Tobias Bisanz's avatar Tobias Bisanz
Browse files

Check if daughter rotation is nullptr in GDML processing code

parent 5e333eca
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -97,7 +97,11 @@ namespace allpix {

                // Add offset and rotation to current daughter location
                G4ThreeVector position_vector = toG4Vector(position_);
                auto* rotation_matrix = new G4RotationMatrix(*gdml_daughter->GetRotation() * *rotation_);
                auto* daughter_rotation = gdml_daughter->GetRotation();
		//It seems that in the case of a trivial rotation the daughter_rotation can be a nullptr
                auto* rotation_matrix = (daughter_rotation ? new G4RotationMatrix(*daughter_rotation * *rotation_)
                                                           : new G4RotationMatrix(*rotation_));
                LOG(TRACE) << "Rotation matrix: " << *rotation_matrix;
                gdml_daughter->SetTranslation(gdml_daughter->GetTranslation() + position_vector);
                gdml_daughter->SetRotation(rotation_matrix);