15# if defined(__EXTENSIONS__)
18# define __EXTENSIONS__
22#elif defined(__GNUC__)
23# if defined(_XOPEN_SOURCE)
42#define DBL_MIN 2.2250738585072014E-308
43#define FLT_MIN 1.175494351E-38F
46TTrackMC::TTrackMC(
const TTrack &
t)
51 _wireFractionHEP(-999.),
143 std::cout << _t.
name() <<
":";
144 std::cout <<
"state=" << _state <<
":";
145 if (_quality &
TTrackGood) std::cout <<
"good :";
146 else if (_quality &
TTrackGhost) std::cout <<
"ghost :";
147 else if (_quality &
TTrackBad) std::cout <<
"bad :";
150 else std::cout <<
"classification error:";
151 bitDisplay(_quality, 23, 15); std::cout <<
":";
152 std::cout << _hepID <<
":";
153 std::cout << _wireFraction <<
"," << _wireFractionHEP <<
":";
154 std::cout << _ptFraction <<
"," << _pzFraction;
155 std::cout << std::endl;
159TTrackMC::compare(
void) {
163 int id = _hep->
pType();
165 if (aId == 11 || aId == 13 || aId == 15)
id *= -1;
168 if ((
int) _t.
charge() *
id > 0) _charge =
true;
173 unsigned n = list.length();
177 for (
unsigned i = 0; i <
n; i++) {
179 if (inner->
hit()->
mc()->
hep() == _hep) {
187 Helix hHep =
Helix(vHep, pHep, copysign(1.,
id));
193 std::cout <<
"TTrackMC::compare !!! something wrong with mc hits"
216 _residual = _t.
p() - pHep;
217 _cosOpen = pHep.unit().dot(_t.
p().unit());
221 double ptHep = sqrt(pHep.x() * pHep.x() + pHep.y() * pHep.y());
222 _ptResidual = pt - ptHep;
226 double ptError2 = h.
Ea().similarity(dPt);
228 std::cout << h.
kappa() <<
" " << h.
Ea() <<
" dPt=" << dPt << std::endl;
230 double ptError = (ptError2 > 0.) ? sqrt(ptError2) : (DBL_MIN);
231 _ptPull = (ptError2 > 0.) ? (_ptResidual) / ptError : (FLT_MAX);
232 _ptFraction = (fabs(ptHep)>(FLT_MIN)) ? _ptResidual / ptHep : 0.0;
236 double pzHep = pHep.z();
237 _pzResidual = pz - pzHep;
240 dPz[4] = 1. / h.
kappa();
241 double pzError2 = h.
Ea().similarity(dPz);
243 std::cout << h.
kappa() <<
" " << h.
Ea() <<
" dPz=" << dPz << std::endl;
245 double pzError = (pzError2 > 0.) ? sqrt(pzError2) : (DBL_MIN);
246 _pzPull = (pzError2 > 0.) ? (_pzResidual) / pzError : (FLT_MAX);
247 _pzFraction = (
abs(pzHep)>FLT_MIN) ? (_pzResidual / pzHep) : (FLT_MAX);
251TTrackMC::classify(
void) {
258 if (fabs(_ptFraction) < .1) _quality |=
TTrackPt;
259 if (fabs(_pzFraction) < .1) _quality |=
TTrackPz;
260 float momResidual = sqrt(_ptResidual * _ptResidual +
261 _pzResidual * _pzResidual);
263 if ((momResidual < 0.100) && (_cosOpen > 0.99))
265 if ((momResidual < 0.020) && (_cosOpen > 0.998))
269 if (_wireFraction < 0.8)
return;
274 if (! _charge)
return;
293 std::string matching;
297 else matching =
"bad";
314 if (quality &
TTrackGood)
return std::string(
"Good");
315 else if (quality &
TTrackGhost)
return std::string(
"Ghost");
316 else if (quality &
TTrackBad)
return std::string(
"Bad");
317 else if (quality &
TTrackCharge)
return std::string(
"Charge");
318 else if (quality &
TTrackGarbage)
return std::string(
"Garbage");
319 return std::string(
"Unknown");
double abs(const EvtComplex &c)
CLHEP::Hep3Vector Vector3
void bitDisplay(unsigned val)
TMLink * InnerMost(const AList< TMLink > &a)
returns the inner(outer)-most link.
std::string TrackMCQualityString(unsigned quality)
std::string TrackMCStatus(unsigned quality)
#define TTrackMatchingLoose
#define TTrackMatchingTight
std::string TrackMCQualityString(unsigned quality)
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
const HepSymMatrix & Ea(void) const
returns error matrix.
const HepPoint3D & pivot(void) const
returns pivot position.
const Hep3Vector & momentum(void) const
returns momentum vector at the entrance.
const TTrackHEP *const hep(void) const
returns a pointer to a GEN_HEPEVT.
const HepPoint3D & entrance(void) const
returns an entrance point.
const TMDCWireHitMC *const mc(void) const
returns a pointer to TMDCWireHitMC.
A class to relate TMDCWireHit and TTrack objects.
const TMDCWireHit * hit(void) const
returns a pointer to a hit.
int pType(void) const
returns particle type.
A class to have MC information of TTrack.
virtual ~TTrackMC()
Destructor.
void update(void)
updates information.
unsigned quality(void) const
returns quality.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
std::string qualityString(void) const
returns quality.
A class to represent a track in tracking.
const Helix & helix(void) const
returns helix parameter.
const std::string & name(void) const
returns/sets name.
double pt(void) const
returns Pt.
double pz(void) const
returns Pz.
const AList< TMLink > & finalHits(void) const
finds cathode hits associated to this track.
double charge(void) const
returns charge.
Hep3Vector p(void) const
returns momentum.