ATLAS Offline Software
PFOMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''@file PFOMonitorAlgorithm.py
6 @author L. Sawyer
7 @date 2020-07-15
8 @python configuration for the Run III PArticle Flow Object (PFO) Monitoring package
9 '''
10 
11 def PFOMonitoringConfig(inputFlags):
12  '''Function to configures some algorithms in the monitoring system.'''
13 
14 
20 
21  # The following class will make a sequence, configure algorithms, and link
22  # them to GenericMonitoringTools
23  from AthenaMonitoring import AthMonitorCfgHelper
24  helper = AthMonitorCfgHelper(inputFlags,'PFOAthMonitorCfg')
25 
26 
27 
33  from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg
34  from AthenaMonitoring.BadLBFilterToolConfig import LArBadLBFilterToolCfg
35 
36  from AthenaConfiguration.ComponentFactory import CompFactory
37  PFOMonAlg = helper.addAlgorithm(CompFactory.PFOMonitorAlgorithm,'PFOMonAlg',
38  addFilterTools = [AtlasReadyFilterCfg(inputFlags),
39  LArBadLBFilterToolCfg(inputFlags)
40  ])
41 
42 
48 
49  # PFO energy threshold in GeV TBD!
50  # PFOMonAlg.lowEt = 5.0
51  # PFOMonAlg.hiEt = 20.0
52 
53 
54 
57 
58  # Add monitor groups - All.
59  pfosAllGroup = helper.addGroup(
60  alg=PFOMonAlg,
61  name='PFOMonitorAllPFOs',
62  topPath='PFOs/AllPFOs/'
63  )
64  # Add monitor groups - Charged.
65  pfosChargedGroup = helper.addGroup(
66  alg=PFOMonAlg,
67  name='PFOMonitorChargedPFOs',
68  topPath='PFOs/ChargedPFOs/'
69  )
70  # Add monitor groups - Neutral.
71  pfosNeutralGroup = helper.addGroup(
72  alg=PFOMonAlg,
73  name='PFOMonitorNeutralPFOs',
74  topPath='PFOs/NeutralPFOs/'
75  )
76 
77 
79  pfosAllGroup.defineHistogram('nPFOs', title='No. of PFOs;N_{PFOs};Events',xbins=200,xmin=0.0,xmax=2000.0)
80  pfosAllGroup.defineHistogram('pfopT', title='PFO transverse momentum;pT;Events',xbins=200,xmin=0.0,xmax=400)
81  pfosAllGroup.defineHistogram('pfoEta', title='PFO eta;eta;Events',xbins=98,xmin=-4.9,xmax=4.9)
82  pfosAllGroup.defineHistogram('pfoPhi', title='PFO phi;phi;Events',xbins=64,xmin=-3.15,xmax=3.15)
83  pfosAllGroup.defineHistogram('pfoMass',title='PFO mass;Mass;Events',xbins=100,xmin=0.0,xmax=100)
84  pfosAllGroup.defineHistogram('pfoE', title='PFO energy;E;Events',xbins=300,xmin=0.0,xmax=600)
85  pfosAllGroup.defineHistogram('pfoRapidity', title='PFO rapidity;y;Events',xbins=98,xmin=-4.9,xmax=4.9)
86 
87  pfosAllGroup.defineHistogram('pfoEta,pfoPhi,pfoE', type='TProfile2D', title='Average PFO Energy;eta;phi',
88  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
89  pfosAllGroup.defineHistogram('pfoEta,pfoPhi,pfopT', type='TProfile2D', title='Average PFO Transverse Momentum;eta;phi',
90  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
91  pfosAllGroup.defineHistogram('pfoEta,pfoPhi', type='TH2F',title='PFO Occupancy - No Threshold;eta;phi',
92  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
93 
94 
96  pfosChargedGroup.defineHistogram('nChPFOs', title='No. of Charged PFOs;N_{PFOs};Events',xbins=200,xmin=0.0,xmax=1000.0)
97  pfosChargedGroup.defineHistogram('ChpfopT', title='Charged PFO transverse momentum;pT;Events',xbins=100,xmin=0.0,xmax=200)
98  pfosChargedGroup.defineHistogram('ChpfoEta', title='Charged PFO eta;eta;Events',xbins=98,xmin=-4.9,xmax=4.9)
99  pfosChargedGroup.defineHistogram('ChpfoPhi', title='Charged PFO phi;phi;Events',xbins=64,xmin=-3.15,xmax=3.15)
100  pfosChargedGroup.defineHistogram('ChpfoMass',title='Charged PFO mass;Mass;Events',xbins=100,xmin=0.0,xmax=100)
101  pfosChargedGroup.defineHistogram('ChpfoE', title='Charged PFO energy;E;Events',xbins=300,xmin=0.0,xmax=300)
102  pfosChargedGroup.defineHistogram('ChpfoDenseEnv',title='Charged PFO isInDenseEnvironment Flag',xbins=3,xmin=-1,xmax=2)
103  pfosChargedGroup.defineHistogram('ChpfoExpE', title='Charged PFO Expected Energy From Tracks; E_{exp};Events', xbins=300,xmin=0.0,xmax=3000.0)
104  pfosChargedGroup.defineHistogram('ChpfoExpE;DenseEnvFlagE', title='Charged PFO Expected Energy From Tracks - IsInDenseEvironmet=TRUE; E_{exp};Events',
105  xbins=200,xmin=0.0,xmax=2000.0, cutmask='DenseEnvFlag')
106 
107  pfosChargedGroup.defineHistogram('ChpfoEta,ChpfoPhi,ChpfoE', type='TProfile2D', title='Average Charged PFO Energy;eta;phi',
108  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
109  pfosChargedGroup.defineHistogram('ChpfoExpE,ChpfoPhi,ChpfoE', type='TProfile2D', title='Average Charged PFO Expected Energy From Tracks;eta;phi',
110  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
111  pfosChargedGroup.defineHistogram('ChpfoEta,ChpfoPhi,ChpfopT', type='TProfile2D', title='Average Charged PFO Transverse Monmentum;eta;phi',
112  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
113  pfosChargedGroup.defineHistogram('ChpfoEta,ChpfoPhi', type='TH2F',title='Charged PFO Occupancy - No Threshold;eta;phi',
114  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
115  pfosChargedGroup.defineHistogram('ChpfoEta,ChpfoPhi;DenseEnvFlagEtaPhi', type='TH2F',title='Charged PFO Occupancy - IsInDenseEvironmet=TRUE;eta;phi',
116  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15, cutmask='DenseEnvFlag' )
117 
118 
120  pfosNeutralGroup.defineHistogram('nNuPFOs', title='No. of Neutral PFOs;N_{PFOs};Events',xbins=200,xmin=0.0,xmax=2000.0)
121  pfosNeutralGroup.defineHistogram('NupfopT', title='Neutral PFO transverse momentum;pT;Events',xbins=200,xmin=0.0,xmax=400)
122  pfosNeutralGroup.defineHistogram('NupfoEta', title='Neutral PFO eta;eta;Events',xbins=98,xmin=-4.9,xmax=4.9)
123  pfosNeutralGroup.defineHistogram('NupfoPhi', title='Neutral PFO phi;phi;Events',xbins=64,xmin=-3.15,xmax=3.15)
124  pfosNeutralGroup.defineHistogram('NupfoMass',title='Neutral PFO mass;Mass;Events',xbins=100,xmin=0.0,xmax=100)
125  pfosNeutralGroup.defineHistogram('NupfoE', title='Neutral PFO energy;E;Events',xbins=300,xmin=0.0,xmax=600)
126  pfosNeutralGroup.defineHistogram('NupfoRapidity', title='Neutral PFO rapidity;y;Events',xbins=98,xmin=-4.9,xmax=4.9)
127  pfosNeutralGroup.defineHistogram('NupfoIsolation', title='Neutral PFO Isolation;Iso;Events',xbins=100,xmin=-1.5,xmax=2.0)
128  pfosNeutralGroup.defineHistogram('NupfoEPos',title='Neutral PFO Energy From Positive Cells;E_{pos};Events',xbins=500,xmin=0.0,xmax=10000.0)
129  pfosNeutralGroup.defineHistogram('NupfoSecondR',title='Neutral PFO SECOND_R',xbins=60,xmin=-1.0,xmax=50.0)
130  pfosNeutralGroup.defineHistogram('NupfoSecondLambda',title='Neutral PFO SECOND_LAMBDA',xbins=60,xmin=-1.0,xmax=3000.0)
131  pfosNeutralGroup.defineHistogram('NupfoCenterLambda',title='Neutral PFO CENTER_LAMBDA',xbins=60,xmin=-50.0,xmax=3000.0)
132 
133  pfosNeutralGroup.defineHistogram('NupfoBadLarQFrac',title='Neutral PFO BADLARQ_FRAC',xbins=25,xmin=-1.0,xmax=1.5)
134  pfosNeutralGroup.defineHistogram('NupfoAvgLarQ',title='Neutral PFO AVG_LAR_Q',xbins=31,xmin=-1000.0,xmax=30000.0)
135  pfosNeutralGroup.defineHistogram('NupfoAvgTileQ',title='Neutral PFO _AVG_TILE_Q',xbins=21,xmin=-10.0,xmax=200.0)
136  pfosNeutralGroup.defineHistogram('NupfoEMProb',title='Neutral PFO EM_PROBABILITY',xbins=21,xmin=-1.0,xmax=1.0)
137 
138  pfosNeutralGroup.defineHistogram('NupfoNBadCells',title='Neutral PFO N_BAD_CELLS',xbins=30,xmin=-1.0,xmax=2.0)
139  pfosNeutralGroup.defineHistogram('NupfoEBadCells',title='Neutral PFO Energy From Bad Cells;E_{bad cells};Events',xbins=210,xmin=-10.0,xmax=100.0)
140 
141  # These quantities do not appear to be filled currently
142  #pfosNeutralGroup.defineHistogram('NupfoSignificance', title='Neutral PFO Significance;Signif;Events',xbins=100,xmin=-100.0,xmax=100.0)
143  #pfosNeutralGroup.defineHistogram('NupfoEFracMax',title='Neutral PFO Energy Fraction of Highest Cell;E_{frac};Events',xbins=200,xmin=-1.0,xmax=1.5)
144 
145  pfosNeutralGroup.defineHistogram('NupfoEta,NupfoPhi,NupfoE', type='TProfile2D', title='Average Neutral PFO Energy;eta;phi',
146  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
147  pfosNeutralGroup.defineHistogram('NupfoEta,NupfoPhi,NupfopT', type='TProfile2D', title='Average Neutral PFO Transverse Momentum;eta;phi',
148  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
149  pfosNeutralGroup.defineHistogram('NupfoEta,NupfoPhi', type='TH2F',title='Neutral PFO Occupancy - No Threshold;eta;phi',
150  xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
151 
152 
153 
158  return helper.result()
159 
160  # # Otherwise, merge with result object and return
161  # acc = helper.result()
162  # result.merge(acc)
163  # return result
164 
165 if __name__=='__main__':
166  # Setup logs
167  from AthenaCommon.Logging import log
168  from AthenaCommon.Constants import INFO
169  log.setLevel(INFO)
170 
171  # Set the Athena configuration flags
172  from AthenaConfiguration.AllConfigFlags import initConfigFlags
173  import sys
174  nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/'
175  file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'
176  flags = initConfigFlags()
177  flags.Input.Files = [nightly+file]
178  flags.Input.isMC = False
179  flags.Output.HISTFileName = 'PFOMonitorOutput.root'
180  flags.fillFromArgs(sys.argv[1:])
181 
182  flags.lock()
183 
184  # Initialize configuration object, add accumulator, merge, and run.
185  from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg
186  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
187  cfg = MainServicesThreadedCfg(flags)
188  cfg.merge(PoolReadCfg(flags))
189 
190  pfoMonitorAcc = PFOMonitoringConfig(flags)
191  cfg.merge(pfoMonitorAcc)
192 
193  # If you want to turn on more detailed messages ...
194  # pfoMonitorAcc.getEventAlgo('PFOMonAlg').OutputLevel = 2 # DEBUG
195  cfg.printConfig(withDetails=False) # set True for exhaustive info
196 
197  cfg.run() #use cfg.run(20) to only run on first 20 events
python.BadLBFilterToolConfig.LArBadLBFilterToolCfg
def LArBadLBFilterToolCfg(inputFlags, origDbTag=None)
Definition: BadLBFilterToolConfig.py:100
Constants
some useful constants -------------------------------------------------—
python.AtlasReadyFilterConfig.AtlasReadyFilterCfg
def AtlasReadyFilterCfg(flags)
Definition: AtlasReadyFilterConfig.py:10
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
PFOMonitorAlgorithm.PFOMonitoringConfig
def PFOMonitoringConfig(inputFlags)
Definition: PFOMonitorAlgorithm.py:11