BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TPerfectFinder Class Reference

A class to find tracks using MC info. More...

#include <TPerfectFinder.h>

Inheritance diagram for TPerfectFinder:

Public Member Functions

 TPerfectFinder (int perfectFitting, float maxSigma, float maxSigmaStereo, unsigned fittingFlag)
 Constructor.
virtual ~TPerfectFinder ()
 Destructor.
std::string name (void) const
 returns name.
std::string version (void) const
 returns version.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
void clear (void)
 clear internal information.
bool perfectFitting (bool)
 gets perfect momentum from MC info.
int doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D)
 finds tracks.
 TPerfectFinder (int perfectFitting, float maxSigma, float maxSigmaStereo, unsigned fittingFlag)
 Constructor.
virtual ~TPerfectFinder ()
 Destructor.
std::string name (void) const
 returns name.
std::string version (void) const
 returns version.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
void clear (void)
 clear internal information.
bool perfectFitting (bool)
 gets perfect momentum from MC info.
int doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D)
 finds tracks.
 TPerfectFinder (int perfectFitting, float maxSigma, float maxSigmaStereo, unsigned fittingFlag)
 Constructor.
virtual ~TPerfectFinder ()
 Destructor.
std::string name (void) const
 returns name.
std::string version (void) const
 returns version.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
void clear (void)
 clear internal information.
bool perfectFitting (bool)
 gets perfect momentum from MC info.
int doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D)
 finds tracks.
Public Member Functions inherited from TFinderBase
 TFinderBase ()
 Constructor.
virtual ~TFinderBase ()
 Destructor.
virtual int debugLevel (void) const
 returns debug level.
virtual int debugLevel (int)
 sets debug level.
virtual bool doStereo (bool)
 sets flag to reconstruct 3D.
virtual bool doSalvage (bool)
 sets flag to salvage hits.
 TFinderBase ()
 Constructor.
virtual ~TFinderBase ()
 Destructor.
virtual int debugLevel (void) const
 returns debug level.
virtual int debugLevel (int)
 sets debug level.
virtual bool doStereo (bool)
 sets flag to reconstruct 3D.
virtual bool doSalvage (bool)
 sets flag to salvage hits.
 TFinderBase ()
 Constructor.
virtual ~TFinderBase ()
 Destructor.
virtual int debugLevel (void) const
 returns debug level.
virtual int debugLevel (int)
 sets debug level.
virtual bool doStereo (bool)
 sets flag to reconstruct 3D.
virtual bool doSalvage (bool)
 sets flag to salvage hits.

Detailed Description

A class to find tracks using MC info.

Definition at line 28 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TPerfectFinder.h.

Constructor & Destructor Documentation

◆ TPerfectFinder() [1/3]

TPerfectFinder::TPerfectFinder ( int perfectFitting,
float maxSigma,
float maxSigmaStereo,
unsigned fittingFlag )

Constructor.

Definition at line 21 of file TPerfectFinder.cxx.

23 : _perfectFitting( perfectFitting )
24 , _builder( "conformal builder", maxSigma, maxSigmaStereo, 0, 0, 0, fittingFlag )
25 , _fitter( "helix fitter" ) {}
bool perfectFitting(bool)
gets perfect momentum from MC info.

◆ ~TPerfectFinder() [1/3]

TPerfectFinder::~TPerfectFinder ( )
virtual

Destructor.

Definition at line 27 of file TPerfectFinder.cxx.

27{}

◆ TPerfectFinder() [2/3]

TPerfectFinder::TPerfectFinder ( int perfectFitting,
float maxSigma,
float maxSigmaStereo,
unsigned fittingFlag )

Constructor.

◆ ~TPerfectFinder() [2/3]

virtual TPerfectFinder::~TPerfectFinder ( )
virtual

Destructor.

◆ TPerfectFinder() [3/3]

TPerfectFinder::TPerfectFinder ( int perfectFitting,
float maxSigma,
float maxSigmaStereo,
unsigned fittingFlag )

Constructor.

◆ ~TPerfectFinder() [3/3]

virtual TPerfectFinder::~TPerfectFinder ( )
virtual

Destructor.

Member Function Documentation

◆ clear() [1/3]

void TPerfectFinder::clear ( void )
virtual

clear internal information.

Implements TFinderBase.

Definition at line 182 of file TPerfectFinder.cxx.

182{ HepAListDeleteAll( _links ); }

◆ clear() [2/3]

void TPerfectFinder::clear ( void )
virtual

clear internal information.

Implements TFinderBase.

◆ clear() [3/3]

void TPerfectFinder::clear ( void )
virtual

clear internal information.

Implements TFinderBase.

◆ doit() [1/3]

int TPerfectFinder::doit ( const AList< TMDCWireHit > & axialHits,
const AList< TMDCWireHit > & stereoHits,
AList< TTrack > & tracks,
AList< TTrack > & tracks2D )
virtual

finds tracks.

Implements TFinderBase.

Definition at line 36 of file TPerfectFinder.cxx.

38 {
39
40 //...Preparations...
41 static const HepPoint3D dummy( 0, 0, 0 );
42 CAList<TMDCWireHit> hits;
43 hits.append( axialHits );
44 hits.append( stereoHits );
45
46 //...Make a list of HEP track...
47 CAList<TTrackHEP> heps;
48 const unsigned nHits = hits.length();
49 for ( unsigned i = 0; i < nHits; i++ )
50 {
51 const TMDCWireHitMC* const mc = hits[i]->mc();
52 if ( !mc ) continue;
53 const TTrackHEP* const hep = mc->hep();
54
55 if ( !hep ) continue;
56 heps.append( hep );
57 }
58 heps.purge();
59
60 //...Create tracks...
61 const AList<TMDCWireHitMC>& mcHits = TMDC::getTMDC()->hitsMC();
62 const unsigned nHitsMC = mcHits.length();
63 const unsigned nHeps = heps.length();
64 for ( unsigned i = 0; i < nHeps; i++ )
65 {
66 const TTrackHEP& hep = *heps[i];
67 const float chg = charge( hep.pType() );
68 AList<TMLink> hepLinks;
69 HepPoint3D posIn, posOut;
70 HepVector3D momIn, momOut;
71 float rMin = 99999;
72 float rMax = 0.;
73 TMLink* linkIn = nullptr; // add initialize 25-05-15
74 unsigned lastLayer = 0;
75 for ( unsigned j = 0; j < mcHits.length(); j++ )
76 {
77 const TMDCWireHitMC* const mc = mcHits[j];
78 if ( !mc ) continue;
79 if ( !mc->hit() ) continue;
80 if ( &hep != mc->hep() ) continue;
81 if ( !hits.hasMember( mc->hit() ) ) continue;
82
83 //...Remove hits by curl back...(assuming order of mc hits)
84 if ( mc->wire()->layerId() < lastLayer ) break;
85 lastLayer = mc->wire()->layerId();
86 HepPoint3D ent = mc->entrance();
87 HepVector3D dir = mc->direction();
88 ent.setZ( 0. );
89 dir.setZ( 0. );
90 if ( ( ent.unit() ).dot( dir.unit() ) < 0.5 ) continue;
91
92 //...Hit...
93 TMLink* l = new TMLink( 0, mc->hit(), dummy );
94 l->leftRight( mc->leftRight() );
95 hepLinks.append( l );
96 _links.append( l );
97
98 //...Check r to get MC mom...
99 const float r = ent.mag();
100 if ( r < rMin )
101 {
102 posIn = mc->entrance();
103 momIn = mc->momentum();
104 rMin = r;
105 linkIn = l;
106 }
107 if ( r > rMax )
108 {
109 posOut = mc->entrance();
110 momOut = mc->momentum();
111 rMax = r;
112 }
113 }
114 if ( _links.length() == 0 ) continue;
115
116 //...Do perfect fitting...
117 TTrack* t = 0;
118 // Helix h(posIn, momIn, chg);
119 Helix h( posOut, momOut, chg );
120 // h.pivot(posIn);
121 h.pivot( linkIn->wire()->xyPosition() );
122 t = new TTrack( h );
123 t->append( hepLinks );
124 t->assign( 0 );
125
126 // Helix hX(posOut, momOut, chg);
127
128 // std::cout << " gen@cdc i = " << h.a() << std::endl;
129 // std::cout << " pivot = " << h.pivot() << std::endl;
130 // std::cout << " mom = " << h.momentum() << std::endl;
131 // std::cout << " gen@cdc o = " << hX.a() << std::endl;
132 // std::cout << " pivot = " << hX.pivot() << std::endl;
133 // std::cout << " mom = " << hX.momentum() << std::endl;
134 // std::cout << " momOut = " << momOut << std::endl;
135 // std::cout << " posOut = " << posOut << std::endl;
136 // std::cout << " ptOut = " << momOut.perp() << std::endl;
137 // std::cout << " costhOut = " << momOut.z() / momOut.mag();
138 // std::cout << std::endl;
139
140 if ( _perfectFitting == 0 )
141 {
142 std::cout << "special test in perfect finder" << std::endl;
143 AList<TMLink> tmp;
144 for ( unsigned i = 0; i < t->nLinks(); i++ )
145 {
146 bool rem = false;
147 if ( t->links()[i]->wire()->name() == "0-56" ) rem = true;
148 else if ( t->links()[i]->wire()->name() == "2-56" ) rem = true;
149 else if ( t->links()[i]->wire()->name() == "5-57" ) rem = true;
150 else if ( t->links()[i]->wire()->name() == "6=68" ) rem = true;
151 else if ( t->links()[i]->wire()->name() == "7=69" ) rem = true;
152 else if ( t->links()[i]->wire()->name() == "8=68" ) rem = true;
153 else if ( t->links()[i]->wire()->name() == "10-85" ) rem = true;
154 else if ( t->links()[i]->wire()->name() == "20-126" ) rem = true;
155 else if ( t->links()[i]->wire()->name() == "39-210" ) rem = true;
156 else if ( t->links()[i]->wire()->name() == "41=221" ) rem = true;
157 else if ( t->links()[i]->wire()->name() == "43=221" ) rem = true;
158 else if ( t->links()[i]->wire()->name() == "46-251" ) rem = true;
159 else if ( t->links()[i]->wire()->name() == "48-251" ) rem = true;
160 if ( rem )
161 {
162 std::cout << t->links()[i]->wire()->name() << " removed" << std::endl;
163 tmp.append( *t->links()[i] );
164 }
165 }
166 t->remove( tmp );
167 t->dump( "detail", "@lastHit" );
168 Helix& h = (Helix&)t->helix();
169 h.pivot( HepVector3D( 0., 0., 0. ) );
170 t->dump( "detail", "@origin " );
171 _fitter.fit( *t );
172 t->dump( "detail", "fitted " );
173 static const HepVector3D p0( 1.226, -1.025, 0.120 );
174 std::cout << "Pdif mag=" << ( t->p() - p0 ).mag() << std::endl;
175 }
176
177 tracks.append( t );
178 }
179 return 0;
180}
HepGeom::Vector3D< double > HepVector3D
HepGeom::Point3D< double > HepPoint3D
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 HepVector3D & direction(void) const
returns vector from entrance to exit point.
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
const HepPoint3D & entrance(void) const
returns an entrance point.
const TMDCWireHit *const hit(void) const
returns a pointer to a TMDCWireHit.
unsigned layerId(void) const
returns layer id.
const HepPoint3D & xyPosition(void) const
returns middle position of a wire. z componet is 0.
static TMDC * getTMDC(void)
Definition TMDC.cxx:84
const AList< TMDCWireHitMC > & hitsMC(void) const
int pType(void) const
returns particle type.
int t()
Definition t.c:1

◆ doit() [2/3]

int TPerfectFinder::doit ( const AList< TMDCWireHit > & axialHits,
const AList< TMDCWireHit > & stereoHits,
AList< TTrack > & tracks,
AList< TTrack > & tracks2D )
virtual

finds tracks.

Implements TFinderBase.

◆ doit() [3/3]

int TPerfectFinder::doit ( const AList< TMDCWireHit > & axialHits,
const AList< TMDCWireHit > & stereoHits,
AList< TTrack > & tracks,
AList< TTrack > & tracks2D )
virtual

finds tracks.

Implements TFinderBase.

◆ dump() [1/3]

void TPerfectFinder::dump ( const std::string & message = std::string( "" ),
const std::string & prefix = std::string( "" ) ) const
virtual

dumps debug information.

Reimplemented from TFinderBase.

Definition at line 31 of file TPerfectFinder.cxx.

31 {
32 std::cout << pre;
33 TFinderBase::dump( msg );
34}
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.

◆ dump() [2/3]

void TPerfectFinder::dump ( const std::string & message = std::string(""),
const std::string & prefix = std::string("") ) const
virtual

dumps debug information.

Reimplemented from TFinderBase.

◆ dump() [3/3]

void TPerfectFinder::dump ( const std::string & message = std::string(""),
const std::string & prefix = std::string("") ) const
virtual

dumps debug information.

Reimplemented from TFinderBase.

◆ name() [1/3]

std::string TPerfectFinder::name ( void ) const
inlinevirtual

returns name.

Implements TFinderBase.

Definition at line 84 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TPerfectFinder.h.

84{ return "Perfect Finder"; }

◆ name() [2/3]

std::string TPerfectFinder::name ( void ) const
virtual

returns name.

Implements TFinderBase.

◆ name() [3/3]

std::string TPerfectFinder::name ( void ) const
virtual

returns name.

Implements TFinderBase.

◆ perfectFitting() [1/3]

bool TPerfectFinder::perfectFitting ( bool a)
inline

gets perfect momentum from MC info.

Definition at line 86 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TPerfectFinder.h.

86{ return _perfectFitting = a; }

Referenced by TPerfectFinder().

◆ perfectFitting() [2/3]

bool TPerfectFinder::perfectFitting ( bool )

gets perfect momentum from MC info.

◆ perfectFitting() [3/3]

bool TPerfectFinder::perfectFitting ( bool )

gets perfect momentum from MC info.

◆ version() [1/3]

std::string TPerfectFinder::version ( void ) const
virtual

returns version.

Implements TFinderBase.

Definition at line 29 of file TPerfectFinder.cxx.

29{ return "2.04"; }

◆ version() [2/3]

std::string TPerfectFinder::version ( void ) const
virtual

returns version.

Implements TFinderBase.

◆ version() [3/3]

std::string TPerfectFinder::version ( void ) const
virtual

returns version.

Implements TFinderBase.


The documentation for this class was generated from the following files: