129 double trueEventT0 = 0;
130 if (mcInitialParticles.
isValid()) trueEventT0 = mcInitialParticles->getTime();
134 for (
const auto& track : tracks) {
135 const auto* trackFit = track.getTrackFitResultWithClosestMass(
Const::pion);
136 if (!trackFit)
continue;
139 if (top->getFlag() != 1)
continue;
146 mother = mcParticle->getMother();
148 const auto barHits = mcParticle->getRelationsWith<
TOPBarHit>();
149 for (
const auto& bHit : barHits) {
150 if (bHit.getModuleID() == extHit->
getCopyID()) barHit = &bHit;
157 m_top.evt = evtMetaData->getEvent();
158 m_top.run = evtMetaData->getRun();
160 ROOT::Math::XYZVector mom = trackFit->getMomentum();
162 m_top.cth = cos(mom.Theta());
163 m_top.phi = mom.Phi();
164 m_top.pValue = trackFit->getPValue();
167 m_top.PDG = mcParticle->getPDG();
168 if (mother)
m_top.motherPDG = mother->getPDG();
170 m_top.seen = mcParticle->hasSeenInDetector(Const::TOP);
171 ROOT::Math::XYZVector prodVertex = mcParticle->getProductionVertex();
172 m_top.rhoProd = prodVertex.Rho();
173 m_top.zProd = prodVertex.Z();
174 m_top.phiProd = prodVertex.Phi();
175 ROOT::Math::XYZVector decVertex = mcParticle->getDecayVertex();
176 m_top.rhoDec = decVertex.Rho();
177 m_top.zDec = decVertex.Z();
178 m_top.phiDec = decVertex.Phi();
179 const auto digits = mcParticle->getRelationsWith<
TOPDigit>();
180 for (
size_t i = 0; i < digits.size(); i++) {
181 double wt = digits.weight(i);
182 if (wt <= 0)
continue;
183 const auto* digit = digits[i];
184 if (digit->getHitQuality() != TOPDigit::c_Good)
continue;
185 if (digit->getModuleID() != top->getModuleID())
continue;
191 m_top.numPhot = top->getNphot();
192 m_top.numBkg = top->getEstBkg();
193 m_top.moduleID = top->getModuleID();
218 auto position =
static_cast<ROOT::Math::XYZPoint
>(extHit->
getPosition());
220 if (geo->isModuleIDValid(moduleID)) {
221 const auto&
module = geo->getModule(moduleID);
222 position =
module.pointToLocal(position);
223 momentum =
module.momentumToLocal(momentum);
225 m_top.extHit.moduleID = moduleID;
227 m_top.extHit.x = position.X();
228 m_top.extHit.y = position.Y();
229 m_top.extHit.z = position.Z();
230 m_top.extHit.p = momentum.R();
231 m_top.extHit.theta = momentum.Theta();
232 m_top.extHit.phi = momentum.Phi();
237 int moduleID = barHit->getModuleID();
238 auto position = barHit->getPosition();
239 auto momentum = barHit->getMomentum();
240 if (geo->isModuleIDValid(moduleID)) {
241 const auto&
module = geo->getModule(moduleID);
242 position =
module.pointToLocal(position);
243 momentum =
module.momentumToLocal(momentum);
245 m_top.barHit.moduleID = moduleID;
246 m_top.barHit.PDG = barHit->getPDG();
247 m_top.barHit.x = position.X();
248 m_top.barHit.y = position.Y();
249 m_top.barHit.z = position.Z();
250 m_top.barHit.p = momentum.R();
251 m_top.barHit.theta = momentum.Theta();
252 m_top.barHit.phi = momentum.Phi();
253 m_top.barHit.time = barHit->getTime() - trueEventT0;
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.