BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
TConformalFinder Class Reference

A class to find tracks with the conformal method. More...

#include <TConformalFinder.h>

+ Inheritance diagram for TConformalFinder:

Public Member Functions

 TConformalFinder (unsigned fastFinder, unsigned slowFinder, unsigned perfectSegmentFinding, float maxSigma, float maxSigmaStereo, float salvageLevel, unsigned minNLinksForSegment, unsigned minNCoreLinks, unsigned minNSegments, unsigned salvageLoadWidth, unsigned stereoMode, unsigned stereoLoadWidth, float szSegmentDistance, float szLinkDistance, unsigned fittingFlag)
 Constructor.
 
virtual ~TConformalFinder ()
 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.
 
bool T0ResetDone (void) const
 returns T0 reset is done.
 
void clear (void)
 clear internal information.
 
int doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D)
 finds tracks.
 
bool doT0Reset (bool)
 sets a flag to do T0 reset in the fast 2D finding.
 
- 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).
 

Static Public Member Functions

static const TMDCWireconformal2Wire (const HepPoint3D &conformalPoint)
 

Detailed Description

A class to find tracks with the conformal method.

Definition at line 46 of file TConformalFinder.h.

Constructor & Destructor Documentation

◆ TConformalFinder()

TConformalFinder::TConformalFinder ( unsigned  fastFinder,
unsigned  slowFinder,
unsigned  perfectSegmentFinding,
float  maxSigma,
float  maxSigmaStereo,
float  salvageLevel,
unsigned  minNLinksForSegment,
unsigned  minNCoreLinks,
unsigned  minNSegments,
unsigned  salvageLoadWidth,
unsigned  stereoMode,
unsigned  stereoLoadWidth,
float  szSegmentDistance,
float  szLinkDistance,
unsigned  fittingFlag 
)

Constructor.

Definition at line 59 of file TConformalFinder.cxx.

74: _fastFinder(fastFinder),
75 _slowFinder(slowFinder),
76 _doT0Reset(false),
77 _perfectSegmentFinding(perfectSegmentFinding),
78 _segmentSeparation(4),
79 _minNLinksForSegment(minNLinksForSegment),
80 _minNLinksForSegmentInRefine(2), //3, 20060307
81 _maxNLinksForSegment(8),
82 _maxWidthForSegment(4),
83 _minNCoreLinks(minNCoreLinks),
84 _minNSegments(minNSegments),
85 _minUsedFractionSlow2D(0.5),
86 _salvageLoadWidth(salvageLoadWidth),
87 _stereoMode(stereoMode),
88 _stereoLoadWidth(stereoLoadWidth),
89 _appendLoad(2),
90 _maxSigma2(maxSigma),
91 _T0ResetDone(false),
92 _builder("conformal builder",
93 maxSigma,
94 maxSigmaStereo,
95 salvageLevel,
96 szSegmentDistance,
97 szLinkDistance,
98 fittingFlag),
99 _s(0)
100#ifdef TRKRECO_WINDOW
101 , _rphiWindow("rphi window")
102#endif
103{
104 _linkMaxDistance[0] = 0.02;
105 _linkMaxDistance[1] = 0.025;
106 _linkMaxDistance[2] = 0.025;
107 _linkMinDirAngle[0] = 0.97; //0.98
108 _linkMinDirAngle[1] = 0.95; //0.97
109 _linkMinDirAngle[2] = 0.95; //0.97
110 // BASF_Sharedmem->allocate("TrkConfSum", sizeof(struct summary));
111
112 //yzhang add 2012-05-03
113 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
114 if(scmgn!=StatusCode::SUCCESS) {
115 std::cout<< __FILE__<<"Unable to open Magnetic field service"<<std::endl;
116 }
117}

◆ ~TConformalFinder()

TConformalFinder::~TConformalFinder ( )
virtual

Destructor.

Definition at line 119 of file TConformalFinder.cxx.

119 {
120}

Member Function Documentation

◆ clear()

void TConformalFinder::clear ( void  )
virtual

clear internal information.

Implements TFinderBase.

Definition at line 173 of file TConformalFinder.cxx.

173 {
174 for (unsigned i = 0; i < 3; i++) {
175 if (i == 2)
176 HepAListDeleteAll(_allHits[i]);
177 else
178 _allHits[i].removeAll();
179 _hits[i].removeAll();
180 _unused[i].removeAll();
181 }
182 for (unsigned i = 0; i < 2; i++) {
183 for (unsigned j = 0; j < 6; j++) {
184#ifdef TRKRECO_DEBUG_DETAIL
185 cout<<"_allSegments length = "<<_allSegments[i][j].length()<<" _allUnused length = "<<_allUnused[i][j].length()<<endl;
186#endif
187 HepAListDeleteAll(_allSegments[i][j]);
188 _allUnused[i][j].removeAll();
189 }
190 }
191 _2DTracks.removeAll();
192 _3DTracks.removeAll();
193}

◆ conformal2Wire()

const TMDCWire * TConformalFinder::conformal2Wire ( const HepPoint3D conformalPoint)
static

Definition at line 1529 of file TConformalFinder.cxx.

1529 {
1530 static const TMDC & cdc = * TMDC::getTMDC();
1531
1532 std::cout << "p = " << p << std::endl;
1533 float r = sqrt(4. / p.mag2());
1534 float phi = p.phi();
1535 return cdc.wire(r, phi);
1536}
Definition: TMDC.h:61
const TMDCWire *const wire(unsigned wireId) const
returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.
Definition: TMDC.h:277
static TMDC * getTMDC(void)
Definition: TMDC.cxx:95

◆ doit()

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

finds tracks.

Implements TFinderBase.

Definition at line 806 of file TConformalFinder.cxx.

809 {
810#ifdef TRKRECO_DEBUG
811 _stage = ConformalInitialization;
812#endif
813
814 static bool first = true;
815 if (first) {
816 first = false;
817 int size;
818// _s = (struct summary *)
819// BASF_Sharedmem->get_pointer(BASF_Sharedmem->get_id(),
820// "TrkConfSum",
821// & size);
822 }
823
824 //...For debug...
825 if (debugLevel()) {
826 std::cout << name() << " ... processing"
827 << " axial=" << axial.length()
828 << ",stereo=" << stereo.length()
829 << ",tracks=" << tracks.length()
830 << std::endl;
831 }
832
833 //...Create TMLinks with conformal position...
834// TConformalFinder0::conformalTransformation(ORIGIN, axial, _allHits[0]);
835// TConformalFinder0::conformalTransformation(ORIGIN, stereo, _allHits[1]);
836 // for Tsf
839 _allHits[2].append(_allHits[0]);
840 _allHits[2].append(_allHits[1]);
841
842 //...Select good hits...
843 selectGoodHits();
844#ifdef TRKRECO_DEBUG
845 cout<<"axial Hits:"<<_allHits[0].length()<<" good axial hits:"<<_hits[0].length()
846 <<endl<<"stereo Hits:"<<_allHits[1].length()<<" good setero hits:"<<_hits[1].length()
847 <<endl;
848#endif
849
850 //...Segment finding...
851 if (_perfectSegmentFinding)
852 findSegmentsPerfect();
853 else
854// findSegments();
855 findSegmentsTsf();
856
857#ifdef TRKRECO_DEBUG
858 cout<<"axial Seg: "<<_allSegments[0][0].length()<<", "<<_allSegments[0][1].length()
859 <<", "<<_allSegments[0][2].length()<<", "<<_allSegments[0][3].length()
860 <<", "<<_allSegments[0][4].length()<<", "<<_allSegments[0][5].length()
861 <<" stereo Seg: "<<_allSegments[1][0].length()<<", "<<_allSegments[1][1].length()
862 <<", "<<_allSegments[1][2].length()<<", "<<_allSegments[1][3].length()
863 <<", "<<_allSegments[1][4].length()<<", "<<_allSegments[1][5].length()<<endl;
864
865 for(int i=0; i<2; ++i) {
866 if (i == 0) cout<<"Axial......"<<endl;
867 else cout<<"Stereo......"<<endl;
868 for(int j=0; j<6; ++j) {
869 for(int k=0; k<_allSegments[i][j].length(); ++k){
870 cout<<"SL(a/s): "<<j<<" seeds in Seg"<<k<<": "<<_allSegments[i][j][k]->links().length()<<endl;
871 for(int kk=0; kk<_allSegments[i][j][k]->links().length(); ++kk)
872 cout<<" layerId: "<<_allSegments[i][j][k]->links()[kk]->hit()->wire()->layerId()
873 <<" localId: "<<_allSegments[i][j][k]->links()[kk]->hit()->wire()->localId()<<endl;
874 }
875 }
876 }
877#endif
878
879 //...Fast finding...
880 unsigned level = 0;
881 _T0ResetDone = false;
882 if (_fastFinder) {
883 linkSegments(level);
884 fastFinding2D(level);
885 updateTLinks(_2DTracks);
886
887 //...T0 reset here...
888 if (_doT0Reset) {
889 std::cout << "TConformalFinder ... T0 reset is done" << std::endl;
890 _T0ResetDone = true;
891 return 0;
892 }
893
894#ifdef TRKRECO_WINDOW
895 _rphiWindow.skip(false);
896#endif
897 fastFinding3D(level);
898 updateTLinks(_2DTracks);
899 updateTLinks(_3DTracks);
900
901#ifdef TRKRECO_WINDOW
902 _rphiWindow.skip(false);
903 displayTracks(_2DTracks, _allUnused, "all 2D after fast level 0");
904 displayTracks(_3DTracks, _allUnused, "all 3D after fast level 0");
905#endif // TRKRECO_WINDOW
906
907
908 //...Fast finding again...
909 level = 1;
910 linkSegments(level);
911 fastFinding2D(level);
912 updateTLinks(_2DTracks);
913
914#ifdef TRKRECO_WINDOW
915 _rphiWindow.skip(false);
916#endif
917 fastFinding3D(level);
918 updateTLinks(_2DTracks);
919 updateTLinks(_3DTracks);
920
921#ifdef TRKRECO_WINDOW
922 _rphiWindow.skip(false);
923 displayTracks(_2DTracks, _allUnused, "all 2D after fast level 1");
924 displayTracks(_3DTracks, _allUnused, "all 3D after fast level 1");
925#endif //TRKRECO_WINDOW
926 }
927
928 //...Slow finding...
929 if (_slowFinder) {
930 level = 2;
931 linkSegments(level);
932 slowFinding2D(level);
933 updateTLinks(_2DTracks);
934#ifdef TRKRECO_WINDOW
935 _rphiWindow.skip(false);
936// _rphiWindow.skipAllWindow(false);
937#endif
938 fastFinding3D(level);
939 updateTLinks(_2DTracks);
940 updateTLinks(_3DTracks);
941
942#ifdef TRKRECO_WINDOW
943 _rphiWindow.skip(false);
944// _rphiWindow.skipAllWindow(false);
945 displayTracks(_2DTracks, _allUnused, "all 2D after slow level 2");
946 displayTracks(_3DTracks, _allUnused, "all 3D after slow level 2");
947#endif //TRKRECO_WINDOW
948 }
949
950#ifdef TRKRECO_DEBUG
951 int zsltrk = _2DTracks.length();
952 std::cout << name() << " ... # 3D tracks = " << _3DTracks.length()
953 << ", # 2D tracks = " << _2DTracks.length() << std::endl;
954 for (unsigned i = 0; i < zsltrk; i++){
955// _2DTracks[i]->dump();
956 cout<<"pt:"<<_2DTracks[i]->pt()<<" impact:"<<_2DTracks[i]->impact()<<endl;
957 // nTrack->fill(0., 1.0);
958 }
959#endif
960
961 //...Mask hits with bad chisq...
962 TTrackManager::maskBadHits(_3DTracks, _maxSigma2);
963
964 tracks2D = _2DTracks;
965 tracks = _3DTracks;
966 for(int i=0;i<_3DTracks.length();i++){
967 _3DTracks[i]->finder(TrackOldConformalFinder);
968 _3DTracks[i]->setFinderType(2);
969 }
970#ifdef TRKRECO_DEBUG
971// if (_3DTracks.length() == 0) {
972// cout<<"3D failed: 2D length = "<<_2DTracks.length()<<endl;
973 for(int nn = 0; nn < tracks2D.length(); ++nn){
974 cout<<"2D: "<<nn<<" radius: "<<tracks2D[nn]->radius()<<endl;
975 for (int mm = 0; mm < tracks2D[nn]->links().length(); ++mm)
976 cout<<"layer: "<<tracks2D[nn]->links()[mm]->wire()->layerId()
977 <<" local: "<<tracks2D[nn]->links()[mm]->wire()->localId()<<endl;
978 }
979
980 cout<<"unused axial Seg: "<<_allUnused[0][0].length()<<", "<<_allUnused[0][1].length()
981 <<", "<<_allUnused[0][2].length()<<", "<<_allUnused[0][3].length()
982 <<", "<<_allUnused[0][4].length()<<", "<<_allUnused[0][5].length()
983 <<" unused stereo Seg: "<<_allUnused[1][0].length()<<", "<<_allUnused[1][1].length()
984 <<", "<<_allUnused[1][2].length()<<", "<<_allUnused[1][3].length()
985 <<", "<<_allUnused[1][4].length()<<", "<<_allUnused[1][5].length()
986 <<endl;
987
988 for(int i=0; i<2; ++i) {
989 if (i == 0) cout<<"unused axial hits: "<<endl;
990 else cout<<"unused stereo hits: "<<endl;
991 for(int k = 0; k < _allHits[i].length(); ++k) {
992 if (_allHits[i][k]->hit()->state() & WireHitUsed) continue;
993 else cout<<" layerId: "<<_allHits[i][k]->hit()->wire()->layerId()
994 <<" localId: "<<_allHits[i][k]->hit()->wire()->localId()<<endl;
995 }
996 if (i == 0) cout<<"unused axial link in segs: "<<endl;
997 else cout<<"unused stereo link in segs: "<<endl;
998 for(int j=0; j<6; ++j) {
999 for(int k=0; k<_allUnused[i][j].length(); ++k){
1000 cout<<"sl: "<<i<<" "<<j<<" length of seg "<<k<<": "<<_allUnused[i][j][k]->links().length()<<endl;
1001 for(int kk=0; kk<_allUnused[i][j][k]->links().length(); ++kk)
1002 cout<<" layerId: "<<_allUnused[i][j][k]->links()[kk]->hit()->wire()->layerId()
1003 <<" localId: "<<_allUnused[i][j][k]->links()[kk]->hit()->wire()->localId()<<endl;
1004 }
1005 }
1006 }
1007// }
1008#endif
1009
1010 //...Termination...
1011/* tracks = _3DTracks;
1012 tracks2D = _2DTracks;
1013 ++_s->_nEvents;
1014 unsigned n3 = _3DTracks.length();
1015 for (unsigned i = 0; i < n3; i++)
1016 if (_3DTracks[i]->finder() & TrackFastFinder)
1017 ++_s->_nTracksFast3D;
1018 else if (_3DTracks[i]->finder() & TrackSlowFinder)
1019 ++_s->_nTracksSlow3D;
1020 unsigned n2 = _2DTracks.length();
1021 for (unsigned i = 0; i < n2; i++)
1022 if (_2DTracks[i]->finder() & TrackFastFinder)
1023 ++_s->_nTracksFast2D;
1024 else if (_2DTracks[i]->finder() & TrackSlowFinder)
1025 ++_s->_nTracksSlow2D;
1026
1027 if (debugLevel()) {
1028 std::cout << name() << " ... # 3D tracks = " << _3DTracks.length()
1029 << ", # 2D tracks = " << _2DTracks.length() << std::endl;
1030 }
1031
1032#ifdef TRKRECO_DEBUG
1033 _stage = ConformalOutside;
1034#endif
1035*/
1036 return 0;
1037}
const HepPoint3D ORIGIN
Constants.
Definition: TMDCUtil.cxx:47
#define WireHitUsed
Definition: TMDCWireHit.h:47
#define TrackOldConformalFinder
Definition: TTrack.h:23
static void conformalTransformationDriftCircle(const HepPoint3D &center, const AList< TMDCWireHit > &hits, AList< TMLink > &links)
transforms drift circle of hits into a conformal plane. transformed positions( x0,...
std::string name(void) const
returns name.
virtual int debugLevel(void) const
returns debug level.
Definition: TFinderBase.h:90
static void maskBadHits(const AList< TTrack > &, float maxSigma2)
masks hits with large chisq as associated hits. Pull in TMLink is used.
Index first(Pair i)
Definition: EvtCyclic3.cc:195

◆ doT0Reset()

bool TConformalFinder::doT0Reset ( bool  a)
inline

sets a flag to do T0 reset in the fast 2D finding.

Definition at line 268 of file TConformalFinder.h.

268 {
269 return _doT0Reset = a;
270}

◆ dump()

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

dumps debug information.

Reimplemented from TFinderBase.

Definition at line 123 of file TConformalFinder.cxx.

123 {
124 if (msg.find("state") != std::string::npos) {
125 std::cout << pre;
127 std::cout << pre;
128 std::cout << "#axial=" << _hits[0].length();
129 std::cout << ",#stereo=" << _hits[1].length();
130 }
131 if (msg.find("summary") != std::string::npos || msg.find("detail") != std::string::npos) {
132/* struct summary s;
133 // bzero((char *) & s, sizeof(struct summary));
134 memset((char *) & s, 0, sizeof(struct summary));
135 for (int i = 0; i < BASF_Sharedmem->nprocess(); i++) {
136 int size;
137 struct summary & r = * (struct summary *)
138 BASF_Sharedmem->get_pointer(i, "TrkConfSum", & size);
139 s._nEvents += r._nEvents;
140 s._nTracksFast3D += r._nTracksFast3D;
141 s._nTracksSlow3D += r._nTracksSlow3D;
142 s._nTracksFast2D += r._nTracksFast2D;
143 s._nTracksSlow2D += r._nTracksSlow2D;
144 s._nTracksFast2DBadQuality += r._nTracksFast2DBadQuality;
145 s._nTracksSlow2DBadQuality += r._nTracksSlow2DBadQuality;
146 }
147
148 std::cout << pre
149 << "all events : " << s._nEvents << std::endl;
150 std::cout << pre
151 << "fast 3D tracks : "
152 << s._nTracksFast3D << std::endl;
153 std::cout << pre
154 << "fast 2D tracks(line failed) : "
155 << s._nTracksFast2D << std::endl;
156 std::cout << pre
157 << "fast 2D tracks(3D failed) : "
158 << s._nTracksFast2DBadQuality << std::endl;
159 std::cout << pre
160 << "slow 3D tracks : "
161 << s._nTracksSlow3D << std::endl;
162 std::cout << pre
163 << "slow 2D tracks(line failed) : "
164 << s._nTracksSlow2D << std::endl;
165 std::cout << pre
166 << "slow 2D tracks(3D failed) : "
167 << s._nTracksSlow2DBadQuality << std::endl;
168*/
169 }
170}
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TFinderBase.cxx:23

◆ name()

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

returns name.

Implements TFinderBase.

Definition at line 262 of file TConformalFinder.h.

262 {
263 return "Conformal Finder";
264}

Referenced by doit().

◆ T0ResetDone()

bool TConformalFinder::T0ResetDone ( void  ) const
inline

returns T0 reset is done.

Definition at line 274 of file TConformalFinder.h.

274 {
275 return _T0ResetDone;
276}

◆ version()

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

returns version.

Implements TFinderBase.

Definition at line 55 of file TConformalFinder.cxx.

55 {
56 return "3.03";
57}

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