ATLAS Offline Software
Loading...
Searching...
No Matches
PyParticleTools.py
Go to the documentation of this file.
1# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3"""module to access particle objects interactively
4
5Examples are in `PyAnalysisExamples/ParticleTest.py`_
6
7.. _PyAnalysisExamples/ParticleTest.py: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/PhysicsAnalysis/PyAnalysis/PyAnalysisExamples/share/ParticleTest.py?rev=HEAD&content-type=text/vnd.viewcvs-markup
8
9:author: Tadashi Maeno
10:contact: Tadashi.Maeno@cern.ch
11
12"""
13__docformat__ = "restructuredtext en"
14
15from PyKernel import PyKernel as PyK
16
17def getElectrons (aKey):
18 """Retrieve ElectronContainer object from SG
19
20 :param aKey: key of the object
21
22 **examples**::
23
24 athena> econ = PyParticleTools.getElectrons('ElectronCollection')
25 athena> for e in econ:
26 ... print e.pt() # don't forget to put an additional whitespace before 'print'
27 ... # just hit the return key
28
29 """
30 return PyK.retrieve(PyK.GNS.ElectronContainer,aKey)
31
32def getMuons (aKey):
33 """Retrieve MuonContainer object from SG
34
35 :param aKey: key of the object
36
37 see `getElectrons`
38
39 """
40 return PyK.retrieve(PyK.GNS.Analysis.MuonContainer,aKey)
41
42def getNeutrinos (aKey):
43 """Retrieve NeutrinoContainer object from SG
44
45 :param aKey: key of the object
46
47 see `getElectrons`
48
49 """
50 return PyK.retrieve(PyK.GNS.NeutrinoContainer,aKey)
51
53 """Retrieve ParticleBaseContainer object from SG
54
55 :param aKey: key of the object
56
57 see `getElectrons`
58
59 """
60 return PyK.retrieve(PyK.GNS.ParticleBaseContainer,aKey)
61
62def getParticleJets (aKey):
63 """Retrieve ParticleJetContainer object from SG
64 OBSOLETE due to ParticleJet/Jet merger
65 :param aKey: key of the object
66
67 see `getElectrons`
68
69 """
70 return PyK.retrieve(PyK.GNS.ParticleJetContainer,aKey)
71
72def getJets (aKey):
73 """Retrieve JetContainer object from SG
74
75 :param aKey: key of the object
76
77 see `getElectrons`
78
79 """
80 return PyK.retrieve(PyK.GNS.JetCollection,aKey)
81
82def getPhotons (aKey):
83 """Retrieve PhotonContainer object from SG
84
85 :param aKey: key of the object
86
87 see `getElectrons`
88
89 """
90 return PyK.retrieve(PyK.GNS.PhotonContainer,aKey)
91
92def getTauJets (aKey):
93 """Retrieve TauJetContainer object from SG
94
95 :param aKey: key of the object
96
97 see `getElectrons`
98
99 """
100 return PyK.retrieve(PyK.GNS.Analysis.TauJetContainer,aKey)
101
103 """Retrieve TruthParticleContainer object from SG
104
105 :param aKey: key of the object
106
107 see `getElectrons`
108
109 """
110 return PyK.retrieve(PyK.GNS.TruthParticleContainer,aKey)
111
112def getIParticles (aKey):
113 """Retrieve IParticleContainer object from SG
114
115 :param aKey: key of the object
116
117 see `getElectrons`
118
119 """
120 return PyK.retrieve(PyK.GNS.IParticleContainer,aKey)
121
122def getBJets (aKey):
123 """Retrieve BJetContainer object from SG
124
125 :param aKey: key of the object
126
127 see `getElectrons`
128
129 """
130 return PyK.retrieve(PyK.GNS.BJetContainer,aKey)
131
132def getMissingET (aKey):
133 """Retrieve MissingET object from SG
134
135 :param aKey: key of the object
136
137 **examples**::
138
139 athena> met = PyParticleTools.getMissingET('MET_Final')
140 athena> print met.sumet()
141
142 """
143 return PyK.retrieve(PyK.GNS.MissingET,aKey)
144
146 """Retrieve MissingETSig object from SG
147
148 :param aKey: key of the object
149
150 **examples**::
151
152 athena> met = PyParticleTools.getMissingETSig('METSig')
153 athena> print met.met()
154
155 """
156 return PyK.retrieve(PyK.GNS.MissingETSig,aKey)
157
159 """Retrieve MissingEtCalo object from SG
160
161 :param aKey: key of the object
162
163 **examples**::
164
165 athena> met = PyParticleTools.getMissingEtCalo('MET_Base')
166 athena> print met.calibType()
167
168 """
169 return PyK.retrieve(PyK.GNS.MissingEtCalo,aKey)
170
172 """Retrieve MissingEtTruth object from SG
173
174 :param aKey: key of the object
175
176 **examples**::
177
178 athena> met = PyParticleTools.getMissingEtTruth('MET_Truth')
179 athena> print met.sumet()
180
181 """
182 return PyK.retrieve(PyK.GNS.MissingEtTruth,aKey)
183
185 """Retrieve MissingETSigObjContainer object from SG
186
187 :param aKey: key of the object
188
189 see `getElectrons`
190 """
191 return PyK.retrieve(PyK.GNS.MissingETSigObjContainer,aKey)
192
194 """Retrieve CaloClusterContainer object from SG
195
196 :param aKey: key of the object
197
198 **examples**::
199
200 see `getElectrons`
201
202 """
203 return PyK.retrieve(PyK.GNS.CaloClusterContainer,aKey)
204
205def getVertices (aKey):
206 """Retrieve VxContainer object from SG
207
208 :param aKey: key of the object
209
210 **examples**::
211
212 see `getElectrons`
213
214 """
215 return PyK.retrieve(PyK.GNS.VxContainer,aKey)
216
217
219 """Retrieve TrackParticleTruthCollection object from SG
220
221 :param aKey: key of the object
222
223 **examples**::
224
225 see `getElectrons`
226
227 """
228 return PyK.retrieve(PyK.GNS.TrackParticleTruthCollection,aKey)
229
230
232 """Retrieve TrackParticleContainer object from SG
233
234 :param aKey: key of the object
235
236 **examples**::
237
238 see `getElectrons`
239
240 """
241 return PyK.retrieve(PyK.GNS.Rec.TrackParticleContainer,aKey)
242
243
245 """Retrieve TrackRecordCollection object from SG
246
247 :param aKey: key of the object
248
249 **examples**::
250
251 see `getElectrons`
252
253 """
254 # nb. TrackRecordCollection is a typedef, but that was the name used
255 # in CLASS_DEF. So we have to pass that name into SG, not the name
256 # of the actual class.
257 return PyK.retrieve("TrackRecordCollection",aKey)
258
259
261 """Retrieve DetStatusMap object from SG
262
263 :param aKey: key of the object
264
265 **examples**::
266
267 see `getElectrons`
268
269 """
270 return PyK.retrieve(PyK.GNS.DetStatusMap,aKey)
271
272
274 """Retrieve Rec::MuonSpShowerContainer object from SG
275
276 :param aKey: key of the object
277
278 **examples**::
279
280 see `getElectrons`
281
282 """
283 return PyK.retrieve(PyK.GNS.Rec.MuonSpShowerContainer,key)
284
285
286# Workarounds for pyroot bugs.
287from RootUtils import PyROOTFixes
288PyROOTFixes.fix_method ("Analysis::TauJet", "clusterLink")
289PyROOTFixes.fix_method ("Analysis::TauJet", "cellClusterLink")
290PyROOTFixes.fix_method ("Analysis::TauJet", "jetLink")