Beispiel #1
0
    def construct(self, geom):
        main_lv, main_hDim = ltools.main_lv(self, geom, "Box")

        TranspV = [0, 0, 1]
        if self.TranspV != None:
            TranspV = self.TranspV
            ltools.placeBooleanBuilders(self, geom, main_lv, TranspV)
Beispiel #2
0
    def construct(self, geom):
        main_lv, main_hDim = ltools.main_lv(self, geom, "Tubs")

        if self.auxParams != None:
            ltools.addAuxParams(self, main_lv)

        self.add_volume(main_lv)

        # sub-detectors
        rot = [Q("0deg"), Q("0deg"), Q("0deg")]
        for pos, sb in zip(self.positions, self.get_builders()):
            sb_lv = sb.get_volume()
            p = pos
            p[1] = -1 * self.halfDimension['dz'] + pos[1]
            print "NAME = ", sb_lv.name
            print "pos = ", p
            sb_pos = geom.structure.Position(sb_lv.name + '_pos', p[0], p[1],
                                             p[2])
            sb_rot = geom.structure.Rotation(sb_lv.name + '_rot',
                                             self.Rotation[0],
                                             self.Rotation[1],
                                             self.Rotation[2])
            sb_pla = geom.structure.Placement(sb_lv.name + '_pla',
                                              volume=sb_lv,
                                              pos=sb_pos,
                                              rot=sb_rot)
            main_lv.placements.append(sb_pla.name)
    def construct(self, geom):
        main_lv, main_hDim = ltools.main_lv(self, geom, "Box")

        if self.auxParams != None:
            ltools.addAuxParams(self, main_lv)

        self.add_volume(main_lv)

        for i, sb in enumerate(self.get_builders()):
            Pos = [Q("0m"), Q("0m"), Q("0m")]
            Rot = [Q("0deg"), Q("0deg"), Q("0deg")]
            if self.Positions != None:
                Pos = self.Positions[i]
            if self.Rotations != None:
                Rot = self.Rotations[i]

            sb_lv = sb.get_volume()
            sb_pos = geom.structure.Position(sb_lv.name + '_pos', Pos[0],
                                             Pos[1], Pos[2])
            sb_rot = geom.structure.Rotation(sb_lv.name + '_rot', Rot[0],
                                             Rot[1], Rot[2])
            sb_pla = geom.structure.Placement(sb_lv.name + '_pla',
                                              volume=sb_lv,
                                              pos=sb_pos,
                                              rot=sb_rot)
            main_lv.placements.append(sb_pla.name)
Beispiel #4
0
    def construct(self, geom):
        main_lv, main_hDim = ltools.main_lv(self, geom, "Box")

        if self.auxParams != None:
            ltools.addAuxParams(self, main_lv)

        self.add_volume(main_lv)
Beispiel #5
0
    def construct(self, geom):
        """
        Construct the geometry for Rectangular Bar.
        :returns: None
        """
        main_lv, main_hDim = ltools.main_lv(self, geom, "Tubs")

        if self.auxParams != None:
            ltools.addAuxParams(self, main_lv)

        self.add_volume(main_lv)
    def construct( self, geom ):
        main_lv = None
        main_hDim = None
        
        if self.shape == "Tubs":
            main_lv, main_hDim = ltools.main_lv( self, geom, "Tubs")
        else: main_lv, main_hDim = ltools.main_lv( self, geom, "Box")

        if self.auxParams != None:
            ltools.addAuxParams( self, main_lv )

        self.add_volume( main_lv )

        if self.NElements != None:
            TranspV = [0,0,1]
            if  self.TranspV != None:
                TranspV = self.TranspV
            ltools.placeBuilders( self, geom, main_lv, TranspV )
        else:
            print( "**Warning, no Elements to place inside "+ self.name)
Beispiel #7
0
    def construct( self, geom ):
        main_lv, main_hDim = ltools.main_lv( self, geom, "Box")
        self.add_volume( main_lv )

        if self.NElements != None:
            TranspV = [1,0,0]
            if  self.TranspV != None:
                TranspV = self.TranspV
            ltools.placeBuilders( self, geom, main_lv, TranspV )
        else:
            print( "**Warning, no Elements to place inside "+ self.name)
Beispiel #8
0
    def construct(self, geom):
        main_lv, main_hDim = ltools.main_lv(self, geom, "Box")

        if self.auxParams != None:
            ltools.addAuxParams(self, main_lv)

        self.add_volume(main_lv)

        builders = self.get_builders()
        sb_central = builders[0]
        sb_top = builders[1]
        sb_side = builders[2]

        ltools.placeCrossBuilders(main_lv, sb_central, sb_top, sb_side, self,
                                  geom)
    def construct( self, geom ):
        main_lv, main_hDim = ltools.main_lv( self, geom, "Box")
        self.add_volume( main_lv )

        # definition local Rotation
        Rotation1 = geom.structure.Rotation( self.name+'_rot1', str(self.Rotation1[0]),
                                            str(self.Rotation1[1]),  str(self.Rotation1[2]) )

        # get sub-builders and its logic volume
        sb = self.get_builder()
        el_lv = sb.get_volume()

        # get the sub-builder dimension, using its shape
        el_shape = geom.store.shapes.get(el_lv.shape)
        el_dim = [self.SubBDim[0], self.SubBDim[1], self.SubBDim[2]]

        # calculate half dimension of element plus the gap projected to the transportation vector
        sb_dim_v1 = [t*(d+0.5*self.InsideGap1) for t,d in zip(self.TranspV1,el_dim)]
        sb_dim_v2 = [t*(d+0.5*self.InsideGap2) for t,d in zip(self.TranspV2,el_dim)]

        # lower edge, the ule dimension projected on transportation vector
        low_end_v1  = [-t*d+ed for t,d,ed in zip(self.TranspV1,main_hDim,sb_dim_v1)]
        low_end_v2  = [-t*d+ed for t,d,ed in zip(self.TranspV2,main_hDim,sb_dim_v2)]

        for elem2 in xrange(self.NElements2):
            for elem1 in xrange(self.NElements1):
                # calculate the distance for n elements = i*2*halfdinemsion
                temp_v = [elem1*2*d1+elem2*2*d2 for d1,d2 in zip(sb_dim_v1,sb_dim_v2)]
                # define the position for the element based on edge
                temp_v = [te+l1+l2 for te,l1,l2 in zip(temp_v,low_end_v1,low_end_v2)]
                # defining position, placement, and finally insert into the ule.
                el_pos = geom.structure.Position(self.name+"_el"+str(elem1)+'_'+str(elem2)+'_pos',
                                                    temp_v[0], temp_v[1], temp_v[2])
                if  self.IndependentVolumes != None :
                    el_lv_temp = geom.structure.Volume( el_lv.name+str(elem1)+str(elem2),
                                        material=el_lv.material, shape=el_lv.shape, placements=el_lv.placements)
                else:
                    el_lv_temp = el_lv

                el_pla = geom.structure.Placement(self.name+"_el"+str(elem1)+'_'+str(elem2)+'_pla',
                                                    volume=el_lv_temp, pos=el_pos, rot =Rotation1)
                main_lv.placements.append(el_pla.name)
Beispiel #10
0
    def construct(self, geom):
        main_lv, main_hDim = ltools.main_lv(self, geom, "Box")
        self.add_volume(main_lv)

        # sub builders
        sb = self.get_builder()
        det_lv = sb.get_volume()
        det_dim = ltools.getShapeDimensions(det_lv, geom)
        displace = -1 * self.halfDimension['dy'] + det_dim[2]
        pos = [Q("0m"), displace, Q("0m")]
        #rot = [Q("0deg"),Q("0deg"),Q("0deg")]

        det_pos = geom.structure.Position(det_lv.name + '_pos', pos[0], pos[1],
                                          pos[2])
        det_rot = geom.structure.Rotation(det_lv.name + '_rot',
                                          self.Rotation[0], self.Rotation[1],
                                          self.Rotation[2])
        det_pla = geom.structure.Placement(det_lv.name + '_pla',
                                           volume=det_lv,
                                           pos=det_pos,
                                           rot=det_rot)
        main_lv.placements.append(det_pla.name)
Beispiel #11
0
    def construct(self, geom):
        # PARTICULAR GEOMETRY, IT IS NO GENERAL, NO EVERYONE CAN USE
        #(xyz- = xyzn, xyz+ = xyzp)
        main_lv, main_hDim = ltools.main_lv(self, geom, "Box")
        sb_boolean_shape = geom.store.shapes.get(main_lv.shape)
        builders = self.get_builders()

        #XY (-Z)
        sb_xyzn = builders[0]
        sb_xyzn_lv = sb_xyzn.get_volume()
        sb_xyzn_shape = geom.store.shapes.get(sb_xyzn_lv.shape)
        sb_pos = geom.structure.Position(
            self.name + '_pos_xyzn', Q('0cm'), Q('0cm'),
            -main_hDim[2] + sb_xyzn.halfDimension['dz'])
        sb_boolean_shape = geom.shapes.Boolean(self.name + '_xyzn',
                                               type='intersection',
                                               first=sb_boolean_shape,
                                               second=sb_xyzn_shape,
                                               pos=sb_pos)

        #XY (+Z)
        sb_xyzp = builders[1]
        sb_xyzp_lv = sb_xyzp.get_volume()
        sb_xyzp_shape = geom.store.shapes.get(sb_xyzp_lv.shape)
        sb_pos = geom.structure.Position(
            self.name + '_pos_xyzp', Q('0cm'), Q('0cm'),
            main_hDim[2] - sb_xyzp.halfDimension['dz'])
        sb_boolean_shape = geom.shapes.Boolean(self.name + '_xyzp',
                                               type='union',
                                               first=sb_boolean_shape,
                                               second=sb_xyzp_shape,
                                               pos=sb_pos)

        #YZ (-X)
        sb_yzxn = builders[2]
        sb_yzxn_lv = sb_yzxn.get_volume()
        sb_yzxn_shape = geom.store.shapes.get(sb_yzxn_lv.shape)
        sb_pos = geom.structure.Position(
            self.name + '_pos_yzxn',
            -main_hDim[0] + sb_yzxn.halfDimension['dx'], Q('0cm'), Q('0cm'))
        sb_boolean_shape = geom.shapes.Boolean(self.name + '_yzxn',
                                               type='union',
                                               first=sb_boolean_shape,
                                               second=sb_yzxn_shape,
                                               pos=sb_pos)

        #YZ (+X)
        sb_yzxp = builders[3]
        sb_yzxp_lv = sb_yzxp.get_volume()
        sb_yzxp_shape = geom.store.shapes.get(sb_yzxp_lv.shape)
        sb_pos = geom.structure.Position(
            self.name + '_pos_yzxp',
            +main_hDim[0] - sb_yzxp.halfDimension['dx'], Q('0cm'), Q('0cm'))
        sb_boolean_shape = geom.shapes.Boolean(self.name + '_yzxp',
                                               type='union',
                                               first=sb_boolean_shape,
                                               second=sb_yzxp_shape,
                                               pos=sb_pos)
        #XZ (-Y)
        sb_xzyn = builders[4]
        sb_xzyn_lv = sb_xzyn.get_volume()
        sb_xzyn_shape = geom.store.shapes.get(sb_xzyn_lv.shape)
        sb_pos = geom.structure.Position(
            self.name + '_pos_xzyn', Q('0cm'),
            -main_hDim[1] + sb_xzyn.halfDimension['dy'] + Q('20cm'), Q('0cm'))
        sb_boolean_shape = geom.shapes.Boolean(self.name + '_xzyn',
                                               type='union',
                                               first=sb_boolean_shape,
                                               second=sb_xzyn_shape,
                                               pos=sb_pos)

        sb_boolean_lv = geom.structure.Volume('vol' + sb_boolean_shape.name,
                                              material=self.material,
                                              shape=sb_boolean_shape)

        if isinstance(self.Sensitive, str):
            sb_boolean_lv.params.append(("SensDet", self.Sensitive))
        if isinstance(self.BField, str):
            sb_boolean_lv.params.append(("BField", self.BField))
        if isinstance(self.EField, str):
            sb_boolean_lv.params.append(("EField", self.EField))

        self.add_volume(sb_boolean_lv)