when i Assign SD to the logical volume i find this error
can you help me to fix it please.

Looks like Box_Hall is not a member of your DetectorConstruction class.

Do you only define it in DetectorConstruction::Construct()?

Yes it’s defined only in construct.

Then that is your issue. The function ConstructSDandField() does not know about Box_Hall because it only exists in Contruct()

Checkout examples/basic/B5