ATLAS Offline Software
Classes | Functions | Variables
python.PyKernel Namespace Reference

Classes

class  _DummyClass
 
class  _SetEventCounter
 

Functions

def init (v_theApp, v_rootStream=None)
 
def retrieve (aClass, aKey=None)
 
def retrieveDet (aClass, aKey=None)
 
def fill (hist, classAndKey, value, criteria="True", nEvent=100)
 
def plot (classAndKey, value="$x", criteria="True", nEvent=100)
 
def fill2 (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100)
 
def plot2 (classAndKey, valueX="$x", valueY="$x", criteria="True", nEvent=100)
 
def fillProf (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100)
 
def plotProf (classAndKey, valueX="$x", valueY="$x", criteria="True", nEvent=100)
 
def _parseString (str)
 
def dumpSG ()
 
def unregister (path)
 
def dumpHist ()
 
def preProcess ()
 
def normalProcess ()
 
def hybridProcess ()
 

Variables

string __docformat__ = "restructuredtext en"
 
 GNS = cppyy.gbl
 
int _PreProcess = 0
 
int _NormalProcess = 1
 
int _HybridProcess = 2
 
 AttributeList
 
 AANT
 
 storeGate = None
 
 detStore = None
 

Function Documentation

◆ _parseString()

def python.PyKernel._parseString (   str)
private

Definition at line 719 of file PyKernel.py.

719 def _parseString (str):
720  # remove $
721  str = re.sub(r"\$", "", str)
722  # replace XXX#YYY with StoreGate access
723  cK = re.findall(r'([\w_]+)#([\w_\*]+)',str)
724  for iCK in cK:
725  # when XXX#*
726  if iCK[1]=='*':
727  bStr = iCK[0]+r"#\*"
728  aStr = 'retrieve(GNS.'+iCK[0]+')'
729  else:
730  bStr = iCK[0]+"#"+iCK[1]
731  aStr = 'retrieve(GNS.'+iCK[0]+',"'+iCK[1]+'")'
732  str = re.sub(bStr, aStr, str)
733  return str
734 
735 
736 # dump objects in StoreGate

◆ dumpHist()

def python.PyKernel.dumpHist ( )
Dump histograms in HistogramSvc

**examples**::

  athena> dumpHist()

Definition at line 765 of file PyKernel.py.

765 def dumpHist ():
766  '''
767  Dump histograms in HistogramSvc
768 
769  **examples**::
770 
771  athena> dumpHist()
772 
773  '''
774  theApp.histSvc().dump()
775 
776 
777 # set event loop type to pre-process

◆ dumpSG()

def python.PyKernel.dumpSG ( )
Dump objects in StoreGate

**examples**::

  athena> dumpSG()

Definition at line 737 of file PyKernel.py.

737 def dumpSG ():
738  '''
739  Dump objects in StoreGate
740 
741  **examples**::
742 
743  athena> dumpSG()
744 
745  '''
746  print (GNS.StoreGate.pointer().dump())
747 
748 
749 # unregister histogram from HistogramSvc

◆ fill()

def python.PyKernel.fill (   hist,
  classAndKey,
  value,
  criteria = "True",
  nEvent = 100 
)
Fill 1D-histogram

:param hist: reference to AIDA or ROOT histogram
:param classAndKey: combination of class name and key separeted with "#". "Class#Key"
:param value: physics parameter in string
:param criteria: selection criteria
:param nEvent: number of event to be processed

**examples**::

  athena> fill(h,"ElectronContainer#ElectronCollection","$x.pt()")
      fill hist with pt of electrons
     "$x" denotes an element of "Class#Key", if "Class#Key" is a collection
   
  athena> fill(h,"MissingET#MET_Calib","$x.sumet()")
      fill hist with et of MissingET.
      "$x" denotes "Class#Key" itself, if "Class#Key" is not a vector-like class
      
  athena> fill(h,"ElectronContainer#ElectronCollection","$x.pt()","$x.pz()>0")
      apply a selection criteria
      
For more detail of parameters, see `PyAnalysisExamples/PlotTest.py`_

.. _PyAnalysisExamples/PlotTest.py: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/PhysicsAnalysis/PyAnalysis/PyAnalysisExamples/share/PlotTest.py?rev=HEAD&content-type=text/vnd.viewcvs-markup

Definition at line 168 of file PyKernel.py.

168 def fill (hist, classAndKey, value, criteria="True", nEvent=100):
169  '''
170  Fill 1D-histogram
171 
172  :param hist: reference to AIDA or ROOT histogram
173  :param classAndKey: combination of class name and key separeted with "#". "Class#Key"
174  :param value: physics parameter in string
175  :param criteria: selection criteria
176  :param nEvent: number of event to be processed
177 
178  **examples**::
179 
180  athena> fill(h,"ElectronContainer#ElectronCollection","$x.pt()")
181  fill hist with pt of electrons
182  "$x" denotes an element of "Class#Key", if "Class#Key" is a collection
183 
184  athena> fill(h,"MissingET#MET_Calib","$x.sumet()")
185  fill hist with et of MissingET.
186  "$x" denotes "Class#Key" itself, if "Class#Key" is not a vector-like class
187 
188  athena> fill(h,"ElectronContainer#ElectronCollection","$x.pt()","$x.pz()>0")
189  apply a selection criteria
190 
191  For more detail of parameters, see `PyAnalysisExamples/PlotTest.py`_
192 
193  .. _PyAnalysisExamples/PlotTest.py: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/PhysicsAnalysis/PyAnalysis/PyAnalysisExamples/share/PlotTest.py?rev=HEAD&content-type=text/vnd.viewcvs-markup
194 
195  '''
196 
197  # number of buffered events
198  bufEvent = nEvent
199  if nEvent > 100:
200  bufEvent = 100
201 
202  # convert class&key to a store gate access
203  commandSG = "None"
204  if classAndKey != "":
205  commandSG = _parseString(classAndKey)
206 
207  # build commands
208  if callable(value):
209  # if function pointer
210  commandV = "value()"
211  else:
212  # if string, parse value/criteria
213  commandV = _parseString(value)
214  if callable(criteria):
215  # if function pointer
216  commandC = "criteria()"
217  else:
218  # if string, parse value/criteria
219  commandC = _parseString(criteria)
220 
221  # initialize application mgr
222  theApp.initialize()
223 
224  # buffer to determine x-range of histgram
225  buf = []
226 
227  # loop over nEvent
228  for iE in range(nEvent):
229  # get object from SG
230  theApp.nextEvent()
231  try:
232  obj = eval(commandSG)
233 
234  # check if the obj is a vector-like class
235  if hasattr(obj,'size') and hasattr(obj,'__getitem__'):
236  lSize = obj.size()
237  isCollection = True
238  else:
239  lSize = 1
240  isCollection = False
241  # if NULL
242  if obj == 0:
243  lSize = 0
244  except Exception:
245  lSize = 0
246 
247  # loop over all elements
248  for iC in range(lSize):
249  # parameter name "x" must be consistent with the parsed strings
250  if isCollection:
251  x = obj[iC] # noqa: F841
252  else:
253  x = obj # noqa: F841
254 
255  # eval value/criteria commands
256  try:
257  vX = eval(commandV)
258  vC = eval(commandC)
259 
260  # evaluate vC/vX. "vC" and "vX" must be consistent with commands
261  if vC:
262  if iE < bufEvent:
263  buf.append(vX)
264  else:
265  h.Fill(vX) # noqa: F405
266  except Exception:
267  pass
268 
269  # if not a collection escape from loop
270  if not isCollection:
271  break
272 
273  # create Histogram
274  if (iE+1) == bufEvent:
275  if len(buf)==0:
276  minX=0
277  else:
278  minX = min(buf)
279 
280  if minX<0:
281  minX *= 1.1
282  elif minX>0:
283  minX *= 0.9
284  else:
285  minX = -1
286 
287  if len(buf)==0:
288  maxX=0
289  else:
290  maxX = max(buf)
291 
292  if maxX<0:
293  maxX *= 0.9
294  elif maxX>0:
295  maxX *= 1.1
296  else:
297  maxX = 1
298 
299  # create histogram if hist is None
300  if hist is None:
301  lpath = '/stat/tmp/PyKernelHist'
302  unregister(lpath)
303  # determine title of histo
304  if callable(value):
305  title = value.__name__
306  else:
307  title = value
308  h = book(lpath, title, 100, minX, maxX) # noqa: F405
309  else:
310  h = hist
311 
312  # buffered elements
313  for vB in buf:
314  h.Fill(vB)
315 
316  return h
317 
318 
319 # plot a histogram

◆ fill2()

def python.PyKernel.fill2 (   hist,
  classAndKey,
  valueX,
  valueY,
  criteria = "True",
  nEvent = 100 
)
Fill 2D-histogram

:param hist: reference to AIDA or ROOT histogram
:param classAndKey: combination of class name and key separeted with '#', 'Class#Key'
:param valueX: physics parameter for X in string
:param valueY: physics parameter for Y in string
:param criteria: selection criteria
:param nEvent: number of event to be processed

For detail, see `fill`

Definition at line 349 of file PyKernel.py.

349 def fill2 (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
350  """Fill 2D-histogram
351 
352  :param hist: reference to AIDA or ROOT histogram
353  :param classAndKey: combination of class name and key separeted with '#', 'Class#Key'
354  :param valueX: physics parameter for X in string
355  :param valueY: physics parameter for Y in string
356  :param criteria: selection criteria
357  :param nEvent: number of event to be processed
358 
359  For detail, see `fill`
360 
361  """
362 
363  # number of buffered events
364  bufEvent = nEvent
365  if nEvent > 100:
366  bufEvent = 100
367 
368  # convert class&key to a store gate access
369  commandSG = "None"
370  if classAndKey != "":
371  commandSG = _parseString(classAndKey)
372 
373  # build commands
374  if callable(valueX):
375  # if function pointer
376  commandX = "valueX()"
377  else:
378  # if string, parse value/criteria
379  commandX = _parseString(valueX)
380  if callable(valueY):
381  # if function pointer
382  commandY = "valueY()"
383  else:
384  # if string, parse value/criteria
385  commandY = _parseString(valueY)
386  if callable(criteria):
387  # if function pointer
388  commandC = "criteria()"
389  else:
390  # if string, parse value/criteria
391  commandC = _parseString(criteria)
392 
393  # initialize application mgr
394  theApp.initialize()
395 
396  # buffer to determine xy-range of histgram
397  bufX = []
398  bufY = []
399 
400  # loop over nEvent
401  for iE in range(nEvent):
402  # get object from SG
403  theApp.nextEvent()
404  try:
405  obj = eval(commandSG)
406 
407  # check if the obj is a vector-like class
408  if hasattr(obj,'size') and hasattr(obj,'__getitem__'):
409  lSize = obj.size()
410  isCollection = True
411  else:
412  lSize = 1
413  isCollection = False
414  # if NULL
415  if obj == 0:
416  lSize = 0
417  except Exception:
418  lSize = 0
419 
420  # loop over all elements
421  for iC in range(lSize):
422  # parameter name "x" must be consistent with the parsed strings
423  if isCollection:
424  x = obj[iC] # noqa: F841
425  else:
426  x = obj # noqa: F841
427 
428  # eval value/criteria commands
429  try:
430  vX = eval(commandX)
431  vY = eval(commandY)
432  vC = eval(commandC)
433 
434  # evaluate vC/vX. "vC" and "vX" must be consistent with commands
435  if vC:
436  if iE < bufEvent:
437  bufX.append(vX)
438  bufY.append(vY)
439  else:
440  h.Fill(vX,vY) # noqa: F405
441  except Exception:
442  pass
443 
444  # if not a collection escape from loop
445  if not isCollection:
446  break
447 
448  # create Histogram
449  if (iE+1) == bufEvent:
450  if len(bufX)==0:
451  minX=0
452  else:
453  minX = min(bufX)
454 
455  if minX<0:
456  minX *= 1.1
457  elif minX>0:
458  minX *= 0.9
459  else:
460  minX = -1
461 
462  if len(bufX)==0:
463  maxX=0
464  else:
465  maxX = max(bufX)
466 
467  if maxX<0:
468  maxX *= 0.9
469  elif maxX>0:
470  maxX *= 1.1
471  else:
472  maxX = 1
473 
474  if len(bufY)==0:
475  minY=0
476  else:
477  minY = min(bufY)
478 
479  if minY<0:
480  minY *= 1.1
481  elif minY>0:
482  minY *= 0.9
483  else:
484  minY = -1
485 
486  if len(bufY)==0:
487  maxY=0
488  else:
489  maxY = max(bufY)
490 
491  if maxY<0:
492  maxY *= 0.9
493  elif maxY>0:
494  maxY *= 1.1
495  else:
496  maxY = 1
497 
498  # create histogram if hist is None
499  if hist is None:
500  lpath = '/stat/tmp/PyKernelHist'
501  unregister(lpath)
502  # determine title of histo
503  if callable(valueX):
504  titleX = valueX.__name__
505  else:
506  titleX = valueX
507  if callable(valueY):
508  titleY = valueY.__name__
509  else:
510  titleY = valueY
511  h = book(lpath, titleY+" vs "+titleX, 100, minX, maxX, 100, minY, maxY) # noqa: F405
512  else:
513  h = hist
514 
515  # buffered elements
516  for iB in range(len(bufX)):
517  vX = bufX[iB]
518  vY = bufY[iB]
519  h.Fill(vX,vY)
520 
521  return h
522 
523 
524 # plot 2D histogram

◆ fillProf()

def python.PyKernel.fillProf (   hist,
  classAndKey,
  valueX,
  valueY,
  criteria = "True",
  nEvent = 100 
)
Fill profile-histogram

:param hist: reference to AIDA or ROOT histogram
:param classAndKey: combination of class name and key separeted with '#', 'Class#Key'
:param valueX: physics parameter for X in string
:param valueY: physics parameter for Y in string
:param criteria: selection criteria
:param nEvent: number of event to be processed

For detail, see `fill`

Definition at line 546 of file PyKernel.py.

546 def fillProf (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
547  """Fill profile-histogram
548 
549  :param hist: reference to AIDA or ROOT histogram
550  :param classAndKey: combination of class name and key separeted with '#', 'Class#Key'
551  :param valueX: physics parameter for X in string
552  :param valueY: physics parameter for Y in string
553  :param criteria: selection criteria
554  :param nEvent: number of event to be processed
555 
556  For detail, see `fill`
557 
558  """
559 
560  # number of buffered events
561  bufEvent = nEvent
562  if nEvent > 100:
563  bufEvent = 100
564 
565  # convert class&key to a store gate access
566  commandSG = "None"
567  if classAndKey != "":
568  commandSG = _parseString(classAndKey)
569 
570  # build commands
571  if callable(valueX):
572  # if function pointer
573  commandX = "valueX()"
574  else:
575  # if string, parse value/criteria
576  commandX = _parseString(valueX)
577  if callable(valueY):
578  # if function pointer
579  commandY = "valueY()"
580  else:
581  # if string, parse value/criteria
582  commandY = _parseString(valueY)
583  if callable(criteria):
584  # if function pointer
585  commandC = "criteria()"
586  else:
587  # if string, parse value/criteria
588  commandC = _parseString(criteria)
589 
590  # initialize application mgr
591  theApp.initialize()
592 
593  # buffer to determine xy-range of histgram
594  bufX = []
595  bufY = []
596 
597  # loop over nEvent
598  for iE in range(nEvent):
599  # get object from SG
600  theApp.nextEvent()
601  try:
602  obj = eval(commandSG)
603 
604  # check if the obj is a vector-like class
605  if hasattr(obj,'size') and hasattr(obj,'__getitem__'):
606  lSize = obj.size()
607  isCollection = True
608  else:
609  lSize = 1
610  isCollection = False
611  # if NULL
612  if obj == 0:
613  lSize = 0
614  except Exception:
615  lSize = 0
616 
617  # loop over all elements
618  for iC in range(lSize):
619  # parameter name "x" must be consistent with the parsed strings
620  if isCollection:
621  x = obj[iC] # noqa: F841
622  else:
623  x = obj # noqa: F841
624 
625  # eval value/criteria commands
626  try:
627  vX = eval(commandX)
628  vY = eval(commandY)
629  vC = eval(commandC)
630 
631  # evaluate vC/vX. "vC" and "vX" must be consistent with commands
632  if vC:
633  if iE < bufEvent:
634  bufX.append(vX)
635  bufY.append(vY)
636  else:
637  h.Fill(vX,vY) # noqa: F405
638  except Exception:
639  pass
640 
641  # if not a collection escape from loop
642  if not isCollection:
643  break
644 
645  # create Histogram
646  if (iE+1) == bufEvent:
647  if len(bufX)==0:
648  minX=0
649  else:
650  minX = min(bufX)
651 
652  if minX<0:
653  minX *= 1.1
654  elif minX>0:
655  minX *= 0.9
656  else:
657  minX = -1
658 
659  if len(bufX)==0:
660  maxX=0
661  else:
662  maxX = max(bufX)
663 
664  if maxX<0:
665  maxX *= 0.9
666  elif maxX>0:
667  maxX *= 1.1
668  else:
669  maxX = 1
670 
671  # create histogram if hist is None
672  if hist is None:
673  lpath = '/stat/tmp/PyKernelHist'
674  unregister(lpath)
675  # determine title of histo
676  if callable(valueX):
677  titleX = valueX.__name__
678  else:
679  titleX = valueX
680  if callable(valueY):
681  titleY = valueY.__name__
682  else:
683  titleY = valueY
684  h = bookProf(lpath, titleY+" vs "+titleX, 100, minX, maxX) # noqa: F405
685  else:
686  h = hist
687 
688  # buffered elements
689  for iB in range(len(bufX)):
690  vX = bufX[iB]
691  vY = bufY[iB]
692  h.Fill(vX,vY)
693 
694  return h
695 
696 
697 # plot profileD histogram

◆ hybridProcess()

def python.PyKernel.hybridProcess ( )
Set event loop type to hybrid-process

Definition at line 800 of file PyKernel.py.

800 def hybridProcess ():
801  '''
802  Set event loop type to hybrid-process
803 
804  '''
805  global eventLoopType
806  eventLoopType = _HybridProcess

◆ init()

def python.PyKernel.init (   v_theApp,
  v_rootStream = None 
)
Initialize core

This method is called in `PyKernel/InitPyKernel.py`_.

:param v_theApp: reference to the application manager. theApp

**examples**::

  athena> PyKernel.init(theApp)

.. _PyKernel/InitPyKernel.py: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/Control/PyKernel/share/InitPyKernel.py?rev=HEAD&content-type=text/vnd.viewcvs-markup  

Definition at line 45 of file PyKernel.py.

45 def init (v_theApp, v_rootStream=None):
46  """Initialize core
47 
48  This method is called in `PyKernel/InitPyKernel.py`_.
49 
50  :param v_theApp: reference to the application manager. theApp
51 
52  **examples**::
53 
54  athena> PyKernel.init(theApp)
55 
56  .. _PyKernel/InitPyKernel.py: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/Control/PyKernel/share/InitPyKernel.py?rev=HEAD&content-type=text/vnd.viewcvs-markup
57 
58  """
59  # application manager
60  global theApp
61  theApp = v_theApp
62  # root stream
63  global rootStream
64  rootStream = v_rootStream
65  # event loop type
66  global eventLoopType
67  eventLoopType = _HybridProcess
68  # event counter
69  global curEvent
70  curEvent = 0
71  if hasattr (theApp, 'curEvent'):
72  # patch some methods
73  method = "nextEvent"
74  mobj = _SetEventCounter(method)
75  setattr(theApp.__class__,method,mobj)
76  method = "run"
77  mobj = _SetEventCounter(method)
78  setattr(theApp.__class__,method,mobj)
79 
80 
81 # a function object to set event counter in ROOT stream

◆ normalProcess()

def python.PyKernel.normalProcess ( )
Set event loop type to normal-process

Definition at line 790 of file PyKernel.py.

790 def normalProcess ():
791  '''
792  Set event loop type to normal-process
793 
794  '''
795  global eventLoopType
796  eventLoopType = _NormalProcess
797 
798 
799 # set event loop type to hybrid-process

◆ plot()

def python.PyKernel.plot (   classAndKey,
  value = "$x",
  criteria = "True",
  nEvent = 100 
)
Plot 1D-histogram

:param classAndKey: combination of class name and key separeted with '#'. 'Class#Key'
:param value: physics parameter in string
:param criteria: selection criteria
:param nEvent: number of event to be processed

**examples**::

  athena> plot('ElectronContainer#ElectronCollection','$x.pt()')
      plot pt of electrons
      
For detail, see `PyAnalysisExamples/PlotTest.py`_

.. _PyAnalysisExamples/PlotTest.py: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/PhysicsAnalysis/PyAnalysis/PyAnalysisExamples/share/PlotTest.py?rev=HEAD&content-type=text/vnd.viewcvs-markup

Definition at line 320 of file PyKernel.py.

320 def plot (classAndKey, value="$x", criteria="True", nEvent=100):
321  """Plot 1D-histogram
322 
323  :param classAndKey: combination of class name and key separeted with '#'. 'Class#Key'
324  :param value: physics parameter in string
325  :param criteria: selection criteria
326  :param nEvent: number of event to be processed
327 
328  **examples**::
329 
330  athena> plot('ElectronContainer#ElectronCollection','$x.pt()')
331  plot pt of electrons
332 
333  For detail, see `PyAnalysisExamples/PlotTest.py`_
334 
335  .. _PyAnalysisExamples/PlotTest.py: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/PhysicsAnalysis/PyAnalysis/PyAnalysisExamples/share/PlotTest.py?rev=HEAD&content-type=text/vnd.viewcvs-markup
336 
337  """
338 
339  # fill a histogram
340  h = fill (None, classAndKey, value, criteria, nEvent)
341  # draw
342  h.Draw()
343  # this return is needed to draw up the canvas.
344  # note that PyKernel._hSave = h doesn't work although it keeps the hist in memory
345  return h
346 
347 
348 # fill 2D histogram

◆ plot2()

def python.PyKernel.plot2 (   classAndKey,
  valueX = "$x",
  valueY = "$x",
  criteria = "True",
  nEvent = 100 
)
Plot 2D-histogram

:param classAndKey: combination of class name and key separeted with '#', 'Class#Key'
:param valueX: physics parameter for X in string
:param valueY: physics parameter for Y in string
:param criteria: selection criteria
:param nEvent: number of event to be processed

For detail, see `plot`

Definition at line 525 of file PyKernel.py.

525 def plot2 (classAndKey, valueX="$x", valueY="$x", criteria="True", nEvent=100):
526  """Plot 2D-histogram
527 
528  :param classAndKey: combination of class name and key separeted with '#', 'Class#Key'
529  :param valueX: physics parameter for X in string
530  :param valueY: physics parameter for Y in string
531  :param criteria: selection criteria
532  :param nEvent: number of event to be processed
533 
534  For detail, see `plot`
535 
536  """
537  h = fill2 (None, classAndKey, valueX, valueY, criteria, nEvent)
538  # draw
539  h.Draw('BOX')
540  # this return is needed to draw up the canvas.
541  # note that PyKernel._hSave = h doesn't work although it keeps the hist in memory
542  return h
543 
544 
545 # fill profile histogram

◆ plotProf()

def python.PyKernel.plotProf (   classAndKey,
  valueX = "$x",
  valueY = "$x",
  criteria = "True",
  nEvent = 100 
)
Plot profile-histogram

:param classAndKey: combination of class name and key separeted with '#', 'Class#Key'
:param valueX: physics parameter for X in string
:param valueY: physics parameter for Y in string
:param criteria: selection criteria
:param nEvent: number of event to be processed

For detail, see `plot`

Definition at line 698 of file PyKernel.py.

698 def plotProf (classAndKey, valueX="$x", valueY="$x", criteria="True", nEvent=100):
699  """Plot profile-histogram
700 
701  :param classAndKey: combination of class name and key separeted with '#', 'Class#Key'
702  :param valueX: physics parameter for X in string
703  :param valueY: physics parameter for Y in string
704  :param criteria: selection criteria
705  :param nEvent: number of event to be processed
706 
707  For detail, see `plot`
708 
709  """
710  h = fillProf (None, classAndKey, valueX, valueY, criteria, nEvent)
711  # draw
712  h.Draw()
713  # this return is needed to draw up the canvas.
714  # note that PyKernel._hSave = h doesn't work although it keeps the hist in memory
715  return h
716 
717 
718 # parse string

◆ preProcess()

def python.PyKernel.preProcess ( )
Set event loop type to pre-process

Definition at line 778 of file PyKernel.py.

778 def preProcess ():
779  '''
780  Set event loop type to pre-process
781 
782  '''
783  global curEvent
784  curEvent = theApp.curEvent()
785  global eventLoopType
786  eventLoopType = _PreProcess
787 
788 
789 # set event loop type to normal-process

◆ retrieve()

def python.PyKernel.retrieve (   aClass,
  aKey = None 
)
Retrieve object from StoreGate

:param aClass: type of the class
:param aKey: key of the object

**examples**::

  athena> obj = PyKernel.retrieve(g.MyClass,'mykey')
  athena> obj = PyKernel.retrieve(g.MyClass)  # when only one MyClass obj is in SG
      where the prefix 'g' is the global namespace provided by cppyy
      g = cppyy.gbl

Definition at line 110 of file PyKernel.py.

110 def retrieve (aClass, aKey=None):
111  """Retrieve object from StoreGate
112 
113  :param aClass: type of the class
114  :param aKey: key of the object
115 
116  **examples**::
117 
118  athena> obj = PyKernel.retrieve(g.MyClass,'mykey')
119  athena> obj = PyKernel.retrieve(g.MyClass) # when only one MyClass obj is in SG
120  where the prefix 'g' is the global namespace provided by cppyy
121  g = cppyy.gbl
122 
123  """
124  #import workaround
125  if aClass == GNS.AttributeList:
126  return rootStream
127  if aClass == GNS.AANT:
128  return rootStream
129  global storeGate
130  if storeGate is None:
131  import AthenaPython.PyAthena as PyAthena
132  storeGate = PyAthena.py_svc('StoreGateSvc/StoreGateSvc')
133  if aKey:
134  ret = storeGate.retrieve(aClass,aKey)
135  else:
136  ret = storeGate.retrieve(aClass)
137  return ret
138 
139 
140 # retrieve object from DetectorStore

◆ retrieveDet()

def python.PyKernel.retrieveDet (   aClass,
  aKey = None 
)
Retrieve object from DetectorStore

:param aClass: type of the class
:param aKey: key of the object

**examples**::

  athena> obj = PyKernel.retrieveDet(g.MyClass,'mykey')
  athena> obj = PyKernel.retrieveDet(g.MyClass) # when only one MyClass obj is in SG
      where the prefix 'g' is the global namespace provided by cppyy
      g = cppyy.gbl

Definition at line 141 of file PyKernel.py.

141 def retrieveDet (aClass, aKey=None):
142  """Retrieve object from DetectorStore
143 
144  :param aClass: type of the class
145  :param aKey: key of the object
146 
147  **examples**::
148 
149  athena> obj = PyKernel.retrieveDet(g.MyClass,'mykey')
150  athena> obj = PyKernel.retrieveDet(g.MyClass) # when only one MyClass obj is in SG
151  where the prefix 'g' is the global namespace provided by cppyy
152  g = cppyy.gbl
153 
154  """
155  #import workaround
156  global detStore
157  if detStore is None:
158  import AthenaPython.PyAthena as PyAthena
159  storeGate = PyAthena.py_svc('StoreGateSvc/DetectorStore') # noqa: F841
160  if aKey:
161  ret = detStore.retrieve(aClass,aKey)
162  else:
163  ret = detStore.retrieve(aClass)
164  return ret
165 
166 
167 # fill a histogram

◆ unregister()

def python.PyKernel.unregister (   path)
Unregister histogram from HistogramSvc

:param path: path to the histogram

**examples**::

  athena> unregister("/stat/tmpHist")

Definition at line 750 of file PyKernel.py.

750 def unregister (path):
751  '''
752  Unregister histogram from HistogramSvc
753 
754  :param path: path to the histogram
755 
756  **examples**::
757 
758  athena> unregister("/stat/tmpHist")
759 
760  '''
761  return theApp.histSvc().unregisterObject(path)
762 
763 
764 # dump histograms in HistogramSvc

Variable Documentation

◆ __docformat__

string python.PyKernel.__docformat__ = "restructuredtext en"
private

Definition at line 15 of file PyKernel.py.

◆ _HybridProcess

int python.PyKernel._HybridProcess = 2
private

Definition at line 32 of file PyKernel.py.

◆ _NormalProcess

int python.PyKernel._NormalProcess = 1
private

Definition at line 31 of file PyKernel.py.

◆ _PreProcess

int python.PyKernel._PreProcess = 0
private

Definition at line 30 of file PyKernel.py.

◆ AANT

python.PyKernel.AANT

Definition at line 37 of file PyKernel.py.

◆ AttributeList

python.PyKernel.AttributeList

Definition at line 36 of file PyKernel.py.

◆ detStore

python.PyKernel.detStore = None

Definition at line 41 of file PyKernel.py.

◆ GNS

python.PyKernel.GNS = cppyy.gbl

Definition at line 25 of file PyKernel.py.

◆ storeGate

python.PyKernel.storeGate = None

Definition at line 40 of file PyKernel.py.

python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
python.PyKernel.fillProf
def fillProf(hist, classAndKey, valueX, valueY, criteria="True", nEvent=100)
Definition: PyKernel.py:546
python.PyKernel.normalProcess
def normalProcess()
Definition: PyKernel.py:790
python.PyKernel.retrieveDet
def retrieveDet(aClass, aKey=None)
Definition: PyKernel.py:141
max
#define max(a, b)
Definition: cfImp.cxx:41
python.PyKernel.preProcess
def preProcess()
Definition: PyKernel.py:778
python.PyKernel.fill2
def fill2(hist, classAndKey, valueX, valueY, criteria="True", nEvent=100)
Definition: PyKernel.py:349
python.PyKernel.unregister
def unregister(path)
Definition: PyKernel.py:750
book
T * book(const std::string &n, const std::string &t, unsigned nbins)
Definition: main_benchmark.cxx:138
python.PyKernel.dumpSG
def dumpSG()
Definition: PyKernel.py:737
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.ChapPy.dump
def dump(buf, stdout=sys.stdout)
Definition: ChapPy.py:25
python.PyKernel._parseString
def _parseString(str)
Definition: PyKernel.py:719
min
#define min(a, b)
Definition: cfImp.cxx:40
python.PyKernel.init
def init(v_theApp, v_rootStream=None)
Definition: PyKernel.py:45
python.PyKernel.plotProf
def plotProf(classAndKey, valueX="$x", valueY="$x", criteria="True", nEvent=100)
Definition: PyKernel.py:698
plot
bool plot
Definition: listroot.cxx:44
python.PyKernel.hybridProcess
def hybridProcess()
Definition: PyKernel.py:800
python.PyKernel.plot2
def plot2(classAndKey, valueX="$x", valueY="$x", criteria="True", nEvent=100)
Definition: PyKernel.py:525
python.PyKernel.dumpHist
def dumpHist()
Definition: PyKernel.py:765
python.PyKernel.fill
def fill(hist, classAndKey, value, criteria="True", nEvent=100)
Definition: PyKernel.py:168