8 def __init__( self, name = "EventAnalyzer", title = "EventAnalyzer", histControlName='histControl', numberOfDarkPhotons=1 ):
10 ROOT.TNamed.__init__( self, name, title )
12 self.SetTitle( title )
19 histControlName = histControlName.replace(
'.root',
'')
31 self.
__histControl.BookHist1D(
'Polarization',
'cos(#theta)', 200, -1.1, 1.1)
35 self.
__histControl.BookHist1D(
'OpeningEtaElectrons',
'#Delta #eta', 200, .0, .1)
36 self.
__histControl.BookHist1D(
'OpeningPhiElectrons',
'#Delta #phi', 200, .0, .1)
37 self.
__histControl.BookHist1D(
'OpeningRElectrons',
'#Delta R', 200, .0, .1)
39 self.
__histControl.BookHist1D(
'OpeningEtaMuons',
'#Delta #eta', 200, .0, .1)
40 self.
__histControl.BookHist1D(
'OpeningPhiMuons',
'#Delta #phi', 200, .0, .1)
41 self.
__histControl.BookHist1D(
'OpeningRMuons',
'#Delta R', 200, .0, .1)
43 self.
__histControl.BookHist1D(
'OpeningEtaPions',
'#Delta #eta', 200, .0, .1)
44 self.
__histControl.BookHist1D(
'OpeningPhiPions',
'#Delta #phi', 200, .0, .1)
45 self.
__histControl.BookHist1D(
'OpeningRPions',
'#Delta R', 200, .0, .1)
47 self.
__histControl.BookHist1D(
'OpeningEtaDarkPhotons',
'#Delta #eta', 200, .0, 4.)
48 self.
__histControl.BookHist1D(
'OpeningPhiDarkPhotons',
'#Delta #phi', 200, .0, 4.)
49 self.
__histControl.BookHist1D(
'OpeningRDarkPhotons',
'#Delta R', 200, .0, 4.)
53 self.
__histControl.BookHist1D(
'leadingPtElectron',
'Leading p_{T};p_{T} [GeV];Entries', 200, .0, maxPt)
54 self.
__histControl.BookHist1D(
'subLeadingPtElectron',
'Sub-Leading p_{T};p_{T} [GeV];Entries', 200, .0, maxPt/2.)
55 self.
__histControl.BookHist1D(
'ptBalanceElectron',
'p_{T} Balance', 200, -.1, 1.1)
57 self.
__histControl.BookHist1D(
'leadingPtMuon',
'Leading p_{T};p_{T} [GeV];Entries', 200, .0, maxPt)
58 self.
__histControl.BookHist1D(
'subLeadingPtMuon',
'Sub-Leading p_{T};p_{T} [GeV];Entries', 200, .0, maxPt/2.)
59 self.
__histControl.BookHist1D(
'ptBalanceMuon',
'p_{T} Balance', 200, -.1, 1.1)
61 self.
__histControl.BookHist1D(
'leadingPtPion',
'Leading p_{T};p_{T} [GeV];Entries', 200, .0, maxPt)
62 self.
__histControl.BookHist1D(
'subLeadingPtPion',
'Sub-Leading p_{T};p_{T} [GeV];Entries', 200, .0, maxPt/2.)
63 self.
__histControl.BookHist1D(
'ptBalancePion',
'p_{T} Balance', 200, -.1, 1.1)
65 self.
__histControl.BookHist1D(
'leadingPtDarkPhoton',
'Leading p_{T};p_{T} [GeV];Entries', 200, .0, maxPt)
66 self.
__histControl.BookHist1D(
'subLeadingPtDarkPhoton',
'Sub-Leading p_{T};p_{T} [GeV];Entries', 200, .0, maxPt/2.)
67 self.
__histControl.BookHist1D(
'ptBalanceDarkPhoton',
'p_{T} Balance', 200, -.1, 1.1)
71 self.
__histControl.BookHist1D(
'decayR1D',
'Dark Photon Decay Radius;R [mm];Entries', 200, 1., -1.)
72 self.
__histControl.BookHist1D(
'decayZ1D',
'Dark Photon Decay Length along Z;Z [mm];Entries', 200, 1., -1.)
73 self.
__histControl.BookHist2D(
'decayZR2D',
'Dark Photon Decay Distance;Z [mm];R [mm]', 150, 1., -1., 150, 1., -1.)
74 self.
__histControl.BookHist2D(
'decayEtaR2D',
'Dark Photon Decay Distance;#eta;R [mm]', 150, 1., -1., 150, 1., -1.)
78 self.
__histControl.BookHist1D(
'darkPhotonEta',
'Dark Photon #eta', 200, 1., -1.)
79 self.
__histControl.BookHist1D(
'darkPhotonPhi',
'Dark Photon #phi', 200, 1., -1.)
80 self.
__histControl.BookHist1D(
'darkPhotonPt',
'Dark Photon p_{T}', 200, 1., -1.)
81 self.
__histControl.BookHist1D(
'scalarEta',
'Scalar #eta', 200, 1., -1.)
82 self.
__histControl.BookHist1D(
'scalarPhi',
'Scalar #phi', 200, 1., -1.)
83 self.
__histControl.BookHist1D(
'scalarPt',
'Scalar p_{T}', 200, 1., -1.)
89 while dphi < -ROOT.TMath.Pi():
90 dphi = dphi + 2. * ROOT.TMath.Pi()
91 while dphi > ROOT.TMath.Pi():
92 dphi = dphi - 2. * ROOT.TMath.Pi()
95 def deltaR(self, eta1, phi1, eta2, phi2):
97 deta = ROOT.TMath.Abs(eta1-eta2)
98 dr = ROOT.TMath.Sqrt(dphi*dphi + deta*deta)
118 print 'Cannot have', self.
__nDarkPhotons,
'per event. Set to 1 or 2'
122 for index,(mc_child_index,pdgId)
in enumerate( zip( self.
__event.mc_child_index, self.
__event.mc_pdgId ) ):
129 if len(mc_child_index) != 2:
130 print 'dark photon has ', len(mc_child_index),
'children instead of 2'
142 print 'Found a scalar (pdgId==700021). But number of dark photons is set to 1. fix this'
148 print 'Didn\'t find a scalar (pdgId==700021). But number of dark photons is set to 2. fix this'
183 '''Get cos(theta) between the dark photon vector in the lab frame
184 and the decay product vector in the dark photon\'s rest frame.
186 eta = self.
__event.mc_eta[indexDP]
187 phi = self.
__event.mc_phi[indexDP]
188 pt = self.
__event.mc_pt[indexDP]
190 theta = 2.*ROOT.TMath.ATan(ROOT.TMath.Exp(-1.*eta))
191 px = pt*ROOT.TMath.Sin(phi)
192 py = pt*ROOT.TMath.Cos(phi)
193 pz = pt/ROOT.TMath.Tan(theta)
194 edp = ROOT.TMath.Sqrt( px**2+py**2+pz**2+self.
__event.mc_m[indexDP]**2 )
196 eta_1 = self.
__event.mc_eta[indexKid]
197 phi_1 = self.
__event.mc_phi[indexKid]
198 pt_1 = self.
__event.mc_pt[indexKid]
199 theta_1 = 2.*ROOT.TMath.ATan(ROOT.TMath.Exp(-1.*eta_1))
201 px_kid_1 = pt_1*ROOT.TMath.Sin(phi_1)
202 py_kid_1 = pt_1*ROOT.TMath.Cos(phi_1)
203 pz_kid_1 = pt_1/ROOT.TMath.Tan(theta_1)
204 e_kid_1 = ROOT.TMath.Sqrt( px_kid_1**2+py_kid_1**2+pz_kid_1**2+self.
__event.mc_m[indexKid]**2 )
206 tlv_dp = ROOT.TLorentzVector(px, py, pz, edp)
207 bv = tlv_dp.BoostVector()
209 tlv_kid_1 = ROOT.TLorentzVector(px_kid_1, py_kid_1, pz_kid_1, e_kid_1)
213 self.
__histControl.FillHist1D(
'Polarization', tlv_dp.Vect().Unit().Dot(tlv_kid_1.Vect().Unit()) )
229 eta_1 = self.
__event.mc_eta[index1]
230 phi_1 = self.
__event.mc_phi[index1]
231 pt_1 = self.
__event.mc_pt[index1]
232 theta_1 = 2.*ROOT.TMath.ATan(ROOT.TMath.Exp(-1.*eta_1))
234 px_kid_1 = pt_1*ROOT.TMath.Sin(phi_1)
235 py_kid_1 = pt_1*ROOT.TMath.Cos(phi_1)
236 pz_kid_1 = pt_1/ROOT.TMath.Tan(theta_1)
237 e_kid_1 = ROOT.TMath.Sqrt( px_kid_1**2+py_kid_1**2+pz_kid_1**2+self.
__event.mc_m[index1]**2 )
239 eta_2 = self.
__event.mc_eta[index2]
240 phi_2 = self.
__event.mc_phi[index2]
241 pt_2 = self.
__event.mc_pt[index2]
242 theta_2 = 2.*ROOT.TMath.ATan(ROOT.TMath.Exp(-1.*eta_2))
244 px_kid_2 = pt_2*ROOT.TMath.Sin(phi_2)
245 py_kid_2 = pt_2*ROOT.TMath.Cos(phi_2)
246 pz_kid_2 = pt_2/ROOT.TMath.Tan(theta_2)
247 e_kid_2 = ROOT.TMath.Sqrt( px_kid_2**2+py_kid_2**2+pz_kid_2**2+self.
__event.mc_m[index2]**2 )
249 tlv_kid_1 = ROOT.TLorentzVector(px_kid_1, py_kid_1, pz_kid_1, e_kid_1)
250 tlv_kid_2 = ROOT.TLorentzVector(px_kid_2, py_kid_2, pz_kid_2, e_kid_2)
252 dPhi = abs( self.
deltaPhi( tlv_kid_1.Phi(), tlv_kid_2.Phi() ) )
253 dEta = abs( tlv_kid_1.Eta() - tlv_kid_2.Eta() )
254 dR = self.
deltaR( tlv_kid_1.Eta(), tlv_kid_1.Phi(), tlv_kid_2.Eta(), tlv_kid_2.Phi() )
256 pdgId = abs(self.
__event.mc_pdgId[index1])
274 self.
__histControl.FillHist1D(
'OpeningEtaDarkPhotons', dEta )
275 self.
__histControl.FillHist1D(
'OpeningPhiDarkPhotons', dPhi )
293 pt_1 = self.
__event.mc_pt[index1]
294 pt_2 = self.
__event.mc_pt[index2]
295 pdgId = abs(self.
__event.mc_pdgId[index1])
299 self.
__histControl.FillHist1D(
'ptBalanceElectron', abs(pt_1 - pt_2)/(pt_1+pt_2) )
304 self.
__histControl.FillHist1D(
'ptBalanceMuon', abs(pt_1 - pt_2)/(pt_1+pt_2) )
309 self.
__histControl.FillHist1D(
'ptBalancePion', abs(pt_1 - pt_2)/(pt_1+pt_2) )
314 self.
__histControl.FillHist1D(
'ptBalanceDarkPhoton', abs(pt_1 - pt_2)/(pt_1+pt_2) )
331 decayR = ROOT.TMath.Sqrt( self.
__event.mc_vx_x[indexKid]**2 + self.
__event.mc_vx_y[indexKid]**2 )
332 decayZ = self.
__event.mc_vx_z[indexKid]
345 self.
fillRZ(indexDP, indexKid)