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 SystematicsSvc
algorithm at the beginning
of the sequence to load/handle systematics:
# Set up the systematics loader/handler service:
sysService = createService( 'CP::SystematicsSvc', 'SystematicsSvc', sequence = algSeq )
sysService.sigmaRecommended = 1
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). 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 SystematicsSvc
. The individual algorithms are
smart enough that they will only run for systematics that actually affect
them.
We won’t worry about using systematic uncertainties for now and will use them 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.