Functions | |
def | checkSteps |
def | determineNewProfile |
def | expandHyphens |
def | getFstOccur |
def | getLstIndex |
def | getProfileArray |
def | getSteps |
def | init_vars |
def | main |
def | optionparse |
def | pythonFragment |
def | setInputFile |
def | setOutputFileOption |
def | setupProgramParameters |
def | writeCommands |
def | writeCommandsToReport |
def | writePrerequisteSteps |
def | writeReportFileHeader |
def | writeStepHead |
def | writeUnprofiledSteps |
Variables | |
list | AfterPileUpSteps = [] |
aftStep = step | |
list | AllSteps = ["GEN,SIM", "DIGI", "L1", "DIGI2RAW", "HLT", "RAW2DIGI","RECO"] |
befStep = step | |
string | cmsDriver = 'cmsDriver.py' |
tuple | Command |
tuple | CustomisePythonFragment = pythonFragment(step,cmsDriverOptions) |
debug = False | |
list | DEF_STEPS = ['GEN,SIM', 'DIGI'] |
string | EdmFile = "%s_%s.root" |
fstROOTfile = False | |
fstROOTfileStr = OutputFile | |
tuple | hypMatch = filter(lambda x: "-" in x,filter(lambda x: step == x.split("-")[0],userSteps)) |
tuple | hypreg = re.compile('-') |
list | hypsteps = [] |
string | InputFileOption = "--filein file:" |
isNextStepForProfile = False | |
oneShotProf = False | |
string | outfile = "_PILEUP" |
tuple | OutputFile = setOutputFileOption(acandle,outfile) |
string | OutputFileOption = "--fileout=" |
string | previousOutputFile = "" |
string | prevPrevOutputFile = "" |
dictionary | Profiler |
list | step = steps[stepIndex] |
stepLabel = stepToWrite | |
stepToWrite = step | |
tuple | THIS_PROG_NAME = os.path.basename(sys.argv[0]) |
list | unprofiledSteps = [] |
def cmsRelvalreportInput::checkSteps | ( | steps | ) |
Definition at line 72 of file cmsRelvalreportInput.py.
00072 : 00073 idx = -2 00074 lstidx = -2 00075 for step in steps: 00076 astep = step 00077 split = [] 00078 if "-" in step: 00079 split = astep.split("-") 00080 astep = split[0] 00081 idx = AllSteps.index(astep) 00082 if not ( idx == -2 ): 00083 if lstidx > idx: 00084 print "ERROR: Your user defined steps are not in a valid order" 00085 sys.exit() 00086 lstidx = idx 00087 if "-" in step: 00088 lstidx = AllSteps.index(split[1]) 00089 00090 def getSteps(userSteps):
def cmsRelvalreportInput::determineNewProfile | ( | step, | ||
Profile, | ||||
SavedProfile | ||||
) |
Definition at line 378 of file cmsRelvalreportInput.py.
00378 : 00379 if 'DIGI2RAW' in step: 00380 SavedProfile = Profile 00381 Profile = [ ] 00382 if 'HLT' in step: 00383 Profile = SavedProfile 00384 00385 return (Profile, SavedProfile) 00386 def pythonFragment(step,cmsdriverOptions):
def cmsRelvalreportInput::expandHyphens | ( | step | ) |
Definition at line 226 of file cmsRelvalreportInput.py.
00226 : 00227 newsteps = [] 00228 # for step in steps: 00229 if "-" in step: 00230 hypsteps = step.split(r"-") 00231 if not (len(hypsteps) == 2): 00232 print "ERROR: Could not parse usersteps. You have too many hypens between commas" 00233 sys.exit() 00234 elif not (hypsteps[0] in AllSteps and hypsteps[1] in AllSteps): 00235 print "ERROR: One of the steps you defined is invalid" 00236 sys.exit() 00237 else: 00238 if (hypsteps[0] == hypsteps[1]): 00239 print "WARNING: You should not add a hypenated step that as the same source and destination step, ignoring" 00240 newsteps.append(hypsteps[0]) 00241 else: 00242 newsteps.append(hypsteps[0]) 00243 srt = AllSteps.index(hypsteps[0]) + 1 00244 for n in range(srt,len(AllSteps) - 1,1): 00245 astep = AllSteps[n] 00246 if astep == hypsteps[1]: 00247 break 00248 else: 00249 newsteps.append(astep) 00250 newsteps.append(hypsteps[1]) 00251 else: 00252 if not (step in AllSteps): 00253 print "ERROR: One of the steps you defined is invalid" 00254 sys.exit() 00255 else: 00256 newsteps.append(step) 00257 00258 return newsteps 00259 def setupProgramParameters(options,args):
def cmsRelvalreportInput::getFstOccur | ( | item, | ||
list | ||||
) |
Definition at line 63 of file cmsRelvalreportInput.py.
00063 : 00064 return filter(item.__eq__,list)[0] 00065 def getLstIndex(item, list):
def cmsRelvalreportInput::getLstIndex | ( | item, | ||
list | ||||
) |
Definition at line 66 of file cmsRelvalreportInput.py.
00066 : 00067 lenlist = len(list) 00068 for x in range(lenlist - 1,0,-1): 00069 if list[x] == item: 00070 return x 00071 def checkSteps(steps):
def cmsRelvalreportInput::getProfileArray | ( | ProfileCode | ) |
Definition at line 337 of file cmsRelvalreportInput.py.
00337 : 00338 00339 Profile = [] 00340 00341 # The allowed profiles are: 00342 00343 AllowedProfile = [ 00344 'TimingReport', 00345 'TimeReport', 00346 'SimpleMemReport', 00347 'EdmSize', 00348 'IgProfperf', 00349 'IgProfMemTotal', 00350 'IgProfMemLive', 00351 'IgProfMemAnalyse', 00352 'valgrind', 00353 'memcheck_valgrind', 00354 'None', 00355 ] 00356 00357 if _noprof: 00358 Profile.append(AllowedProfile[-1]) 00359 else: 00360 for i in range(10): 00361 if str(i) in ProfileCode: 00362 firstCase = i == 0 and (str(1) in ProfileCode or str(2) in ProfileCode) or i == 1 and str(2) in ProfileCode 00363 secCase = i == 5 and (str(6) in ProfileCode or str(7) in ProfileCode) or i == 6 and str(7) in ProfileCode 00364 00365 if firstCase or secCase: 00366 Profile.append(AllowedProfile[i] + ' @@@ reuse') 00367 else: 00368 Profile.append(AllowedProfile[i]) 00369 00370 return Profile 00371 def writeStepHead(simcandles,acandle,step):
def cmsRelvalreportInput::getSteps | ( | userSteps | ) |
Definition at line 91 of file cmsRelvalreportInput.py.
00091 : 00092 00093 # Then split the user steps into "steps" 00094 gsreg = re.compile('GEN-SIM') 00095 greg = re.compile('GEN') #Add a second hack (due to the first) to handle the step 1 case GEN-HLT 00096 StepsTokens = userSteps.split(",") 00097 steps = [] 00098 for astep in StepsTokens: 00099 00100 # Then transform the combined steps (GEN-SIM, RAW2DIGI-RECO) 00101 # from using the "-" to using the "," to match cmsDriver.py convention 00102 00103 if gsreg.search(astep): 00104 astep = gsreg.sub(r"GEN,SIM", astep) 00105 elif greg.search(astep): 00106 astep = greg.sub(r"GEN,SIM", astep) 00107 00108 print astep 00109 # Finally collect all the steps into the @Steps array: 00110 00111 steps.append(astep) 00112 00113 #steps = expandHypens(steps) 00114 checkSteps(steps) 00115 return steps 00116 def optionparse():
def cmsRelvalreportInput::init_vars | ( | ) |
Definition at line 301 of file cmsRelvalreportInput.py.
00301 : 00302 00303 #################### 00304 # Obtain required environment variables 00305 # 00306 00307 try: 00308 CMSSW_BASE = os.environ['CMSSW_BASE'] 00309 CMSSW_RELEASE_BASE = os.environ['CMSSW_RELEASE_BASE'] 00310 CMSSW_VERSION = os.environ['CMSSW_VERSION'] 00311 except KeyError: 00312 print 'Error: An environment variable either CMSSW_{BASE, RELEASE_BASE or VERSION} is not available.' 00313 print ' Please run eval `scramv1 runtime -csh` to set your environment variables' 00314 sys.exit() 00315 00316 return ( CMSSW_BASE, 00317 CMSSW_RELEASE_BASE, 00318 CMSSW_VERSION) 00319 def writeReportFileHeader(CMSSW_VERSION,CMSSW_RELEASE_BASE,CMSSW_BASE):
def cmsRelvalreportInput::main | ( | argv = sys.argv |
) |
Definition at line 791 of file cmsRelvalreportInput.py.
00791 : 00792 00793 ##################### 00794 # Options Parser 00795 # 00796 00797 (options, args) = optionparse() 00798 00799 ##################### 00800 # Set up arguments and option handling 00801 # 00802 00803 (NumberOfEvents, ProfileCode, cmsDriverOptions, steps, Candle, bypasshlt ) = setupProgramParameters(options,args) 00804 00805 ###################### 00806 # Initialize a few variables 00807 # 00808 00809 (CMSSW_BASE, CMSSW_RELEASE_BASE, CMSSW_VERSION ) = init_vars() 00810 00811 ################## 00812 # Ok everything is ready now we need to create the input file for the relvalreport script 00813 # 00814 00815 simcandles = writeReportFileHeader(CMSSW_VERSION,CMSSW_RELEASE_BASE,CMSSW_BASE) 00816 00817 ################## 00818 # Based on the profile code create the array of profiles to run: 00819 # 00820 00821 Profile = getProfileArray(ProfileCode) 00822 00823 ################## 00824 # Write the commands for the report to the file 00825 # 00826 00827 writeCommandsToReport(simcandles,Candle,Profile,debug,NumberOfEvents,cmsDriverOptions,steps,bypasshlt) 00828 00829 simcandles.close() 00830 if __name__ == "__main__":
def cmsRelvalreportInput::optionparse | ( | ) |
Definition at line 117 of file cmsRelvalreportInput.py.
00117 : 00118 global _noprof 00119 explanations = map(lambda x: " " + x, Candles) 00120 explanation = "" 00121 for x in range(len(explanations)): 00122 explanation += "%-*s %s\n" % (30, explanations[x],CandDesc[x]) 00123 parser = opt.OptionParser(usage=("""%s NUM_EVENTS_PER_CFG CANDLES PROFILE [--cmsdriver=cmsDriverOptions] [--usersteps=processingStepsOption] 00124 00125 Description - This program creates a configuration file for cmsRelvalreport.py that describes the order in which cmsDriver.py should be run with which candles, steps and profiling so that time spent running cmsDriver.py is minimised. Without this correct ordering we would have to re-run parts of the profiling steps. 00126 00127 Arguments: 00128 NUM_EVENTS_PER_CFG - The number of events per config file 00129 00130 CANDLES - The simulation type to perform profiling on 00131 Candles Description 00132 AllCandles Run all of the candles below 00133 %s 00134 00135 PROFILE - the type of profiling to perform (multiple codes can be used): 00136 Code Profile Type 00137 0 TimingReport 00138 1 TimeReport 00139 2 SimpleMemoryCheck 00140 3 EdmSize 00141 4 IgProfPerf 00142 5 IgProfMemTotal 00143 6 IgProfMemLive 00144 7 IgProfAnalyse 00145 8 ValgrindFCE 00146 9 ValgrindMemCheck 00147 00148 Examples: 00149 Perform Timing Report profiling for all candles and 10 events per cfg. 00150 ./%s 10 AllCandles 1 00151 Perform Timing Report, Time Report and SimpleMemoryCheck profiling for Higgs boson and 50 events. 00152 ./%s 50 \"HZZLLLL\" 012 00153 Perform IgProfPerf and IgProfMemTotal profiling for TTbar and 100 events. 00154 ./%s 100 \"TTBAR\" 45 --cmsdriver=\"--conditions FakeConditions\" 00155 Perform ValgrindFCE ValgrindMemCheck profiling for Minimum bias and 100 events. Only on gensim and digi steps. 00156 ./%s 100 \"MINBIAS\" 89 --cmsdriver=\"--conditions FakeConditions\" \"--usersteps=GEN-SIM,DIGI""" 00157 % ( THIS_PROG_NAME, explanation, THIS_PROG_NAME,THIS_PROG_NAME,THIS_PROG_NAME,THIS_PROG_NAME))) 00158 00159 devel = opt.OptionGroup(parser, "Developer Options", 00160 "Caution: use these options at your own risk." 00161 "It is believed that some of them bite.\n") 00162 #parser.set_defaults(debug=False) 00163 00164 parser.add_option( 00165 '-b', 00166 '--bypass-hlt', 00167 action="store_true", 00168 dest='bypasshlt', 00169 default=False, 00170 help='Should we bypass using the HLT root file?' 00171 ) 00172 00173 parser.add_option( 00174 '-u', 00175 '--usersteps', 00176 type='string', 00177 dest='userSteps', 00178 help='Which steps to run', 00179 metavar='<STEPS>', 00180 ) 00181 parser.add_option( 00182 '-c', 00183 '--cmsdriver', 00184 type='string', 00185 dest='cmsDriverOptions', 00186 help='Option for cmsDriver.py can be specified as a string to be added to all cmsDriver.py commands', 00187 metavar='<CONDITION>', 00188 ) 00189 00190 devel.add_option( 00191 '-1', 00192 '--no-profile', 00193 action="store_true", 00194 dest='noprof', 00195 help='Do not perform profiling, ever', 00196 #metavar='DEBUG', 00197 ) 00198 00199 devel.add_option( 00200 '-d', 00201 '--debug', 00202 action="store_true", 00203 dest='debug', 00204 help='Show debug output', 00205 #metavar='DEBUG', 00206 ) 00207 00208 parser.set_defaults(debug=False,noprof=False) 00209 parser.add_option_group(devel) 00210 00211 (options, args) = parser.parse_args() 00212 00213 00214 _noprof = options.noprof 00215 debug = options.debug 00216 numofargs = len(args) 00217 # print "runtime cmsinput " + str(numofargs) + " noprof " + str(_noprof) 00218 if ((not numofargs == 3) and (not _noprof)) or (_noprof and not (numofargs == 2)): 00219 parser.error("There are not enough arguments specified to run this program." 00220 " Please determine the correct arguments from the usage information above." 00221 " Run with --help option for more information.") 00222 sys.exit() 00223 00224 return (options, args) 00225 def expandHyphens(step):
def cmsRelvalreportInput::pythonFragment | ( | step, | ||
cmsdriverOptions | ||||
) |
Definition at line 387 of file cmsRelvalreportInput.py.
00387 : 00388 # Convenient dictionary to map the correct customise Python fragment for cmsDriver.py: 00389 #It is now living in cmsPerfCommons.py! 00390 00391 # CustomiseFragment = { 00392 # 'GEN,SIM': 'Validation/Performance/TimeMemoryG4Info.py', 00393 # 'DIGI': 'Validation/Performance/TimeMemoryInfo.py', 00394 # 'DIGI-PILEUP':'Validation/Performance/MixingModule.py'} 00395 00396 if "--pileup" in cmsdriverOptions: 00397 return CustomiseFragment['DIGI-PILEUP'] 00398 elif CustomiseFragment.has_key(step): 00399 return CustomiseFragment[step] 00400 else: 00401 #This is a safe default in any case, 00402 #the maintenance of the customise python fragments goes into cmsPerfCommons.py 00403 return CustomiseFragment['DIGI'] 00404 00405 def setInputFile(steps,step,acandle,stepIndex,pileup=False,bypasshlt=False):
def cmsRelvalreportInput::setInputFile | ( | steps, | ||
step, | ||||
acandle, | ||||
stepIndex, | ||||
pileup = False , |
||||
bypasshlt = False | ||||
) |
Definition at line 406 of file cmsRelvalreportInput.py.
00406 : 00407 #print "StepIndex 2:%s"%stepIndex 00408 InputFileOption = "" 00409 if pileup and stepIndex == 0: 00410 InputFileOption = "--filein file:%s_%s" % ( FileName[acandle],"DIGI" ) 00411 else: 00412 InputFileOption = "--filein file:%s_%s" % ( FileName[acandle],steps[stepIndex - 1] ) 00413 00414 if pileup: 00415 pass 00416 else : 00417 if 'GEN,SIM' in step: # there is no input file for GEN,SIM! 00418 InputFileOption = '' 00419 elif 'HLT' in steps[stepIndex - 1] and bypasshlt: 00420 00421 # Special hand skipping of HLT since it is not stable enough, so it will not prevent 00422 # RAW2DIGI,RECO from running 00423 00424 InputFileOption = "--filein file:%s_%s" % ( FileName[acandle],steps[stepIndex - 2] ) 00425 00426 if not InputFileOption == "" : 00427 InputFileOption += ".root " 00428 00429 return InputFileOption 00430 def writeUnprofiledSteps(simcandles,CustomisePythonFragment,cmsDriverOptions,unprofiledSteps,previousOutputFile,acandle,NumberOfEvents, stepIndex, pileup,bypasshlt):
def cmsRelvalreportInput::setOutputFileOption | ( | acandle, | ||
endstep | ||||
) |
Definition at line 489 of file cmsRelvalreportInput.py.
00489 : 00490 return "%s_%s.root" % ( FileName[acandle],endstep) 00491 def writeCommands(simcandles,
def cmsRelvalreportInput::setupProgramParameters | ( | options, | ||
args | ||||
) |
Definition at line 260 of file cmsRelvalreportInput.py.
00260 : 00261 steps = [] 00262 cmsDriverOptions = "" 00263 global AfterPileUpSteps 00264 NumberOfEvents = int(args[0]) # first arg 00265 WhichCandles = str(args[1]) # second arg 00266 ProfileCode = "" 00267 if not _noprof: 00268 ProfileCode = str(args[2]) # third arg 00269 00270 if options.cmsDriverOptions: 00271 00272 cmsDriverOptions = options.cmsDriverOptions 00273 print 'Using user-specified cmsDriver.py options: ' + cmsDriverOptions 00274 00275 if options.userSteps: 00276 00277 userSteps = options.userSteps 00278 steps = getSteps(userSteps) 00279 00280 if WhichCandles.lower() == 'allcandles': 00281 Candle = Candles 00282 print 'ALL standard simulation candles will be PROCESSED:' 00283 else: 00284 Candle = [WhichCandles] 00285 print 'ONLY %s will be PROCESSED' % Candle[0] 00286 00287 # For now the two steps are built in, this can be added as an argument later 00288 # Added the argument option so now this will only be defined if it was not defined already: 00289 00290 if not steps: 00291 print 'The default steps will be run:' 00292 steps = DEF_STEPS 00293 else: 00294 print "You defined your own steps to run:" 00295 00296 for astep in steps: 00297 print astep 00298 00299 return (NumberOfEvents, ProfileCode, cmsDriverOptions, steps, Candle, options.bypasshlt) 00300 def init_vars():
def cmsRelvalreportInput::writeCommands | ( | simcandles, | ||
Profile, | ||||
acandle, | ||||
steps, | ||||
NumberOfEvents, | ||||
cmsDriverOptions, | ||||
bypasshlt, | ||||
stepIndex = 0 , |
||||
pileup = False | ||||
) |
Definition at line 492 of file cmsRelvalreportInput.py.
00500 : 00501 00502 OutputStep = "" 00503 00504 stopIndex = len(steps) 00505 start = 0 00506 00507 userSteps = steps 00508 SavedProfile = [] 00509 fstROOTfile = True 00510 fstROOTfileStr = "" 00511 00512 #Handling the case of the first user step not being the first step (GEN,SIM): 00513 print "Steps passed to writeCommands %s",steps 00514 if not (steps[0] == AllSteps[0]) and (steps[0].split("-")[0] != "GEN,SIM"): 00515 #Write the necessary line to run without profiling all the steps before the wanted ones in one shot: 00516 (stepIndex, rootFileStr) = writePrerequisteSteps(simcandles,steps,acandle,NumberOfEvents,cmsDriverOptions,pileup,bypasshlt) 00517 00518 #Now take care of setting the indeces and input root file name right for the profiling part... 00519 if fstROOTfile: 00520 fstROOTfileStr = rootFileStr 00521 fstROOTfile = False 00522 start = -1 00523 if "-" in steps[0]: 00524 start = AllSteps.index(steps[0].split("-")[0]) 00525 else: 00526 start = AllSteps.index(steps[0]) 00527 lst = - 1 00528 if "-" in steps[-1]: 00529 lst = AllSteps.index(steps[-1].split("-")[1]) #here we are assuming that - is always between two steps no GEN-SIM-DIGI, this is GEN-DIGI 00530 else: 00531 lst = AllSteps.index(steps[-1]) 00532 runSteps = AllSteps[start:lst] 00533 numOfSteps = (lst - start) + 1 00534 stopIndex = start + numOfSteps 00535 #Handling the case in which the first user step is the same as the first step (GEN,SIM) 00536 #elif not (steps[0] == AllSteps[0]) and (steps[0].split("-")[0] == "GEN"): 00537 else: 00538 #Handling the case of the last step being a composite one: 00539 if "-" in steps[-1]: 00540 #Set the stop index at the last step of the composite step (WHY???) 00541 stopIndex = AllSteps.index(steps[-1].split("-")[1]) + 1 00542 else: 00543 stopIndex = AllSteps.index(steps[-1]) + 1 00544 00545 steps = AllSteps 00546 00547 unprofiledSteps = [] 00548 rawreg = re.compile("^RAW2DIGI") 00549 00550 #Beginning of a new design of the loop (abandoned for now for lack of time... simply fixed the issues with unprofiled steps by adding one argument to the writeUnprofiledSteps and fixed a couple of inconsistencies with the -b option: ## #CurrentStepIndex = 0
def cmsRelvalreportInput::writeCommandsToReport | ( | simcandles, | ||
Candle, | ||||
Profile, | ||||
debug, | ||||
NumberOfEvents, | ||||
cmsDriverOptions, | ||||
steps, | ||||
bypasshlt | ||||
) |
Definition at line 765 of file cmsRelvalreportInput.py.
00765 : 00766 00767 OutputStep = '' 00768 00769 # This option will not be used for now since the event content names keep changing, it can be 00770 # edited by hand pre-release by pre-release if wanted (Still moved all to FEVTDEBUGHLT for now, except RECO, left alone). 00771 # 00772 #EventContent = {'GEN,SIM': 'FEVTDEBUGHLT', 'DIGI': 'FEVTDEBUGHLT'} 00773 00774 for acandle in Candle: 00775 print '*Candle ' + acandle 00776 00777 ################## 00778 # If the first profiling we run is EdmSize we need to create the root file first 00779 # 00780 00781 #Here all candles are processed with all the same command, and in the pileup case they will have the pileup settings set correctly already: 00782 fstoutfile = writeCommands(simcandles, 00783 Profile, 00784 acandle, 00785 steps, 00786 NumberOfEvents, 00787 cmsDriverOptions, 00788 bypasshlt) 00789 00790 def main(argv=sys.argv):
def cmsRelvalreportInput::writePrerequisteSteps | ( | simcandles, | ||
steps, | ||||
acandle, | ||||
NumberOfEvents, | ||||
cmsDriverOptions, | ||||
pileup, | ||||
bypasshlt | ||||
) |
Definition at line 478 of file cmsRelvalreportInput.py.
00478 : 00479 fstIdx = -1 00480 if "-" in steps[0]: 00481 fstIdx = AllSteps.index(steps[0].split("-")[0]) 00482 else: 00483 fstIdx = AllSteps.index(steps[0]) 00484 CustomisePythonFragment = pythonFragment("GEN,SIM",cmsDriverOptions) 00485 previousOutputFile="" 00486 OutputFile = writeUnprofiledSteps(simcandles, CustomisePythonFragment, cmsDriverOptions,AllSteps[0:fstIdx],previousOutputFile,acandle,NumberOfEvents, 0,pileup,bypasshlt) 00487 return (fstIdx, OutputFile) 00488 def setOutputFileOption(acandle,endstep):
def cmsRelvalreportInput::writeReportFileHeader | ( | CMSSW_VERSION, | ||
CMSSW_RELEASE_BASE, | ||||
CMSSW_BASE | ||||
) |
Definition at line 320 of file cmsRelvalreportInput.py.
00320 : 00321 00322 SimCandlesFile = 'SimulationCandles_%s.txt' % CMSSW_VERSION 00323 00324 try: 00325 simcandles = open(SimCandlesFile, 'w') 00326 except IOError: 00327 print "Couldn't open %s to save" % SimCandlesFile 00328 00329 simcandles.write('#Candles file automatically generated by %s for %s\n' 00330 % (THIS_PROG_NAME, CMSSW_VERSION)) 00331 simcandles.write("#CMSSW Base : %s\n" % CMSSW_BASE) 00332 simcandles.write("#Release Base: %s\n" % CMSSW_RELEASE_BASE) 00333 simcandles.write("#Version : %s\n\n" % CMSSW_VERSION) 00334 00335 return simcandles 00336 def getProfileArray(ProfileCode):
def cmsRelvalreportInput::writeStepHead | ( | simcandles, | ||
acandle, | ||||
step | ||||
) |
Definition at line 372 of file cmsRelvalreportInput.py.
00372 : 00373 simcandles.write('#%s\n' % FileName[acandle]) 00374 simcandles.write('#Step %s\n' % step) 00375 print step 00376 00377 def determineNewProfile(step,Profile,SavedProfile):
def cmsRelvalreportInput::writeUnprofiledSteps | ( | simcandles, | ||
CustomisePythonFragment, | ||||
cmsDriverOptions, | ||||
unprofiledSteps, | ||||
previousOutputFile, | ||||
acandle, | ||||
NumberOfEvents, | ||||
stepIndex, | ||||
pileup, | ||||
bypasshlt | ||||
) |
Definition at line 431 of file cmsRelvalreportInput.py.
00431 : 00432 # reduce(lambda x,y : x + "," + "y",unprofiledSteps) 00433 #stepsStr = ",".join(unprofiledSteps) 00434 00435 00436 #print "unprofiledSteps is %s"%unprofiledSteps 00437 #print "22acandle is %s"%acandle 00438 #Kludge in case -b option to skip HLT is used... 00439 if bypasshlt and unprofiledSteps[-1]=="HLT": 00440 stepsStr = ",".join(unprofiledSteps[:-1]) 00441 OutputFile = "%s_%s.root" % ( FileName[acandle],unprofiledSteps[-2]) 00442 else: 00443 stepsStr = ",".join(unprofiledSteps) 00444 OutputFile = "%s_%s.root" % ( FileName[acandle],unprofiledSteps[-1]) 00445 simcandles.write("\n#Run a %s step(s) that has not been selected for profiling but is needed to run the next step to be profiled\n" % (stepsStr)) 00446 OutputFileOption = "--fileout=%s" % OutputFile 00447 #Bug here: should take into account the flag --bypass-hlt instead of assuming hlt should be bypassed 00448 #This affects the Step1/Step2 running since Step1 will produce an HLT.root file and Step2 should start from there! 00449 #Adding the argument bypasshlt to the calls... 00450 #PreviousInputFile=AllSteps[AllSteps.index(unprofiledSteps[0])-1] 00451 #print "StepIndex 1:%s"%stepIndex 00452 #Correcting a bug: when unprofiled intermediate steps are present it would skip 1 step... 00453 #stepIndexAdjust=stepIndex - 2 00454 #if stepIndexAdjust < 0: #To avoid issues with negative indeces 00455 # stepIndexAdjust=0 00456 #InputFileOption = setInputFile(AllSteps,unprofiledSteps[0],acandle,stepIndexAdjust,bypasshlt=bypasshlt) 00457 #Use an argument to make it easier: 00458 InputFileOption = "--filein file:" + previousOutputFile 00459 if previousOutputFile =="": 00460 InputFileOption = setInputFile(AllSteps,unprofiledSteps[0],acandle,stepIndex,pileup=pileup,bypasshlt=bypasshlt) 00461 #Introduce an over-ride of cmsDriverOptions: 00462 #For the case of unprofiled steps, always run them with FEVTDEBUGHLT eventcontent 00463 #At the moment the only use case is when running step2 on its own... 00464 for eventcontent in EventContents: 00465 cmsDriverOptions=re.sub(eventcontent,'FEVTDEBUGHLT',cmsDriverOptions) 00466 Command = ("%s %s -n %s --step=%s %s %s --customise=%s %s" 00467 % (cmsDriver, 00468 KeywordToCfi[acandle], 00469 NumberOfEvents, 00470 stepsStr, 00471 InputFileOption, 00472 OutputFileOption, 00473 CustomisePythonFragment, 00474 cmsDriverOptions) ) 00475 simcandles.write( "%s @@@ None @@@ None\n\n" % (Command)) 00476 return OutputFile 00477 def writePrerequisteSteps(simcandles,steps,acandle,NumberOfEvents,cmsDriverOptions,pileup,bypasshlt):
list cmsRelvalreportInput::AfterPileUpSteps = [] [static] |
Definition at line 37 of file cmsRelvalreportInput.py.
list cmsRelvalreportInput::aftStep = step [static] |
Definition at line 620 of file cmsRelvalreportInput.py.
list cmsRelvalreportInput::AllSteps = ["GEN,SIM", "DIGI", "L1", "DIGI2RAW", "HLT", "RAW2DIGI","RECO"] [static] |
Definition at line 36 of file cmsRelvalreportInput.py.
list cmsRelvalreportInput::befStep = step [static] |
Definition at line 619 of file cmsRelvalreportInput.py.
string cmsRelvalreportInput::cmsDriver = 'cmsDriver.py' [static] |
Definition at line 32 of file cmsRelvalreportInput.py.
tuple cmsRelvalreportInput::Command [static] |
Initial value:
("%s %s -n %s --step=%s %s %s --customise=%s %s"
% (cmsDriver,
KeywordToCfi[acandle],
NumberOfEvents,
stepToWrite,
InputFileOption,
OutputFileOption,
CustomisePythonFragment,
cmsDriverOptions) )
Definition at line 678 of file cmsRelvalreportInput.py.
tuple cmsRelvalreportInput::CustomisePythonFragment = pythonFragment(step,cmsDriverOptions) [static] |
Definition at line 624 of file cmsRelvalreportInput.py.
cmsRelvalreportInput::debug = False [static] |
Definition at line 34 of file cmsRelvalreportInput.py.
list cmsRelvalreportInput::DEF_STEPS = ['GEN,SIM', 'DIGI'] [static] |
Definition at line 35 of file cmsRelvalreportInput.py.
string cmsRelvalreportInput::EdmFile = "%s_%s.root" [static] |
Definition at line 663 of file cmsRelvalreportInput.py.
cmsRelvalreportInput::fstROOTfile = False [static] |
Definition at line 655 of file cmsRelvalreportInput.py.
cmsRelvalreportInput::fstROOTfileStr = OutputFile [static] |
Definition at line 654 of file cmsRelvalreportInput.py.
tuple cmsRelvalreportInput::hypMatch = filter(lambda x: "-" in x,filter(lambda x: step == x.split("-")[0],userSteps)) [static] |
Definition at line 632 of file cmsRelvalreportInput.py.
tuple cmsRelvalreportInput::hypreg = re.compile('-') [static] |
Definition at line 33 of file cmsRelvalreportInput.py.
tuple cmsRelvalreportInput::hypsteps = [] [static] |
Definition at line 626 of file cmsRelvalreportInput.py.
tuple cmsRelvalreportInput::InputFileOption = "--filein file:" [static] |
Definition at line 672 of file cmsRelvalreportInput.py.
list cmsRelvalreportInput::isNextStepForProfile = False [static] |
Definition at line 743 of file cmsRelvalreportInput.py.
cmsRelvalreportInput::oneShotProf = False [static] |
Definition at line 625 of file cmsRelvalreportInput.py.
cmsRelvalreportInput::outfile = "_PILEUP" [static] |
Definition at line 648 of file cmsRelvalreportInput.py.
Referenced by pos::PixelFEDCard::writeASCII(), and AlpgenExtractor::writeHeader().
tuple cmsRelvalreportInput::OutputFile = setOutputFileOption(acandle,outfile) [static] |
Definition at line 652 of file cmsRelvalreportInput.py.
string cmsRelvalreportInput::OutputFileOption = "--fileout=" [static] |
Definition at line 656 of file cmsRelvalreportInput.py.
cmsRelvalreportInput::previousOutputFile = "" [static] |
Definition at line 611 of file cmsRelvalreportInput.py.
cmsRelvalreportInput::prevPrevOutputFile = "" [static] |
CurrentStepIndex = 0 print "UserSteps:" AllStepsIndex=-1 Tests that can be done before looping: Check the first step to see if there are unprofiled pre-steps needed: if not (userSteps[0] == AllSteps[0]) and (userSteps[0].split("-")[0] != "GEN,SIM"): print "Need some pre-steps before starting with userSteps %s"userSteps print "Will run steps %s"AllSteps[0:AllSteps.index(userSteps[0].split("-")[0])] implement here the running of unprofiled steps between GEN-SIM and AllSteps.index(steps[0].split("-")[0] -1) possibly calling a function WriteUnprofiledSteps(unprofiledSteps) that takes care of all (input, output filename)
for step in userSteps: print step Before establish the corresponding index in AllSteps:
Check if there are hypens (they mean we want to run all the steps between the hypens in one shot profiling them) if "-" in step: print "Hyphenated step: %s"step implement profiling of steps a la cmsDriver.py, by translating the hypens: GEN-HLT -> GEN,SIM,DIGI,L1,DIGI2RAW,HLT Also make sure the output is called like the last step (in this case HLT.root) print "Expanded hyphenated steps: %s"expandHyphens(step) FirstStep=expandHyphens(step)[0] FirstStepIndex=AllSteps.index(FirstStep) LastStep=expandHyphens(step)[1] LastStepIndex=AllSteps.index(LastStep) print "First step %s and last step %s"%(FirstStep,LastStep) cmsDriverSteps=",".join(AllSteps[FirstStepIndex:LastStepIndex+1]) print "cmsDriverSteps = %s"cmsDriverSteps if '--pileup' in cmsDriverOptions: outfile = LastStep + "_PILEUP" else: outfile = LastStep OutputFile = setOutputFileOption(acandle,outfile) print "OutputFile is %s"OutputFile if AllStepsIndex != -1: try: if AllSteps.index(step) == AllStepsIndex + 1: print "Consecutive steps to profile" else: print "Step %s is not the consecutive step of %s, so we will need to run the intermediate ones unprofiled"%(AllSteps.index(step),AllStepsIndex) except:To catch the case of hyphenated steps if AllSteps.index(expandHyphens(step)[0]) == AllStepsIndex + 1: print "Consecutive steps to profile" else: print "Step %s is not the consecutive step of %s, so we will need to run the intermediate ones unprofiled"%(AllSteps.index(expandHyphens(step)[0]),AllStepsIndex) Finally establish the corresponding index in AllSteps: try: AllStepsIndex=AllSteps.index(step) except: To catch the case of hyphenated steps AllStepsIndex=AllSteps.index(expandHyphens(step)[-1])
CurrentStepIndex = CurrentStepIndex + 1
Definition at line 610 of file cmsRelvalreportInput.py.
dictionary cmsRelvalreportInput::Profiler [static] |
Initial value:
{ 'TimingReport' : 'Timing_Parser', 'TimingReport @@@ reuse' : 'Timing_Parser', 'TimeReport' : 'Timereport_Parser', 'TimeReport @@@ reuse' : 'Timereport_Parser', 'SimpleMemReport' : 'SimpleMem_Parser', 'EdmSize' : 'Edm_Size', 'IgProfperf' : 'IgProf_perf.PERF_TICKS', 'IgProfMemTotal' : 'IgProf_mem.MEM_TOTAL', 'IgProfMemTotal @@@ reuse': 'IgProf_mem.MEM_TOTAL', 'IgProfMemLive' : 'IgProf_mem.MEM_LIVE', 'IgProfMemLive @@@ reuse' : 'IgProf_mem.MEM_LIVE', 'IgProfMemAnalyse' : 'IgProf_mem.ANALYSE', 'valgrind' : 'ValgrindFCE', 'memcheck_valgrind' : 'Memcheck_Valgrind', 'None' : 'None', }
Definition at line 43 of file cmsRelvalreportInput.py.
list cmsRelvalreportInput::step = steps[stepIndex] [static] |
Definition at line 616 of file cmsRelvalreportInput.py.
Referenced by PixelToLNKAssociateFromAscii::addConnections(), EBBeamCaloClient::analyze(), evf::ExceptionGenerator::analyze(), EEBeamCaloClient::analyze(), DTCalibValidation::beginRun(), ThePEG::HepMCConverter< HepMCEventT, Traits >::createParticle(), HOCalibAnalyzer::endJob(), MaterialBudgetHcalHistos::fillPerStep(), AdaptiveVertexFitter::fit(), IgSoGridPlaneMap::generatePrimitives(), CSCGasCollisions::generateStep(), getLinearizedADC(), CachedTrajectory::getTrajectory(), IgSoGridPlaneMap::GLRender(), HDShower::indexFinder(), HFShower::indexFinder(), PhotonValidator::initVectors(), langaufun(), DTTSTheta::loadDTTSTheta(), DTSectColl::loadSectColl(), DTTracoCard::loadTRACO(), DTTSPhi::loadTSPhi(), MagneticFieldMap::MagneticFieldMap(), operator *(), operator+(), operator-(), operator/(), PhiBorderFinder::PhiBorderFinder(), pos::PixelCalibConfiguration::PixelCalibConfiguration(), EMShower::prepareSteps(), DTTrigProd::produce(), cms::FastMuPropagator::propagate(), RKPropagatorInR::propagate(), RBorderFinder::RBorderFinder(), IgSoFieldPlane::refreshColors(), IgSoAnimator::resetSensorCB(), DTBtiCard::runBTI(), DTTracoCard::runTRACO(), MultiTrackValidatorBase::setUpVectors(), CSCGasCollisions::simulate(), TrackingMaterialAnalyser::split(), DTSegmentUpdator::update(), VisG4TrackPtTwig::update(), IgSoFieldPlane::updateCorners(), IgSoGridPlane::updateScale(), EEBeamCaloClient::writeDb(), and EBBeamCaloClient::writeDb().
string cmsRelvalreportInput::stepLabel = stepToWrite [static] |
Definition at line 727 of file cmsRelvalreportInput.py.
string cmsRelvalreportInput::stepToWrite = step [static] |
Definition at line 622 of file cmsRelvalreportInput.py.
tuple cmsRelvalreportInput::THIS_PROG_NAME = os.path.basename(sys.argv[0]) [static] |
Definition at line 31 of file cmsRelvalreportInput.py.
list cmsRelvalreportInput::unprofiledSteps = [] [static] |
Definition at line 755 of file cmsRelvalreportInput.py.