BOSS 7.0.2
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.
 
- Public Member Functions inherited from TFinderBase
 TFinderBase ()
 Constructor.
 
virtual ~TFinderBase ()
 Destructor.
 
virtual std::string name (void) const =0
 returns name.
 
virtual std::string version (void) const =0
 returns version.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
virtual int debugLevel (void) const
 returns debug level.
 
virtual void clear (void)=0
 clear internal information.
 
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.
 
virtual int doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks3D, AList< TTrack > &tracks2D)=0
 finds tracks. 'hits' are used to reconstruct. 'tracks' can be used for both inputs and outputs. Return value = (0, +, -) means (success, warning, fatal error).
 
 TFinderBase ()
 Constructor.
 
virtual ~TFinderBase ()
 Destructor.
 
virtual std::string name (void) const =0
 returns name.
 
virtual std::string version (void) const =0
 returns version.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
virtual int debugLevel (void) const
 returns debug level.
 
virtual void clear (void)=0
 clear internal information.
 
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.
 
virtual int doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks3D, AList< TTrack > &tracks2D)=0
 finds tracks. 'hits' are used to reconstruct. 'tracks' can be used for both inputs and outputs. Return value = (0, +, -) means (success, warning, fatal error).
 

Detailed Description

A class to find tracks using MC info.

Definition at line 28 of file InstallArea/include/TrkReco/TrkReco/TPerfectFinder.h.

Constructor & Destructor Documentation

◆ TPerfectFinder() [1/2]

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

Constructor.

Definition at line 21 of file TPerfectFinder.cxx.

25: _perfectFitting(perfectFitting),
26 _builder("conformal builder",
27 maxSigma,
28 maxSigmaStereo,
29 0,
30 0,
31 0,
32 fittingFlag),
33 _fitter("helix fitter") {
34}
bool perfectFitting(bool)
gets perfect momentum from MC info.

◆ ~TPerfectFinder() [1/2]

TPerfectFinder::~TPerfectFinder ( )
virtual

Destructor.

Definition at line 36 of file TPerfectFinder.cxx.

36 {
37}

◆ TPerfectFinder() [2/2]

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

Constructor.

◆ ~TPerfectFinder() [2/2]

virtual TPerfectFinder::~TPerfectFinder ( )
virtual

Destructor.

Member Function Documentation

◆ clear() [1/2]

void TPerfectFinder::clear ( void  )
virtual

clear internal information.

Implements TFinderBase.

Definition at line 204 of file TPerfectFinder.cxx.

204 {
205 HepAListDeleteAll(_links);
206}

◆ clear() [2/2]

void TPerfectFinder::clear ( void  )
virtual

clear internal information.

Implements TFinderBase.

◆ doit() [1/2]

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 51 of file TPerfectFinder.cxx.

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

◆ doit() [2/2]

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

finds tracks.

Implements TFinderBase.

◆ dump() [1/2]

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 45 of file TPerfectFinder.cxx.

45 {
46 std::cout << pre;
48}
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TFinderBase.cxx:23

◆ dump() [2/2]

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/2]

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

returns name.

Implements TFinderBase.

Definition at line 90 of file InstallArea/include/TrkReco/TrkReco/TPerfectFinder.h.

90 {
91 return "Perfect Finder";
92}

◆ name() [2/2]

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

returns name.

Implements TFinderBase.

◆ perfectFitting() [1/2]

bool TPerfectFinder::perfectFitting ( bool  a)
inline

gets perfect momentum from MC info.

Definition at line 96 of file InstallArea/include/TrkReco/TrkReco/TPerfectFinder.h.

96 {
97 return _perfectFitting = a;
98}

◆ perfectFitting() [2/2]

bool TPerfectFinder::perfectFitting ( bool  )

gets perfect momentum from MC info.

◆ version() [1/2]

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

returns version.

Implements TFinderBase.

Definition at line 40 of file TPerfectFinder.cxx.

40 {
41 return "2.04";
42}

◆ version() [2/2]

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

returns version.

Implements TFinderBase.


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