Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:04

0001 #!/usr/bin/env python3
0002 
0003 from builtins import range
0004 import os, sys, re, optparse, math
0005 
0006 copyargs = sys.argv[:]
0007 for i in range(len(copyargs)):
0008     if copyargs[i] == "":
0009         copyargs[i] = "\"\""
0010     if copyargs[i].find(" ") != -1:
0011         copyargs[i] = "\"%s\"" % copyargs[i]
0012 commandline = " ".join(copyargs)
0013 
0014 usage = """./%prog DIRNAME PATTERN INITIALGEOM INPUTFILES [options]
0015 
0016 Creates (overwrites) a directory for each word in PATTERN and creates
0017 (overwrites) submitJobs.sh with the submission sequence and
0018 dependencies.
0019 
0020 DIRNAME        directories will be named DIRNAME01, DIRNAME02, etc.
0021 PATTERN        a quoted combination of "phiy", "phipos", "phiz"
0022 INITIALGEOM    SQLite file containing muon geometry with tag names
0023                CSCAlignmentRcd, CSCAlignmentErrorExtendedRcd
0024 INPUTFILES     Python file defining 'fileNames', a list of input files as
0025                strings"""
0026 
0027 parser = optparse.OptionParser(usage)
0028 parser.add_option("-j", "--jobs",
0029                   help="approximate number of \"gather\" subjobs",
0030                   type="int",
0031                   default=50,
0032                   dest="subjobs")
0033 parser.add_option("-s", "--submitJobs",
0034                   help="alternate name of submitJobs.sh script (please include .sh extension); a file with this name will be OVERWRITTEN",
0035                   type="string",
0036                   default="submitJobs.sh",
0037                   dest="submitJobs")
0038 parser.add_option("-b", "--big",
0039                   help="if invoked, subjobs will also be run on cmscaf1nd",
0040                   action="store_true",
0041                   dest="big")
0042 parser.add_option("-u", "--user_mail",
0043                   help="if invoked, send mail to a specified email destination. If \"-u\" is not present, the default destination LSB_MAILTO in lsf.conf will be used",
0044                   type="string",
0045                   dest="user_mail")       
0046 parser.add_option("--globalTag",
0047                   help="GlobalTag for calibration conditions",
0048                   type="string",
0049                   default="GR_R_42_V14::All",
0050                   dest="globaltag")
0051 parser.add_option("--photogrammetry",
0052                   help="if invoked, alignment will be constrained to photogrammetry",
0053                   action="store_true",
0054                   dest="photogrammetry")
0055 parser.add_option("--photogrammetryOnlyholes",
0056                   help="if invoked, only missing data will be constrained to photogrammetry",
0057                   action="store_true",
0058                   dest="photogrammetryOnlyholes")
0059 parser.add_option("--photogrammetryOnlyOnePerRing",
0060                   help="if invoked, only one chamber per ring will be constrained to photogrammetry",
0061                   action="store_true",
0062                   dest="photogrammetryOnlyOnePerRing")
0063 parser.add_option("--photogrammetryScale",
0064                   help="scale factor for photogrammetry constraint: 1 is default and 10 *weakens* the constraint by a factor of 10",
0065                   type="string",
0066                   default="1.",
0067                   dest="photogrammetryScale")
0068 parser.add_option("--slm",
0069                   help="if invoked, apply SLM constraint",
0070                   action="store_true",
0071                   dest="slm")
0072 parser.add_option("--fillME11holes",
0073                   help="use CollisionsOct2010 data to fill holes in ME1/1",
0074                   action="store_true",
0075                   dest="fillME11holes")
0076 parser.add_option("--disks",
0077                   help="align whole disks, rather than individual rings",
0078                   action="store_true",
0079                   dest="disks")
0080 
0081 parser.add_option("--minP",
0082                   help="minimum track momentum (measured via radial component of fringe fields)",
0083                   type="string",
0084                   default="5",
0085                   dest="minP")
0086 parser.add_option("--minHitsPerChamber",
0087                   help="minimum number of hits per chamber",
0088                   type="string",
0089                   default="5",
0090                   dest="minHitsPerChamber")
0091 parser.add_option("--maxdrdz",
0092                   help="maximum dr/dz of tracklets (anti-cosmic cut)",
0093                   type="string",
0094                   default="0.2",
0095                   dest="maxdrdz")
0096 parser.add_option("--maxRedChi2",
0097                   help="maximum reduced chi^2 of tracks",
0098                   type="string",
0099                   default="10",
0100                   dest="maxRedChi2")
0101 parser.add_option("--fiducial",
0102                   help="if invoked, select only segments within the good region of the chamber (for all 6 layers)",
0103                   action="store_true",
0104                   dest="fiducial")
0105 parser.add_option("--useHitWeights",
0106                   help="if invoked, use hit weights in tracklet fits",
0107                   action="store_true",
0108                   dest="useHitWeights")
0109 parser.add_option("--truncateSlopeResid",
0110                   help="maximum allowed slope residual in mrad (like the histograms in a phiy job)",
0111                   type="string",
0112                   default="30.",
0113                   dest="truncateSlopeResid")
0114 parser.add_option("--truncateOffsetResid",
0115                   help="maximum allowed offset residual in mm (like the histograms in a phipos or phiz job)",
0116                   type="string",
0117                   default="15.",
0118                   dest="truncateOffsetResid")
0119 parser.add_option("--combineME11",
0120                   help="if invoked, combine ME1/1a and ME1/1b chambers",
0121                   action="store_true",
0122                   dest="combineME11")
0123 parser.add_option("--useTrackWeights",
0124                   help="if invoked, weight residuals by track uncertainties",
0125                   action="store_true",
0126                   dest="useTrackWeights")
0127 parser.add_option("--errorFromRMS",
0128                   help="if invoked, determine residuals uncertainties from the RMS of the residuals distribution",
0129                   action="store_true",
0130                   dest="errorFromRMS")
0131 parser.add_option("--minTracksPerOverlap",
0132                   help="minimum number of tracks needed for an overlap constraint to be valid",
0133                   type="string",
0134                   default="10",
0135                   dest="minTracksPerOverlap")
0136 parser.add_option("--slopeFromTrackRefit",
0137                   help="if invoked, determine direction of tracklets by refitting track to all other stations",
0138                   action="store_true",
0139                   dest="slopeFromTrackRefit")
0140 parser.add_option("--minStationsInTrackRefits",
0141                   help="minimum number of stations in a full track refit (slopeFromTrackRefit)",
0142                   type="string",
0143                   default="2",
0144                   dest="minStationsInTrackRefits")
0145 parser.add_option("--inputInBlocks",
0146                   help="if invoked, assume that INPUTFILES provides a list of files already groupped into job blocks, -j has no effect in that case",
0147                   action="store_true",
0148                   dest="inputInBlocks")
0149 parser.add_option("--json",
0150                   help="If present with JSON file as argument, use JSON file for good lumi mask. "+\
0151                   "The latest JSON file is available at /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions10/7TeV/StreamExpress/",
0152                   type="string",
0153                   default="",
0154                   dest="json")
0155 
0156 if len(sys.argv) < 5:
0157     raise SystemError("Too few arguments.\n\n"+parser.format_help())
0158 
0159 DIRNAME = sys.argv[1]
0160 PATTERN = re.split("\s+", sys.argv[2])
0161 INITIALGEOM = sys.argv[3]
0162 INPUTFILES = sys.argv[4]
0163 
0164 options, args = parser.parse_args(sys.argv[5:])
0165 user_mail = options.user_mail
0166 globaltag = options.globaltag
0167 photogrammetry = options.photogrammetry
0168 photogrammetryOnlyholes = options.photogrammetryOnlyholes
0169 photogrammetryOnlyOnePerRing = options.photogrammetryOnlyOnePerRing
0170 photogrammetryScale = options.photogrammetryScale
0171 slm = options.slm
0172 fillME11holes = options.fillME11holes
0173 disks = options.disks
0174 minP = options.minP
0175 minHitsPerChamber = options.minHitsPerChamber
0176 maxdrdz = options.maxdrdz
0177 maxRedChi2 = options.maxRedChi2
0178 fiducial = options.fiducial
0179 useHitWeights = options.useHitWeights
0180 truncateSlopeResid = options.truncateSlopeResid
0181 truncateOffsetResid = options.truncateOffsetResid
0182 combineME11 = options.combineME11
0183 useTrackWeights = options.useTrackWeights
0184 errorFromRMS = options.errorFromRMS
0185 minTracksPerOverlap = options.minTracksPerOverlap
0186 slopeFromTrackRefit = options.slopeFromTrackRefit
0187 minStationsInTrackRefits = options.minStationsInTrackRefits
0188 
0189 if options.inputInBlocks: inputInBlocks = "--inputInBlocks"
0190 json_file = options.json
0191 
0192 
0193 fileNames=[]
0194 fileNamesBlocks=[]
0195 execfile(INPUTFILES)
0196 njobs = options.subjobs
0197 if (options.inputInBlocks):
0198     njobs = len(fileNamesBlocks)
0199     if njobs==0:
0200         print("while --inputInBlocks is specified, the INPUTFILES has no blocks!")
0201         sys.exit()
0202 
0203 stepsize = int(math.ceil(1.*len(fileNames)/options.subjobs))
0204 pwd = str(os.getcwd())
0205 
0206 bsubfile = ["#!/bin/sh", ""]
0207 bsubnames = []
0208 last_align = None
0209 
0210 directory = ""
0211 for i, mode in enumerate(PATTERN):
0212     iteration = i+1
0213     if iteration == 1:
0214         inputdb = INITIALGEOM
0215         inputdbdir = directory[:]
0216     else:
0217         inputdb = director + ".db"
0218         inputdbdir = directory[:]
0219 
0220     directory = "%s%02d/" % (DIRNAME, iteration)
0221     director = directory[:-1]
0222     os.system("rm -rf %s; mkdir %s" % (directory, directory))
0223     os.system("cp gatherBH_cfg.py %s" % directory)
0224     os.system("cp alignBH_cfg.py %s" % directory)
0225 
0226     bsubfile.append("cd %s" % directory)
0227 
0228     constraints = """echo \"\" > constraints_cff.py
0229 """
0230     if photogrammetry and (mode == "phipos" or mode == "phiz"):
0231         diskswitch = ""
0232         if disks: diskswitch = "--disks "
0233 
0234         constraints += """export ALIGNMENT_CONVERTXML=%(inputdb)s
0235 cmsRun $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/python/convertToXML_global_cfg.py 
0236 python $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/scripts/relativeConstraints.py %(inputdb)s_global.xml $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/data/Photogrammetry2007.%(mode)s PGFrame --scaleErrors %(photogrammetryScale)s %(diskswitch)s>> constraints_cff.py
0237 """ % vars()
0238 
0239     elif photogrammetryOnlyholes and (mode == "phipos" or mode == "phiz"):
0240         diskswitch = ""
0241         if disks: diskswitch = "--disks "
0242 
0243         constraints += """export ALIGNMENT_CONVERTXML=%(inputdb)s
0244 cmsRun $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/python/convertToXML_global_cfg.py 
0245 python $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/scripts/relativeConstraints.py %(inputdb)s_global.xml $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/data/Photogrammetry2007_onlyOct2010holes.%(mode)s PGFrame --scaleErrors %(photogrammetryScale)s %(diskswitch)s>> constraints_cff.py
0246 """ % vars()
0247 
0248     elif photogrammetryOnlyOnePerRing and (mode == "phipos" or mode == "phiz"):
0249         diskswitch = ""
0250         if disks: diskswitch = "--disks "
0251 
0252         constraints += """export ALIGNMENT_CONVERTXML=%(inputdb)s
0253 cmsRun $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/python/convertToXML_global_cfg.py 
0254 python $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/scripts/relativeConstraints.py %(inputdb)s_global.xml $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/data/Photogrammetry2007_onlyOnePerRing.%(mode)s PGFrame --scaleErrors %(photogrammetryScale)s %(diskswitch)s>> constraints_cff.py
0255 """ % vars()
0256 
0257     if slm and (mode == "phipos" or "phiz"):
0258         diskswitch = ""
0259         if disks: diskswitch = "--disks "
0260 
0261         constraints += """export ALIGNMENT_CONVERTXML=%(inputdb)s
0262 cmsRun $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/python/convertToXML_global_cfg.py
0263 python $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/scripts/relativeConstraints.py %(inputdb)s_global.xml $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/data/SLM_test.%(mode)s SLMFrame --scaleErrors 1.0 %(diskswitch)s>> constraints_cff.py
0264 """ % vars()
0265 
0266     if fillME11holes and (mode == "phipos" or mode == "phiz"):
0267         diskswitch = ""
0268         if disks: diskswitch = "--disks "
0269 
0270         constraints += """export ALIGNMENT_CONVERTXML=%(inputdb)s
0271 cmsRun $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/python/convertToXML_global_cfg.py 
0272 python $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/scripts/relativeConstraints.py %(inputdb)s_global.xml $ALIGNMENT_AFSDIR/Alignment/MuonAlignmentAlgorithms/data/CollisionsOct2010_ME11holes.%(mode)s TKFrame --scaleErrors 1. %(diskswitch)s>> constraints_cff.py
0273 """ % vars()
0274 
0275     for jobnumber in range(njobs):
0276         gather_fileName = "%sgather%03d.sh" % (directory, jobnumber)
0277         if not options.inputInBlocks:
0278             inputfiles = " ".join(fileNames[jobnumber*stepsize:(jobnumber+1)*stepsize])
0279         else:
0280             inputfiles = " ".join(fileNamesBlocks[jobnumber])
0281 
0282         if len(inputfiles) > 0:
0283             file(gather_fileName, "w").write("""#/bin/sh
0284 # %(commandline)s
0285 
0286 export ALIGNMENT_CAFDIR=`pwd`
0287 
0288 cd %(pwd)s
0289 
0290 export SCRAM_ARCH=slc5_amd64_gcc434
0291 echo INFO: SCRAM_ARCH $SCRAM_ARCH
0292 
0293 eval `scramv1 run -sh`
0294 
0295 source /afs/cern.ch/cms/caf/setup.sh
0296 echo INFO: CMS_PATH $CMS_PATH
0297 echo INFO: STAGE_SVCCLASS $STAGE_SVCCLASS
0298 echo INFO: STAGER_TRACE $STAGER_TRACE
0299 
0300 export ALIGNMENT_AFSDIR=`pwd`
0301 
0302 export ALIGNMENT_INPUTFILES='%(inputfiles)s'
0303 export ALIGNMENT_ITERATION=%(iteration)d
0304 export ALIGNMENT_MODE=%(mode)s
0305 export ALIGNMENT_JOBNUMBER=%(jobnumber)d
0306 export ALIGNMENT_INPUTDB=%(inputdb)s
0307 export ALIGNMENT_GLOBALTAG=%(globaltag)s
0308 export ALIGNMENT_PHOTOGRAMMETRY='%(photogrammetry)s or %(photogrammetryOnlyholes)s or %(photogrammetryOnlyOnePerRing)s'
0309 export ALIGNMENT_SLM=%(slm)s
0310 export ALIGNMENT_FILLME11HOLES='%(fillME11holes)s'
0311 export ALIGNMENT_DISKS=%(disks)s
0312 export ALIGNMENT_minP=%(minP)s
0313 export ALIGNMENT_minHitsPerChamber=%(minHitsPerChamber)s
0314 export ALIGNMENT_maxdrdz=%(maxdrdz)s
0315 export ALIGNMENT_maxRedChi2=%(maxRedChi2)s
0316 export ALIGNMENT_fiducial=%(fiducial)s
0317 export ALIGNMENT_useHitWeights=%(useHitWeights)s
0318 export ALIGNMENT_truncateSlopeResid=%(truncateSlopeResid)s
0319 export ALIGNMENT_truncateOffsetResid=%(truncateOffsetResid)s
0320 export ALIGNMENT_combineME11=%(combineME11)s
0321 export ALIGNMENT_useTrackWeights=%(useTrackWeights)s
0322 export ALIGNMENT_errorFromRMS=%(errorFromRMS)s
0323 export ALIGNMENT_minTracksPerOverlap=%(minTracksPerOverlap)s
0324 export ALIGNMENT_slopeFromTrackRefit=%(slopeFromTrackRefit)s
0325 export ALIGNMENT_minStationsInTrackRefits=%(minStationsInTrackRefits)s
0326 
0327 cp -f %(directory)sgatherBH_cfg.py %(inputdbdir)s%(inputdb)s inertGlobalPositionRcd.db $ALIGNMENT_CAFDIR/
0328 cd $ALIGNMENT_CAFDIR/
0329 
0330 %(constraints)s
0331 
0332 ls -l
0333 cmsRun gatherBH_cfg.py
0334 ls -l
0335 cp -f *.tmp *.root $ALIGNMENT_AFSDIR/%(directory)s
0336 """ % vars())
0337             os.system("chmod +x %s" % gather_fileName)
0338             bsubfile.append("echo %sgather%03d.sh" % (directory, jobnumber))
0339 
0340             if last_align is None: waiter = ""
0341             else: waiter = "-w \"ended(%s)\"" % last_align
0342             if options.big: queue = "cmscaf1nd"
0343             else: queue = "cmscaf1nh"
0344 
0345             if user_mail: bsubfile.append("bsub -R \"type==SLC5_64\" -q %s -J \"%s_gather%03d\" -u %s %s gather%03d.sh" % (queue, director, jobnumber, user_mail, waiter, jobnumber))
0346             else: bsubfile.append("bsub -R \"type==SLC5_64\" -q %s -J \"%s_gather%03d\" %s gather%03d.sh" % (queue, director, jobnumber, waiter, jobnumber))
0347 
0348             bsubnames.append("ended(%s_gather%03d)" % (director, jobnumber))
0349 
0350     file("%sconvert-db-to-xml_cfg.py" % directory, "w").write("""from Alignment.MuonAlignment.convertSQLitetoXML_cfg import *
0351 process.PoolDBESSource.connect = \"sqlite_file:%(directory)s%(director)s.db\"
0352 process.MuonGeometryDBConverter.outputXML.fileName = \"%(directory)s%(director)s.xml\"
0353 process.MuonGeometryDBConverter.outputXML.relativeto = \"ideal\"
0354 process.MuonGeometryDBConverter.outputXML.suppressDTChambers = True
0355 process.MuonGeometryDBConverter.outputXML.suppressDTSuperLayers = True
0356 process.MuonGeometryDBConverter.outputXML.suppressDTLayers = True
0357 process.MuonGeometryDBConverter.outputXML.suppressCSCChambers = False
0358 process.MuonGeometryDBConverter.outputXML.suppressCSCLayers = True
0359 
0360 process.MuonGeometryDBConverter.getAPEs = True
0361 process.PoolDBESSource.toGet = cms.VPSet(
0362     cms.PSet(record = cms.string(\"DTAlignmentRcd\"), tag = cms.string(\"DTAlignmentRcd\")),
0363     cms.PSet(record = cms.string(\"DTAlignmentErrorExtendedRcd\"), tag = cms.string(\"DTAlignmentErrorExtendedRcd\")),
0364     cms.PSet(record = cms.string(\"CSCAlignmentRcd\"), tag = cms.string(\"CSCAlignmentRcd\")),
0365     cms.PSet(record = cms.string(\"CSCAlignmentErrorExtendedRcd\"), tag = cms.string(\"CSCAlignmentErrorExtendedRcd\")),
0366       )
0367 """ % vars())
0368 
0369     constraints += """\ncp -f constraints_cff.py $ALIGNMENT_AFSDIR/%(directory)sconstraints_cff.py""" % vars()
0370 
0371     file("%salign.sh" % directory, "w").write("""#!/bin/sh
0372 # %(commandline)s
0373 
0374 export ALIGNMENT_CAFDIR=`pwd`
0375 
0376 cd %(pwd)s
0377 
0378 export SCRAM_ARCH=slc5_amd64_gcc434
0379 echo INFO: SCRAM_ARCH $SCRAM_ARCH
0380 
0381 eval `scramv1 run -sh`
0382 
0383 source /afs/cern.ch/cms/caf/setup.sh
0384 echo INFO: CMS_PATH $CMS_PATH
0385 echo INFO: STAGE_SVCCLASS $STAGE_SVCCLASS
0386 echo INFO: STAGER_TRACE $STAGER_TRACE
0387 
0388 export ALIGNMENT_AFSDIR=`pwd`
0389 
0390 export ALIGNMENT_ITERATION=%(iteration)d
0391 export ALIGNMENT_MODE=%(mode)s
0392 export ALIGNMENT_INPUTDB=%(inputdb)s
0393 export ALIGNMENT_GLOBALTAG=%(globaltag)s
0394 export ALIGNMENT_PHOTOGRAMMETRY='%(photogrammetry)s or %(photogrammetryOnlyholes)s or %(photogrammetryOnlyOnePerRing)s'
0395 export ALIGNMENT_SLM=%(slm)s
0396 export ALIGNMENT_FILLME11HOLES='%(fillME11holes)s'
0397 export ALIGNMENT_DISKS=%(disks)s
0398 export ALIGNMENT_minP=%(minP)s
0399 export ALIGNMENT_minHitsPerChamber=%(minHitsPerChamber)s
0400 export ALIGNMENT_maxdrdz=%(maxdrdz)s
0401 export ALIGNMENT_maxRedChi2=%(maxRedChi2)s
0402 export ALIGNMENT_fiducial=%(fiducial)s
0403 export ALIGNMENT_useHitWeights=%(useHitWeights)s
0404 export ALIGNMENT_truncateSlopeResid=%(truncateSlopeResid)s
0405 export ALIGNMENT_truncateOffsetResid=%(truncateOffsetResid)s
0406 export ALIGNMENT_combineME11=%(combineME11)s
0407 export ALIGNMENT_useTrackWeights=%(useTrackWeights)s
0408 export ALIGNMENT_errorFromRMS=%(errorFromRMS)s
0409 export ALIGNMENT_minTracksPerOverlap=%(minTracksPerOverlap)s
0410 export ALIGNMENT_slopeFromTrackRefit=%(slopeFromTrackRefit)s
0411 export ALIGNMENT_minStationsInTrackRefits=%(minStationsInTrackRefits)s
0412 
0413 cp -f %(directory)salignBH_cfg.py %(directory)sconvert-db-to-xml_cfg.py %(inputdbdir)s%(inputdb)s %(directory)s*.tmp inertGlobalPositionRcd.db $ALIGNMENT_CAFDIR/
0414 cd $ALIGNMENT_CAFDIR/
0415 export ALIGNMENT_ALIGNMENTTMP=`ls alignment*.tmp`
0416 
0417 %(constraints)s
0418 
0419 ls -l
0420 cmsRun alignBH_cfg.py
0421 cp -f report.py $ALIGNMENT_AFSDIR/%(directory)s%(director)s_report.py
0422 cp -f outputdb.db $ALIGNMENT_AFSDIR/%(directory)s%(director)s.db
0423 cp -f plotting.root $ALIGNMENT_AFSDIR/%(directory)s%(director)s.root
0424 
0425 cd $ALIGNMENT_AFSDIR
0426 cmsRun %(directory)sconvert-db-to-xml_cfg.py
0427 
0428 export ALIGNMENT_PLOTTINGTMP=`ls %(directory)splotting0*.root 2> /dev/null`
0429 if [ \"zzz$ALIGNMENT_PLOTTINGTMP\" != \"zzz\" ]; then
0430   hadd -f1 %(directory)s%(director)s_plotting.root %(directory)splotting0*.root
0431   #if [ $? == 0 ] && [ \"$ALIGNMENT_CLEANUP\" == \"True\" ]; then rm %(directory)splotting0*.root; fi
0432 fi
0433 
0434 """ % vars())
0435     os.system("chmod +x %salign.sh" % directory)
0436 
0437     bsubfile.append("echo %salign.sh" % directory)
0438 
0439     if user_mail: bsubfile.append("bsub -R \"type==SLC5_64\" -q cmscaf1nd -J \"%s_align\" -u %s -w \"%s\" align.sh" % (director, user_mail, " && ".join(bsubnames)))
0440     else: bsubfile.append("bsub -R \"type==SLC5_64\" -q cmscaf1nd -J \"%s_align\" -w \"%s\" align.sh" % (director, " && ".join(bsubnames)))
0441 
0442     bsubfile.append("cd ..")
0443     bsubnames = []
0444     last_align = "%s_align" % director
0445 
0446 bsubfile.append("")
0447 file(options.submitJobs, "w").write("\n".join(bsubfile))
0448 os.system("chmod +x %s" % options.submitJobs)