ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tools
PyJobTransforms
share
postInclude.SortInput.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
# Joboptions fragment that should be post-included after a typicaly configured Athena job
4
# It will read original input files, create a list of Events in memory, sort them and produce
5
# an intermediate Event reference file that Athena will read instead of the original inputs
6
7
# Event information is read from EventInfoTags (stored by default in all Athena data files)
8
# The default sort key value (LumiBlockN) can be overridden. The sorting order is ascending.
9
10
import
os
11
12
from
AthenaCommon.AppMgr
import
ServiceMgr
13
inputs = ServiceMgr.EventSelector.InputCollections
14
15
# set default sort parameters, read overrides from locals()
16
tmpCollFile = locals().
get
(
"AthenaInputSortCollName"
,
"sortedEventRefs"
+ str(os.getpid()) +
".root"
)
17
sortTag = locals().
get
(
"AthenaInputSortTag"
,
"LumiBlockN"
)
18
19
from
OutputStreamAthenaPool.SortedInputFileCreator
import
SortedInputFileCreator
20
sorter = SortedInputFileCreator()
21
# Sort Inputs based on one of the EventInfoTag attributes
22
# Store sorted event references in a temporary file
23
# This should run as postInclude, so we assume EventSelector.InputCollections is set earlier
24
sorter.execute(inputs, outputFile=tmpCollFile, sortAttribute=sortTag)
25
26
# Reading Events through References require a populated FileCatalog
27
for
inpfile
in
inputs:
28
os.system(
'pool_insertFileToCatalog {}'
.format(inpfile))
29
30
ServiceMgr.PoolSvc.AttemptCatalogPatch =
False
31
32
# Tell Athena to use the sorted collection instead of the original inputs
33
ServiceMgr.EventSelector.InputCollections = [tmpCollFile]
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition
hcg.cxx:132
Generated on
for ATLAS Offline Software by
1.17.0