7 def deltaR2( e1, p1, e2=None, p2=None):
8 """Take either 4 arguments (eta,phi, eta,phi) or two objects that have 'eta', 'phi' methods)""" 9 if (e2 ==
None and p2 ==
None):
10 return deltaR2(e1.eta(),e1.phi(), p1.eta(), p1.phi())
17 return math.sqrt(
deltaR2(*args) )
21 '''Computes delta phi, handling periodic limit conditions.''' 31 '''Returns the list of particles that are less than deltaRMax away from pivot.''' 32 dR2Max = deltaRMax ** 2
33 dR2Min = deltaRMin ** 2
if deltaRMin > 0
else -1
36 dR2 =
deltaR2(pivot.eta(), pivot.phi(), ptc.eta(), ptc.phi())
37 if dR2Min < dR2
and dR2 < dR2Max:
42 '''Univoque association of an element from matchCollection to an element of objects. 43 Reco and Gen objects get the "matched" attribute, true is they are re part of a matched tulpe. 44 By default, the matching is true only if delta R is smaller than 0.3. 51 if len(matchCollection)==0:
52 return dict(
list(
zip(objects, [
None]*len(objects))) )
55 objectCoords = [ (o.eta(),o.phi(),o)
for o
in objects ]
56 matchdCoords = [ (o.eta(),o.phi(),o)
for o
in matchCollection ]
57 allPairs = sorted([(deltaR2 (oeta, ophi, meta, mphi), (object, match))
for (oeta,ophi,object)
in objectCoords
for (meta,mphi,match)
in matchdCoords
if abs(oeta-meta)<=deltaRMax
and filter(object,match) ])
63 for object
in objects:
64 object.matched =
False 65 for match
in matchCollection:
69 deltaR2Max = deltaRMax * deltaRMax
70 for dR2, (object, match)
in allPairs:
73 if dR2 < deltaR2Max
and object.matched ==
False and match.matched ==
False:
79 for object
in objects:
80 if object.matched ==
False:
92 '''Masks objects using a deltaR cut, another algorithm (same results).''' 95 deltaR2Min = deltaRMin*deltaRMin
96 cleanObjects = copy.copy( objects )
99 for idx, object
in enumerate(cleanObjects):
100 dR2 =
deltaR2( object.eta(), object.phi(),
101 mask.eta(), mask.phi() )
103 tooClose.append( idx )
113 del cleanObjects[idx]
119 '''Masks objects using a deltaR cut.''' 120 if len(objects)==0
or len(masks)==0:
122 deltaR2Min = deltaRMin*deltaRMin
125 for object
in objects:
128 dR2 =
deltaR2( object.eta(), object.phi(),
129 mask.eta(), mask.phi() )
133 cleanObjects.append( object )
135 dirtyObjects.append( object )
136 return cleanObjects, dirtyObjects
139 '''Return the best match to object in matchCollection, which is the closest object in delta R''' 140 deltaR2Min =
float(
'+inf')
142 for match
in matchCollection:
143 dR2 =
deltaR2( object.eta(), object.phi(),
144 match.eta(), match.phi() )
148 return bm, deltaR2Min
155 if len(matchCollection)==0:
156 return dict(
list(
zip(objects, [
None]*len(objects))) )
157 for object
in objects:
158 bm, dr2 =
bestMatch( object, [mob
for mob
in matchCollection
if filter(object,mob)] )
167 '''Univoque association of an element from matchCollection to an element of objects. 168 Reco and Gen objects get the "matched" attribute, true is they are re part of a matched tulpe. 169 By default, the matching is true only if delta R is smaller than 0.3. 175 if len(matchCollection)==0:
176 return dict(
list(
zip(objects, [
None]*len(objects))) )
178 allPairs = sorted([(deltaR2 (object.eta(), object.phi(), match.eta(), match.phi()), (object, match))
for object
in objects
for match
in matchCollection])
182 for object
in objects:
183 object.matched =
False 184 for match
in matchCollection:
185 match.matched =
False 187 deltaR2Max = deltaRMax * deltaRMax
188 for dR2, (object, match)
in allPairs:
191 if dR2 < deltaR2Max
and object.matched ==
False and match.matched ==
False:
192 object.matched =
True 194 pairs[object] = match
196 for object
in objects:
197 if object.matched ==
False:
def deltaR2(e1, p1, e2=None, p2=None)
def matchObjectCollection
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
Abs< T >::type abs(const T &t)
def bestMatch(object, matchCollection)
def cleanObjectCollection(objects, masks, deltaRMin)
def matchObjectCollection2(objects, matchCollection, deltaRMax=0.3)
def inConeCollection(pivot, particles, deltaRMax, deltaRMin=1e-5)
def matchObjectCollection3
def cleanObjectCollection2(objects, masks, deltaRMin)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run