12 return math.sqrt(
deltaR2(*args) )
16 '''Computes delta phi, handling periodic limit conditions.''' 25 '''Univoque association of an element from matchCollection to an element of objects. 26 Reco and Gen objects get the "matched" attribute, true if they are part of a matched tuple. 27 By default, the matching is true only if delta R is smaller than 0.3. 33 if len(matchCollection)==0:
34 return dict(
zip(objects, [
None]*len(objects)) )
37 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)) ])
42 for object
in objects:
43 object.matched =
False 44 for match
in matchCollection:
48 deltaR2Max = deltaRMax * deltaRMax
49 for dR2, (object, match)
in allPairs:
52 if dR2 < deltaR2Max
and object.matched ==
False and match.matched ==
False:
58 for object
in objects:
59 if object.matched ==
False:
69 '''Masks objects using a deltaR cut, another algorithm (same results).''' 72 deltaR2Min = deltaRMin*deltaRMin
73 cleanObjects = copy.copy( objects )
76 for idx, object
in enumerate(cleanObjects):
77 dR2 =
deltaR2( object.eta(), object.phi(),
78 mask.eta(), mask.phi() )
80 tooClose.append( idx )
96 '''Masks objects using a deltaR cut.''' 97 if len(objects)==0
or len(masks)==0:
99 deltaR2Min = deltaRMin*deltaRMin
102 for object
in objects:
105 dR2 =
deltaR2( object.eta(), object.phi(),
106 mask.eta(), mask.phi() )
110 cleanObjects.append( object )
112 dirtyObjects.append( object )
113 return cleanObjects, dirtyObjects
118 '''Return the best match to object in matchCollection, which is the closest object in delta R''' 119 deltaR2Min =
float(
'+inf')
121 for match
in matchCollection:
122 dR2 =
deltaR2( object.eta(), object.phi(),
123 match.eta(), match.phi() )
127 return bm, deltaR2Min
134 if len(matchCollection)==0:
135 return dict(
zip(objects, [
None]*len(objects)) )
136 for object
in objects:
137 bm, dr2 =
bestMatch( object, matchCollection )
146 '''Univoque association of an element from matchCollection to an element of objects. 147 Reco and Gen objects get the "matched" attribute, true if they are part of a matched tuple. 148 By default, the matching is true only if delta R is smaller than 0.3. 154 if len(matchCollection)==0:
155 return dict(
zip(objects, [
None]*len(objects)) )
157 allPairs = sorted([(deltaR2 (object.eta(), object.phi(), match.eta(), match.phi()), (object, match))
for object
in objects
for match
in matchCollection])
161 for object
in objects:
162 object.matched =
False 163 for match
in matchCollection:
164 match.matched =
False 166 deltaR2Max = deltaRMax * deltaRMax
167 for dR2, (object, match)
in allPairs:
170 if dR2 < deltaR2Max
and object.matched ==
False and match.matched ==
False:
171 object.matched =
True 173 pairs[object] = match
175 for object
in objects:
176 if object.matched ==
False:
185 if __name__ ==
'__main__':
189 fargs =
map( float, args )
191 print 'dR2 = ',
deltaR2( *fargs )
192 print 'dR = ',
deltaR( *fargs )
def cleanObjectCollection2(objects, masks, deltaRMin)
def matchObjectCollection3
def cleanObjectCollection(objects, masks, deltaRMin)
def deltaR2(e1, p1, e2, p2)
def matchObjectCollection2(objects, matchCollection, deltaRMax=0.3)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
double deltaR(double eta1, double eta2, double phi1, double phi2)
def matchObjectCollection(objects, matchCollection, deltaR2Max)
def bestMatch(object, matchCollection)
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