ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.MuonSegmentFilter.MuonSegmentFilter Class Reference
Inheritance diagram for python.MuonSegmentFilter.MuonSegmentFilter:
Collaboration diagram for python.MuonSegmentFilter.MuonSegmentFilter:

Public Member Functions

def __init__ (self, name="MuonSegmentFilter", **kw)
 
def initialize (self)
 
def execute (self)
 
def finalize (self)
 

Public Attributes

 muonSegmentContainerName
 initialize base class More...
 
 muonSegmentContainerType
 
 passAll
 
 minNumberSegments
 
 maxNumberSegments
 
 sgSvc
 retrieve a handle to the event store More...
 
 containerNames
 
 nProcessed
 Also, declare some counters and initialize them to zero. More...
 
 nMuonSegments
 
 nEventPassed
 

Detailed Description

This class is a short algorithm to select events that contain some 
number of muon segments (probably zero).

Definition at line 23 of file MuonSegmentFilter.py.

Constructor & Destructor Documentation

◆ __init__()

def python.MuonSegmentFilter.MuonSegmentFilter.__init__ (   self,
  name = "MuonSegmentFilter",
**  kw 
)

Definition at line 31 of file MuonSegmentFilter.py.

31  def __init__ ( self, name = "MuonSegmentFilter", **kw ):
32 
33  kw['name'] = name
34  super(MuonSegmentFilter, self).__init__(**kw)
35 
36 
37  self.muonSegmentContainerName = kw.get('muonSegmentContainers', "MooreSegments")
38  self.muonSegmentContainerType = kw.get('muonSegmentContainerType', "Trk::SegmentCollection")
39  self.passAll = kw.get('passAll', False)
40  self.minNumberSegments = kw.get('minNumberSegments', 0)
41  self.maxNumberSegments = kw.get('maxNumberSegments', 0)
42 
43  #handle to storegate
44  self.sgSvc = None
45  self.containerNames = []
46 
47  return
48 

Member Function Documentation

◆ execute()

def python.MuonSegmentFilter.MuonSegmentFilter.execute (   self)

Definition at line 71 of file MuonSegmentFilter.py.

71  def execute(self):
72  self.nProcessed+=1
73  self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed )
74 
75 
76  if self.passAll :
77  self.msg.debug( '%s event passed because passAll is true', self.name() )
78  self.setFilterPassed(True)
79  return StatusCode.Success
80 
81  _retrieve = self.sgSvc.retrieve
82 
83  try :
84  muSegCollection = _retrieve (self.muonSegmentContainerType, self.muonSegmentContainerName)
85  except LookupError :
86  self.msg.warning('%s container not found in StoreGate ', self.muonSegmentContainerName)
87 
88 
89  if muSegCollection.__len__() >= self.minNumberSegments and \
90  muSegCollection.__len__()<= self.maxNumberSegments :
91  self.nEventPassed += 1
92  self.msg.debug( '%s event passed', self.name() )
93  self.setFilterPassed(True)
94  else :
95  self.msg.debug( '%s event failed', self.name() )
96  self.setFilterPassed(False)
97 
98  return StatusCode.Success
99 
100 
101 

◆ finalize()

def python.MuonSegmentFilter.MuonSegmentFilter.finalize (   self)

Definition at line 102 of file MuonSegmentFilter.py.

102  def finalize(self):
103 
104  import math
105 
106  effiNumPassed = 0.0
107  effiErrNumPassed = 0.0
108  try :
109  # Efficiencies
110  effiNumPassed = self.nEventPassed / float(self.nProcessed)
111  # Error on efficiencies, use binomial errors
112  effiErrNumPassed = 100.0 * math.sqrt( effiNumPassed*(1.0 - effiNumPassed) / float(self.nProcessed) )
113  effiNumPassed *= 100.0
114 
115  except ZeroDivisionError :
116  self.msg.warning( 'Division by zero error when calculating the uncertainties on the pass efficiencies...' )
117 
118 
119  self.msg.info( '==> finalize %s...', self.name() )
120  self.msg.info( '***************************************************************' )
121  self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() )
122  self.msg.info( '-------------' )
123  self.msg.info( ' Number of processed events: %r', self.nProcessed )
124  self.msg.info( ' Events after numberPassed %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventPassed, effiNumPassed, effiErrNumPassed )
125  self.msg.info( '***************************************************************' )
126 
127  return StatusCode.Success
128 
129 

◆ initialize()

def python.MuonSegmentFilter.MuonSegmentFilter.initialize (   self)

Definition at line 49 of file MuonSegmentFilter.py.

49  def initialize(self):
50  self.msg.info( '************************************' )
51  self.msg.info( '===> initialize %s...', self.name() )
52  self.msg.info( 'Will apply the following cuts:' )
53  self.msg.info( 'Minimum number of segments = %r',str(self.minNumberSegments) )
54  self.msg.info( 'Maximum number of segments = %r',str(self.maxNumberSegments) )
55 
56 
57  self.nProcessed = 0
58  self.nMuonSegments = 0
59  self.nEventPassed = 0
60 
61 
62  self.sgSvc = PyAthena.py_svc('StoreGateSvc')
63  if not self.sgSvc :
64  self.msg.error("could not retrieve a handle to the event store !")
65  return StatusCode.Failure
66 
67  return StatusCode.Success
68 
69 
70 

Member Data Documentation

◆ containerNames

python.MuonSegmentFilter.MuonSegmentFilter.containerNames

Definition at line 45 of file MuonSegmentFilter.py.

◆ maxNumberSegments

python.MuonSegmentFilter.MuonSegmentFilter.maxNumberSegments

Definition at line 41 of file MuonSegmentFilter.py.

◆ minNumberSegments

python.MuonSegmentFilter.MuonSegmentFilter.minNumberSegments

Definition at line 40 of file MuonSegmentFilter.py.

◆ muonSegmentContainerName

python.MuonSegmentFilter.MuonSegmentFilter.muonSegmentContainerName

initialize base class

Define the cuts

Definition at line 37 of file MuonSegmentFilter.py.

◆ muonSegmentContainerType

python.MuonSegmentFilter.MuonSegmentFilter.muonSegmentContainerType

Definition at line 38 of file MuonSegmentFilter.py.

◆ nEventPassed

python.MuonSegmentFilter.MuonSegmentFilter.nEventPassed

Definition at line 59 of file MuonSegmentFilter.py.

◆ nMuonSegments

python.MuonSegmentFilter.MuonSegmentFilter.nMuonSegments

Definition at line 58 of file MuonSegmentFilter.py.

◆ nProcessed

python.MuonSegmentFilter.MuonSegmentFilter.nProcessed

Also, declare some counters and initialize them to zero.

Definition at line 57 of file MuonSegmentFilter.py.

◆ passAll

python.MuonSegmentFilter.MuonSegmentFilter.passAll

Definition at line 39 of file MuonSegmentFilter.py.

◆ sgSvc

python.MuonSegmentFilter.MuonSegmentFilter.sgSvc

retrieve a handle to the event store

Definition at line 44 of file MuonSegmentFilter.py.


The documentation for this class was generated from the following file:
grepfile.info
info
Definition: grepfile.py:38
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
initialize
void initialize()
Definition: run_EoverP.cxx:894
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11
error
Definition: IImpactPoint3dEstimator.h:70
readCCLHist.float
float
Definition: readCCLHist.py:83