def single_line_manual_with_z(self, slopey, slopez, intercepty=0.0, interceptz=0.0): # no container needed vec = euclid.Vector3(1.0, slopey, slopez) pos = euclid.Point3(0.0, intercepty, interceptz) # fix at x=0 plane -> foil plane return euclid.Line3(pos, vec)
def hits(self, line=None, side=0): """ Input: A euclid line3 object The tracker side (=0 -> left tracker default) Process: Determine the nearest wires given a line throught the initial grid and cut on those wires closer than the lattice constant. Output: 2 Lists of wire coordinates and radii = shortest distance wire to line """ zvec = euclid.Vector3(0.0,0.0,1.0) # zaxis vector for 3D wire line darr = np.zeros((self.rows, self.columns)) zcoord = np.zeros((self.rows, self.columns)) if side < 1: sign = -1 tracker = self.grid_left else: sign = 1 tracker = self.grid_right self.wireinfo = [] # clean start m = 0 for entry in tracker: # rows for n in range(len(entry)): # columns if isinstance(line, euclid.Line3): # input was a Line3 object pos = euclid.Point3(entry[n][0], entry[n][1], 0.0) # point of wire in grid wire = euclid.Line3(pos,zvec) # wire into a vertical 3D line segm = wire.connect(line) zcoord[m][n] = segm.p.z darr[m][n] = segm.length # shortest distance line to line in 3D elif isinstance(line, HX.helix): # input was a Helix object distance = line.GetDistanceToPoint((entry[n][0]*1.0e-3, entry[n][1]*1.0e-3, 0.0)) # input in [m] zcoord[m][n] = sign*line.tanlambda * entry[n][0] # [mm] darr[m][n] = distance[0]*1.0e3 # [mm] shortest distance helix to wire point in 2D else: print 'grid ERROR: input type unknown, not line nor helix' return [], [] m += 1 cells = [] radius = [] iarr,jarr = np.where(darr <= (0.51*self.d)) #allow minimal overlap for ind,item in enumerate(iarr): jind = jarr[ind] pair = list(tracker[item][jind]) pair.append(zcoord[item][jind]) #print 'hit: ',pair self.wireinfo.append((side, jind, item)) # side, row, column cells.append(pair) # wire (x,y) and z concatenated radius.append(darr[item][jind]) return cells, radius
def single_line_manual_atplane(self, slope, interceptx, intercepty): # no container needed vec = euclid.Vector3(1.0, slope,0.0) pos = euclid.Point3(interceptx, intercepty, 0.0) # fix at icx, iy point return euclid.Line3(pos,vec)
def single_line_manual(self, slope, intercept = 0.0): # no container needed vec = euclid.Vector3(1.0, slope,0.0) pos = euclid.Point3(0.0, intercept, 0.0) # fix at x=0 plane -> foil plane return euclid.Line3(pos,vec)
euclid.Point2(sign * 53.0 + sign * bl * 44.0 + cellvariation, 0.0), euclid.Vector2(0.0, 1.0)) breakpoint = original.intersect(layerline) bpoints.append((breakpoint.x, breakpoint.y)) blayer.append(bl) c, r, i = remove_hits(bl + 1, 9, cells, radii, info) # return numpy arrays cluster[1] = (c, r, i) # next line continuing from breakpoint scat_angle = random.gauss(0.0, scatter_angle * math.pi / 180.0) # random scattering angle newangle = angle + scat_angle # altering original slope angle with new angle sl = math.tan(newangle) nextdummy = euclid.Line3( euclid.Point3(breakpoint.x, breakpoint.y, 5.0), euclid.Vector3(1.0, sl, 0.0)) caloinfo = dcalo.calohits(nextdummy, lrtracker) while len(caloinfo) < 1: # no calo was hit, try again scat_angle = random.gauss(0.0, scatter_angle * math.pi / 180.0) # random scattering angle newangle = angle + scat_angle # altering original slope angle with new angle sl = math.tan(newangle) nextdummy = euclid.Line3( euclid.Point3(breakpoint.x, breakpoint.y, 5.0), euclid.Vector3(1.0, sl, 0.0)) caloinfo = dcalo.calohits(nextdummy, lrtracker) bangles.append(scat_angle) lines.append(nextdummy) ncells, nradii = wgr.hits(nextdummy,
def _calorimeter_plane(self, info): type = info[0] # calo type side = info[1] # the tracker side wall = info[2] # the wall # Main Wall if type == 0: # main calo sitting at x = +- 43.5cm if side == 0: calo = EU.Plane(EU.Point3(-435, 0.0, 0.0), EU.Point3(-435, 1.0, 0.0), EU.Point3(-435, 0.0, 1.0)) else: calo = EU.Plane(EU.Point3(435, 0.0, 0.0), EU.Point3(435, 1.0, 0.0), EU.Point3(435, 0.0, 1.0)) # X Wall elif type == 1: # xwall calo sitting at y = +- 250.55cm if wall == 0: calo = EU.Plane(EU.Point3(0.0, -2505.5, 0.0), EU.Point3(1.0, -2505.5, 0.0), EU.Point3(0.0, -2505.5, 1.0)) else: calo = EU.Plane(EU.Point3(0.0, 2505.5, 0.0), EU.Point3(1.0, 2505.5, 0.0), EU.Point3(0.0, 2505.5, 1.0)) # Gamma Veto elif type == 2: # gveto calo sitting at z = +- 155.0cm if wall == 0: calo = EU.Plane(EU.Point3(1.0, 0.0, -1550.0), EU.Point3(0.0, 1.0, -1550.0), EU.Point3(0.0, 0.0, -1550.0)) else: calo = EU.Plane(EU.Point3(1.0, 0.0, 1550.0), EU.Point3(0.0, 1.0, 1550.0), EU.Point3(0.0, 0.0, 1550.0)) return calo # a euclid plane object in 3D
def calohits(self, structure, side=0): ''' Takes input line and tracker side from artificial multilines generator to create corresponding artificial calorimeter hits line is a euclid line3 object. ''' self.point = [] ci = [] for t, s, w in self.store.keys(): # check each calo type thispoint = () #print 'calohits side = %d'%side if isinstance(structure, EU.Line3): plane = self.store[(t, s, w)][0] thispoint = structure.intersect(plane) if isinstance(thispoint, EU.Point3): caloinfo = self.calo_id(thispoint) if len(caloinfo ) and caloinfo[3] == side: # not an empty tuple self.point.append(thispoint) # now the right units ci.append(caloinfo) # found the calo hit #print 'calo info found: ',caloinfo else: # helix object, internal length units [m] plane = self.store[(t, s, w)][0] if t == 0: # main wall if s == side: if side == 0: planetup = (-435.0 * 1.0e-3, 0.0, 1.0, 0.0 ) # input to helix method thispoint = structure.intersectionXY(planetup) else: planetup = (435.0 * 1.0e-3, 0.0, -1.0, 0.0 ) # input to helix method thispoint = structure.intersectionXY(planetup) elif t == 1: # xwall if s == side: if w == 0: planetup = (0.0, -2505.5 * 1.0e-3, 0.0, 1.0 ) # input to helix method thispoint = structure.intersectionXY(planetup) else: planetup = (0.0, 2505.0 * 1.0e-3, 0.0, -1.0 ) # input to helix method thispoint = structure.intersectionXY(planetup) elif t == 2: # gveto if s == side: if w == 0: zplane = -1550.0 # input to helix method thispoint = structure.intersectionZ(zplane * 1.0e-3) else: zplane = 1550.0 # input to helix method thispoint = structure.intersectionZ(zplane * 1.0e-3) if thispoint is not None and len(thispoint) > 0: p = EU.Point3(thispoint[0], thispoint[1], thispoint[2]) p *= 1.0e3 # [m] to [mm] #print 'test point: ',p caloinfo = self.calo_id(p) if len(caloinfo): # not an empty tuple self.point.append(p) # now the right units ci.append(caloinfo) # found the calo hit #return caloinfo # found the calo hit return ci # not found