ATLAS Offline Software
InDetGlobalBeamSpotMonAlgCfg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 """
6 @file InDetGlobalBeamSpotMonAlgCfg.py
7 @author Leonid Serkin and Per Johansson
8 @date April 2020
9 @brief Configuration for Run 3 based on InDetGlobalBeamSpotMonTool.cxx
10 """
11 
12 from AthenaConfiguration.ComponentFactory import CompFactory
13 
14 def HistoInDetGlobalBeamSpotMonAlgCfg(helper, alg, useBeamSpot=False):
15  '''Function to configures some algorithms in the monitoring system.'''
16 
17  # Values set by default here
18  m_useBeamspot = useBeamSpot
19  expert = True
20  m_vxContainerWithBeamConstraint = False
21 
22  # this creates a "trackGroup" called "alg" which will put its histograms into the subdirectory "BeamSpot"
23  bsGroup = helper.addGroup(alg, 'BeamSpot')
24  pathbs = '/InDetGlobal/BeamSpot'
25 
26  # Histograms for track-based beam spot monitoring:
27  varName = 'm_trkD0Phi,m_trkD0;trkDPhi'
28  bsGroup.defineHistogram(varName,type="TH2F",title="DCA vs Phi; #varphi (rad);d_{0} (#mum)", path=pathbs, xbins=100, xmin=-3.5, xmax=3.5, ybins=100, ymin=-1000, ymax=1000)
29  varName = 'm_trkD0;trkD0'
30  bsGroup.defineHistogram(varName, type="TH1F", title="DCA; d_{0} (#mum)",path=pathbs,xbins=100,xmin=-500,xmax=500)
31 
32  if (expert):
33  varName = 'm_trkPt;trkPt'
34  bsGroup.defineHistogram(varName, type="TH1F", title="Track Pt;p_{T} (GeV)",path=pathbs,xbins=100,xmin=0,xmax=20)
35  varName = 'm_trkNPt;trkNPt'
36  bsGroup.defineHistogram(varName, type="TH1F", title="Number of Tracks per event (after p_{T} cut);Number of tracks", path=pathbs, xbins=100, xmin=0, xmax=1000)
37 
38  #Histograms of assumed beam spot position
39  if (m_useBeamspot):
40  varName = 'm_trkD0PhiCorr,m_trkD0Corr;trkDPhiCorr'
41  bsGroup.defineHistogram(varName,type="TH2F",title="DCA vs Phi wrt Beamspot;#varphi (rad);d_{0} (#mum)",path=pathbs,xbins=100, xmin=-3.5,xmax=3.5, ybins=100, ymin=-500,ymax=500)
42  varName = 'm_trkD0Corr;trkD0Corr'
43  bsGroup.defineHistogram(varName, type="TH1F", title="DCA; d_{0} (#mum)",path=pathbs,xbins=100,xmin=-500,xmax=500)
44  varName = 'm_bsX;bsX'
45  bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot position: x;x (mm)",path=pathbs,xbins=100,xmin=-10,xmax=10)
46  varName = 'm_bsY;bsY'
47  bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot position: y;y (mm)",path=pathbs,xbins=100,xmin=-10,xmax=10)
48  varName = 'm_bsZ;bsZ'
49  bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot position: z;z (mm)",path=pathbs,xbins=100,xmin=-500,xmax=500)
50  varName = 'm_bsTiltX;bsTiltX'
51  bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot tile angle: x-z plane; Tilt angle (#murad)",path=pathbs,xbins=100,xmin=-1e3,xmax=1e3)
52  varName = 'm_bsTiltY;bsTiltY'
53  bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot tile angle: y-z plane; Tilt angle (#murad)",path=pathbs,xbins=100,xmin=-1e3,xmax=1e3)
54 
55  # Histograms for vertex-based beam spot monitoring
56  if (not m_vxContainerWithBeamConstraint):
57  # The following histograms are made either relative to the current beamspot (from BeamCondSvc), or relative to the nomial beamspot at (0,0,0) without any tilt.
58  if (m_useBeamspot):
59  varName = 'm_pvXbeam;pvX'
60  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: x - x_{beam};x-x_{beam} (#mum)",path=pathbs,xbins=100,xmin=-200,xmax=200)
61  varName = 'm_pvYbeam;pvY'
62  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: y - y_{beam};y-y_{beam} (#mum)",path=pathbs,xbins=100,xmin=-200,xmax=200)
63  varName = 'm_pvZbeam;pvZ'
64  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: z - z_{beam};z-z_{beam} (#mum)",path=pathbs,xbins=100,xmin=-500,xmax=500)
65  else:
66  varName = 'm_pvXbeam;pvX'
67  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: x;x (mm)",path=pathbs,xbins=100,xmin=-2,xmax=2)
68  varName = 'm_pvYbeam;pvY'
69  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: y;y (mm)",path=pathbs,xbins=100,xmin=-2,xmax=2)
70  varName = 'm_pvZbeam;pvZ'
71  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: z;z (mm)",path=pathbs,xbins=100,xmin=-500,xmax=500)
72 
73 
74  #Histograms that are independent of the useBeamSpot parameters
75  varName = 'm_pvZ,m_pvX;pvXZ'
76  bsGroup.defineHistogram(varName, type="TH2F", title="Primary vertex: x vs z;z (mm);x (mm)", path=pathbs, xbins=100, xmin=-500, xmax=500, ybins=100, ymin=-10, ymax=10)
77  varName = 'm_pvZ,m_pvY;pvYZ'
78  bsGroup.defineHistogram(varName, type="TH2F", title="Primary vertex: y vs z;z (mm);y (mm)", path=pathbs, xbins=100, xmin=-500, xmax=500, ybins=100, ymin=-10,ymax=10)
79  varName = 'm_pvX,m_pvY;pvYX'
80  bsGroup.defineHistogram(varName, type="TH2F", title="Primary vertex: y vs x;x (mm);y (mm)", path=pathbs, xbins=100, xmin=-10, xmax=10, ybins=100, ymin=-10, ymax=10)
81  varName = 'm_pvChiSqDof;pvChiSqDof'
82  bsGroup.defineHistogram(varName, type="TH1F", title="",path=pathbs,xbins=100,xmin=0,xmax=20)
83 
84  if (expert):
85  varName = 'm_pvN;pvN'
86  bsGroup.defineHistogram(varName, type="TH1F", title="Number of primary vertices;Number of vertices", path=pathbs, xbins=100,xmin=0,xmax=100)
87  varName = 'm_pvNPriVtx;pvNPriVtx'
88  bsGroup.defineHistogram(varName, type="TH1F", title="Number of primary vertices;Number of vertices", path=pathbs, xbins=3,xmin=0,xmax=3)
89  varName = 'm_pvNPileupVtx;pvNPileupVtx'
90  bsGroup.defineHistogram(varName, type="TH1F", title="Number of pileup vertices;Number of vertices", path=pathbs, xbins=100,xmin=0,xmax=100)
91  varName = 'm_pvErrX;pvErrX'
92  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: #sigma_{x}; #sigma_{x} (mm)",path=pathbs,xbins=100,xmin=0,xmax=0.5)
93  varName = 'm_pvErrY;pvErrY'
94  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: #sigma_{y}; #sigma_{y} (mm)",path=pathbs,xbins=100,xmin=0,xmax=0.5)
95  varName = 'm_pvErrZ;pvErrZ'
96  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: #sigma_{z}; #sigma_{z} (mm)",path=pathbs,xbins=100,xmin=0,xmax=0.5)
97  varName = 'm_pvNTracks;pvNTracks'
98  bsGroup.defineHistogram(varName, type="TH1F", title="Number of tracks in primary vertex;Number of tracks",path=pathbs,xbins=100,xmin=0,xmax=500)
99  varName = 'm_pvTrackPt;pvTrackPt'
100  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: original track p_{t};p_{t} (GeV)",path=pathbs,xbins=100,xmin=0,xmax=20)
101  varName = 'm_pvTrackEta;pvTrackEta'
102  bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: original track #eta; #eta",path=pathbs,xbins=100,xmin=-3,xmax=3)
103 
104 # end histograms
105 
106 
108  flags, jobConfig={}, name="InDetGlobalBeamSpotMonAlg", **kwargs):
109  from BeamSpotConditions.BeamSpotConditionsConfig import BeamSpotCondAlgCfg
110  acc.merge(BeamSpotCondAlgCfg(flags))
111 
112  from AthenaMonitoring.FilledBunchFilterToolConfig import FilledBunchFilterToolCfg
113  from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg
114 
115  if 'MinTracksPerVtx' in jobConfig: kwargs.setdefault("minTracksPerVtx",jobConfig['MinTracksPerVtx'])
116  if 'MinTrackPt' in jobConfig: kwargs.setdefault("minTrackPt",jobConfig['MinTrackPt'])
117  useBeamSpot = False
118  if 'useBeamSpot' in jobConfig:
119  kwargs.setdefault("useBeamspot",jobConfig['useBeamSpot'])
120  useBeamSpot = jobConfig['useBeamSpot']
121 
122  monAlg = helper.addAlgorithm(
123  CompFactory.InDetGlobalBeamSpotMonAlg, name,
124  addFilterTools = [FilledBunchFilterToolCfg(flags), AtlasReadyFilterCfg(flags)],
125  **kwargs)
126 
127  HistoInDetGlobalBeamSpotMonAlgCfg(helper, monAlg, useBeamSpot)
128  return
python.FilledBunchFilterToolConfig.FilledBunchFilterToolCfg
def FilledBunchFilterToolCfg(AthConfigFlags flags)
Definition: FilledBunchFilterToolConfig.py:9
python.BeamSpotConditionsConfig.BeamSpotCondAlgCfg
def BeamSpotCondAlgCfg(flags, name="BeamSpotCondAlg", **kwargs)
Definition: BeamSpotConditionsConfig.py:7
python.AtlasReadyFilterConfig.AtlasReadyFilterCfg
def AtlasReadyFilterCfg(flags)
Definition: AtlasReadyFilterConfig.py:10
InDetGlobalBeamSpotMonAlgCfg.HistoInDetGlobalBeamSpotMonAlgCfg
def HistoInDetGlobalBeamSpotMonAlgCfg(helper, alg, useBeamSpot=False)
Definition: InDetGlobalBeamSpotMonAlgCfg.py:14
InDetGlobalBeamSpotMonAlgCfg.InDetGlobalBeamSpotMonAlgCfg
def InDetGlobalBeamSpotMonAlgCfg(helper, acc, flags, jobConfig={}, name="InDetGlobalBeamSpotMonAlg", **kwargs)
Definition: InDetGlobalBeamSpotMonAlgCfg.py:107