CMS 3D CMS Logo

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