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
11def setIDPVMFlags(flags, idpvm_output_file:str='idpvm.root') :
12 flags.PhysVal.OutputFileName = idpvm_output_file
13
14 # Set default truthMinPt depending on Run config
15
16 flags.PhysVal.IDPVM.doExpertOutput = True
17 flags.PhysVal.IDPVM.doValidateTightPrimaryTracks = True
18 flags.PhysVal.IDPVM.doHitLevelPlots = True
19 flags.PhysVal.IDPVM.runDecoration = False
20 flags.PhysVal.IDPVM.doTechnicalEfficiency = True
21
22 # force the vertex for hgg case
23 if flags.PhysVal.IDPVM.hardScatterStrategy == 3:
24 flags.PhysVal.IDPVM.PrimaryVertexContainer = 'HggPrimaryVertices'
25
26 flags.PhysVal.doExample = False
27
28 if flags.PhysVal.IDPVM.doTechnicalEfficiency :
29 flags.Tracking.writeExtendedSi_PRDInfo=True
30
31def addIPVM(flags, cfg) :
32
33 if flags.PhysVal.IDPVM.doPRW:
34 from AthenaConfiguration.ComponentFactory import CompFactory
35 cfg.addService(CompFactory.CP.SystematicsSvc("SystematicsSvc"))
36 from AsgAnalysisAlgorithms.PileupReweightingAlgConfig import PileupReweightingAlgCfg
37 cfg.merge(PileupReweightingAlgCfg(flags))
38
39 from InDetPhysValMonitoring.InDetPhysValDecorationConfig import AddDecoratorCfg
40 cfg.merge(AddDecoratorCfg(flags))
41
42 from InDetPhysValMonitoring.InDetPhysValMonitoringConfig import InDetPhysValMonitoringCfg
43 cfg.merge(InDetPhysValMonitoringCfg(flags))
44
45def removePRDFromAOD(flags, cfg) :
46 '''
47 The ExtendedSi_PRDInfo is needed by IDPVM for the technical efficiency, but increases the
48 AOD size significantly, to avoid that remove it from the output item list.
49 '''
50 import re
51 from OutputStreamAthenaPool.OutputStreamConfig import outputStreamName
52 StreamAOD = cfg.getEventAlgo(outputStreamName("AOD"))
53
54 new_item_list=[]
55 pat=re.compile('.*MeasurementsAux\\..*')
56 for elm in StreamAOD.ItemList :
57 m = pat.match(elm)
58 if m is None :
59 new_item_list.append(elm)
60 else :
61 print('DEBUG remove %s' % elm)
62 StreamAOD.ItemList = new_item_list
63 print (StreamAOD)
64 pass
void print(char *figname, TCanvas *c1)
removePRDFromAOD(flags, cfg)
setIDPVMFlags(flags, str idpvm_output_file='idpvm.root')