17 #include <top/reconstruction/TOPtrack.h>
18 #include <top/geometry/TOPGeometryPar.h>
20 #include <framework/gearbox/Const.h>
21 #include <framework/logging/Logger.h>
23 #include <mdst/dataobjects/Track.h>
24 #include <mdst/dataobjects/TrackFitResult.h>
25 #include <mdst/dataobjects/HitPatternCDC.h>
26 #include <mdst/dataobjects/MCParticle.h>
27 #include <tracking/dataobjects/ExtHit.h>
28 #include <top/dataobjects/TOPBarHit.h>
31 void track2top_(
float*,
float*,
float*,
float*,
int*);
42 double px,
double py,
double pz,
43 double Tlen,
int Q,
int pdg):
44 m_valid(true), m_position(x, y, z), m_momentum(px, py, pz),
45 m_trackLength(Tlen), m_charge(Q), m_pdg(pdg),
46 m_atTop(false), m_moduleID(0),
47 m_track(0), m_extHit(0), m_mcParticle(0), m_barHit(0)
59 const auto* fitResult = track->getTrackFitResultWithClosestMass(chargedStable);
61 B2ERROR(
"No TrackFitResult available."
67 if (fitResult->getHitPatternCDC().getNHits() == 0)
return;
80 for (
unsigned i = 0; i < extHits.
size(); i++) {
81 const ExtHit* extHit = extHits[i];
82 if (abs(extHit->
getPdgCode()) != pdgCode)
continue;
85 if (extHit->
getTOF() < tmin) {
95 for (
const auto& barHit : barHits) {
105 m_charge = fitResult->getChargeSign();
123 int pdgCode = abs(chargedStable.
getPDGCode());
127 for (
const auto& extHit : extHits) {
128 if (abs(extHit.getPdgCode()) != pdgCode)
continue;
129 if (extHit.getDetectorID() != myDetID)
continue;
130 if (extHit.getCopyID() != moduleID)
continue;
131 if (extHit.getTOF() < tmin) {
141 for (
const auto& barHit : barHits) {
150 const auto* fitResult = track->getTrackFitResultWithClosestMass(chargedStable);
152 B2ERROR(
"No TrackFitResult available."
156 m_charge = fitResult->getChargeSign();
165 double pmom =
getP();
166 double beta = pmom / sqrt(pmom * pmom + mass * mass);
172 double pmom =
getP();
173 double beta = pmom / sqrt(pmom * pmom + mass * mass);
179 int lundc[6] = {11, 13, 211, 321, 2212, 1000010020};
180 for (
int i = 0; i < 6; i++) {
181 if (abs(
m_pdg) == lundc[i])
return i + 1;
200 track2top_(r, p, &q, &t, &m);
210 double sig_theta,
double sig_phi)
214 double theta =
getTheta() + gRandom->Gaus(0., sig_theta);
215 double phi =
getPhi() + gRandom->Gaus(0., sig_phi);
220 double rho = gRandom->Gaus(0., sig_x);
224 double z =
m_position.Z() + gRandom->Gaus(0., sig_z);
231 double pi = 4 * atan(1);
233 cout <<
"TOPtrack::dump(): ";
234 cout <<
" PDG=" <<
m_pdg;
235 cout <<
" charge=" <<
m_charge << endl;
236 cout <<
" p=" << setprecision(3) <<
getP() <<
" GeV/c";
237 cout <<
" theta=" << setprecision(3) <<
getTheta() / pi * 180;
238 cout <<
" phi=" << setprecision(3) <<
getPhi() / pi * 180 << endl;
239 cout <<
" x=" <<
getX() <<
" cm";
240 cout <<
" y=" <<
getY() <<
" cm";
241 cout <<
" z=" <<
getZ() <<
" cm\n";
242 cout <<
" trackLength=" << setprecision(4) <<
m_trackLength <<
" cm";
261 track2top_(r, p, &q, &t, &m);