14#include "TrkReco/TTrackBase.h"
15#include "CLHEP/Alist/CList.h"
16#include "TrkReco/TMDCUtil.h"
17#include "TrkReco/TMDCWire.h"
18#include "TrkReco/TMDCWireHit.h"
19#include "TrkReco/TMDCWireHitMC.h"
20#include "TrkReco/TMFitter.h"
21#include "TrkReco/TMLink.h"
22#include "TrkReco/TTrackHEP.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 );
65 if (
detail || ( msg.find(
"layer" ) != std::string::npos ) )
69 if (
detail || ( msg.find(
"hits" ) != std::string::npos ) ) {
Dump(
_links, msg, pre ); }
75 for (
unsigned i = 0; i <
n; i++ )
87 std::cout <<
"TTrackBase::distance !!! not implemented" << std::endl;
92 std::cout <<
"TTrackBase::approach !!! not implemented" << std::endl;
97#ifdef TRKRECO_DEBUG_DETAIL
98 std::cout <<
" TTrackBase::appendByApproach ... sigma=" << maxSigma << std::endl;
102 unsigned n = list.length();
103 for (
unsigned i = 0; i <
n; i++ )
120 float sigma = diff / l.
dDrift();
123#ifdef TRKRECO_DEBUG_DETAIL
124 std::cout <<
" sigma=" << sigma;
126 std::cout <<
",diff=" << diff;
127 std::cout <<
",err=" << l.
hit()->
dDrift() <<
",";
128 if ( sigma < maxSigma ) std::cout <<
"ok,";
129 else std::cout <<
"X,";
134 if ( sigma > maxSigma )
145 list.remove( unused );
149 std::cout <<
"TTrackBase::appendByDistance !!! not implemented" << std::endl;
156 for (
unsigned i = 0; i <
n; i++ )
159 if (
_links[i]->pull() > sigma ) bad.append(
_links[i] );
167 std::cout <<
" refine ... sigma=" << sigma <<
", # of rejected hits=";
168 std::cout << bad.length() << std::endl;
171 Dump( bad,
"sort pull mc",
" " );
192#ifdef TRKRECO_DEBUG_DETAIL
193 std::cout <<
" refine ... sigma=" << sigma << std::endl;
194 Dump( bad,
"detail sort",
" " );
209 for (
unsigned i = 0; i <
n; i++ )
212 chi2 +=
_links[i]->pull();
213 if (
_links[i]->pull() > sigma )
216 sigma =
_links[i]->pull();
223 if ( sigma > 9 ) { bad.append(
_links[jbad] ); }
234#ifdef TRKRECO_DEBUG_DETAIL
235 std::cout <<
" TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl;
239 unsigned n = list.length();
240 for (
unsigned i = 0; i <
n; i++ )
249#ifdef TRKRECO_DEBUG_DETAIL
250 std::cout <<
" TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl;
256 if ( err < 0 )
return 0;
261 l.
pull( sigma * sigma );
264#ifdef TRKRECO_DEBUG_DETAIL
265 std::cout <<
" sigma=" << sigma;
267 std::cout <<
",diff=" << diff <<
",";
268 if ( sigma < maxSigma ) std::cout <<
"ok,";
269 else std::cout <<
"X,";
274 if ( sigma < maxSigma )
return 1;
290 if ( mask == 0 )
return _links;
292 std::cout <<
"TTrackBase::links !!! mask is not supportted yet" << std::endl;
298 if ( mask == 0 )
return n;
300 for (
unsigned i = 0; i <
n; i++ )
303 if ( h.
state() & mask ) ++nn;
309 if ( mask ) std::cout <<
"TTrackBase::cores !!! mask is not supported" << std::endl;
310 if ( !_updated )
update();
315 if ( mask ) std::cout <<
"TTrackBase::nCores !!! mask is not supported" << std::endl;
316 if ( !_updated )
update();
317 return _cores.length();
349#ifdef TRKRECO_DEBUG_DETAIL
350 std::cout <<
"TTrackBase::append !!! " << a.
wire()->
name()
351 <<
" this is already used by another track!" << std::endl;
355 if (
_links.hasMember( a ) )
357#ifdef TRKRECO_DEBUG_DETAIL
358 std::cout <<
"TTrackBase::append !!! " << a.
wire()->
name()
359 <<
" this is already included in this track!" << std::endl;
371 for (
unsigned i = 0; i < a.length(); i++ )
375#ifdef TRKRECO_DEBUG_DETAIL
376 std::cout <<
" TTrackBase::append(list) !!! ";
377 std::cout << a[i]->wire()->name();
378 std::cout <<
" Hey!, this is already used! Don't mess with me.";
379 std::cout << std::endl;
383 else { tmp.append( a[i] ); }
394 CList<unsigned> hepCounter;
395 for (
unsigned i = 0; i <
n; i++ )
398 unsigned nH = hepList.length();
400 for (
unsigned j = 0; j < nH; j++ )
402 if ( hepList[j] ==
hep )
405 ++( *hepCounter[j] );
411 hepList.append(
hep );
413 hepCounter.append( c );
417 _nHeps = hepList.length();
420 for (
unsigned i = 0; i < _nHeps; i++ )
422 if ( ( *hepCounter[i] ) >
max )
424 max = ( *hepCounter[i] );
#define WireHitFittingValid
#define WireHitInvalidForFit
void Dump(const CAList< TMLink > &links, const std::string &message=std::string(""), const std::string &prefix=std::string(""))
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.
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
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)
virtual void removeLinks(void)
void appendByDistance(AList< TMLink > &list, double maxDistance)
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
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)
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.