There is a file in your MyAnalysis/python
directory called
MyAnalysisAlgorithms.py
. This creates and returns an algorithm
sequence:
def makeSequence (dataType) :
algSeq = AlgSequence()
...
return algSeq
It additionally loads a CommonServiceSequence
at the beginning
of the sequence to load/handle systematics:
# Set up CommonServiceSequence
from AsgAnalysisAlgorithms.CommonServiceSequence import makeCommonServiceSequence
makeCommonServiceSequence (algSeq, runSystematics = True)
Among other things, this takes care of registering all the systematics to
run on, so that subsequent algorithms can just pick it up (and don’t have
to be configured for it one-by-one). If you do not need to use systematics,
you can set the runSystematics
option to False
. Note that even if you
have a large number of algorithms for various object types with a lot of
different systematics, you will only ever need/have a single
CommonServiceSequence
. The individual algorithms are smart enough that
they will only run for systematics that actually affect them.
We won’t worry about how to use systematic uncertainties for now and will cover that later in the tutorial.
The following line in
MyAnalysis/CMakeLists.txt
enables the use of the sequence:atlas_install_python_modules( python/*.py )
To run the CP algorithm sequence, it needs to be added to your
steering macro MyAnalysis/share/ATestRun_eljob.py
. To do this,
add the following lines after the job is created and before
your analysis algorithm is created:
from MyAnalysis.MyAnalysisAlgorithms import makeSequence
algSeq = makeSequence (dataType)
print(algSeq) # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
The
makeSequence
method takes an argument indicating whether a data or MC sample is used as input. This is defined in the steering macro:# Set data type to MC dataType = "mc"
Adding the sequence to your job in Athena is very similar to doing
so in EventLoop. Add the following code to ATestRun_jobOptions.py
before your algorithm is added to the main sequence:
# Set data type
dataType = "mc" # "mc" or "data"
from MyAnalysis.MyAnalysisAlgorithms import makeSequence
algSeq = makeSequence (dataType)
print(algSeq) # For debugging
# Add all algorithms from the sequence to the job.
athAlgSeq += algSeq
Recompile and rerun your code to see what changes in the output messages. When you are happy that it is running correctly, commit and push your changes.