CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
createJobs.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 import os, sys, optparse, math
4 
5 copyargs = sys.argv[:]
6 for i in range(len(copyargs)):
7  if copyargs[i] == "":
8  copyargs[i] = "\"\""
9  if copyargs[i].find(" ") != -1:
10  copyargs[i] = "\"%s\"" % copyargs[i]
11 commandline = " ".join(copyargs)
12 
13 usage = """./%prog DIRNAME ITERATIONS INITIALGEOM INPUTFILES [options]
14 
15 Creates (overwrites) a directory for each of the iterations and creates (overwrites)
16 submitJobs.sh with the submission sequence and dependencies.
17 
18 DIRNAME directories will be named DIRNAME01, DIRNAME02, etc.
19 ITERATIONS number of iterations
20 INITIALGEOM SQLite file containing muon geometry with tag names
21  DTAlignmentRcd, DTAlignmentErrorRcd, CSCAlignmentRcd, CSCAlignmentErrorRcd
22 INPUTFILES Python file defining 'fileNames', a list of input files as
23  strings (create with findQualityFiles.py)"""
24 
25 parser = optparse.OptionParser(usage)
26 parser.add_option("-j", "--jobs",
27  help="approximate number of \"gather\" subjobs",
28  type="int",
29  default=50,
30  dest="subjobs")
31 parser.add_option("-s", "--submitJobs",
32  help="alternate name of submitJobs.sh script (please include .sh extension); a file with this name will be OVERWRITTEN",
33  type="string",
34  default="submitJobs.sh",
35  dest="submitJobs")
36 parser.add_option("-b", "--big",
37  help="if invoked, subjobs will also be run on cmscaf1nd",
38  action="store_true",
39  dest="big")
40 parser.add_option("--mapplots",
41  help="if invoked, draw \"map plots\"",
42  action="store_true",
43  dest="mapplots")
44 parser.add_option("--segdiffplots",
45  help="if invoked, draw \"segment-difference plots\"",
46  action="store_true",
47  dest="segdiffplots")
48 parser.add_option("--curvatureplots",
49  help="if invoked, draw \"curvature plots\"",
50  action="store_true",
51  dest="curvatureplots")
52 parser.add_option("--globalTag",
53  help="GlobalTag for alignment/calibration conditions (typically all conditions except muon and tracker alignment)",
54  type="string",
55  default="CRAFT0831X_V1::All",
56  dest="globaltag")
57 parser.add_option("--trackerconnect",
58  help="connect string for tracker alignment (frontier://... or sqlite_file:...)",
59  type="string",
60  default="",
61  dest="trackerconnect")
62 parser.add_option("--trackeralignment",
63  help="name of TrackerAlignmentRcd tag",
64  type="string",
65  default="Alignments",
66  dest="trackeralignment")
67 parser.add_option("--trackerAPEconnect",
68  help="connect string for tracker APEs (frontier://... or sqlite_file:...)",
69  type="string",
70  default="",
71  dest="trackerAPEconnect")
72 parser.add_option("--trackerAPE",
73  help="name of TrackerAlignmentErrorRcd tag (tracker APEs)",
74  type="string",
75  default="AlignmentErrors",
76  dest="trackerAPE")
77 parser.add_option("--gprcdconnect",
78  help="connect string for GlobalPositionRcd (frontier://... or sqlite_file:...)",
79  type="string",
80  default="",
81  dest="gprcdconnect")
82 parser.add_option("--gprcd",
83  help="name of GlobalPositionRcd tag",
84  type="string",
85  default="SurveyGeometry",
86  dest="gprcd")
87 parser.add_option("--iscosmics",
88  help="if invoked, use cosmic track refitter instead of the standard one",
89  action="store_true",
90  dest="iscosmics")
91 parser.add_option("--station123params",
92  help="alignable parameters for DT stations 1, 2, 3 (see SWGuideAlignmentAlgorithms#Selection_of_what_to_align)",
93  type="string",
94  default="111111",
95  dest="station123params")
96 parser.add_option("--station4params",
97  help="alignable parameters for DT station 4",
98  type="string",
99  default="100011",
100  dest="station4params")
101 parser.add_option("--cscparams",
102  help="alignable parameters for CSC chambers",
103  type="string",
104  default="100011",
105  dest="cscparams")
106 parser.add_option("--minTrackPt",
107  help="minimum allowed track transverse momentum (in GeV)",
108  type="string",
109  default="100",
110  dest="minTrackPt")
111 parser.add_option("--maxTrackPt",
112  help="maximum allowed track transverse momentum (in GeV)",
113  type="string",
114  default="200",
115  dest="maxTrackPt")
116 parser.add_option("--minTrackerHits",
117  help="minimum number of tracker hits",
118  type="int",
119  default=15,
120  dest="minTrackerHits")
121 parser.add_option("--maxTrackerRedChi2",
122  help="maximum tracker chi^2 per degrees of freedom",
123  type="string",
124  default="10",
125  dest="maxTrackerRedChi2")
126 parser.add_option("--allowTIDTEC",
127  help="if invoked, allow tracks that pass through the tracker's !TID/!TEC region (recommended)",
128  action="store_true",
129  dest="allowTIDTEC")
130 parser.add_option("--twoBin",
131  help="if invoked, apply the \"two-bin method\" to control charge-antisymmetric errors",
132  action="store_true",
133  dest="twoBin")
134 parser.add_option("--weightAlignment",
135  help="if invoked, segments will be weighted by ndf/chi^2 in the alignment",
136  action="store_true",
137  dest="weightAlignment")
138 parser.add_option("--minAlignmentSegments",
139  help="minimum number of segments required to align a chamber",
140  type="int",
141  default=5,
142  dest="minAlignmentHits")
143 parser.add_option("--combineME11",
144  help="treat ME1/1a and ME1/1b as the same objects",
145  action="store_true",
146  dest="combineME11")
147 parser.add_option("--maxEvents",
148  help="maximum number of events",
149  type="string",
150  default="-1",
151  dest="maxEvents")
152 parser.add_option("--skipEvents",
153  help="number of events to be skipped",
154  type="string",
155  default="0",
156  dest="skipEvents")
157 parser.add_option("--validationLabel",
158  help="if given nonempty string RUNLABEL, diagnostics and creation of plots will be run in the end of the last iteration; the RUNLABEL will be used to mark a run; the results will be put into a RUNLABEL_DATESTAMP.tgz tarball",
159  type="string",
160  default="",
161  dest="validationLabel")
162 parser.add_option("--maxResSlopeY",
163  help="maximum residual slope y component",
164  type="string",
165  default="10",
166  dest="maxResSlopeY")
167 parser.add_option("--motionPolicyNSigma",
168  help="minimum nsigma(deltax) position displacement in order to move a chamber for the final alignment result; default NSIGMA=3",
169  type="int",
170  default=3,
171  dest="motionPolicyNSigma")
172 
173 if len(sys.argv) < 5:
174  raise SystemError, "Too few arguments.\n\n"+parser.format_help()
175 
176 DIRNAME = sys.argv[1]
177 ITERATIONS = int(sys.argv[2])
178 INITIALGEOM = sys.argv[3]
179 INPUTFILES = sys.argv[4]
180 
181 options, args = parser.parse_args(sys.argv[5:])
182 mapplots_ingeneral = options.mapplots
183 segdiffplots_ingeneral = options.segdiffplots
184 curvatureplots_ingeneral = options.curvatureplots
185 globaltag = options.globaltag
186 trackerconnect = options.trackerconnect
187 trackeralignment = options.trackeralignment
188 trackerAPEconnect = options.trackerAPEconnect
189 trackerAPE = options.trackerAPE
190 gprcdconnect = options.gprcdconnect
191 gprcd = options.gprcd
192 iscosmics = str(options.iscosmics)
193 station123params = options.station123params
194 station4params = options.station4params
195 cscparams = options.cscparams
196 minTrackPt = options.minTrackPt
197 maxTrackPt = options.maxTrackPt
198 minTrackerHits = str(options.minTrackerHits)
199 maxTrackerRedChi2 = options.maxTrackerRedChi2
200 allowTIDTEC = str(options.allowTIDTEC)
201 twoBin = str(options.twoBin)
202 weightAlignment = str(options.weightAlignment)
203 minAlignmentHits = str(options.minAlignmentHits)
204 combineME11 = str(options.combineME11)
205 maxEvents = options.maxEvents
206 skipEvents = options.skipEvents
207 validationLabel = options.validationLabel
208 maxResSlopeY = options.maxResSlopeY
209 theNSigma = options.motionPolicyNSigma
210 
211 execfile(INPUTFILES)
212 stepsize = int(math.ceil(1.*len(fileNames)/options.subjobs))
213 pwd = str(os.getcwdu())
214 
215 bsubfile = ["#!/bin/sh", ""]
216 bsubnames = []
217 last_align = None
218 
219 #####################################################################
220 # step 0: convert initial geometry to xml
221 INITIALXML = INITIALGEOM + '.xml'
222 if INITIALGEOM[-3:]=='.db':
223  INITIALXML = INITIALGEOM[:-3] + '.xml'
224 print "Converting",INITIALGEOM,"to",INITIALXML," ...will be done in several seconds..."
225 exit_code = os.system("./Alignment/MuonAlignmentAlgorithms/scripts/convertSQLiteXML.py %s %s" % (INITIALGEOM,INITIALXML))
226 if exit_code>0:
227  print "problem: conversion exited with code:", exit_code
228  sys.exit()
229 
230 #####################################################################
231 
232 directory = ""
233 for iteration in range(1, ITERATIONS+1):
234  if iteration == 1:
235  inputdb = INITIALGEOM
236  inputdbdir = directory[:]
237  else:
238  inputdb = director + ".db"
239  inputdbdir = directory[:]
240 
241  directory = "%s%02d/" % (DIRNAME, iteration)
242  director = directory[:-1]
243  os.system("rm -rf %s; mkdir %s" % (directory, directory))
244  os.system("cp gather_cfg.py %s" % directory)
245  os.system("cp align_cfg.py %s" % directory)
246 
247  bsubfile.append("cd %s" % directory)
248 
249  mapplots = False
250  if mapplots_ingeneral and (iteration == 1 or iteration == ITERATIONS): mapplots = True
251  segdiffplots = False
252  if segdiffplots_ingeneral and (iteration == 1 or iteration == ITERATIONS): segdiffplots = True
253  curvatureplots = False
254  if curvatureplots_ingeneral and (iteration == 1 or iteration == ITERATIONS): curvatureplots = True
255 
256  for jobnumber in range(options.subjobs):
257  gather_fileName = "%sgather%03d.sh" % (directory, jobnumber)
258  inputfiles = " ".join(fileNames[jobnumber*stepsize:(jobnumber+1)*stepsize])
259 
260  if mapplots or segdiffplots or curvatureplots: copyplots = "plotting*.root"
261  else: copyplots = ""
262 
263  copytrackerdb = ""
264  if trackerconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % trackerconnect[12:]
265  if trackerAPEconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % trackerAPEconnect[12:]
266  if gprcdconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % gprcdconnect[12:]
267 
268  if len(inputfiles) > 0:
269  file(gather_fileName, "w").write("""#/bin/sh
270 # %(commandline)s
271 
272 export ALIGNMENT_CAFDIR=`pwd`
273 
274 cd %(pwd)s
275 eval `scramv1 run -sh`
276 export ALIGNMENT_AFSDIR=`pwd`
277 
278 export ALIGNMENT_INPUTFILES='%(inputfiles)s'
279 export ALIGNMENT_ITERATION=%(iteration)d
280 export ALIGNMENT_JOBNUMBER=%(jobnumber)d
281 export ALIGNMENT_MAPPLOTS=%(mapplots)s
282 export ALIGNMENT_SEGDIFFPLOTS=%(segdiffplots)s
283 export ALIGNMENT_CURVATUREPLOTS=%(curvatureplots)s
284 export ALIGNMENT_GLOBALTAG=%(globaltag)s
285 export ALIGNMENT_INPUTDB=%(inputdb)s
286 export ALIGNMENT_TRACKERCONNECT=%(trackerconnect)s
287 export ALIGNMENT_TRACKERALIGNMENT=%(trackeralignment)s
288 export ALIGNMENT_TRACKERAPECONNECT=%(trackerAPEconnect)s
289 export ALIGNMENT_TRACKERAPE=%(trackerAPE)s
290 export ALIGNMENT_GPRCDCONNECT=%(gprcdconnect)s
291 export ALIGNMENT_GPRCD=%(gprcd)s
292 export ALIGNMENT_ISCOSMICS=%(iscosmics)s
293 export ALIGNMENT_STATION123PARAMS=%(station123params)s
294 export ALIGNMENT_STATION4PARAMS=%(station4params)s
295 export ALIGNMENT_CSCPARAMS=%(cscparams)s
296 export ALIGNMENT_MINTRACKPT=%(minTrackPt)s
297 export ALIGNMENT_MAXTRACKPT=%(maxTrackPt)s
298 export ALIGNMENT_MINTRACKERHITS=%(minTrackerHits)s
299 export ALIGNMENT_MAXTRACKERREDCHI2=%(maxTrackerRedChi2)s
300 export ALIGNMENT_ALLOWTIDTEC=%(allowTIDTEC)s
301 export ALIGNMENT_TWOBIN=%(twoBin)s
302 export ALIGNMENT_WEIGHTALIGNMENT=%(weightAlignment)s
303 export ALIGNMENT_MINALIGNMENTHITS=%(minAlignmentHits)s
304 export ALIGNMENT_COMBINEME11=%(combineME11)s
305 export ALIGNMENT_MAXEVENTS=%(maxEvents)s
306 export ALIGNMENT_SKIPEVENTS=%(skipEvents)s
307 export ALIGNMENT_MAXRESSLOPEY=%(maxResSlopeY)s
308 
309 cp -f %(directory)sgather_cfg.py %(inputdbdir)s%(inputdb)s %(copytrackerdb)s $ALIGNMENT_CAFDIR/
310 cd $ALIGNMENT_CAFDIR/
311 ls -l
312 cmsRun gather_cfg.py
313 ls -l
314 cp -f *.tmp %(copyplots)s $ALIGNMENT_AFSDIR/%(directory)s
315 """ % vars())
316  os.system("chmod +x %s" % gather_fileName)
317  bsubfile.append("echo %sgather%03d.sh" % (directory, jobnumber))
318 
319  if last_align is None: waiter = ""
320  else: waiter = "-w \"ended(%s)\"" % last_align
321  if options.big: queue = "cmscaf1nd"
322  else: queue = "cmscaf1nh"
323 
324  bsubfile.append("bsub -R \"type==SLC5_64\" -q %s -J \"%s_gather%03d\" %s gather%03d.sh" % (queue, director, jobnumber, waiter, jobnumber))
325 
326  bsubnames.append("ended(%s_gather%03d)" % (director, jobnumber))
327 
328  file("%sconvert-db-to-xml_cfg.py" % directory, "w").write("""from Alignment.MuonAlignment.convertSQLitetoXML_cfg import *
329 process.PoolDBESSource.connect = \"sqlite_file:%(directory)s%(director)s.db\"
330 process.MuonGeometryDBConverter.outputXML.fileName = \"%(directory)s%(director)s.xml\"
331 process.MuonGeometryDBConverter.outputXML.relativeto = \"ideal\"
332 process.MuonGeometryDBConverter.outputXML.suppressDTChambers = False
333 process.MuonGeometryDBConverter.outputXML.suppressDTSuperLayers = True
334 process.MuonGeometryDBConverter.outputXML.suppressDTLayers = True
335 process.MuonGeometryDBConverter.outputXML.suppressCSCChambers = False
336 process.MuonGeometryDBConverter.outputXML.suppressCSCLayers = True
337 
338 process.MuonGeometryDBConverter.getAPEs = True
339 process.PoolDBESSource.toGet = cms.VPSet(
340  cms.PSet(record = cms.string(\"DTAlignmentRcd\"), tag = cms.string(\"DTAlignmentRcd\")),
341  cms.PSet(record = cms.string(\"DTAlignmentErrorRcd\"), tag = cms.string(\"DTAlignmentErrorRcd\")),
342  cms.PSet(record = cms.string(\"CSCAlignmentRcd\"), tag = cms.string(\"CSCAlignmentRcd\")),
343  cms.PSet(record = cms.string(\"CSCAlignmentErrorRcd\"), tag = cms.string(\"CSCAlignmentErrorRcd\")),
344  )
345 """ % vars())
346 
347  copytrackerdb = ""
348  if trackerconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % trackerconnect[12:]
349  if trackerAPEconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % trackerAPEconnect[12:]
350  if gprcdconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % gprcdconnect[12:]
351 
352  file("%salign.sh" % directory, "w").write("""#!/bin/sh
353 # %(commandline)s
354 
355 export ALIGNMENT_CAFDIR=`pwd`
356 
357 cd %(pwd)s
358 eval `scramv1 run -sh`
359 export ALIGNMENT_AFSDIR=`pwd`
360 export ALIGNMENT_INPUTDB=%(inputdb)s
361 export ALIGNMENT_ITERATION=%(iteration)d
362 export ALIGNMENT_GLOBALTAG=%(globaltag)s
363 export ALIGNMENT_TRACKERCONNECT=%(trackerconnect)s
364 export ALIGNMENT_TRACKERALIGNMENT=%(trackeralignment)s
365 export ALIGNMENT_TRACKERAPECONNECT=%(trackerAPEconnect)s
366 export ALIGNMENT_TRACKERAPE=%(trackerAPE)s
367 export ALIGNMENT_GPRCDCONNECT=%(gprcdconnect)s
368 export ALIGNMENT_GPRCD=%(gprcd)s
369 export ALIGNMENT_ISCOSMICS=%(iscosmics)s
370 export ALIGNMENT_STATION123PARAMS=%(station123params)s
371 export ALIGNMENT_STATION4PARAMS=%(station4params)s
372 export ALIGNMENT_CSCPARAMS=%(cscparams)s
373 export ALIGNMENT_MINTRACKPT=%(minTrackPt)s
374 export ALIGNMENT_MAXTRACKPT=%(maxTrackPt)s
375 export ALIGNMENT_MINTRACKERHITS=%(minTrackerHits)s
376 export ALIGNMENT_MAXTRACKERREDCHI2=%(maxTrackerRedChi2)s
377 export ALIGNMENT_ALLOWTIDTEC=%(allowTIDTEC)s
378 export ALIGNMENT_TWOBIN=%(twoBin)s
379 export ALIGNMENT_WEIGHTALIGNMENT=%(weightAlignment)s
380 export ALIGNMENT_MINALIGNMENTHITS=%(minAlignmentHits)s
381 export ALIGNMENT_COMBINEME11=%(combineME11)s
382 export ALIGNMENT_MAXRESSLOPEY=%(maxResSlopeY)s
383 
384 cp -f %(directory)salign_cfg.py %(directory)sconvert-db-to-xml_cfg.py %(inputdbdir)s%(inputdb)s %(directory)s*.tmp %(copytrackerdb)s $ALIGNMENT_CAFDIR/
385 cd $ALIGNMENT_CAFDIR/
386 export ALIGNMENT_ALIGNMENTTMP=`ls alignment*.tmp`
387 
388 ls -l
389 cmsRun align_cfg.py
390 cp -f MuonAlignmentFromReference_report.py $ALIGNMENT_AFSDIR/%(directory)s%(director)s_report.py
391 cp -f MuonAlignmentFromReference_outputdb.db $ALIGNMENT_AFSDIR/%(directory)s%(director)s.db
392 cp -f MuonAlignmentFromReference_plotting.root $ALIGNMENT_AFSDIR/%(directory)s%(director)s.root
393 
394 cd $ALIGNMENT_AFSDIR
395 cmsRun %(directory)sconvert-db-to-xml_cfg.py
396 
397 # if it's 1st or last iteration, combine _plotting.root files into one:
398 if [ \"$ALIGNMENT_ITERATION\" == \"1\" ] || [ \"$ALIGNMENT_ITERATION\" == \"%(ITERATIONS)s\" ]; then
399  nfiles=$(ls %(directory)splotting0*.root 2> /dev/null | wc -l)
400  if [ \"$nfiles\" != \"0\" ]; then
401  hadd -f1 %(directory)s%(director)s_plotting.root %(directory)splotting0*.root
402  #if [ $? == 0 ]; then rm %(directory)splotting0*.root; fi
403  fi
404 fi
405 
406 # if it's last iteration, apply chamber motion policy
407 if [ \"$ALIGNMENT_ITERATION\" == \"%(ITERATIONS)s\" ]; then
408  # convert this iteration's geometry into detailed xml
409  ./Alignment/MuonAlignmentAlgorithms/scripts/convertSQLiteXML.py %(directory)s%(director)s.db %(directory)s%(director)s_extra.xml
410  # perform motion policy
411  ./Alignment/MuonAlignmentAlgorithms/scripts/motionPolicyChamber.py \
412  %(INITIALXML)s %(directory)s%(director)s_extra.xml \
413  %(directory)s%(director)s_report.py \
414  %(directory)s%(director)s_final.xml \
415  --nsigma %(theNSigma)s
416  # convert the resulting xml into the final sqlite geometry
417  ./Alignment/MuonAlignmentAlgorithms/scripts/convertSQLiteXML.py %(directory)s%(director)s_final.xml %(directory)s%(director)s_final.db
418 fi
419 
420 """ % vars())
421  os.system("chmod +x %salign.sh" % directory)
422 
423  bsubfile.append("echo %salign.sh" % directory)
424  bsubfile.append("bsub -R \"type==SLC5_64\" -q cmscaf1nd -J \"%s_align\" -w \"%s\" align.sh" % (director, " && ".join(bsubnames)))
425  bsubfile.append("cd ..")
426  bsubnames = []
427  last_align = "%s_align" % director
428 
429  # after the last iteration (optionally) do diagnostics run
430  if len(validationLabel) and iteration == ITERATIONS:
431  # do we have plotting files created?
432  directory1 = "%s01/" % DIRNAME
433  director1 = directory1[:-1]
434 
435  file("%svalidation.sh" % directory, "w").write("""#!/bin/sh
436 # %(commandline)s
437 
438 export ALIGNMENT_CAFDIR=`pwd`
439 mkdir files
440 mkdir out
441 
442 cd %(pwd)s
443 eval `scramv1 run -sh`
444 ALIGNMENT_AFSDIR=`pwd`
445 ALIGNMENT_ITERATION=%(iteration)d
446 ALIGNMENT_MAPPLOTS=None
447 ALIGNMENT_SEGDIFFPLOTS=None
448 ALIGNMENT_CURVATUREPLOTS=None
449 
450 # copy the scripts to CAFDIR
451 cd Alignment/MuonAlignmentAlgorithms/scripts/
452 cp -f plotscripts.py $ALIGNMENT_CAFDIR/
453 cp -f mutypes.py $ALIGNMENT_CAFDIR/
454 cp -f alignmentValidation.py $ALIGNMENT_CAFDIR/
455 cp -f phiedges_fitfunctions.C $ALIGNMENT_CAFDIR/
456 cp -f createTree.py $ALIGNMENT_CAFDIR/
457 cd -
458 cp Alignment/MuonAlignmentAlgorithms/test/browser/tree* $ALIGNMENT_CAFDIR/out/
459 
460 # copy the results to CAFDIR
461 cp -f %(directory1)s%(director1)s_report.py $ALIGNMENT_CAFDIR/files/
462 cp -f %(directory)s%(director)s_report.py $ALIGNMENT_CAFDIR/files/
463 cp -f %(directory1)s%(director1)s.root $ALIGNMENT_CAFDIR/files/
464 cp -f %(directory)s%(director)s.root $ALIGNMENT_CAFDIR/files/
465 if [ -e %(directory1)s%(director1)s_plotting.root ] && [ -e %(directory)s%(director)s_plotting.root ]; then
466  cp -f %(directory1)s%(director1)s_plotting.root $ALIGNMENT_CAFDIR/files/
467  cp -f %(directory)s%(director)s_plotting.root $ALIGNMENT_CAFDIR/files/
468  ALIGNMENT_MAPPLOTS=%(mapplots)s
469  ALIGNMENT_SEGDIFFPLOTS=%(segdiffplots)s
470  ALIGNMENT_CURVATUREPLOTS=%(curvatureplots)s
471 fi
472 
473 cd $ALIGNMENT_CAFDIR/
474 echo \" ### Start running ###\"
475 date
476 
477 # do fits and median plots first
478 ./alignmentValidation.py -l %(validationLabel)s -i $ALIGNMENT_CAFDIR --i1 files --iN files --i1prefix %(director1)s --iNprefix %(director)s -o $ALIGNMENT_CAFDIR/out --createDirSructure --dt --csc --fit --median
479 
480 if [ $ALIGNMENT_MAPPLOTS == \"True\" ]; then
481  ./alignmentValidation.py -l %(validationLabel)s -i $ALIGNMENT_CAFDIR --i1 files --iN files --i1prefix %(director1)s --iNprefix %(director)s -o $ALIGNMENT_CAFDIR/out --dt --csc --map
482 fi
483 
484 if [ $ALIGNMENT_SEGDIFFPLOTS == \"True\" ]; then
485  ./alignmentValidation.py -l %(validationLabel)s -i $ALIGNMENT_CAFDIR --i1 files --iN files --i1prefix %(director1)s --iNprefix %(director)s -o $ALIGNMENT_CAFDIR/out --dt --csc --segdiff
486 fi
487 
488 if [ $ALIGNMENT_CURVATUREPLOTS == \"True\" ]; then
489  ./alignmentValidation.py -l %(validationLabel)s -i $ALIGNMENT_CAFDIR --i1 files --iN files --i1prefix %(director1)s --iNprefix %(director)s -o $ALIGNMENT_CAFDIR/out --dt --csc --curvature
490 fi
491 
492 # run simple diagnostic
493 ./alignmentValidation.py -l %(validationLabel)s -i $ALIGNMENT_CAFDIR --i1 files --iN files --i1prefix %(director1)s --iNprefix %(director)s -o $ALIGNMENT_CAFDIR/out --dt --csc --diagnostic
494 
495 # fill the tree browser structure:
496 ./createTree.py -i $ALIGNMENT_CAFDIR/out
497 
498 timestamp=`date \"+%%y-%%m-%%d %%H:%%M:%%S\"`
499 echo \"%(validationLabel)s.plots (${timestamp})\" > out/label.txt
500 
501 ls -l out/
502 timestamp=`date +%%Y%%m%%d%%H%%M%%S`
503 tar czf %(validationLabel)s_${timestamp}.tgz out
504 cp -f %(validationLabel)s_${timestamp}.tgz $ALIGNMENT_AFSDIR/
505 
506 """ % vars())
507  os.system("chmod +x %svalidation.sh" % directory)
508 
509  bsubfile.append("echo %svalidation.sh" % directory)
510  bsubfile.append("bsub -R \"type==SLC5_64\" -q cmscaf1nd -J \"%s_validation\" -w \"ended(%s)\" validation.sh" % (director, last_align))
511  bsubfile.append("cd ..")
512 
513  bsubfile.append("")
514 
515 
516 file(options.submitJobs, "w").write("\n".join(bsubfile))
517 os.system("chmod +x %s" % options.submitJobs)
518 
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static std::string join(char **cmd)
Definition: RemoteFile.cc:18