13#define HEP_SHORT_NAMES
14#include "CLHEP/Alist/CList.h"
59 bool mc = (msg.find(
"mc") != std::string::npos);
60 bool pull = (msg.find(
"pull") != std::string::npos);
61 bool flag = (msg.find(
"flag") != std::string::npos);
62 bool detail = (msg.find(
"detail") != std::string::npos);
64 mc = pull = flag =
true;
66 if (detail || (msg.find(
"layer") != std::string::npos)) {
69 if (detail || (msg.find(
"hits") != std::string::npos)) {
78 for (
unsigned i = 0; i <
n; i++) {
90 std::cout <<
"TTrackBase::distance !!! not implemented" << std::endl;
96 std::cout <<
"TTrackBase::approach !!! not implemented" << std::endl;
102#ifdef TRKRECO_DEBUG_DETAIL
103 std::cout <<
" TTrackBase::appendByApproach ... sigma=" << maxSigma << std::endl;
107 unsigned n = list.length();
108 for (
unsigned i = 0; i <
n; i++) {
124 float sigma = diff / l.
dDrift();
127#ifdef TRKRECO_DEBUG_DETAIL
128 std::cout <<
" sigma=" << sigma;
130 std::cout <<
",diff=" << diff;
131 std::cout <<
",err=" << l.
hit()->
dDrift() <<
",";
132 if (sigma < maxSigma) std::cout <<
"ok,";
133 else std::cout <<
"X,";
138 if (sigma > maxSigma) {
153 std::cout <<
"TTrackBase::appendByDistance !!! not implemented" << std::endl;
158TTrackBase::refineMain(
double sigma) {
161 for (
unsigned i = 0; i <
n; i++){
163 if (
_links[i]->pull() > sigma)
173 std::cout <<
" refine ... sigma=" << sigma <<
", # of rejected hits=";
174 std::cout << bad.length() << std::endl;
177 Dump(bad,
"sort pull mc",
" ");
201#ifdef TRKRECO_DEBUG_DETAIL
202 std::cout <<
" refine ... sigma=" << sigma << std::endl;
203 Dump(bad,
"detail sort",
" ");
218 for (
unsigned i = 0; i <
n; i++){
221 if (
_links[i]->pull() > sigma){
223 sigma =
_links[i]->pull();
230 if(sigma>9){bad.append(
_links[jbad]);}
241#ifdef TRKRECO_DEBUG_DETAIL
242 std::cout <<
" TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl;
246 unsigned n = list.length();
247 for (
unsigned i = 0; i <
n; i++) {
256#ifdef TRKRECO_DEBUG_DETAIL
257 std::cout <<
" TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl;
263 if (err < 0)
return 0;
268 l.
pull(sigma * sigma);
271#ifdef TRKRECO_DEBUG_DETAIL
272 std::cout <<
" sigma=" << sigma;
274 std::cout <<
",diff=" << diff <<
",";
275 if (sigma < maxSigma) std::cout <<
"ok,";
276 else std::cout <<
"X,";
281 if (sigma < maxSigma)
return 1;
298 if (mask == 0)
return _links;
300 std::cout <<
"TTrackBase::links !!! mask is not supportted yet" << std::endl;
307 if (mask == 0)
return n;
309 for (
unsigned i = 0; i <
n; i++) {
311 if (h.
state() & mask) ++nn;
319 std::cout <<
"TTrackBase::cores !!! mask is not supported" << std::endl;
327 std::cout <<
"TTrackBase::nCores !!! mask is not supported" << std::endl;
329 return _cores.length();
358 return _fitter->
fit(*
this);
364#ifdef TRKRECO_DEBUG_DETAIL
365 std::cout <<
"TTrackBase::append !!! " << a.
wire()->
name()
366 <<
" this is already used by another track!" << std::endl;
370 if (
_links.hasMember(a)) {
371#ifdef TRKRECO_DEBUG_DETAIL
372 std::cout <<
"TTrackBase::append !!! " << a.
wire()->
name()
373 <<
" this is already included in this track!" << std::endl;
386 for (
unsigned i = 0; i < a.length(); i++) {
388#ifdef TRKRECO_DEBUG_DETAIL
389 std::cout <<
" TTrackBase::append(list) !!! ";
390 std::cout << a[i]->wire()->name();
391 std::cout <<
" Hey!, this is already used! Don't mess with me.";
392 std::cout << std::endl;
410 CList<unsigned> hepCounter;
411 for (
unsigned i = 0; i <
n; i++) {
413 unsigned nH = hepList.length();
415 for (
unsigned j = 0; j < nH; j++) {
416 if (hepList[j] ==
hep) {
425 hepCounter.append(c);
429 _nHeps = hepList.length();
432 for (
unsigned i = 0; i < _nHeps; i++) {
433 if ((* hepCounter[i]) > max) {
434 max = (* hepCounter[i]);
#define WireHitFittingValid
#define WireHitInvalidForFit
void Dump(const CAList< TMLink > &links, const std::string &msg, const std::string &pre)
dumps TMLinks.
unsigned state(void) const
returns state.
float dDrift(unsigned) const
returns drift distance error.
float drift(unsigned) const
returns drift distance.
std::string name(void) const
returns name.
virtual int fit(TTrackBase &) const =0
A class to relate TMDCWireHit and TTrack objects.
double distance(void) const
returns distance between point on wire and on track.
const HepPoint3D & positionOnWire(void) const
returns the closest point on wire to a track.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
const HepPoint3D & positionOnTrack(void) const
returns the closest point on track to wire.
const TMDCWireHit * hit(void) const
returns a pointer to a hit.
float dDrift(void) const
returns/sets drift distance error.
double pull(void) const
returns pull.
float drift(void) const
returns/sets drift distance.
const TMDCWire *const wire(void) const
returns a pointer to a wire.
virtual int approach(TMLink &) const
calculates the closest approach to a wire in real space. Results are stored in TMLink....
virtual double distance(const TMLink &) const
returns distance to a position of TMLink in TMLink space.
virtual int fit(void)
fits itself by a default fitter. Error was happened if return value is not zero.
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
virtual void refine(AList< TMLink > &list, double maxSigma)
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
virtual void removeLinks(void)
void appendByDistance(AList< TMLink > &list, double maxDistance)
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when ...
unsigned testByApproach(const TMLink &list, double sigma) const
returns # of good hits to be appended.
const TTrackMC *const mc(void) const
returns a pointer to TTrackMC.
unsigned nHeps(void) const
returns # of contributed TTrackHEP tracks.
void append(TMLink &)
appends a TMLink.
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
const TTrackHEP *const hep(void) const
returns TTrackHEP.
unsigned nCores(unsigned mask=0) const
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
void appendByApproach(AList< TMLink > &list, double maxSigma)
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when ...
virtual ~TTrackBase()
Destructor.
const AList< TMLink > & cores(unsigned mask=0) const
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
unsigned nLinks(unsigned mask=0) const
returns # of masked TMLinks assigned to this track object.
void update(void) const
update cache.
A class to represent a GEN_HEPEVT particle in tracking.