ATLAS Offline Software
Loading...
Searching...
No Matches
IDPVMPostInclude.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3# Convenience functions to schedule algorithms to produce IDPVM output
4# during reconstruction.
5# USAGE:
6# --preExec "from InDetPhysValMonitoring.IDPVMPostInclude import setIDPVMFlags;setIDPVMFlags(flags,idpvm_output_file='idpvm.root');"
7# --postInclude 'InDetPhysValMonitoring.IDPVMPostInclude.addIPVM','InDetPhysValMonitoring.IDPVMPostInclude.removePRDFromAOD' \
8# "removePRDFromAOD" will remove the MeasurementsAux content from the AOD, which significantly
9# reduces the AOD for ITk.
10
11from InDetPhysValMonitoring.InDetPhysValMonitoringConfig import HardScatterStrategy
12
13def setIDPVMFlags(flags, idpvm_output_file:str='idpvm.root') :
14 flags.PhysVal.OutputFileName = idpvm_output_file
15
16 # Set default truthMinPt depending on Run config
17
18 flags.PhysVal.IDPVM.doExpertOutput = True
19 flags.PhysVal.IDPVM.doValidateTightPrimaryTracks = True
20 flags.PhysVal.IDPVM.doHitLevelPlots = True
21 flags.PhysVal.IDPVM.runDecoration = False
22 flags.PhysVal.IDPVM.doTechnicalEfficiency = True
23
24 # force the vertex for hgg case
25 if flags.PhysVal.IDPVM.hardScatterStrategy == HardScatterStrategy.HYY:
26 flags.PhysVal.IDPVM.PrimaryVertexContainer = 'HggPrimaryVertices'
27
28 flags.PhysVal.doExample = False
29
30 if flags.PhysVal.IDPVM.doTechnicalEfficiency :
31 flags.Tracking.writeExtendedSi_PRDInfo=True
32
33def addIPVM(flags, cfg) :
34
35 if flags.PhysVal.IDPVM.doPRW:
36 from AthenaConfiguration.ComponentFactory import CompFactory
37 cfg.addService(CompFactory.CP.SystematicsSvc("SystematicsSvc"))
38 from AsgAnalysisAlgorithms.PileupReweightingAlgConfig import PileupReweightingAlgCfg
39 cfg.merge(PileupReweightingAlgCfg(flags))
40
41 from InDetPhysValMonitoring.InDetPhysValDecorationConfig import AddDecoratorCfg
42 cfg.merge(AddDecoratorCfg(flags))
43
44 from InDetPhysValMonitoring.InDetPhysValMonitoringConfig import InDetPhysValMonitoringCfg
45 cfg.merge(InDetPhysValMonitoringCfg(flags))
46
47def removePRDFromAOD(flags, cfg) :
48 '''
49 The ExtendedSi_PRDInfo is needed by IDPVM for the technical efficiency, but increases the
50 AOD size significantly, to avoid that remove it from the output item list.
51 '''
52 import re
53 from OutputStreamAthenaPool.OutputStreamConfig import outputStreamName
54 StreamAOD = cfg.getEventAlgo(outputStreamName("AOD"))
55
56 new_item_list=[]
57 pat=re.compile('.*MeasurementsAux\\..*')
58 for elm in StreamAOD.ItemList :
59 m = pat.match(elm)
60 if m is None :
61 new_item_list.append(elm)
62 else :
63 print('DEBUG remove %s' % elm)
64 StreamAOD.ItemList = new_item_list
65 print (StreamAOD)
66 pass
void print(char *figname, TCanvas *c1)
removePRDFromAOD(flags, cfg)
setIDPVMFlags(flags, str idpvm_output_file='idpvm.root')