CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
createCSCRingsJobs.py
Go to the documentation of this file.
1 #! /usr/bin/env python3
2 
3 from __future__ import print_function
4 from builtins import range
5 import os, sys, optparse, math
6 
7 copyargs = sys.argv[:]
8 for i in range(len(copyargs)):
9  if copyargs[i] == "":
10  copyargs[i] = "\"\""
11  if copyargs[i].find(" ") != -1:
12  copyargs[i] = "\"%s\"" % copyargs[i]
13 commandline = " ".join(copyargs)
14 
15 prog = sys.argv[0]
16 
17 usage = """./%(prog)s DIRNAME ITERATIONS INITIALGEOM INPUTFILES [options]
18 
19 Creates (overwrites) a directory for each of the iterations and creates (overwrites)
20 submitJobs.sh with the submission sequence and dependencies.
21 
22 DIRNAME directories will be named DIRNAME01, DIRNAME02...
23 ITERATIONS number of iterations
24 INITIALGEOM SQLite file containing muon geometry with tag names
25  DTAlignmentRcd, DTAlignmentErrorExtendedRcd, CSCAlignmentRcd, CSCAlignmentErrorExtendedRcd
26 INPUTFILES Python file defining 'fileNames', a list of input files as
27  strings (create with findQualityFiles.py)""" % vars()
28 
29 parser = optparse.OptionParser(usage)
30 parser.add_option("--validationLabel",
31  help="[REQUIRED] the label to be used to mark a run; the results will be put into a LABEL_DATESTAMP.tgz tarball",
32  type="string",
33  default="",
34  dest="validationLabel")
35 parser.add_option("-j", "--jobs",
36  help="approximate number of \"gather\" subjobs",
37  type="int",
38  default=50,
39  dest="subjobs")
40 parser.add_option("-s", "--submitJobs",
41  help="alternate name of submitJobs.sh script (please include .sh extension); a file with this name will be OVERWRITTEN",
42  type="string",
43  default="submitJobs.sh",
44  dest="submitJobs")
45 parser.add_option("-b", "--big",
46  help="if invoked, subjobs will also be run on cmscaf1nd",
47  action="store_true",
48  dest="big")
49 parser.add_option("--globalTag",
50  help="GlobalTag for alignment/calibration conditions (typically all conditions except muon and tracker alignment)",
51  type="string",
52  default="CRAFT0831X_V1::All",
53  dest="globaltag")
54 parser.add_option("--trackerconnect",
55  help="connect string for tracker alignment (frontier://... or sqlite_file:...)",
56  type="string",
57  default="",
58  dest="trackerconnect")
59 parser.add_option("--trackeralignment",
60  help="name of TrackerAlignmentRcd tag",
61  type="string",
62  default="Alignments",
63  dest="trackeralignment")
64 parser.add_option("--trackerAPEconnect",
65  help="connect string for tracker APEs (frontier://... or sqlite_file:...)",
66  type="string",
67  default="",
68  dest="trackerAPEconnect")
69 parser.add_option("--trackerAPE",
70  help="name of TrackerAlignmentErrorExtendedRcd tag (tracker APEs)",
71  type="string",
72  default="AlignmentErrorsExtended",
73  dest="trackerAPE")
74 parser.add_option("--gprcdconnect",
75  help="connect string for GlobalPositionRcd (frontier://... or sqlite_file:...)",
76  type="string",
77  default="",
78  dest="gprcdconnect")
79 parser.add_option("--gprcd",
80  help="name of GlobalPositionRcd tag",
81  type="string",
82  default="GlobalPosition",
83  dest="gprcd")
84 parser.add_option("--iscosmics",
85  help="if invoked, use cosmic track refitter instead of the standard one",
86  action="store_true",
87  dest="iscosmics")
88 parser.add_option("--station123params",
89  help="alignable parameters for DT stations 1, 2, 3 (see SWGuideAlignmentAlgorithms#Selection_of_what_to_align)",
90  type="string",
91  default="111111",
92  dest="station123params")
93 parser.add_option("--station4params",
94  help="alignable parameters for DT station 4",
95  type="string",
96  default="100011",
97  dest="station4params")
98 parser.add_option("--cscparams",
99  help="alignable parameters for CSC chambers",
100  type="string",
101  default="100011",
102  dest="cscparams")
103 parser.add_option("--minTrackPt",
104  help="minimum allowed track transverse momentum (in GeV)",
105  type="string",
106  default="0",
107  dest="minTrackPt")
108 parser.add_option("--maxTrackPt",
109  help="maximum allowed track transverse momentum (in GeV)",
110  type="string",
111  default="1000",
112  dest="maxTrackPt")
113 parser.add_option("--minTrackP",
114  help="minimum allowed track momentum (in GeV)",
115  type="string",
116  default="0",
117  dest="minTrackP")
118 parser.add_option("--maxTrackP",
119  help="maximum allowed track momentum (in GeV)",
120  type="string",
121  default="10000",
122  dest="maxTrackP")
123 parser.add_option("--minTrackerHits",
124  help="minimum number of tracker hits",
125  type="int",
126  default=15,
127  dest="minTrackerHits")
128 parser.add_option("--maxTrackerRedChi2",
129  help="maximum tracker chi^2 per degrees of freedom",
130  type="string",
131  default="10",
132  dest="maxTrackerRedChi2")
133 parser.add_option("--notAllowTIDTEC",
134  help="if invoked, do not allow tracks that pass through the tracker's TID||TEC region (not recommended)",
135  action="store_true",
136  dest="notAllowTIDTEC")
137 parser.add_option("--twoBin",
138  help="if invoked, apply the \"two-bin method\" to control charge-antisymmetric errors",
139  action="store_true",
140  dest="twoBin")
141 parser.add_option("--weightAlignment",
142  help="if invoked, segments will be weighted by ndf/chi^2 in the alignment",
143  action="store_true",
144  dest="weightAlignment")
145 parser.add_option("--minAlignmentSegments",
146  help="minimum number of segments required to align a chamber",
147  type="int",
148  default=5,
149  dest="minAlignmentHits")
150 parser.add_option("--notCombineME11",
151  help="if invoked, treat ME1/1a and ME1/1b as separate objects",
152  action="store_true",
153  dest="notCombineME11")
154 parser.add_option("--maxEvents",
155  help="maximum number of events",
156  type="string",
157  default="-1",
158  dest="maxEvents")
159 parser.add_option("--skipEvents",
160  help="number of events to be skipped",
161  type="string",
162  default="0",
163  dest="skipEvents")
164 parser.add_option("--maxResSlopeY",
165  help="maximum residual slope y component",
166  type="string",
167  default="10",
168  dest="maxResSlopeY")
169 parser.add_option("--ring2only",
170  help="if invoked, use only ring 2 results to align all rings in corresponding disks",
171  action="store_true",
172  dest="ring2only")
173 parser.add_option("--createMapNtuple",
174  help="if invoked while mapplots are switched on, a special ntuple would be created",
175  action="store_true",
176  dest="createMapNtuple")
177 parser.add_option("--inputInBlocks",
178  help="if invoked, assume that INPUTFILES provides a list of files already groupped into job blocks, -j has no effect in that case",
179  action="store_true",
180  dest="inputInBlocks")
181 parser.add_option("--json",
182  help="If present with JSON file as argument, use JSON file for good lumi mask. "+\
183  "The latest JSON file is available at /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/Prompt/",
184  type="string",
185  default="",
186  dest="json")
187 parser.add_option("--preFilter",
188  help="if invoked, MuonAlignmentPreFilter module would be invoked in the Path's beginning. Can significantly speed up gather jobs.",
189  action="store_true",
190  dest="preFilter")
191 parser.add_option("--useTrackerMuons",
192  help="use tracker muons approach instead of the default global muons tracks based one",
193  action="store_true",
194  dest="useTrackerMuons")
195 parser.add_option("--muonCollectionTag",
196  help="InputTag of muons collection to use in tracker muons based approach",
197  type="string",
198  default="newmuons",
199  dest="muonCollectionTag")
200 parser.add_option("--maxDxy",
201  help="maximum track impact parameter with relation to beamline",
202  type="string",
203  default="1000.",
204  dest="maxDxy")
205 parser.add_option("--minNCrossedChambers",
206  help="minimum number of muon chambers that a track is required to cross",
207  type="string",
208  default="2",
209  dest="minNCrossedChambers")
210 
211 if len(sys.argv) < 5:
212  raise SystemError("Too few arguments.\n\n"+parser.format_help())
213 
214 DIRNAME = sys.argv[1]
215 ITERATIONS = int(sys.argv[2])
216 INITIALGEOM = sys.argv[3]
217 INPUTFILES = sys.argv[4]
218 
219 options, args = parser.parse_args(sys.argv[5:])
220 globaltag = options.globaltag
221 trackerconnect = options.trackerconnect
222 trackeralignment = options.trackeralignment
223 trackerAPEconnect = options.trackerAPEconnect
224 trackerAPE = options.trackerAPE
225 gprcdconnect = options.gprcdconnect
226 gprcd = options.gprcd
227 iscosmics = str(options.iscosmics)
228 station123params = options.station123params
229 station4params = options.station4params
230 cscparams = options.cscparams
231 muonCollectionTag = options.muonCollectionTag
232 minTrackPt = options.minTrackPt
233 maxTrackPt = options.maxTrackPt
234 minTrackP = options.minTrackP
235 maxTrackP = options.maxTrackP
236 maxDxy = options.maxDxy
237 minTrackerHits = str(options.minTrackerHits)
238 maxTrackerRedChi2 = options.maxTrackerRedChi2
239 minNCrossedChambers = options.minNCrossedChambers
240 allowTIDTEC = str(not options.notAllowTIDTEC)
241 twoBin = str(options.twoBin)
242 weightAlignment = str(options.weightAlignment)
243 minAlignmentHits = str(options.minAlignmentHits)
244 combineME11 = str(not options.notCombineME11)
245 maxEvents = options.maxEvents
246 skipEvents = options.skipEvents
247 validationLabel = options.validationLabel
248 maxResSlopeY = options.maxResSlopeY
249 preFilter = not not options.preFilter
250 useTrackerMuons = options.useTrackerMuons
251 
252 createMapNtuple=False
253 if options.createMapNtuple: createMapNtuple=True
254 
255 ring2only = ""
256 if options.ring2only: ring2only = "--ring2only"
257 inputInBlocks = ""
258 if options.inputInBlocks: inputInBlocks = "--inputInBlocks"
259 
260 json_file = options.json
261 
262 if validationLabel == '':
263  print("\nOne or more of REQUIRED options is missing!\n")
264  parser.print_help()
265  sys.exit()
266 
267 fileNames=[]
268 fileNamesBlocks=[]
269 execfile(INPUTFILES)
270 njobs = options.subjobs
271 if (options.inputInBlocks):
272  njobs = len(fileNamesBlocks)
273  if njobs==0:
274  print("while --inputInBlocks is specified, the INPUTFILES has no blocks!")
275  sys.exit()
276 
277 stepsize = int(math.ceil(1.*len(fileNames)/njobs))
278 
279 pwd = str(os.getcwd())
280 
281 bsubfile = ["#!/bin/sh", ""]
282 bsubnames = []
283 last_align = None
284 
285 
287 INITIALXML = INITIALGEOM + '.xml'
288 if INITIALGEOM[-3:]=='.db':
289  INITIALXML = INITIALGEOM[:-3] + '.xml'
290 print("Converting",INITIALGEOM,"to",INITIALXML," ...will be done in several seconds...")
291 exit_code = os.system("./Alignment/MuonAlignmentAlgorithms/scripts/convertSQLiteXML.py %s %s" % (INITIALGEOM,INITIALXML))
292 if exit_code>0:
293  print("problem: conversion exited with code:", exit_code)
294  sys.exit()
295 
296 
297 
299 directory = ""
300 for iteration in range(1, ITERATIONS+1):
301  if iteration == 1:
302  inputdb = INITIALGEOM
303  inputdbdir = directory[:]
304  inputxml = INITIALXML
305  else:
306  inputdb = director + ".db"
307  inputdbdir = directory[:]
308  inputxml = director + ".xml"
309 
310  directory = "%s%02d/" % (DIRNAME, iteration)
311  director = directory[:-1]
312  directory1 = "%s01/" % DIRNAME
313  director1 = directory1[:-1]
314  os.system("rm -rf %s; mkdir %s" % (directory, directory))
315  os.system("cp gather_cfg.py %s" % directory)
316  #os.system("cp align_cfg.py %s" % directory)
317 
318  bsubfile.append("cd %s" % directory)
319 
320  for jobnumber in range(njobs):
321  gather_fileName = "%sgather%03d.sh" % (directory, jobnumber)
322  if not options.inputInBlocks:
323  inputfiles = " ".join(fileNames[jobnumber*stepsize:(jobnumber+1)*stepsize])
324  else:
325  inputfiles = " ".join(fileNamesBlocks[jobnumber])
326 
327  copyplots = "plotting*.root"
328 
329  copytrackerdb = ""
330  if trackerconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % trackerconnect[12:]
331  if trackerAPEconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % trackerAPEconnect[12:]
332  if gprcdconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % gprcdconnect[12:]
333 
334  if len(inputfiles) > 0:
335  file(gather_fileName, "w").write("""#/bin/sh
336 # %(commandline)s
337 
338 export ALIGNMENT_CAFDIR=`pwd`
339 
340 cd %(pwd)s
341 eval `scramv1 run -sh`
342 export ALIGNMENT_AFSDIR=`pwd`
343 
344 export ALIGNMENT_INPUTFILES='%(inputfiles)s'
345 export ALIGNMENT_ITERATION=%(iteration)d
346 export ALIGNMENT_JOBNUMBER=%(jobnumber)d
347 export ALIGNMENT_MAPPLOTS=True
348 export ALIGNMENT_SEGDIFFPLOTS=True
349 export ALIGNMENT_CURVATUREPLOTS=False
350 export ALIGNMENT_GLOBALTAG=%(globaltag)s
351 export ALIGNMENT_INPUTDB=%(inputdb)s
352 export ALIGNMENT_TRACKERCONNECT=%(trackerconnect)s
353 export ALIGNMENT_TRACKERALIGNMENT=%(trackeralignment)s
354 export ALIGNMENT_TRACKERAPECONNECT=%(trackerAPEconnect)s
355 export ALIGNMENT_TRACKERAPE=%(trackerAPE)s
356 export ALIGNMENT_GPRCDCONNECT=%(gprcdconnect)s
357 export ALIGNMENT_GPRCD=%(gprcd)s
358 export ALIGNMENT_ISCOSMICS=%(iscosmics)s
359 export ALIGNMENT_STATION123PARAMS=%(station123params)s
360 export ALIGNMENT_STATION4PARAMS=%(station4params)s
361 export ALIGNMENT_CSCPARAMS=%(cscparams)s
362 export ALIGNMENT_MUONCOLLECTIONTAG=%(muonCollectionTag)s
363 export ALIGNMENT_MINTRACKPT=%(minTrackPt)s
364 export ALIGNMENT_MAXTRACKPT=%(maxTrackPt)s
365 export ALIGNMENT_MINTRACKP=%(minTrackP)s
366 export ALIGNMENT_MAXTRACKP=%(maxTrackP)s
367 export ALIGNMENT_MAXDXY=%(maxDxy)s
368 export ALIGNMENT_MINTRACKERHITS=%(minTrackerHits)s
369 export ALIGNMENT_MAXTRACKERREDCHI2=%(maxTrackerRedChi2)s
370 export ALIGNMENT_MINNCROSSEDCHAMBERS=%(minNCrossedChambers)s
371 export ALIGNMENT_ALLOWTIDTEC=%(allowTIDTEC)s
372 export ALIGNMENT_TWOBIN=%(twoBin)s
373 export ALIGNMENT_WEIGHTALIGNMENT=%(weightAlignment)s
374 export ALIGNMENT_MINALIGNMENTHITS=%(minAlignmentHits)s
375 export ALIGNMENT_COMBINEME11=%(combineME11)s
376 export ALIGNMENT_MAXEVENTS=%(maxEvents)s
377 export ALIGNMENT_SKIPEVENTS=%(skipEvents)s
378 export ALIGNMENT_MAXRESSLOPEY=%(maxResSlopeY)s
379 export ALIGNMENT_DO_DT='False'
380 export ALIGNMENT_DO_CSC='True'
381 export ALIGNMENT_JSON=%(json_file)s
382 export ALIGNMENT_CREATEMAPNTUPLE=%(createMapNtuple)s
383 export ALIGNMENT_PREFILTER=%(preFilter)s
384 export ALIGNMENT_USETRACKERMUONS=%(useTrackerMuons)s
385 
386 if [ \"zzz$ALIGNMENT_JSON\" != \"zzz\" ]; then
387  cp -f $ALIGNMENT_JSON $ALIGNMENT_CAFDIR/
388 fi
389 
390 cp -f %(directory)sgather_cfg.py %(inputdbdir)s%(inputdb)s %(copytrackerdb)s $ALIGNMENT_CAFDIR/
391 cd $ALIGNMENT_CAFDIR/
392 ls -l
393 cmsRun gather_cfg.py
394 ls -l
395 cp -f %(copyplots)s $ALIGNMENT_AFSDIR/%(directory)s
396 """ % vars())
397  os.system("chmod +x %s" % gather_fileName)
398  bsubfile.append("echo %sgather%03d.sh" % (directory, jobnumber))
399 
400  if last_align is None: waiter = ""
401  else: waiter = "-w \"ended(%s)\"" % last_align
402  if options.big: queue = "cmscaf1nd"
403  else: queue = "cmscaf1nh"
404 
405  bsubfile.append("bsub -R \"type==SLC5_64\" -q %s -J \"%s_gather%03d\" %s gather%03d.sh" % (queue, director, jobnumber, waiter, jobnumber))
406 
407  bsubnames.append("ended(%s_gather%03d)" % (director, jobnumber))
408 
409  copytrackerdb = ""
410  if trackerconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % trackerconnect[12:]
411  if trackerAPEconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % trackerAPEconnect[12:]
412  if gprcdconnect[0:12] == "sqlite_file:": copytrackerdb += "%s " % gprcdconnect[12:]
413 
414  file("%salign.sh" % directory, "w").write("""#!/bin/sh
415 # %(commandline)s
416 
417 export ALIGNMENT_CAFDIR=`pwd`
418 mkdir files
419 mkdir out
420 
421 cd %(pwd)s
422 eval `scramv1 run -sh`
423 export ALIGNMENT_AFSDIR=`pwd`
424 
425 # combine _plotting.root files into one:
426 nfiles=$(ls %(directory)splotting0*.root 2> /dev/null | wc -l)
427 if [ \"$nfiles\" != \"0\" ]; then
428  flist=""
429  for fn in %(directory)splotting0*.root
430  do
431  FILESIZE=$(stat -c%%s "$fn")
432  if [ $FILESIZE -gt 1000 ]; then
433  echo $fn, $FILESIZE
434  flist="$flist $fn"
435  fi
436  done
437  echo $flist
438  #hadd -f1 %(directory)s%(director)s_plotting.root %(directory)splotting0*.root
439  hadd -f1 %(directory)s%(director)s_plotting.root $flist
440  #if [ $? == 0 ]; then rm %(directory)splotting0*.root; fi
441 fi
442 
443 # copy plotting and db files to CAFDIR
444 cp -f %(directory)s%(director)s_plotting.root $ALIGNMENT_CAFDIR/files
445 cp -f inertGlobalPositionRcd.db %(inputdbdir)s%(inputdb)s %(inputdbdir)s%(inputxml)s %(copytrackerdb)s $ALIGNMENT_CAFDIR/
446 
447 # copy the scripts to CAFDIR
448 cd Alignment/MuonAlignmentAlgorithms/scripts/
449 cp -f plotscripts.py $ALIGNMENT_CAFDIR/
450 cp -f mutypes.py $ALIGNMENT_CAFDIR/
451 cp -f alignmentValidation.py $ALIGNMENT_CAFDIR/
452 cp -f phiedges_fitfunctions.C $ALIGNMENT_CAFDIR/
453 cp -f convertSQLiteXML.py $ALIGNMENT_CAFDIR/
454 cp -f alignCSCRings.py $ALIGNMENT_CAFDIR/
455 cp -f signConventions.py $ALIGNMENT_CAFDIR/
456 cd -
457 
458 cd $ALIGNMENT_CAFDIR/
459 ls -l
460 
461 # run alignment validation to produce map plots and sin fit results
462 ./alignmentValidation.py -l %(validationLabel)s -i $ALIGNMENT_CAFDIR --i1 files --iN files --i1prefix %(director)s --iNprefix %(director)s -o $ALIGNMENT_CAFDIR/out --csc --map --segdiff --createDirSructure
463 
464 # align CSC rings using the fit results from the previous step
465 ./alignCSCRings.py -d $ALIGNMENT_CAFDIR/out -l %(validationLabel)s -x %(inputxml)s %(ring2only)s
466 
467 # convert ring-aligned xml geometry into sqlite
468 ./convertSQLiteXML.py %(inputxml)s.ring.xml %(director)s.db
469 
470 # convert the new sqlite into proper chambers and layers xml
471 ./convertSQLiteXML.py %(director)s.db %(director)s.xml
472 
473 #copy all good stuff to $ALIGNMENT_AFSDIR/%(directory)s
474 tar czf %(director)s_%(validationLabel)s.tgz out
475 cp -f %(director)s_%(validationLabel)s.tgz $ALIGNMENT_AFSDIR/%(directory)s
476 cp -f out/tmp_test_results_map__%(validationLabel)s.pkl $ALIGNMENT_AFSDIR/%(directory)s%(director)s.pkl
477 cp -f %(inputxml)s.ring.xml $ALIGNMENT_AFSDIR/%(directory)s
478 cp -f %(director)s.xml $ALIGNMENT_AFSDIR/%(directory)s
479 cp -f %(director)s.db $ALIGNMENT_AFSDIR/%(directory)s
480 
481 # if it's last iteration, apply chamber motion policy
482 #if [ \"$ALIGNMENT_ITERATION\" == 2 ]; then
483 # #nfiles=$(ls %(directory)splotting0*.root 2> /dev/null | wc -l)
484 #fi
485 
486 """ % vars())
487  os.system("chmod +x %salign.sh" % directory)
488 
489  bsubfile.append("echo %salign.sh" % directory)
490  if options.big: queue = "cmscaf1nd"
491  else: queue = "cmscaf1nh"
492  bsubfile.append("bsub -R \"type==SLC5_64\" -q %s -J \"%s_align\" -w \"%s\" align.sh" % (queue, director, " && ".join(bsubnames)))
493  bsubnames = []
494  last_align = "%s_align" % director
495 
496  # after the last iteration do diagnostics run for putting into a browser
497  if iteration == ITERATIONS:
498  # do we have plotting files created?
499  directory1 = "%s01/" % DIRNAME
500  director1 = directory1[:-1]
501 
502  file("%svalidation.sh" % directory, "w").write("""#!/bin/sh
503 # %(commandline)s
504 
505 export ALIGNMENT_CAFDIR=`pwd`
506 #mkdir files
507 mkdir out
508 mkdir tmp
509 
510 cd %(pwd)s
511 eval `scramv1 run -sh`
512 ALIGNMENT_AFSDIR=`pwd`
513 
514 # copy the scripts to CAFDIR
515 cd Alignment/MuonAlignmentAlgorithms/scripts/
516 cp -f plotscripts.py $ALIGNMENT_CAFDIR/
517 cp -f mutypes.py $ALIGNMENT_CAFDIR/
518 cp -f alignmentValidation.py $ALIGNMENT_CAFDIR/
519 cp -f phiedges_fitfunctions.C $ALIGNMENT_CAFDIR/
520 cp -f createTree.py $ALIGNMENT_CAFDIR/
521 cp -f signConventions.py $ALIGNMENT_CAFDIR/
522 cd -
523 cp Alignment/MuonAlignmentAlgorithms/test/browser/tree* $ALIGNMENT_CAFDIR/out/
524 
525 # copy the results to CAFDIR
526 cp -f %(directory1)s%(director1)s_%(validationLabel)s.tgz $ALIGNMENT_CAFDIR/tmp/
527 cp -f %(directory)s%(director)s_%(validationLabel)s.tgz $ALIGNMENT_CAFDIR/tmp/
528 
529 cd $ALIGNMENT_CAFDIR/
530 tar xzvf tmp/%(director1)s_%(validationLabel)s.tgz
531 mv tmp/out/* out/
532 mv out/iterN out/iter1
533 mv out/tmp_test_results_map__%(validationLabel)s.pkl out/tmp_test_results_map__%(validationLabel)s_1.pkl
534 tar xzvf tmp/%(director)s_%(validationLabel)s.tgz
535 mv tmp/out/* out/
536 
537 echo \" ### Start running ###\"
538 date
539 
540 # run simple diagnostic
541 ./alignmentValidation.py -l %(validationLabel)s -i $ALIGNMENT_CAFDIR --i1 files --iN files --i1prefix %(director1)s --iNprefix %(director)s -o $ALIGNMENT_CAFDIR/out --csc --diagnostic
542 
543 # fill the tree browser structure:
544 ./createTree.py -i $ALIGNMENT_CAFDIR/out
545 
546 timestamp=`date \"+%%y-%%m-%%d %%H:%%M:%%S\"`
547 echo \"%(validationLabel)s.plots (${timestamp})\" > out/label.txt
548 
549 ls -l out/
550 timestamp=`date +%%Y%%m%%d%%H%%M%%S`
551 tar czf %(validationLabel)s_${timestamp}.tgz out
552 cp -f %(validationLabel)s_${timestamp}.tgz $ALIGNMENT_AFSDIR/
553 
554 """ % vars())
555  os.system("chmod +x %svalidation.sh" % directory)
556 
557  bsubfile.append("echo %svalidation.sh" % directory)
558  bsubfile.append("bsub -R \"type==SLC5_64\" -q cmscaf1nd -J \"%s_validation\" -w \"ended(%s)\" validation.sh" % (director, last_align))
559 
560  bsubfile.append("cd ..")
561  bsubfile.append("")
562 
563 
564 file(options.submitJobs, "w").write("\n".join(bsubfile))
565 os.system("chmod +x %s" % options.submitJobs)
566 
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
#define str(s)