35 write_xml(scenario,
"MCScenario_CRAFT1_22X.xml")
38 write_check_cfg(
"check_cfg.py",
"MCScenario_CRAFT1_22X.db",
"MCScenario_CRAFT1_22X_CHECKME.xml")
43 outfile =
file(fileName,
"w")
45 from Alignment.MuonAlignment.convertXMLtoSQLite_cfg import *
46 process.MuonGeometryDBConverter.fileName = "%(xmlFileName)s"
47 process.PoolDBOutputService.connect = "sqlite_file:%(dbFileName)s"
51 outfile =
file(fileName,
"w")
53 from Alignment.MuonAlignment.convertSQLitetoXML_cfg import *
54 process.PoolDBESSource.connect = "sqlite_file:%(dbFileName)s"
55 process.MuonGeometryDBConverter.outputXML.fileName = "%(xmlFileName)s"
56 process.MuonGeometryDBConverter.outputXML.relativeto = "ideal"
57 process.MuonGeometryDBConverter.outputXML.suppressDTChambers = False
58 process.MuonGeometryDBConverter.outputXML.suppressDTSuperLayers = False
59 process.MuonGeometryDBConverter.outputXML.suppressDTLayers = True
60 process.MuonGeometryDBConverter.outputXML.suppressCSCChambers = False
61 process.MuonGeometryDBConverter.outputXML.suppressCSCLayers = False
65 os.system(
"cmsRun %(fileName)s" % vars())
70 DTpreferred_order = {
"wheel":1,
"station":2,
"sector":3,
"superlayer":4,
"layer":5}
71 CSCpreferred_order = {
"endcap":1,
"station":2,
"ring":3,
"chamber":4,
"layer":5}
72 def DTsorter(a, b):
return cmp(DTpreferred_order[a], DTpreferred_order[b])
73 def CSCsorter(a, b):
return cmp(CSCpreferred_order[a], CSCpreferred_order[b])
82 parameters = self.location.keys()
84 parameters.sort(DTsorter)
86 parameters.sort(CSCsorter)
89 for parameter
in parameters:
90 output.extend([parameter,
"=\"", str(self.
location[parameter]),
"\" "])
93 return "".
join(output)
95 preferred_order = {
"x":1,
"y":2,
"z":3,
"phix":4,
"phiy":5,
"phiz":6}
96 def sorter(a, b):
return cmp(preferred_order[a], preferred_order[b])
104 parameters = self.location.keys()
105 parameters.sort(sorter)
107 output = [
"<setposition relativeto=\"ideal\" "]
108 for parameter
in parameters:
109 output.extend([parameter,
"=\"", str(self.
location[parameter]),
"\" "])
112 return "".
join(output)
121 output = [
"<operation> ", self.alignable.writeXML(),
" ", self.position.writeXML(),
" </operation>\n"]
122 return "".
join(output)
126 XMLlist = [
"<MuonAlignment>\n"]
127 for operation
in scenario:
128 XMLlist.append(operation.writeXML())
129 XMLlist.append(
"</MuonAlignment>\n")
130 XMLstring =
"".
join(XMLlist)
132 outfile =
file(fileName,
"w")
133 outfile.write(XMLstring)
137 self.__dict__.update(location)
141 self.__dict__.update(location)
176 for wheel
in -2, -1, 0, 1, 2:
177 for station
in 1, 2, 3, 4:
178 if station == 4: nsectors = 14
180 for sector
in range(1, nsectors+1):
181 DTchambers.append(
DTChamber(wheel = wheel, station = station, sector = sector))
184 for dtchamber
in DTchambers:
185 for superlayer
in 1, 2, 3:
186 if superlayer == 2
and dtchamber.station == 4:
continue
188 alignable =
Alignable(
"DTSuperLayer", wheel = dtchamber.wheel, station = dtchamber.station, sector = dtchamber.sector, superlayer = superlayer)
189 position =
Position(x = 0, y = 0, z = random.gauss(0, 0.054), phix = 0, phiy = 0, phiz = 0)
190 scenario.append(
Operation(alignable, position))
195 for wheel
in -1, 0, 1:
196 for sector
in 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14:
197 sector_errx[wheel, sector] = random.gauss(0., 0.05)
200 for wheel
in -1, 0, 1:
202 sector_errx[wheel, sector] = random.gauss(0., 0.65)
204 for sector
in 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14:
205 sector_errx[wheel, sector] = random.gauss(0., 0.65)
207 for dtchamber
in DTchambers:
209 if dtchamber.wheel
in (-1, 0, 1)
and dtchamber.sector
in (2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14):
210 errx = random.gauss(0, 0.08)
211 erry = random.gauss(0, 0.10)
212 errz = random.gauss(0, 0.10)
213 errphix = random.gauss(0, 0.0007)
214 errphiy = random.gauss(0, 0.0007)
215 errphiz = random.gauss(0, 0.0003)
219 errx = random.gauss(0, 0.08)
220 erry = random.gauss(0, 0.24)
221 errz = random.gauss(-0.35, 0.42)
222 errphix = random.gauss(0, 0.0016)
223 errphiy = random.gauss(0, 0.0021)
224 errphiz = random.gauss(0, 0.0010)
226 errx += sector_errx[dtchamber.wheel, dtchamber.sector]
229 alignable =
Alignable(
"DTChamber", wheel = dtchamber.wheel, station = dtchamber.station, sector = dtchamber.sector)
230 position =
Position(x = errx, y = erry, z = errz, phix = errphix, phiy = errphiy, phiz = errphiz)
231 scenario.append(
Operation(alignable, position))
243 for station, ring
in (1, 1), (1, 2), (1, 3), (1, 4), (2, 1), (2, 2), (3, 1), (3, 2), (4, 1):
244 if station > 1
and ring == 1:
249 for chamber
in range(1, nchambers+1):
250 CSCchambers.append(
CSCChamber(endcap = endcap, station = station, ring = ring, chamber = chamber))
253 for chamber
in CSCchambers:
254 for layer
in 1, 2, 3, 4, 5, 6:
255 alignable =
Alignable(
"CSCLayer", endcap = chamber.endcap, station = chamber.station, ring = chamber.ring, chamber = chamber.chamber, layer = layer)
256 position =
Position(x = random.gauss(0, 0.0092), y = 0, z = 0, phix = 0, phiy = 0, phiz = 0)
257 scenario.append(
Operation(alignable, position))
262 for station, ring
in (1, 1), (1, 2), (1, 3), (1, 4), (2, 1), (2, 2), (3, 1), (3, 2), (4, 1):
263 CSCrings.append(
CSCChamber(endcap = endcap, station = station, ring = ring, z = random.gauss(0, 0.1438), phix = random.gauss(0, 0.00057)))
266 for chamber
in CSCchambers:
267 errx = random.gauss(0, 0.03)
268 erry = random.gauss(0, 0.03)
269 errz = random.gauss(0, 0.03)
270 errphix = random.gauss(0, 0.00057)
271 errphiy = random.gauss(0, 0.0023)
272 errphiz = random.gauss(0, 0.00015)
274 for ring
in CSCrings:
275 if ring.endcap == chamber.endcap
and ring.station == chamber.station
and ring.ring == chamber.ring:
280 alignable =
Alignable(
"CSCChamber", endcap = chamber.endcap, station = chamber.station, ring = chamber.ring, chamber = chamber.chamber)
281 position =
Position(x = errx, y = erry, z = errz, phix = errphix, phiy = errphiy, phiz = errphiz)
282 scenario.append(
Operation(alignable, position))
286 for station
in 1, 2, 3, 4:
287 alignable =
Alignable(
"CSCStation", endcap = endcap, station = station)
288 position =
Position(x = random.gauss(0, 0.05), y = random.gauss(0, 0.05), z = random.gauss(0, 0.05), phix = 0., phiy = 0., phiz = random.gauss(0, 0.0001))
289 scenario.append(
Operation(alignable, position))
def make_scenario_sqlite
called once at the end of this script
static std::string join(char **cmd)
def write_conversion_cfg
that's it! everything this uses is defined below