13def findPi0(sTree,secVertex):
14 recoGammas = {}
15 pi0List = []
16 listOfGammas = None
17 for aClu in sTree.EcalReconstructed:
18
19
20 mc = aClu.MCTrack()
21 if mc<0: continue
22 gamma = sTree.MCTrack[mc]
23 if gamma.GetPdgCode()!=22: continue
24 if gamma.GetMotherId()<0: continue
25 P = aClu.RecoE()
26 direction = ROOT.TVector3(aClu.X()-secVertex.X(),aClu.Y()-secVertex.Y(),z_ecal-secVertex.Z())
27 norm = direction.Mag()
28 recoGammas[gamma] = ROOT.TLorentzVector(direction.X()/norm*P,direction.Y()/norm*P,direction.Z()/norm*P,P)
29 sTree.MCTrack[mc].GetStartVertex(V)
30 if len(recoGammas)==0: return []
31 listOfGammas=list(recoGammas.values())
32 for g1 in range(len(listOfGammas)-1):
33 for g2 in range(g1+1,len(listOfGammas)):
34 pi0 = listOfGammas[g1] + listOfGammas[g2]
35 pi0List.append(pi0)
36 return pi0List