Protons (and heavy ions) are collided in ATLAS in bunches, resulting in multiple simultaneous collisions in every bunch crossing. This is referred to as pileup. Pileup is measured by the mean number of interactions per bunch crossing. The distribution of this during Run 2 is shown below.
In order to properly simulate data with Monte Carlo, it is necessary to include the effects of pileup as seen in data. However, MC samples are generally produced before data collection occurs, which means that the pileup profile of the corresponding detector data is unknown at the time of simulation. Additionally, if an analysis uses a non-standard GRL or a dynamically prescaled trigger, the data pileup profile will be unique to the analysis.
In order to correct the MC pileup profile to that of data, weights are applied to events to change the pileup profile. This reweighting changes the amount that each event contributes to the final distribution. This is done using a centrally provided tool.
Reweighting is a mathematical trick we use in many situations in ATLAS. By changing the weight of MC events, we can modify their relative contribution to various distributions without sacrificing the statistical precision of the MC samples. A weight greater than 1 increases the relative contribution of an event and a weight less than 1 decreases its contribution. Throughout your analysis, you will encounter many different weights that need to be applied to events. The total event weight is simply the product of all of the individual weights.
To schedule the pileup analysis sequence, add the following lines to
makeSequence method in
MyAnalysisAlgorithms.py next to the
GRLSelectorAlg lines. The order of the GRL and pileup sequences does
# Include and set up the pileup analysis sequence: from AsgAnalysisAlgorithms.PileupAnalysisSequence import makePileupAnalysisSequence from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import pileupConfigFiles prwfiles, lumicalcfiles = pileupConfigFiles( dataType ) pileupSequence = makePileupAnalysisSequence( dataType, userPileupConfigs=prwfiles, userLumicalcFiles=lumicalcfiles, ) pileupSequence.configure( inputName = "EventInfo", outputName = "" ) # Add the pileup analysis sequence to the job: algSeq += pileupSequence
Make sure that the pileup algorithm sequence is not within the
if dataType == 'data'statement used for
It is crucial that the pileup sequence is scheduled before any of the analysis object algorithms. The pileup reweighting tool generates and attaches a random run number to MC events. This random run number is used to assign MC events to different data taking periods. This is used to determine the pileup weights that are applied as well as a variety of period-dependent procedures done by CP algorithms.
Rerun your code to make sure you see printouts from the pileup sequence.
When you are happy this is running correctly, commit and push your changes.