trajFilter.SetStoreSecondaries(ROOT.kTRUE) # The VMC sets the fields using the "/mcDet/setIsLocalMagField true" option in "gconfig/g4config.in" import geomGeant4 # geomGeant4.setMagnetField() # replaced by VMC, only has effect if /mcDet/setIsLocalMagField false # Define extra VMC B fields not already set by the geometry definitions, e.g. a global field, # any field maps, or defining if any volumes feel only the local or local+global field. # For now, just keep the fields already defined by the C++ code, i.e comment out the fieldMaker if charm == 0: # charm and muflux testbeam not yet updated for using the new bfield interface if hasattr(ship_geo.Bfield, "fieldMap"): fieldMaker = geomGeant4.addVMCFields(ship_geo, '', True) # Print VMC fields and associated geometry objects if debug > 0: geomGeant4.printVMCFields() geomGeant4.printWeightsandFields(onlyWithField = True,\ exclude=['DecayVolume','Tr1','Tr2','Tr3','Tr4','Veto','Ecal','Hcal','MuonDetector','SplitCal']) # Plot the field example #fieldMaker.plotField(1, ROOT.TVector3(-9000.0, 6000.0, 50.0), ROOT.TVector3(-300.0, 300.0, 6.0), 'Bzx.png') #fieldMaker.plotField(2, ROOT.TVector3(-9000.0, 6000.0, 50.0), ROOT.TVector3(-400.0, 400.0, 6.0), 'Bzy.png') if inactivateMuonProcesses: ROOT.gROOT.ProcessLine('#include "Geant4/G4ProcessTable.hh"') mygMC = ROOT.TGeant4.GetMC() mygMC.ProcessGeantCommand("/process/inactivate muPairProd") mygMC.ProcessGeantCommand("/process/inactivate muBrems") mygMC.ProcessGeantCommand("/process/inactivate muIoni") mygMC.ProcessGeantCommand("/process/inactivate muonNuclear") mygMC.ProcessGeantCommand("/particle/select mu+") mygMC.ProcessGeantCommand("/particle/process/dump")
trajFilter.SetMomentumCutP(0.1*u.GeV) trajFilter.SetEnergyCut(0., 400.*u.GeV) trajFilter.SetStorePrimaries(ROOT.kTRUE) trajFilter.SetStoreSecondaries(ROOT.kTRUE) # The VMC sets the fields using the "/mcDet/setIsLocalMagField true" option in "gconfig/g4config.in" import geomGeant4 # geomGeant4.setMagnetField() # replaced by VMC, only has effect if /mcDet/setIsLocalMagField false # Define extra VMC B fields not already set by the geometry definitions, e.g. a global field, # any field maps, or defining if any volumes feel only the local or local+global field. # For now, just keep the fields already defined by the C++ code, i.e comment out the fieldMaker #fieldMaker = geomGeant4.addVMCFields('field/ExampleBFieldSetup.txt', False) # Print VMC fields and associated geometry objects if debug > 0: geomGeant4.printVMCFields() geomGeant4.printWeightsandFields(onlyWithField = True,\ exclude=['DecayVolume','Tr1','Tr2','Tr3','Tr4','Veto','Ecal','Hcal','MuonDetector','SplitCal']) # Plot the field example #fieldMaker.plotField(1, ROOT.TVector3(-9000.0, 6000.0, 50.0), ROOT.TVector3(-300.0, 300.0, 6.0), 'Bzx.png') #fieldMaker.plotField(2, ROOT.TVector3(-9000.0, 6000.0, 50.0), ROOT.TVector3(-400.0, 400.0, 6.0), 'Bzy.png') if inactivateMuonProcesses : ROOT.gROOT.ProcessLine('#include "Geant4/G4ProcessTable.hh"') mygMC = ROOT.TGeant4.GetMC() mygMC.ProcessGeantCommand("/process/inactivate muPairProd") mygMC.ProcessGeantCommand("/process/inactivate muBrems") mygMC.ProcessGeantCommand("/process/inactivate muIoni") mygMC.ProcessGeantCommand("/particle/select mu+") mygMC.ProcessGeantCommand("/particle/process/dump") gProcessTable = ROOT.G4ProcessTable.GetProcessTable()