ATLAS Offline Software
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 
5 Examples 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 
15 from PyKernel import PyKernel as PyK
16 
17 def 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 
32 def 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 
42 def 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 
52 def getParticleBases (aKey):
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 
62 def 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 
72 def 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 
82 def 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 
92 def 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 
102 def getTruthParticles (aKey):
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 
112 def 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 
122 def 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 
132 def 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 
145 def getMissingETSig (aKey):
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 
158 def getMissingEtCalo (aKey):
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 
171 def getMissingEtTruth (aKey):
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 
193 def getCaloClusters (aKey):
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 
205 def 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 
231 def getTrackParticles (aKey):
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 
244 def getTrackRecords (aKey):
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 
260 def getDetStatusMap (aKey):
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.
287 from RootUtils import PyROOTFixes
288 PyROOTFixes.fix_method ("Analysis::TauJet", "clusterLink")
289 PyROOTFixes.fix_method ("Analysis::TauJet", "cellClusterLink")
290 PyROOTFixes.fix_method ("Analysis::TauJet", "jetLink")
python.PyParticleTools.getElectrons
def getElectrons(aKey)
Definition: PyParticleTools.py:17
python.PyParticleTools.getTrackRecords
def getTrackRecords(aKey)
Definition: PyParticleTools.py:244
python.PyParticleTools.getMissingEtTruth
def getMissingEtTruth(aKey)
Definition: PyParticleTools.py:171
python.PyParticleTools.getParticleBases
def getParticleBases(aKey)
Definition: PyParticleTools.py:52
python.PyParticleTools.getMissingETSig
def getMissingETSig(aKey)
Definition: PyParticleTools.py:145
python.PyParticleTools.getCaloClusters
def getCaloClusters(aKey)
Definition: PyParticleTools.py:193
python.PyParticleTools.getTruthParticles
def getTruthParticles(aKey)
Definition: PyParticleTools.py:102
python.PyParticleTools.getVertices
def getVertices(aKey)
Definition: PyParticleTools.py:205
python.PyParticleTools.getMissingEtCalo
def getMissingEtCalo(aKey)
Definition: PyParticleTools.py:158
python.PyParticleTools.getMissingET
def getMissingET(aKey)
Definition: PyParticleTools.py:132
python.PyParticleTools.getMuonSpShowers
def getMuonSpShowers(key)
Definition: PyParticleTools.py:273
python.PyParticleTools.getBJets
def getBJets(aKey)
Definition: PyParticleTools.py:122
python.PyParticleTools.getTauJets
def getTauJets(aKey)
Definition: PyParticleTools.py:92
python.PyParticleTools.getMuons
def getMuons(aKey)
Definition: PyParticleTools.py:32
python.PyParticleTools.getTrackParticles
def getTrackParticles(aKey)
Definition: PyParticleTools.py:231
python.PyParticleTools.getJets
def getJets(aKey)
Definition: PyParticleTools.py:72
python.PyParticleTools.getIParticles
def getIParticles(aKey)
Definition: PyParticleTools.py:112
python.PyParticleTools.getPhotons
def getPhotons(aKey)
Definition: PyParticleTools.py:82
python.PyParticleTools.getTrackParticleTruths
def getTrackParticleTruths(aKey)
Definition: PyParticleTools.py:218
python.PyParticleTools.getNeutrinos
def getNeutrinos(aKey)
Definition: PyParticleTools.py:42
python.PyParticleTools.getDetStatusMap
def getDetStatusMap(aKey)
Definition: PyParticleTools.py:260
python.PyParticleTools.getParticleJets
def getParticleJets(aKey)
Definition: PyParticleTools.py:62
python.PyParticleTools.getMissingETSigObjs
def getMissingETSigObjs(aKey)
Definition: PyParticleTools.py:184