137 double trueEventT0 = 0;
138 if (mcInitialParticles.
isValid()) trueEventT0 = mcInitialParticles->getTime();
142 for (
const auto& track : tracks) {
143 const auto* trackFit = track.getTrackFitResultWithClosestMass(
Const::pion);
144 if (!trackFit)
continue;
147 if (top->getFlag() != 1)
continue;
154 mother = mcParticle->getMother();
156 const auto barHits = mcParticle->getRelationsWith<
TOPBarHit>();
157 for (
const auto& bHit : barHits) {
158 if (bHit.getModuleID() == extHit->
getCopyID()) barHit = &bHit;
165 m_top.evt = evtMetaData->getEvent();
166 m_top.run = evtMetaData->getRun();
168 ROOT::Math::XYZVector mom = trackFit->getMomentum();
170 m_top.cth = cos(mom.Theta());
171 m_top.phi = mom.Phi();
172 m_top.pValue = trackFit->getPValue();
175 m_top.PDG = mcParticle->getPDG();
176 if (mother)
m_top.motherPDG = mother->getPDG();
178 m_top.seen = mcParticle->hasSeenInDetector(Const::TOP);
179 ROOT::Math::XYZVector prodVertex = mcParticle->getProductionVertex();
180 m_top.rhoProd = prodVertex.Rho();
181 m_top.zProd = prodVertex.Z();
182 m_top.phiProd = prodVertex.Phi();
183 ROOT::Math::XYZVector decVertex = mcParticle->getDecayVertex();
184 m_top.rhoDec = decVertex.Rho();
185 m_top.zDec = decVertex.Z();
186 m_top.phiDec = decVertex.Phi();
187 const auto digits = mcParticle->getRelationsWith<
TOPDigit>();
188 for (
size_t i = 0; i < digits.size(); i++) {
189 double wt = digits.weight(i);
190 if (wt <= 0)
continue;
191 const auto* digit = digits[i];
192 if (digit->getHitQuality() != TOPDigit::c_Good)
continue;
193 if (digit->getModuleID() != top->getModuleID())
continue;
199 m_top.numPhot = top->getNphot();
200 m_top.numBkg = top->getEstBkg();
201 m_top.moduleID = top->getModuleID();
226 auto position =
static_cast<ROOT::Math::XYZPoint
>(extHit->
getPosition());
228 if (geo->isModuleIDValid(moduleID)) {
229 const auto&
module = geo->getModule(moduleID);
230 position =
module.pointToLocal(position);
231 momentum =
module.momentumToLocal(momentum);
233 m_top.extHit.moduleID = moduleID;
235 m_top.extHit.x = position.X();
236 m_top.extHit.y = position.Y();
237 m_top.extHit.z = position.Z();
238 m_top.extHit.p = momentum.R();
239 m_top.extHit.theta = momentum.Theta();
240 m_top.extHit.phi = momentum.Phi();
245 int moduleID = barHit->getModuleID();
246 auto position = barHit->getPosition();
247 auto momentum = barHit->getMomentum();
248 if (geo->isModuleIDValid(moduleID)) {
249 const auto&
module = geo->getModule(moduleID);
250 position =
module.pointToLocal(position);
251 momentum =
module.momentumToLocal(momentum);
253 m_top.barHit.moduleID = moduleID;
254 m_top.barHit.PDG = barHit->getPDG();
255 m_top.barHit.x = position.X();
256 m_top.barHit.y = position.Y();
257 m_top.barHit.z = position.Z();
258 m_top.barHit.p = momentum.R();
259 m_top.barHit.theta = momentum.Theta();
260 m_top.barHit.phi = momentum.Phi();
261 m_top.barHit.time = barHit->getTime() - trueEventT0;
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.