3 from svgfig
import rgb, SVG, pathtoPath, load
as load_svg
4 from geometryXMLparser
import *
5 from signConventions
import *
8 return rgb(0.1, 0.9, 0.)
11 return rgb(0.1, 0.9, 0.)
13 def draw_station(geom1, geom2, station, filename, length_factor=100., angle_factor=100., colors=dt_colors):
14 if station == 4: station_template = load_svg(
"station4_template.svg")
15 else: station_template = load_svg(
"station_template.svg")
17 if station == 1: x_scale_factor = 1/6.
18 if station == 2: x_scale_factor = 1/7.
19 if station == 3: x_scale_factor = 1/8.5
20 if station == 4: x_scale_factor = 1/10.
27 for treeindex, svgitem
in station_template:
28 if isinstance(svgitem, SVG)
and "id" in svgitem.attr
and svgitem[
"id"][:3] ==
"MB_":
29 m = re.match(
"MB_([0-9mpz]+)_([0-9]+)", svgitem[
"id"])
30 if m
is None:
raise Exception
33 if wheel ==
"m2": wheel = -2
34 elif wheel ==
"m1": wheel = -1
35 elif wheel ==
"z": wheel = 0
36 elif wheel ==
"p1": wheel = 1
37 elif wheel ==
"p2": wheel = 2
38 sector = int(m.group(2))
40 xdiff = x_scale_factor * length_factor * (geom1.dt[wheel, station, sector].x - geom2.dt[wheel, station, sector].x) * signConventions[
"DT", wheel, station, sector][0]
41 ydiff = -y_scale_factor * length_factor * (geom1.dt[wheel, station, sector].y - geom2.dt[wheel, station, sector].y) * signConventions[
"DT", wheel, station, sector][1]
42 phizdiff = -angle_factor * (geom1.dt[wheel, station, sector].phiz - geom2.dt[wheel, station, sector].phiz) * signConventions[
"DT", wheel, station, sector][2]
44 sx = float(svgitem[
"x"]) + float(svgitem[
"width"])/2.
45 sy = float(svgitem[
"y"]) + float(svgitem[
"height"])/2.
47 svgitem[
"transform"] =
"translate(%g,%g)" % (sx, sy)
48 svgitem[
"x"] = -float(svgitem[
"width"])/2.
49 svgitem[
"y"] = -float(svgitem[
"height"])/2.
51 svgitem[
"style"] =
"fill:#e1e1e1;fill-opacity:1;stroke:#000000;stroke-width:1.0;stroke-dasharray:1, 1;stroke-dashoffset:0"
53 newBox = svgitem.clone()
54 newBox[
"transform"] =
"translate(%g,%g) rotate(%g) " % (sx + xdiff, sy + ydiff, phizdiff * 180./pi)
55 newBox[
"style"] =
"fill:%s;fill-opacity:0.5;stroke:#000000;stroke-width:1.0;stroke-opacity:1;stroke-dasharray:none" %
colors(wheel, station, sector)
57 new_boxes.append(newBox)
59 for treeindex, svgitem
in station_template:
60 if isinstance(svgitem, SVG)
and svgitem.t ==
"g" and "id" in svgitem.attr
and svgitem[
"id"] ==
"chambers":
61 svgitem.append(new_boxes)
63 elif isinstance(svgitem, SVG)
and "id" in svgitem.attr
and svgitem[
"id"] ==
"stationx":
64 svgitem[0] =
"Station %d" % station
65 svgitem[0] +=
" (length x%g, angle x%g)" % (length_factor, angle_factor)
67 station_template.save(filename)
69 def draw_wheel(geom1, geom2, wheel, filename, length_factor=100., angle_factor=100., colors=dt_colors):
70 wheel_template = load_svg(
"wheel_template.svg")
76 for treeindex, svgitem
in wheel_template:
77 if isinstance(svgitem, SVG)
and "id" in svgitem.attr
and svgitem[
"id"][:3] ==
"MB_":
78 m = re.match(
"MB_([0-9]+)_([0-9]+)", svgitem[
"id"])
79 if m
is None:
raise Exception
81 station, sector = int(m.group(1)), int(m.group(2))
82 xdiff = -length_factor * (geom1.dt[wheel, station, sector].x - geom2.dt[wheel, station, sector].x) * signConventions[
"DT", wheel, station, sector][0]
83 zdiff = length_factor * (geom1.dt[wheel, station, sector].z - geom2.dt[wheel, station, sector].z) * signConventions[
"DT", wheel, station, sector][2]
84 phiydiff = -angle_factor * (geom1.dt[wheel, station, sector].phiy - geom2.dt[wheel, station, sector].phiy) * signConventions[
"DT", wheel, station, sector][1]
86 m = re.search(
"translate\(([0-9\.\-\+eE]+),\s([0-9\.\-\+eE]+)\)\srotate\(([0-9\.\-\+eE]+)\)",svgitem[
"transform"])
88 tx = float(m.group(1))
89 ty = float(m.group(2))
90 tr = float(m.group(3))
92 newBox = svgitem.clone()
94 svgitem[
"style"] =
"fill:#e1e1e1;fill-opacity:1;stroke:#000000;stroke-width:5.0;stroke-dasharray:1, 1;stroke-dashoffset:0"
95 newBox[
"style"] =
"fill:%s;fill-opacity:0.5;stroke:#000000;stroke-width:5.0;stroke-opacity:1;stroke-dasharray:none" %
colors(wheel, station, sector)
96 newBox[
"id"] = newBox[
"id"] +
"_moved"
98 newBox[
"transform"] =
"translate(%g,%g) rotate(%g)" % (tx - xdiff*
cos(tr*pi/180.) + zdiff*
sin(tr*pi/180.), ty - xdiff*
sin(tr*pi/180.) - zdiff*
cos(tr*pi/180.), tr - phiydiff*180./pi)
100 new_boxes.append(newBox)
102 for treeindex, svgitem
in wheel_template:
103 if isinstance(svgitem, SVG)
and svgitem.t ==
"g" and "id" in svgitem.attr
and svgitem[
"id"] ==
"chambers":
104 svgitem.append(new_boxes)
106 elif isinstance(svgitem, SVG)
and "id" in svgitem.attr
and svgitem[
"id"] ==
"wheelx":
107 if wheel == 0: svgitem[0] =
"Wheel 0"
108 else: svgitem[0] =
"Wheel %+d" % wheel
109 svgitem[0] +=
" (length x%g, angle x%g)" % (length_factor, angle_factor)
111 wheel_template.save(filename)
113 def draw_disk(geom1, geom2, endcap, station, filename, length_factor=1., angle_factor=100., colors=csc_colors):
114 if station == 1: disk_template = load_svg(
"disk1_template.svg")
115 if station
in (2, 3): disk_template = load_svg(
"disk23_template.svg")
116 if endcap == 1
and station == 4: disk_template = load_svg(
"diskp4_template.svg")
117 if endcap == 2
and station == 4: disk_template = load_svg(
"diskm4_template.svg")
123 for treeindex, svgitem
in disk_template:
124 if isinstance(svgitem, SVG)
and "id" in svgitem.attr
and svgitem[
"id"] ==
"fakecenter":
129 for i, di
in enumerate(fakecenter.d):
130 if di[0]
in (
"M",
"L"):
137 for treeindex, svgitem
in disk_template:
138 if isinstance(svgitem, SVG)
and "id" in svgitem.attr
and svgitem[
"id"][:3] ==
"ME_":
139 m = re.match(
"ME_([0-9]+)_([0-9]+)", svgitem[
"id"])
140 if m
is None:
raise Exception
142 ring, chamber = int(m.group(1)), int(m.group(2))
143 xdiff = scale_factor * length_factor * (geom1.csc[endcap, station, ring, chamber].x - geom2.csc[endcap, station, ring, chamber].x) * signConventions[
"CSC", endcap, station, ring, chamber][0]
144 ydiff = -scale_factor * length_factor * (geom1.csc[endcap, station, ring, chamber].y - geom2.csc[endcap, station, ring, chamber].y) * signConventions[
"CSC", endcap, station, ring, chamber][1]
145 phizdiff = -angle_factor * (geom1.csc[endcap, station, ring, chamber].phiz - geom2.csc[endcap, station, ring, chamber].phiz) * signConventions[
"CSC", endcap, station, ring, chamber][2]
147 svgitem[
"style"] =
"fill:#e1e1e1;fill-opacity:1;stroke:#000000;stroke-width:1.0;stroke-dasharray:1, 1;stroke-dashoffset:0"
153 for i, di
in enumerate(newBox.d):
154 if not first
and di[0] ==
"m":
157 newBox.d[i] = tuple(di)
167 for i, di
in enumerate(newBox.d):
175 phipos = atan2(centery - originy, centerx - originx) - pi/2.
176 for i, di
in enumerate(newBox.d):
177 if di[0]
in (
"M",
"L"):
179 di[1] +=
cos(phipos)*xdiff -
sin(phipos)*ydiff
180 di[2] +=
sin(phipos)*xdiff +
cos(phipos)*ydiff
181 newBox.d[i] = tuple(di)
183 centerx +=
cos(phipos)*xdiff -
sin(phipos)*ydiff
184 centery +=
sin(phipos)*xdiff +
cos(phipos)*ydiff
186 for i, di
in enumerate(newBox.d):
187 if di[0]
in (
"M",
"L"):
189 dispx =
cos(phizdiff) * (di[1] - centerx) -
sin(phizdiff) * (di[2] - centery)
190 dispy =
sin(phizdiff) * (di[1] - centerx) +
cos(phizdiff) * (di[2] - centery)
191 di[1] = dispx + centerx
192 di[2] = dispy + centery
193 newBox.d[i] = tuple(di)
195 newBox = newBox.SVG()
196 newBox[
"style"] =
"fill:%s;fill-opacity:0.5;stroke:#000000;stroke-width:1.0;stroke-opacity:1;stroke-dasharray:none" %
colors(endcap, station, ring, chamber)
197 newBox[
"id"] = newBox[
"id"] +
"_moved"
199 new_boxes.append(newBox)
201 for treeindex, svgitem
in disk_template:
202 if isinstance(svgitem, SVG)
and svgitem.t ==
"g" and "id" in svgitem.attr
and svgitem[
"id"] ==
"chambers":
203 svgitem.append(new_boxes)
205 elif isinstance(svgitem, SVG)
and "id" in svgitem.attr
and svgitem[
"id"] ==
"diskx":
206 if endcap == 1: svgitem[0] =
"Disk %+d" % station
207 else: svgitem[0] =
"Disk %+d" % (-station)
208 svgitem[0] +=
" (length x%g, angle x%g)" % (length_factor, angle_factor)
210 disk_template.save(filename)
Sin< T >::type sin(const T &t)
std::vector< Color_t > colors
Cos< T >::type cos(const T &t)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run