ATLAS Offline Software
Functions
TestWriteFileMetaDataAOD Namespace Reference

Functions

def writeFileMetaData (flags)
 
def testMetaData (file_name)
 
def main ()
 

Function Documentation

◆ main()

def TestWriteFileMetaDataAOD.main ( )
Run a job writing a file with FileMetaData

Definition at line 45 of file TestWriteFileMetaDataAOD.py.

45 def main():
46  """Run a job writing a file with FileMetaData"""
47  msg = Logging.logging.getLogger("TestFileMetaData")
48 
49  flags = AllConfigFlags.initConfigFlags()
50  flags.Exec.OutputLevel = Constants.DEBUG
51  flags.Input.Files = TestDefaults.defaultTestFiles.AOD_RUN2_DATA
52  flags.Output.AODFileName = "test.pool.root"
53  flags.Output.doWriteAOD = True
54  flags.Concurrency.NumThreads = 4
55  flags.Concurrency.NumConcurrentEvents = 4
56  flags.lock()
57 
58  write = MainServicesConfig.MainServicesCfg(flags)
59  write.merge(PoolReadCfg(flags))
60  write.merge(writeFileMetaData(flags))
61  write.run(100)
62 
63  try:
64  if testMetaData(flags.Output.AODFileName):
65  msg.info("File contains xAOD::FileMetaData")
66  return 0
67  msg.error("File does not contain xAOD::FileMetaData")
68  except ReferenceError:
69  msg.error("Failed to produce output file")
70  except KeyError:
71  msg.error("Failed to get metadata item list from file")
72  return 1
73 
74 

◆ testMetaData()

def TestWriteFileMetaDataAOD.testMetaData (   file_name)
Check that file metadata is in output

Definition at line 35 of file TestWriteFileMetaDataAOD.py.

35 def testMetaData(file_name):
36  """Check that file metadata is in output"""
37  meta = MetaReader.read_metadata([file_name])[file_name]["metadata_items"]
38  file_info_items = [
39  v for _, v in meta.items() if "FileMetaData" in v
40  ]
41  print("found file metadata objects:", file_info_items)
42  return bool(file_info_items)
43 
44 

◆ writeFileMetaData()

def TestWriteFileMetaDataAOD.writeFileMetaData (   flags)
set up an output stream and xAOD::EventInfo

Definition at line 21 of file TestWriteFileMetaDataAOD.py.

21 def writeFileMetaData(flags):
22  """set up an output stream and xAOD::EventInfo"""
23  accumulator = OutputStreamConfig.OutputStreamCfg(flags, streamName="AOD")
24  accumulator.merge(SetupMetaDataForStreamCfg(flags, streamName="AOD"))
25 
26  accumulator.merge(
27  xAODEventInfoCnvConfig.EventInfoCnvAlgCfg(
28  flags=flags, inputKey="", disableBeamSpot=flags.Common.Project is not Enums.Project.Athena
29  )
30  )
31 
32  return accumulator
33 
34 
TestWriteFileMetaDataAOD.main
def main()
Definition: TestWriteFileMetaDataAOD.py:45
TestWriteFileMetaDataAOD.testMetaData
def testMetaData(file_name)
Definition: TestWriteFileMetaDataAOD.py:35
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
TestWriteFileMetaDataAOD.writeFileMetaData
def writeFileMetaData(flags)
Definition: TestWriteFileMetaDataAOD.py:21
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:222
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60