|
|
|
def | bestMatch (object, matchCollection) |
|
def | cleanObjectCollection (objects, masks, deltaRMin) |
|
def | cleanObjectCollection2 (objects, masks, deltaRMin) |
|
def | deltaPhi (p1, p2) |
|
def | deltaR (*args) |
|
def | deltaR2 (e1, p1, e2, p2) |
|
def | matchObjectCollection (objects, matchCollection, deltaR2Max) |
|
def | matchObjectCollection2 (objects, matchCollection, deltaRMax=0.3) |
|
def | matchObjectCollection3 (objects, matchCollection, deltaRMax=0.3, filter=lambda x, True y) |
|
◆ bestMatch()
def DeltaR.bestMatch |
( |
|
object, |
|
|
|
matchCollection |
|
) |
| |
Return the best match to object in matchCollection, which is the closest object in delta R
Definition at line 118 of file DeltaR.py.
119 '''Return the best match to object in matchCollection, which is the closest object in delta R'''
120 deltaR2Min =
float(
'+inf')
122 for match
in matchCollection:
123 dR2 =
deltaR2( object.eta(), object.phi(),
124 match.eta(), match.phi() )
128 return bm, deltaR2Min
References deltaR2(), and dqmMemoryStats.float.
Referenced by matchObjectCollection().
◆ cleanObjectCollection()
def DeltaR.cleanObjectCollection |
( |
|
objects, |
|
|
|
masks, |
|
|
|
deltaRMin |
|
) |
| |
Masks objects using a deltaR cut.
Definition at line 96 of file DeltaR.py.
97 '''Masks objects using a deltaR cut.'''
98 if len(objects)==0
or len(masks)==0:
100 deltaR2Min = deltaRMin*deltaRMin
103 for object
in objects:
106 dR2 =
deltaR2( object.eta(), object.phi(),
107 mask.eta(), mask.phi() )
111 cleanObjects.append( object )
113 dirtyObjects.append( object )
114 return cleanObjects, dirtyObjects
References deltaR2().
◆ cleanObjectCollection2()
def DeltaR.cleanObjectCollection2 |
( |
|
objects, |
|
|
|
masks, |
|
|
|
deltaRMin |
|
) |
| |
Masks objects using a deltaR cut, another algorithm (same results).
Definition at line 69 of file DeltaR.py.
70 '''Masks objects using a deltaR cut, another algorithm (same results).'''
73 deltaR2Min = deltaRMin*deltaRMin
74 cleanObjects = copy.copy( objects )
77 for idx, object
in enumerate(cleanObjects):
78 dR2 =
deltaR2( object.eta(), object.phi(),
79 mask.eta(), mask.phi() )
81 tooClose.append( idx )
References deltaR2().
◆ deltaPhi()
def DeltaR.deltaPhi |
( |
|
p1, |
|
|
|
p2 |
|
) |
| |
Computes delta phi, handling periodic limit conditions.
Definition at line 16 of file DeltaR.py.
17 '''Computes delta phi, handling periodic limit conditions.'''
Referenced by deltaR2().
◆ deltaR()
def DeltaR.deltaR |
( |
* |
args | ) |
|
◆ deltaR2()
def DeltaR.deltaR2 |
( |
|
e1, |
|
|
|
p1, |
|
|
|
e2, |
|
|
|
p2 |
|
) |
| |
◆ matchObjectCollection()
def DeltaR.matchObjectCollection |
( |
|
objects, |
|
|
|
matchCollection, |
|
|
|
deltaR2Max |
|
) |
| |
◆ matchObjectCollection2()
def DeltaR.matchObjectCollection2 |
( |
|
objects, |
|
|
|
matchCollection, |
|
|
|
deltaRMax = 0.3 |
|
) |
| |
Univoque association of an element from matchCollection to an element of objects.
Reco and Gen objects get the "matched" attribute, true if they are part of a matched tuple.
By default, the matching is true only if delta R is smaller than 0.3.
Definition at line 146 of file DeltaR.py.
147 '''Univoque association of an element from matchCollection to an element of objects.
148 Reco and Gen objects get the "matched" attribute, true if they are part of a matched tuple.
149 By default, the matching is true only if delta R is smaller than 0.3.
155 if len(matchCollection)==0:
156 return dict(
zip(objects, [
None]*len(objects)) )
158 allPairs = sorted([(deltaR2 (object.eta(), object.phi(), match.eta(), match.phi()), (object, match))
for object
in objects
for match
in matchCollection])
162 for object
in objects:
163 object.matched =
False
164 for match
in matchCollection:
165 match.matched =
False
167 deltaR2Max = deltaRMax * deltaRMax
168 for dR2, (object, match)
in allPairs:
171 if dR2 < deltaR2Max
and object.matched ==
False and match.matched ==
False:
172 object.matched =
True
174 pairs[object] = match
176 for object
in objects:
177 if object.matched ==
False:
References ComparisonHelper.zip().
◆ matchObjectCollection3()
def DeltaR.matchObjectCollection3 |
( |
|
objects, |
|
|
|
matchCollection, |
|
|
|
deltaRMax = 0.3 , |
|
|
|
filter = lambda x , |
|
|
True |
y |
|
) |
| |
Univoque association of an element from matchCollection to an element of objects.
Reco and Gen objects get the "matched" attribute, true if they are part of a matched tuple.
By default, the matching is true only if delta R is smaller than 0.3.
Definition at line 25 of file DeltaR.py.
26 '''Univoque association of an element from matchCollection to an element of objects.
27 Reco and Gen objects get the "matched" attribute, true if they are part of a matched tuple.
28 By default, the matching is true only if delta R is smaller than 0.3.
34 if len(matchCollection)==0:
35 return dict(
zip(objects, [
None]*len(objects)) )
38 allPairs = sorted([(deltaR2 (object.eta(), object.phi(), match.eta(), match.phi()), (object, match))
for object
in objects
for match
in matchCollection
if list(
filter(object,match)) ])
43 for object
in objects:
44 object.matched =
False
45 for match
in matchCollection:
49 deltaR2Max = deltaRMax * deltaRMax
50 for dR2, (object, match)
in allPairs:
53 if dR2 < deltaR2Max
and object.matched ==
False and match.matched ==
False:
59 for object
in objects:
60 if object.matched ==
False:
References ALCARECOTkAlBeamHalo_cff.filter, and ComparisonHelper.zip().
def matchObjectCollection(objects, matchCollection, deltaR2Max)
def matchObjectCollection3(objects, matchCollection, deltaRMax=0.3, filter=lambda x, True y)
def cleanObjectCollection2(objects, masks, deltaRMin)
def bestMatch(object, matchCollection)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def cleanObjectCollection(objects, masks, deltaRMin)
def deltaR2(e1, p1, e2, p2)
def matchObjectCollection2(objects, matchCollection, deltaRMax=0.3)