SND@LHC Software
Loading...
Searching...
No Matches
pi0Reco.py
Go to the documentation of this file.
1from __future__ import division
2import ROOT,os
3import shipunit as u
4import rootUtils as ut
5pdg = ROOT.TDatabasePDG.Instance()
6mPi0 = pdg.GetParticle(111).Mass()
7L = ROOT.TLorentzVector()
8V = ROOT.TVector3()
9top = ROOT.gGeoManager.GetTopVolume()
10z_ecal = top.GetNode('Ecal_1').GetMatrix().GetTranslation()[2]
11
12
13def findPi0(sTree,secVertex):
14 recoGammas = {}
15 pi0List = []
16 listOfGammas = None
17 for aClu in sTree.EcalReconstructed:
18# short cut to exclude ecal clusters of charged tracks
19# would need another routine to extrapolate tracks to ecal and exclude matched showers
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
findPi0(sTree, secVertex)
Definition pi0Reco.py:13