5 Functions that work on photon lists.
7 Contributor(s): Torben Ferber
12 from basf2
import create_path
15 from variables
import variables
16 import modularAnalysis
as ma
19 def getRandomId(size=6, chars=string.ascii_uppercase + string.digits):
20 return ''.join(random.choice(chars)
for _
in range(size))
23 def writeClosestParticleExtraClusterInfo(
25 particleSelection='True',
31 Add various variables to the first particle that are related to their angular separation and kinematics.
33 @param particleList Particle list with particle candidates that will have the extra information in the end
34 @param particleSelection Selection for the other particle
35 @param roe_path a path for the rest of event to be executed
36 @param deadend_path a path for skipping irrelevant RestOfEvent objects that may exist (if this was called twice, for instance)
37 @param path modules are added to this path
40 particleType = particleList.split(
":")[0]
43 roe_path = create_path()
46 deadend_path = create_path()
49 ma.buildRestOfEvent(particleList, path=path)
52 pListPair =
'vpho:writeClosestParticleExtraClusterInfo' + getRandomId()
53 pList0 = particleType +
':writeClosestParticleExtraClusterInfo' + getRandomId()
54 pList1 = particleType +
':writeClosestParticleExtraClusterInfo' + getRandomId()
56 ma.signalSideParticleFilter(particleList,
'', roe_path, deadend_path)
58 ma.fillSignalSideParticleList(pList0,
'^' + particleList, path=roe_path)
60 ma.fillParticleList(pList1,
'isInRestOfEvent == 1 and ' + particleSelection, path=roe_path)
62 ma.reconstructDecay(pListPair +
' -> ' + pList0 +
' ' + pList1,
'', path=roe_path)
65 ma.rankByLowest(pListPair,
'daughterClusterAngleInBetween(0, 1)', 1, path=roe_path)
70 ma.variableToSignalSideExtraInfo(pListPair, {
'useLabFrame(daughterClusterAngleInBetween(0, 1))':
'openingAngle'}, path=roe_path)
71 ma.variableToSignalSideExtraInfo(pListPair, {
'useLabFrame(daughterDiffOf(0, 1, clusterTheta))':
'deltaTheta'}, path=roe_path)
72 ma.variableToSignalSideExtraInfo(pListPair, {
'useLabFrame(daughterDiffOfClusterPhi(0, 1))':
'deltaPhi'}, path=roe_path)
74 path.for_each(
'RestOfEvent',
'RestOfEvents', roe_path)