BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcTrackListCsmc Class Reference

#include <MdcTrackListCsmc.h>

+ Inheritance diagram for MdcTrackListCsmc:

Public Member Functions

 MdcTrackListCsmc (const MdcTrackParams &tkPar)
 
 ~MdcTrackListCsmc ()
 
int createFromSegs (MdcSegList *segs, const MdcHitMap *, const MdcDetector *, TrkContext &, double trackT0)
 
int finish3d (TrkRecoTrk &trk)
 
void remove (MdcTrack *atrack)
 
- Public Member Functions inherited from MdcTrackListBase
 MdcTrackListBase (const MdcTrackParams &tkPar)
 
virtual ~MdcTrackListBase ()
 
int nTrack () const
 
void setPlot (int plotFlag)
 
void newParams (const MdcTrackParams &tkPar)
 
void plot () const
 
void store (RecMdcTrackCol *, RecMdcHitCol *)
 
virtual int createFromSegs (MdcSegList *, const MdcHitMap *, const MdcDetector *, TrkContext &, double bunchTime)=0
 
int arbitrateHits ()
 
void dropMultiHotInLayer (const MdcTrack *tk)
 
void remove (MdcTrack *atrack)
 
void setD0Cut (double d0Cut)
 
void setZ0Cut (double z0Cut)
 
void setPtCut (double ptCut)
 

Additional Inherited Members

- Static Public Attributes inherited from MdcTrackListBase
static double m_d0Cut = -999.
 
static double m_z0Cut = -999.
 
static double m_ptCut = -999.
 
- Protected Attributes inherited from MdcTrackListBase
MdcTrackParams tkParam
 

Detailed Description

Definition at line 30 of file MdcTrackListCsmc.h.

Constructor & Destructor Documentation

◆ MdcTrackListCsmc()

MdcTrackListCsmc::MdcTrackListCsmc ( const MdcTrackParams tkPar)

Definition at line 34 of file MdcTrackListCsmc.cxx.

34 :
35 MdcTrackListBase(tkPar) {
36// *************************************************************************
37 return;
38 }

◆ ~MdcTrackListCsmc()

MdcTrackListCsmc::~MdcTrackListCsmc ( )

Definition at line 41 of file MdcTrackListCsmc.cxx.

41{}

Member Function Documentation

◆ createFromSegs()

int MdcTrackListCsmc::createFromSegs ( MdcSegList segs,
const MdcHitMap ,
const MdcDetector gm,
TrkContext context,
double  trackT0 
)
virtual

Implements MdcTrackListBase.

Definition at line 45 of file MdcTrackListCsmc.cxx.

47 {
48// *************************************************************************
49 // Forms tracks out of list of superlayer segments
50 int nTracks = 0;
51 // Create empty list of stereo segs (to save time)
52 MdcSegGrouperSt stereoSegs(gm,tkParam.lPrint);
53 // *** Create r-phi track
54
55 // Create list of axial segments, treated as on straight tracks
56 MdcSegGrouperCsmc straightSegs(gm, tkParam.lPrint);
57 straightSegs.fillWithSegs(segs);
58 //std::cout<< "after straight fill " << std::endl;
59 //segs->plot();//yzhang debug
60 MdcSeg *seed;
61 int goodOnly = 1;
62 MdcTrack* trialTrack = 0;
63 while (1) {
64 seed = segs->getSeed(0,goodOnly);
65 if (seed == 0 && goodOnly == 1) {
66 segs->resetSeed(gm);
67 goodOnly = 0;
68 continue;
69 }
70 else if (seed == 0 && goodOnly == 0) {
71 break;
72 }
73 delete trialTrack;
74 trialTrack = 0;
75 int success = straightSegs.combineSegs(trialTrack, seed,
76 context, t0, tkParam.maxSegChisqO);
77 if (!success) {
78 //std::cout<< " MdcTrackListCsmc::combineSegs not successed!" << std::endl;
79 continue;
80 }
81
82 if (tkParam.lPrint > 1) {
83 trialTrack->track().printAll(cout);
84 }
85 // *** End r-phi track-finding
86
87 // *** Add stereo to taste
88 stereoSegs.fillWithSegs(segs, trialTrack);
89
90 success = stereoSegs.combineSegs(trialTrack, 0, context, t0,
92 if (success) {
93 // Finish 3-d track;
94 success = finish3d(trialTrack->track());
95 // success = finish3d(trialTrack->track()); // GSciolla: try to repeat
96 }
97 if (!success) {
98 //std::cout<< " MdcTrackListCsmc::finish3d not successed!" << std::endl;
99 continue;
100 }
101
102 if (tkParam.lPrint > 1) {
103 trialTrack->track().printAll(cout);
104 }
105
106 nTracks++;
107 append(trialTrack); // Add to list of Tracks
108 trialTrack = 0;
109
110 } // end while(1)
111 delete trialTrack;
112
113
114 //cout << " Number of Tracks found= " << nTracks ;
115 //cout << " " << endl;
116 return nTracks;
117}
MdcSeg * getSeed(int iview, int goodOnly)
Definition: MdcSegList.cxx:139
void resetSeed(const MdcDetector *gm)
Definition: MdcSegList.cxx:57
Definition: MdcSeg.h:42
MdcTrackParams tkParam
int finish3d(TrkRecoTrk &trk)
TrkRecoTrk & track()
Definition: MdcTrack.h:27
virtual void printAll(std::ostream &) const
Definition: TrkRecoTrk.cxx:195
char * append(const char *str, EvtCyclic3::Index i)
Definition: EvtCyclic3.cc:284

◆ finish3d()

int MdcTrackListCsmc::finish3d ( TrkRecoTrk trk)

Definition at line 120 of file MdcTrackListCsmc.cxx.

120 {
121// ************************************************************************
122 int success = 0;
123 int nParamFit = 0 ;
124
125 TrkErrCode fitResult;
126
127 // ------------------------
128 // 4 param fit (line)
129 // ------------------------
130 nParamFit = 4;
131 TrkLineMaker makeFit;
132 makeFit.changeFit(trk);
133 makeFit.setFlipAndDrop(trk, true, true);
134 //setCosmic(&trk); // set hot to cosmics OBSOLETE! REMOVE!
135 fitResult = trk.hits()->fit();
136 makeFit.setFlipAndDrop(trk, false, false);
137
138 // ---------------------------------------------------------------
139 // Are there some TDC that can be replaced with later measurements? ( beginning)
140 // ---------------------------------------------------------------
141 // Note to Sciolla: multiple hits commented out for now OK! I will put it back later...
142 /* if( _flags.useMultipleHits ) {
143 int NHITS = trk.nHit();
144
145 if (fitResult.success()) {
146 int ifirst = 0;
147 for (int ihot = 0; ihot < NHITS ; ihot++) {
148
149 MdcHitOnTrack* ahot = (MdcHitOnTrack*)trk.hitAList()[ihot];
150 double firstTime = ahot->mdcHit()->rawTime(0);
151
152 // Get the list of times for this Digi
153 const MdcDigi* tmpDigi = ahot->mdcHit()->digi() ;
154// int nTDChits = tmpDigi->getTdcTimeAList()->length() ;
155 int nTDChits = tmpDigi->tmdcits() ;
156
157 double newTime=0. ;
158
159 for( int il = 1; il<nTDChits ; il++){
160
161 // get the time corresponding to this doca ---> distance to time
162 newTime = tmpDigi->TdcTime(il);
163 double newDrift = ahot->layer()->timeToDistance(newTime);
164
165 double tmp_doca = ahot->dcaToWire();
166 double new_diff = fabs(fabs(tmp_doca)-fabs(newDrift));
167 double tmp_drift = ahot->drift();
168 double tmp_drift2 =
169 ahot->layer()->timeToDistance(tmpDigi->TdcTime(0));
170 double old_diff = fabs(fabs(tmp_doca)-fabs(tmp_drift2));
171
172 if( ((old_diff-new_diff)>0.1) // new time better then old of at least 1 mm
173 && (new_diff<=0.8) ) { // and newresid < 2 mm
174 // if(_flags.debug) {
175 if(1) {
176
177 if(ifirst==0) {
178 ifirst = 1 ;
179 cout <<" nHits | time1 |fittim | time2 | doca(mm) | drift1 "
180 <<" drift1(rec) | drift2 | layer | wire | isActive"
181 << " | chi2 | nactive" << endl;
182 }
183
184 int isAct = 1 ;
185 if (!ahot->isActive()) {
186 isAct = 0 ;
187 // cout<< " >> " ;
188 // cout << "This hit is not active " << endl ;
189 }
190
191 cout << " " << nTDChits
192 << " " << tmpDigi->TdcTime(0)
193 << " " << ahot->fitTime()
194 << " " << newTime
195 << " " << tmp_doca*10
196 << " " << tmp_drift*10
197 << " " << tmp_drift2*10
198 << " " << newDrift*10
199 << " " << ahot->layer()->layNum()
200 << " " << ahot->wire()
201 << " " << isAct
202 << " " << trk.chisq()
203 << " " << trk.nActive()
204 << endl;
205
206 cout << " old/new diff (mm) = " << old_diff*10
207 << " | " << new_diff*10
208 << endl ;
209 }
210
211 ahot->setTimeIndex(il) ;
212 // cout << "new rawtime ="
213 // << ahot->mdcHit()->rawTime(0)<< endl ; // check the new value
214
215
216 // store results in ntuple to see improvements ... before ...
217 HepTuple* tupleMultHits = _manager->ntuple("multiHits");
218
219 tupleMultHits->column("ch2Dof1", trk.chisq()/(trk.nActive() - 4));
220 tupleMultHits->column("nActiv1", trk.nActive());
221 tupleMultHits->column("resid1",ahot->resid());
222 tupleMultHits->column("doca1",ahot->resid()+ahot->drift());
223 tupleMultHits->column("time1", ahot->fitTime() );
224 tupleMultHits->column("rawtime1", ahot->mdcHit()->rawTime(il) );
225
226 // - make the hit active and usable
227 ahot->setActivity(true);
228
229 // now refit the track ...
230 fitResult = trk.fit();
231
232 // store results in ntuple to see improvements ... after ...
233 tupleMultHits->column("ch2Dof2", trk.chisq()/(trk.nActive() - 4));
234 tupleMultHits->column("nActiv2", trk.nActive());
235 tupleMultHits->column("resid2",ahot->resid());
236 tupleMultHits->column("doca2",ahot->resid()+ahot->drift());
237 tupleMultHits->column("time2", ahot->fitTime() );
238 tupleMultHits->column("rawtime2", ahot->mdcHit()->rawTime(il) );
239 tupleMultHits->dumpData();
240 }
241 }
242 }
243 }
244 } // Are there some TDC that can be replaced with later measurements? (end)
245 */
246
247 const TrkFit* tkFit = trk.fitResult();
248 double chisqperDOF = 0.;
249 if (fitResult.success()) {
250 int nDOF = tkFit->nActive() - nParamFit;
251 if (nDOF > nParamFit)
252 chisqperDOF = tkFit->chisq() / nDOF;
253 else
254 chisqperDOF = tkFit->chisq();
255 int goodMatch = 1;
256 if (chisqperDOF > tkParam.maxChisq) goodMatch = 0;
257 if (tkFit->nActive() < tkParam.minHits) goodMatch = 0;
258
259 if (goodMatch) success = 1;
260 }
261
262 return success;
263}
virtual double chisq() const =0
int success() const
Definition: TrkErrCode.h:62
Definition: TrkFit.h:23
virtual int nActive() const =0
TrkErrCode fit()
Definition: TrkHitList.cxx:59
TrkHitList * hits()
Definition: TrkRecoTrk.h:107
const TrkFit * fitResult() const
Definition: TrkRecoTrk.cxx:387
bool setFlipAndDrop(TrkRecoTrk &, bool allowFlips, bool allowDrops) const
virtual void changeFit(TrkRecoTrk &theTrack) const

Referenced by createFromSegs().

◆ remove()

void MdcTrackListCsmc::remove ( MdcTrack atrack)

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