Assigning field manager to logical volume issue

When I “make” my code, it all compiles fine but when I actually run it, it runs into a segmentation violation error. For context, I have two logical volumes that both should have uniform electric fields. However, when I run my actual program, this happens :

I followed the field examples and everything, but I just can’t seem to isolate the problem. If you guys could give me a hand, that would be great. Here’s some of my code.

ConstructSDandField Code


void BckgrdReductDetectorConstruction::ConstructSDandField()
{
  // Construct field creator - register the field it creates

  if (!fEMFieldSetup.Get()) {
    BckgrdReductFieldSetup* emFieldSetup = new BckgrdReductFieldSetup();

    fEMFieldSetup.Put(emFieldSetup); 
    G4AutoDelete::Register(emFieldSetup);
  }

  G4bool allLocal = true; 

  logicScoring->SetFieldManager(fEMFieldSetup.Get()->GetDriftFieldManager(), allLocal); 

  logicSmall_GEMGas_Layer->SetFieldManager(fEMFieldSetup.Get()->GetTransferFieldManager(), allLocal);
 
  if (fOrientation == "up" || fOrientation == "Up" || fOrientation == "Upstream" || fOrientation == "upstream"|| fOrientation == "front" || fOrientation == "Front") {
    logicKap_Layer->SetFieldManager(fEMFieldSetup.Get()->GetDriftFieldManager(), allLocal); 
  }
}

Just had a problem in my DetectorConstructor, fixed one problem for now.

Hi! Do you know what the problem was? I am having similar issues to you. I try to assign a field to a logical volume and it compiles fine, then when I run it I get a segmentation fault. Would be great to know how you solved your issue :pray: