Calibrating Your Object and Other Tools

Last update: 24 Oct 2019 [History] [Edit]

Throughout a physics analysis, various selections and calibrations will be applied to your data and reconstructed objects. Physics analysis tools are usually provided by each CP group to implement into your framework. In the past, analysers were required to initialise the tool, configure it and apply it for each event/object.

Although the common CP algorithms are still relatively new, the majority of physics analysis tools have been added to the list of algorithms making the process a lot easier. If a tool is required for your analysis but is not currently included in the common CP algorithms please email the relevant team to have this added.

Muon Calibration

As an example of what is included in the muon sequence, look back in the previous section and notice the calibration and smearing algorithm CP::MuonCalibrationAndSmearingAlg.

    # Set up the muon calibration and smearing algorithm:
    alg = createAlgorithm( 'CP::MuonCalibrationAndSmearingAlg',
                           'MuonCalibrationAndSmearingAlg' + postfix )
    alg.preselection = "&&".join (selectionDecorNames)
    addPrivateTool( alg, 'calibrationAndSmearingTool',
                    'CP::MuonCalibrationPeriodTool' )
    seq.append( alg, inputPropName = 'muons', outputPropName = 'muonsOut',
                affectingSystematics = '(^MUON_ID$)|(^MUON_MS$)|(^MUON_SAGITTA_.*)|(^MUON_SCALE$)',
                stageName = 'calibration' )

This algorithm applies the calibration and smearing to each muon object appropriately. As you can see, there is also the option to add the relevant systematics this calibration will affect so this can be handled by the systematics handler.

It may be worth reading the output of your job closely. You will see the setup of your algorithm sequence and tools in the order you specified.

Algorithm CP::SysListLoaderAlg/SysLoaderAlg
...
Private Tool CP::PileupReweightingTool/pileupReweightingTool
...
Algorithm CP::AsgSelectionAlg/MuonEtaCutAlg_medium
...
Private Tool CP::MuonCalibrationPeriodTool/calibrationAndSmearingTool

You may also notice some output corresponding to the opening of correction files for the relevant muon calibration, for example

ToolSvc.MuonCalibratio...INFO    Opening correction file : /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/MuonMomentumCorrections/sagittaBiasDataAll_03_02_19_Data16/outqDeltamPlots_iter0/CB_data.root

Get into the habit of reading the log of your jobs to make sure you have configured your algorithms correctly. If you now check your muon sum pT plot, you should notice that it looks a little different to your previous histogram due to the calibration.

Multiple Working Points

Most analyses will want to have the option to run multiple working points for their objects for optimisation studies and sensitivity tests, this is relatively simple with the common CP algorithms.

Add a second configuration to MyMuonAnalysisAlgorithms.py just below your medium working point like so:

    muonSequenceTight = makeMuonAnalysisSequence( dataType, deepCopyOutput = True, shallowViewOutput = False,
                                                  workingPoint = 'Tight.Iso', postfix = 'tight' )
    muonSequenceTight.removeStage ("calibration")
    muonSequenceTight.configure( inputName = 'AnalysisMuonsMedium_%SYS%',
                                 outputName = 'AnalysisMuonsTight_%SYS%',
                                 affectingSystematics = muonSequenceMedium.affectingSystematics())

    # Add the sequence to the job:
    algSeq += muonSequenceTight

This is almost like the previous one, except:

  • we select a different working point when creating the sequence
  • we specify a different postfix which is appended to all decorations (and algorithm names) to make them unique
  • before the configure call, we call removeStage to remove the calibration algorithms (as calibrations only should be applied once)
  • in the configure call we specify the output of the previous sequence as the input of this sequence.

As of the time of this writing multiple workings should have been added to all object types.

As an exercise, try to plot the muon sum pT we plotted earlier but using the AnalysisMuonTight output and compare the two.