16 for ai, bi, name
in zip(
list(a) + [0]*(5 - len(a)), \
17 list(b) + [0]*(5 - len(b)), \
18 (
"wheel",
"station",
"sector",
"superlayer",
"layer")):
19 exec(
"a%s = %d" % (name, ai))
20 exec(
"b%s = %d" % (name, bi))
22 if awheel == bwheel
and astation == bstation:
24 if asector != bsector:
25 if astation == 4: sectororder = [0, 1, 2, 3, 4, 13, 5, 6, 7, 8, 9, 10, 14, 11, 12]
26 elif awheel == 0: sectororder = [0, 1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12]
27 else: sectororder = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
28 return cmp(sectororder.index(asector), sectororder.index(bsector))
30 elif asuperlayer != bsuperlayer:
31 superlayerorder = [0, 1, 3, 2]
32 return cmp(superlayerorder.index(asuperlayer), superlayerorder.index(bsuperlayer))
37 for ai, bi, name
in zip(
list(a) + [0]*(5 - len(a)), \
38 list(b) + [0]*(5 - len(b)), \
39 (
"endcap",
"station",
"ring",
"chamber",
"layer")):
40 exec(
"a%s = %d" % (name, ai))
41 exec(
"b%s = %d" % (name, bi))
43 if astation == 1
and aring == 3:
return cmp(a, b)
45 elif aendcap == bendcap
and astation == bstation
and aring == bring
and achamber != bchamber:
46 if achamber == 0:
return -1
47 if bchamber == 0:
return 1
48 if achamber % 2 == 1
and bchamber % 2 == 0:
return -1
49 elif achamber % 2 == 0
and bchamber % 2 == 1:
return 1
58 return self.x, self.y, self.z
60 return (self.xx, self.xy, self.xz, self.xa, self.xb, self.xc), (self.xy, self.yy, self.yz, self.ya, self.yb, self.yc), (self.xz, self.yz, self.zz, self.za, self.zb, self.zc), (self.xa, self.ya, self.za, self.aa, self.ab, self.ac), (self.xb, self.yb, self.zb, self.ab, self.bb, self.bc), (self.xc, self.yc, self.zc, self.ac, self.ac, self.cc)
65 try: i.append(self.wheel)
66 except AttributeError:
pass 67 try: i.append(self.station)
68 except AttributeError:
pass 69 try: i.append(self.sector)
70 except AttributeError:
pass 71 try: i.append(self.superlayer)
72 except AttributeError:
pass 73 try: i.append(self.layer)
74 except AttributeError:
pass 80 try: i.append(self.endcap)
81 except AttributeError:
pass 82 try: i.append(self.station)
83 except AttributeError:
pass 84 try: i.append(self.ring)
85 except AttributeError:
pass 86 try: i.append(self.chamber)
87 except AttributeError:
pass 88 try: i.append(self.layer)
89 except AttributeError:
pass 105 if stream
is not None:
106 parser = xml.sax.make_parser()
107 parser.setContentHandler(self)
112 attrib =
dict(attrib.items())
113 if "rawId" in attrib:
raise Exception(
"Please use \"rawIds = false\"")
114 if "aa" in attrib:
raise Exception(
"Please use \"survey = false\"")
116 if tag ==
"MuonAlignment":
pass 118 elif tag ==
"collection":
raise NotImplementedError(
"<collection /> and <collection> blocks aren't implemented yet")
120 elif tag ==
"operation":
123 elif self.
_operation is None:
raise Exception(
"All chambers and positions must be enclosed in <operation> blocks")
125 elif tag ==
"setposition":
126 self._operation.setposition[
"relativeto"] =
str(attrib[
"relativeto"])
128 for name
in "x",
"y",
"z":
129 self._operation.setposition[name] =
float(attrib[name])
131 for name
in "phix",
"phiy",
"phiz":
132 self._operation.setposition[name] =
float(attrib[name])
134 for name
in "alpha",
"beta",
"gamma":
135 self._operation.setposition[name] =
float(attrib[name])
137 elif tag ==
"setape":
138 for name
in "xx",
"xy",
"xz",
"xa",
"xb",
"xc",
"yy",
"yz",
"ya",
"yb",
"yc",
"zz",
"za",
"zb",
"zc",
"aa",
"ab",
"ac",
"bb",
"bc",
"cc":
139 self._operation.setposition[name] =
float(attrib[name])
141 elif tag[0:2] ==
"DT":
143 for name
in "wheel",
"station",
"sector",
"superlayer",
"layer":
145 alignable.__dict__[name] =
int(attrib[name])
146 self._operation.chambers.append(alignable)
149 elif tag[0:3] ==
"CSC":
151 for name
in "endcap",
"station",
"ring",
"chamber",
"layer":
153 alignable.__dict__[name] =
int(attrib[name])
154 self._operation.chambers.append(alignable)
158 if tag ==
"operation":
160 for c
in self._operation.chambers:
161 c.__dict__.update(self._operation.setposition)
162 c.__dict__.update(self._operation.setape)
163 if isinstance(c, DTAlignable): self.
dt[c.index()] = c
164 elif isinstance(c, CSCAlignable): self.
csc[c.index()] = c
167 def xml(self, stream=None, precision=10):
168 if precision ==
None: format =
"%g" 169 else: format =
"%." +
str(precision) +
"f" 173 writeline =
lambda x: output.append(x)
175 writeline =
lambda x: stream.write(x)
177 writeline(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
178 writeline(
"<?xml-stylesheet type=\"text/xml\" href=\"MuonAlignment.xsl\"?>\n")
179 writeline(
"<MuonAlignment>\n\n")
181 dtkeys = self.dt.keys()
183 csckeys = self.csc.keys()
184 csckeys.sort(cscorder)
186 def f(number):
return format % number
188 def position_ape(ali, attributes):
189 writeline(
" <%s%s />\n" % (level, attributes))
190 writeline(
" <setposition relativeto=\"%s\" x=\"%s\" y=\"%s\" z=\"%s\" phix=\"%s\" phiy=\"%s\" phiz=\"%s\" />\n" % \
191 (ali.relativeto,
f(ali.x),
f(ali.y),
f(ali.z),
f(ali.phix),
f(ali.phiy),
f(ali.phiz)))
193 if "xx" in ali.__dict__:
194 writeline(
" <setape xx=\"%s\" xy=\"%s\" xz=\"%s\" xa=\"%s\" xb=\"%s\" xc=\"%s\" yy=\"%s\" yz=\"%s\" ya=\"%s\" yb=\"%s\" yc=\"%s\" zz=\"%s\" za=\"%s\" zb=\"%s\" zc=\"%s\" aa=\"%s\" ab=\"%s\" ac=\"%s\" bb=\"%s\" bc=\"%s\" cc=\"%s\" />\n" % \
195 (
f(ali.xx),
f(ali.xy),
f(ali.xz),
f(ali.xa),
f(ali.xb),
f(ali.xc),
f(ali.yy),
f(ali.yz),
f(ali.ya),
f(ali.yb),
f(ali.yc),
f(ali.zz),
f(ali.za),
f(ali.zb),
f(ali.zc),
f(ali.aa),
f(ali.ab),
f(ali.ac),
f(ali.bb),
f(ali.bc),
f(ali.cc)))
198 writeline(
"<operation>\n")
200 if len(key) == 0: level =
"DTBarrel" 201 elif len(key) == 1: level =
"DTWheel " 202 elif len(key) == 2: level =
"DTStation " 203 elif len(key) == 3: level =
"DTChamber " 204 elif len(key) == 4: level =
"DTSuperLayer " 205 elif len(key) == 5: level =
"DTLayer " 208 attributes =
" ".
join([
"%s=\"%d\"" % (name, value)
for name, value
in zip((
"wheel",
"station",
"sector",
"superlayer",
"layer"), key)])
209 position_ape(ali, attributes)
211 writeline(
"</operation>\n\n")
214 writeline(
"<operation>\n")
216 if len(key) == 1: level =
"CSCEndcap " 217 elif len(key) == 2: level =
"CSCStation " 218 elif len(key) == 3: level =
"CSCRing " 219 elif len(key) == 4: level =
"CSCChamber " 220 elif len(key) == 5: level =
"CSCLayer " 223 attributes =
" ".
join([
"%s=\"%d\"" % (name, value)
for name, value
in zip((
"endcap",
"station",
"ring",
"chamber",
"layer"), key)])
224 position_ape(ali, attributes)
226 writeline(
"</operation>\n\n")
228 writeline(
"</MuonAlignment>\n")
229 if stream ==
None:
return "".
join(output)
def endElement(self, tag)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def xml(self, stream=None, precision=10)
def __init__(self, stream=None)
def startElement(self, tag, attrib)
static std::string join(char **cmd)
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