def __init__(self, field_polarity): self.log = logging.getLogger('root') self.log = self.log.getChild(self.__class__.__name__) self.log.debug('Initialized %s', self.__class__.__name__) G4.G4VUserDetectorConstruction.__init__(self) self.world = None self.gdml_parser = G4.G4GDMLParser() self.sensitive_detector = None self.config = Configuration.GLOBAL_CONFIG self.filename = os.path.join(self.config['data_dir'], 'iron_scint_bars.gdml') self.field_manager = None self.my_field = None self.field_polarity = field_polarity self.gdml_parser.Read(self.filename) # Grab constants from the GDML <define> rc['layers'] = int(self.gdml_parser.GetConstant("layers")) rc['bars'] = int(self.gdml_parser.GetConstant("bars")) for name in ["width", "thickness_layer", "thickness_bar", "density_scint", "density_iron"]: rc[name] = self.gdml_parser.GetConstant(name) det_width = rc['width'] * rc['bars'] iron_volume = det_width * det_width * (rc['layers']/2 * (rc['thickness_layer'] - rc['thickness_bar'])) scint_volume = det_width * det_width * (rc['layers']/2 * rc['thickness_bar']) self.mass = iron_volume * rc['density_iron'] + scint_volume * rc['density_scint'] self.mass /= 10**3 # mm^2 -> cm^3, density in /cm^3 but distances in mm self.log.info("Mass [g]: %f" % self.mass)
def __init__(self, name): self.log = logging.getLogger('root') self.log = self.log.getChild(self.__class__.__name__) self.log.debug('Initialized %s', self.__class__.__name__) G4.G4VUserDetectorConstruction.__init__(self) self.world = None self.gdml_parser = G4.G4GDMLParser() self.sensitive_detector = None self.config = Configuration.GLOBAL_CONFIG self.filename = os.path.join(self.config['data_dir'], name)