92 def event(self):
93 ''' event processing: fill ntuple and histograms '''
94
98 for timeZero in timeZeros:
99 extHit = timeZero.getRelated('ExtHits')
100 if not extHit:
101 b2.B2WARNING('no related extHits')
102 continue
103 barHit = None
104 for barhit in mcParticles[0].getRelationsWith('TOPBarHits'):
105 if barhit.getModuleID() == extHit.getCopyID():
106 barHit = barhit
107 if not barHit:
108 b2.B2WARNING('no corresponding TOPBarHit')
109 continue
110
111 moduleID = timeZero.getModuleID()
112 if extHit.getCopyID() != moduleID:
113 b2.B2ERROR('moduleID in extHit differs: ' + str(extHit.getCopyID()) +
114 ' ' + str(moduleID))
115 if barHit.getModuleID() != moduleID:
116 b2.B2ERROR('moduleID in barHit differs: ' + str(barHit.getModuleID()) +
117 ' ' + str(moduleID))
118
119 self.data.slot = moduleID
120 self.data.nfot = timeZero.getNumPhotons()
121 self.data.pdg = barHit.getPDG()
122 pos = barHit.getLocalPosition()
123 self.data.x = pos.X()
124 self.data.y = pos.Y()
125 self.data.z = pos.Z()
126 self.data.t = barHit.getTime()
127 module = geo.getModule(moduleID)
128 mom = module.momentumToLocal(barHit.getMomentum())
129 self.data.p = mom.R()
130 self.data.theta = math.degrees(mom.Theta())
131 self.data.phi = math.degrees(mom.Phi())
132 dr = module.momentumToLocal(extHit.getPosition() - XYZVector(barHit.getPosition()))
133 self.data.dx = dr.X()
134 self.data.dy = dr.Y()
135 self.data.dz = dr.Z()
136 self.data.dt = extHit.getTOF() - self.data.t
137 momExt = module.momentumToLocal(extHit.getMomentum())
138 self.data.dp = momExt.R() - self.data.p
139 self.data.dtheta = math.degrees(momExt.Theta()) - self.data.theta
140 self.data.dphi = math.degrees(momExt.Phi()) - self.data.phi
141 self.data.t0 = timeZero.getTime()
142 self.data.t0err = timeZero.getError()
143 self.data.timeShift = timeShift
144 self.data.dt0 = self.data.dt + self.data.t0 - self.data.timeShift
145 self.file.cd()
146 self.tree.Fill()
147 self.reso.Fill(self.data.dt0)
148 self.pull.Fill(self.data.dt0/self.data.t0err)
149 if timeZero.getChi2().GetEntries() > 0:
150 timeZero.getChi2().Write()
151 timeZero.getPDF().Write()
152 timeZero.getHits().Write()
153
A (simplified) python wrapper for StoreArray.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.