ATLAS Offline Software
Classes | Functions | Variables
Gen_tf Namespace Reference

Classes

class  EvgenExecutor
 

Functions

def move_files (main_dir, tmp_dir, whitelist)
 
def getTransform ()
 
def main ()
 

Variables

list ListOfDefaultPositionalKeys = ['--AMIConfig', '--AMITag', '--argJSON', '--asetup', '--athena', '--athenaMPMergeTargetSize', '--athenaopts', '--attempt', '--checkEventCount', '--command', '--dumpJSON', '--dumpPickle', '--ecmEnergy', '--env', '--eventAcceptanceEfficiency', '--evgenJobOpts', '--execOnly', '--fileValidation', '--firstEvent', '--ignoreErrors', '--ignoreFiles', '--ignorePatterns', '--imf', '--inputEVNT_PreFile', '--inputFileValidation', '--inputGenConfFile', '--inputGeneratorFile', '--jobConfig', '--jobid', '--maxEvents', '--orphanKiller', '--outputEVNTFile', '--outputEVNT_PreFile', '--outputFileValidation', '--outputNTUP_TRUTHFile', '--outputTXTFile', '--parallelFileValidation', '--postExec', '--postInclude', '--preExec', '--preInclude', '--wprintEvts', '--randomSeed', '--reportName', '--reportType', '--rivetAnas', '--runNumber', '--showGraph', '--showPath', '--showSteps', '--skipEvents', '--skipFileValidation', '--skipInputFileValidation', '--skipOutputFileValidation', '--steering', '--taskid', '--tcmalloc', '--valgrind', '--valgrindbasicopts', '--valgrindextraopts', '--lheOnly', '--localPath', '--cleanOut', '--saveList']
 Prodsys1 hack... More...
 

Function Documentation

◆ getTransform()

def Gen_tf.getTransform ( )

Definition at line 188 of file Gen_tf.py.

188 def getTransform():
189  exeSet = set()
190  msg.info("Transform arguments %s" % sys.argv[1:])
191  if "--outputEVNTFile" in str(sys.argv[1:]):
192  exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoEVGEN.py", skeletonCA="EvgenJobTransforms.GENtoEVGEN_Skeleton", inData=["inNULL"], outData=["YODA", "EVNT", "EVNT_Pre", "TXT"]))
193  msg.info("Output EVNT file")
194  elif "--outputYODAFile" in str(sys.argv[1:]):
195  exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoEVGEN.py", inData=["inNULL"], outData=["YODA", "TXT"]))
196  msg.info("Output EVNT file")
197  elif "--outputTXTFile" in str(sys.argv[1:]):
198  exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoTXT.py", inData=["inNULL"], outData=["TXT"]))
199  msg.info("Output TXT file")
200  else:
201  msg.error("Output cannot be recognised")
202 
203  exeSet.add(EvgenExecutor(name="afterburn", skeleton="EvgenJobTransforms/skel.ABtoEVGEN.py", inData=["EVNT_Pre"], outData=["EVNT"]))
204  exeSet.add(athenaExecutor(name = "AODtoDPD", skeletonFile = "PATJobTransforms/skeleton.AODtoDPD_tf.py",
205  substep = "a2d", inData = ["EVNT"], outData = ["NTUP_TRUTH"], perfMonFile = "ntuple_AODtoDPD.pmon.gz"))
206  trf = transform(executor=exeSet)
207  addAthenaArguments(trf.parser, maxEventsDefaultSubstep='all')
208  addStdEvgenArgs(trf.parser)
209  return trf
210 
211 
212 @stdTrfExceptionHandler
213 @sigUsrStackTrace

◆ main()

def Gen_tf.main ( )

Definition at line 214 of file Gen_tf.py.

214 def main():
215  msg.info("This is %s" % sys.argv[0])
216 
217  main_dir = os.getcwd()
218  trf = getTransform()
219  trf.parseCmdLineArgs(sys.argv[1:])
220  if (("cleanOut" in trf.argdict) and (trf.argdict["cleanOut"].value != 0)):
221  name_tmpdir = "tmprun"
222  tmp_dir = os.path.join(main_dir, name_tmpdir)
223  if os.path.isdir(tmp_dir):
224  shutil.rmtree(tmp_dir, ignore_errors=True)
225  os.mkdir("tmprun")
226  os.chdir("tmprun")
227  tmp_dir = os.getcwd()
228  whitelist_in = ['MC','group','TXT']
229  move_files(tmp_dir,main_dir,whitelist_in)
230 
231  trf.execute()
232  trf.generateReport()
233  msg.info("%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode))
234 
235 
236 # read files/dirs that should be saved and if present in cwd - remove
237 
238  if (("cleanOut" in trf.argdict) and (trf.argdict["cleanOut"].value!=0)):
239  whitelist_out = ['log.generate','.root']
240  if "outputTXTFile" in trf.argdict:
241  whitelist_out.append('TXT')
242  if "saveList" in trf.argdict:
243  saveList_dic= trf.argdict["saveList"].value
244  saveList_str= str(saveList_dic)
245  saveList_str=saveList_str[10:-3]
246  saveList= saveList_str.split(",")
247  for item in saveList:
248  test_ex = os.path.join(main_dir,str(item))
249  if os.path.isdir(test_ex):
250  shutil.rmtree(test_ex, ignore_errors=True)
251  elif os.path.isfile(test_ex):
252  os.remove(test_ex)
253  if not saveList[0].isdigit():
254  whitelist_out=whitelist_out+saveList
255 
256  move_files(main_dir,tmp_dir,whitelist_out)
257  os.chdir(main_dir)
258  if "saveList" not in trf.argdict:
259  shutil.rmtree(tmp_dir, ignore_errors=True)
260  elif not saveList[0].isdigit():
261  shutil.rmtree(tmp_dir, ignore_errors=True)
262 # if cleanOut is not defined and multipleinput preset, remove the merged file
263  elif ("inputGeneratorFile" in trf.argdict):
264  myinputfiles = trf.argdict["inputGeneratorFile"].value
265  genInputFiles = myinputfiles.split(',')
266  numberOfFiles = len(genInputFiles)
267  merge_file = 'merged_lhef._0.events'
268  if((numberOfFiles>1) and (os.path.exists(merge_file))):
269  os.remove(merge_file)
270 #
271  if (("lheOnly" in trf.argdict ) and (trf.argdict["lheOnly"].value == 1)):
272  outputName = ''.join(trf.argdict["outputEVNTFile"].value)
273  os.remove(outputName)
274  sys.exit(trf.exitCode)
275 
276 
277 # TODO: Open resulting EVNT file to extract cross-section, generator names+versions, etc. from the HepMC::GenRun or whatever... in an executor postExecute?
278 
279 

◆ move_files()

def Gen_tf.move_files (   main_dir,
  tmp_dir,
  whitelist 
)

Definition at line 176 of file Gen_tf.py.

176 def move_files(main_dir,tmp_dir,whitelist):
177  files = os.listdir(tmp_dir)
178  files.sort()
179  for f in files:
180  for i in whitelist:
181  if i in f:
182  src = tmp_dir+"/"+f
183  dest = main_dir+"/"+f
184  os.rename(src,dest)
185  break
186 
187 

Variable Documentation

◆ ListOfDefaultPositionalKeys

list Gen_tf.ListOfDefaultPositionalKeys = ['--AMIConfig', '--AMITag', '--argJSON', '--asetup', '--athena', '--athenaMPMergeTargetSize', '--athenaopts', '--attempt', '--checkEventCount', '--command', '--dumpJSON', '--dumpPickle', '--ecmEnergy', '--env', '--eventAcceptanceEfficiency', '--evgenJobOpts', '--execOnly', '--fileValidation', '--firstEvent', '--ignoreErrors', '--ignoreFiles', '--ignorePatterns', '--imf', '--inputEVNT_PreFile', '--inputFileValidation', '--inputGenConfFile', '--inputGeneratorFile', '--jobConfig', '--jobid', '--maxEvents', '--orphanKiller', '--outputEVNTFile', '--outputEVNT_PreFile', '--outputFileValidation', '--outputNTUP_TRUTHFile', '--outputTXTFile', '--parallelFileValidation', '--postExec', '--postInclude', '--preExec', '--preInclude', '--wprintEvts', '--randomSeed', '--reportName', '--reportType', '--rivetAnas', '--runNumber', '--showGraph', '--showPath', '--showSteps', '--skipEvents', '--skipFileValidation', '--skipInputFileValidation', '--skipOutputFileValidation', '--steering', '--taskid', '--tcmalloc', '--valgrind', '--valgrindbasicopts', '--valgrindextraopts', '--lheOnly', '--localPath', '--cleanOut', '--saveList']

Prodsys1 hack...

TODO: Remove!

Definition at line 19 of file Gen_tf.py.

Gen_tf.move_files
def move_files(main_dir, tmp_dir, whitelist)
Definition: Gen_tf.py:176
Gen_tf.getTransform
def getTransform()
Definition: Gen_tf.py:188
python.trfArgs.addAthenaArguments
def addAthenaArguments(parser, maxEventsDefaultSubstep='first', addValgrind=True, addPerfMon=True, addVTune=True)
Options related to running athena in general TODO: Some way to mask certain options (perExec,...
Definition: trfArgs.py:59
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.evgenTrfArgs.addStdEvgenArgs
def addStdEvgenArgs(parser)
Definition: evgenTrfArgs.py:5
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
str
Definition: BTagTrackIpAccessor.cxx:11
Gen_tf.main
def main()
Definition: Gen_tf.py:214