CMS 3D CMS Logo

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