BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcSegGrouperAx Class Reference

#include <MdcSegGrouperAx.h>

+ Inheritance diagram for MdcSegGrouperAx:

Public Member Functions

 MdcSegGrouperAx (const MdcDetector *gm, int debug)
 
 ~MdcSegGrouperAx ()
 
void fillWithSegs (const MdcSegList *inSegs)
 
virtual int incompWithSeg (const MdcSeg *refSeg, const MdcSeg *testSeg)
 
virtual int incompWithGroup (MdcSeg **segGroup, const MdcSeg *testSeg, int iply)
 
void resetComb (const MdcSeg *seed)
 
virtual MdcTrackstorePar (MdcTrack *, double parms[2], double chisq, TrkContext &, double trackT0)
 
- Public Member Functions inherited from MdcSegGrouper
virtual ~MdcSegGrouper ()
 
int nextGroup (MdcSeg **segGroup, bool printit)
 
int updateGap ()
 
void resetGap (int nGap)
 
int nPly () const
 
int combineSegs (MdcTrack *&, MdcSeg *seed, TrkContext &, double trackT0, double maxSegChisqO, int combineByFitHits=0)
 
void transferHits (MdcTrack *track, int nSegs, MdcSeg **segGroup)
 
void dumpSegList ()
 
double calcParBySegs (MdcSeg **segGroup, double seedAngle[2], int nToUse, double &qual, int &nSegFit, double param[2])
 
double calcParByHits (MdcSeg **segGroup, int nToUse, const TrkExchangePar &par, double &qual, int &nSegFit, double param[2], double Bz)
 
void setNoInner (bool noInnerFlag)
 

Additional Inherited Members

- Protected Member Functions inherited from MdcSegGrouper
 MdcSegGrouper (const MdcDetector *gm, int nDeep, int debug)
 
void resetSegCounters ()
 
- Protected Attributes inherited from MdcSegGrouper
int nDeep
 
int nPlyFilled
 
int * currentSeg
 
int * firstGood
 
int * firstBad
 
bool ** isValid
 
HepAList< MdcSeg > ** combList
 
const MdcDetector_gm
 
HepAList< MdcSeg > * segList
 
boolleaveGap
 
int nNull
 
int maxNull
 
int * gapCounter
 
bool lTestGroup
 
bool lTestSingle
 
int _debug
 
bool _noInner
 

Detailed Description

Definition at line 29 of file MdcSegGrouperAx.h.

Constructor & Destructor Documentation

◆ MdcSegGrouperAx()

MdcSegGrouperAx::MdcSegGrouperAx ( const MdcDetector * gm,
int debug )

Definition at line 60 of file MdcSegGrouperAx.cxx.

60 :
61 MdcSegGrouper(gm, gm->nAxialSuper() - 1, debug) {
62//------------------------------------------------------------------------
63 lTestGroup = false;
64 lTestSingle = true;
65
66 isValid = new bool * [nPly()];
67 for (int j = 0; j < nPly(); j++) {
68 isValid[j] = 0;
69 }
70}
int nAxialSuper(void) const
Definition MdcDetector.h:55
MdcSegGrouper(const MdcDetector *gm, int nDeep, int debug)
int nPly() const

◆ ~MdcSegGrouperAx()

MdcSegGrouperAx::~MdcSegGrouperAx ( )
inline

Definition at line 33 of file MdcSegGrouperAx.h.

33{ };

Member Function Documentation

◆ fillWithSegs()

void MdcSegGrouperAx::fillWithSegs ( const MdcSegList * inSegs)

Definition at line 73 of file MdcSegGrouperAx.cxx.

73 {
74//------------------------------------------------------------------------
75 if(3==_debug) std::cout<<std::endl<< "=====MdcSegGrouperAx::fillWithSegs====="<<std::endl;
76 // Prepare for axial finding
77 // Store the segments (pointers, actually), sorting by phi0
78 for (int isuper = 0; isuper < _gm->nSuper(); isuper++) {
79 const GmsList *inList = inSegs->oneList(isuper);
80 if (inList->count() == 0) continue;
81 MdcSeg *inSeg = (MdcSeg *) inList->first();
82 // Only load axial segments
83 if (inSeg->superlayer()->whichView() != 0) continue;
84
85 while (inSeg != 0) {
86 // Create an info object within the seg to store info
88 inSeg->setInfo(info);
89 info->calcFromOrigin(inSeg); // calc. origin-dependent info
90
91 // Loop over the segs already stored, looking for the right place
92 // to stick the new one
93 int isInserted = 0;
94 for (int iseg = 0; iseg < (int) segList[isuper].length(); iseg++) {
95 MdcSeg *aSeg = segList[isuper][iseg];
96 if ( ((MdcSegInfoAxialO *)aSeg->info())->phi0() < info->phi0()) {
97 continue; }
98 segList[isuper].insert(inSeg, iseg);
99 isInserted = 1;
100 break;
101 } // end of loop over existing segs
102 if (isInserted == 0) segList[isuper].append(inSeg);
103 inSeg = (MdcSeg *) inSeg->next();
104 } // end loop over new segs
105// cout<<"segList["<<isuper<<"].length"<< segList[isuper].length()<<endl;//yzhang debug
106 } // end loop over superlayers
107
108/////////////////////
109/* for(int isuper = 0; isuper < _gm->nSuper(); isuper++) {
110 std::cout<<"-------super layer "<<isuper<<std::endl;
111 for (int iseg = 0; iseg < (int) segList[isuper].length(); iseg++) {
112 MdcSeg *aSeg = segList[isuper][iseg];
113 std::cout << " seg phi "<<iseg<< " "<<((MdcSegInfoAxialO*)aSeg->info())->phi0()<<std::endl;
114 } // end of loop over existing segs
115 }
116
117*/
118
119}
GmsListLink * first() const
Definition GmsList.h:42
unsigned int count() const
Definition GmsList.h:43
int nSuper() const
Definition MdcDetector.h:53
HepAList< MdcSeg > * segList
const MdcDetector * _gm
void calcFromOrigin(const MdcSeg *parentSeg)
double phi0() const
const GmsList * oneList(int slayIndex) const
const MdcSuperLayer * superlayer() const
Definition MdcSeg.h:51
MdcSegInfo * info() const
Definition MdcSeg.h:52
void setInfo(MdcSegInfo *ptr)
Definition MdcSeg.cxx:96
int whichView(void) const

Referenced by MdcTrackList::createFromSegs().

◆ incompWithGroup()

int MdcSegGrouperAx::incompWithGroup ( MdcSeg ** segGroup,
const MdcSeg * testSeg,
int iply )
virtual

Implements MdcSegGrouper.

Definition at line 242 of file MdcSegGrouperAx.cxx.

243 {
244 //-------------------------------------------------------------------------
245
246 return 0;
247}

◆ incompWithSeg()

int MdcSegGrouperAx::incompWithSeg ( const MdcSeg * refSeg,
const MdcSeg * testSeg )
virtual

Implements MdcSegGrouper.

Definition at line 122 of file MdcSegGrouperAx.cxx.

123 {
124//-------------------------------------------------------------------------
125
126 // Returns 0 if valid, -1 if invalid, +1 if invalid and no more valid
127 // ones possible in this slayer (assumes they're ordered)
128 if (testSeg == 0) return 0;
129 if(3 == _debug) {
130 //std::cout<< "test seg:";
131 testSeg->plotSegAll();
132 }
133 // Test phi0 match
134 MdcSegInfoAxialO *refInfo = (MdcSegInfoAxialO *) refSeg->info();
135 MdcSegInfoAxialO *testInfo = (MdcSegInfoAxialO *) testSeg->info();
136
137
138 double sigPhi0 = (refInfo->sigPhi0() > testInfo->sigPhi0() ?
139 refInfo->sigPhi0() : testInfo->sigPhi0());
140 double refPhi0 = refInfo->phi0();
141 double testPhi0 = testInfo->phi0();
142 double corrPhi0 = mdcWrapAng(refPhi0, testPhi0);
143
144 double sigCurv = (refInfo->sigCurv() > testInfo->sigCurv() ?
145 refInfo->sigCurv() : testInfo->sigCurv());
146 double refCurv = refInfo->curv();
147 double testCurv = testInfo->curv();
148 //double nSigmaPhi0 = MdcTrkReconCut_combAxPhi0;//4. for default
149 //double nSigmaCurv = MdcTrkReconCut_combAxCurv;//4. for default
150 double phi0Cut = MdcTrkReconCut_combAxPhi0Cut;
151 double curvCut = MdcTrkReconCut_combAxCurvCut;
152 //std::cout << "test phi0 "<<corrPhi0<<" ref "<<refPhi0<<" sig "<< nSigmaPhi0 * sigPhi0 << std::endl;
153 //std::cout << "test Curv "<<testCurv<<" ref "<<refCurv<<" sig "<< nSigmaCurv * sigCurv << std::endl;
154
155 if (g_tupleCombAx) {
156 g_combAxdPhi0 = refPhi0 - corrPhi0;
157 g_combAxdCurv = refCurv - testCurv;
158 g_combAxQualitySeed = refSeg->quality()+refSeg->nHit()*10+refSeg->superlayer()->slayNum()*1000;
159 g_combAxQualityTest = testSeg->quality()+testSeg->nHit()*10+testSeg->superlayer()->slayNum()*1000;
162 g_combAxMc = refSeg->testCombSeg(testSeg);
163 g_combAxMcPt = refSeg->testCombSegPt();
165 //g_combAxSigPhi0 = sigPhi0;
166 //g_combAxSigCurv = sigCurv;
167 //g_combAxSlSeed = refSeg->superlayer()->slayNum();
168 //g_combAxSlTest = testSeg->superlayer()->slayNum();
169 //g_combAxPatSeed = refSeg->segPattern();
170 //g_combAxPatTest = testSeg->segPattern();
171 //g_combAxNhitSeed = refSeg->nHit();
172 //g_combAxNhitTest = testSeg->nHit();
173 //test if the combined segments in the same track
174 // return -1:seed false
175 // return value = n hits on the seed track/ n hits of test seg
176 //g_combAxMcPhi = refSeg->testCombSegPhi();
177 //std::cout<< "mc seg "<< refSeg->testCombSeg(testSeg) << std::endl;//yzhang debug
178 g_tupleCombAx->write();
179 }
180
181 //yzhang add 2009-10-16
182 //if (refPhi0 - corrPhi0 > nSigmaPhi0 * sigPhi0)
183 //if(3 == _debug){
184 // std::cout << " phi0 ref"<<refPhi0
185 // <<" corr "<<corrPhi0
186 // << " diff "<<fabs(corrPhi0-refPhi0)
187 // <<" >? "<<phi0Cut<<std::endl;
188 // std::cout << " curv ref"<<refCurv
189 // <<" test "<<testCurv<< " diff "<<refCurv-testCurv
190 // <<" >? "<<curvCut<< std::endl;
191 //}
192 if(refSeg->testCombSegPt()>0.4 && fabs(corrPhi0 - refPhi0)>0.4 &&(refSeg->testCombSeg(testSeg)>0.5)){
193 if(3==_debug){
194 std::cout<< endl<<" test " << std::endl;
195 std::cout<<"seed seg: "; refSeg->plotSegAll(); std::cout<< std::endl;
196 std::cout<<"test seg: "; testSeg->plotSegAll(); std::cout<< std::endl;
197 std::cout<< " dPhi0 abnormal "<<corrPhi0 - refPhi0<<std::endl;
198 }
199 }else{
200 if(3== _debug){
201 std::cout<< endl<<" test " << std::endl;
202 std::cout<<"seed seg: "; refSeg->plotSegAll(); std::cout<< std::endl;
203 std::cout<<"test seg: "; testSeg->plotSegAll(); std::cout<< std::endl;
204 std::cout<< " dPhi0 ok " <<setprecision(3)<< corrPhi0 - refPhi0<<std::endl;
205 }
206 }
207
208 //std::cout<< __FILE__ << " " << __LINE__ << " dphi0= "<<fabs(corrPhi0 - refPhi0)<<" mc "<<refSeg->testCombSeg(testSeg)<<std::endl;
209
210 cout<<setiosflags(ios::fixed);
211 //FIXME 2011-05-31 yzhang cut vs pt
212 if (fabs(corrPhi0 - refPhi0) > phi0Cut) {
213 if(3 == _debug) std::cout << " SKIP by dPhi0 "
214 <<fabs(corrPhi0-refPhi0)<<">"<<phi0Cut<<std::endl;
215 //yzhang delete
216 //if (testPhi0 > refPhi0) return 1;
217 //else
218 return -1; // => testPhi0>2pi & refPhi0<2pi
219 }else{
220 if(3 == _debug)std::cout<< " dphi " <<setprecision(3)<< fabs(corrPhi0 - refPhi0);
221 }
222
223 // Test curvature match
224 // use larger error of the two
225 //if (fabs(refCurv - testCurv) > nSigmaCurv * sigCurv)
226 if (fabs(refCurv - testCurv) > curvCut){
227 if(3 == _debug) std::cout << " SKIP by dCurv"
228 <<fabs(refCurv-testCurv)<<">"<<curvCut<<std::endl;
229 return -2;
230 }else{
231 if(3 == _debug)std::cout<< " dCurv " <<setprecision(3)<< fabs(refCurv - testCurv);
232 }
233 if(3 == _debug) std::cout << " KEEP "<<std::endl;
234
235 cout<<setprecision(6);
236 cout<<setiosflags(ios::scientific);
237 //std::cout<< "ok! " << std::endl;//yzhang debug
238 return 0;
239}
NTuple::Item< double > g_combAxMcPt
NTuple::Item< double > g_combAxQualitySeed
NTuple::Item< double > g_combAxMcAmbigTest
NTuple::Item< double > g_combAxMcTheta
NTuple::Item< double > g_combAxQualityTest
NTuple::Item< double > g_combAxdCurv
NTuple::Item< double > g_combAxdPhi0
NTuple::Item< double > g_combAxMc
NTuple::Tuple * g_tupleCombAx
NTuple::Item< double > g_combAxMcAmbigSeed
double MdcTrkReconCut_combAxPhi0Cut
double MdcTrkReconCut_combAxCurvCut
double curv() const
double sigPhi0() const
double sigCurv() const
double testCombSegTheta() const
Definition MdcSeg.cxx:424
int nHit() const
Definition MdcSeg.cxx:368
double testCombSegAmbig() const
Definition MdcSeg.cxx:458
double testCombSeg(const MdcSeg *) const
Definition MdcSeg.cxx:376
void plotSegAll() const
Definition MdcSeg.cxx:159
unsigned int quality() const
Definition MdcSeg.h:49
double testCombSegPt() const
Definition MdcSeg.cxx:407
int slayNum(void) const
double mdcWrapAng(double phi1, double phi2)
Definition mdcWrapAng.h:12

Referenced by resetComb().

◆ resetComb()

void MdcSegGrouperAx::resetComb ( const MdcSeg * seed)
virtual

Implements MdcSegGrouper.

Definition at line 250 of file MdcSegGrouperAx.cxx.

250 {
251 //-------------------------------------------------------------------------
252
253 // Delete existing list of valid/invalid segs
254 if (isValid != 0) {
255 int i;
256 for (i = 0; i < nDeep; i++) {
257 delete [] isValid[i];
258 isValid[i] = 0;
259 }
260 }
261
262 _seed = seed;
263 //Grab the seglist for each non-seed slayer
264 int islay = 0;
265 int iply = 0;
266 nPlyFilled = 0;
267 nNull = 0;
268 const MdcSuperLayer *seedSlay = 0;
269 if (seed != 0) seedSlay = seed->superlayer();
270
271
272 // Set up all sorts of stuff for fast grouping of segs in nextGroup()
273 for (const MdcSuperLayer *thisSlay = _gm->firstSlay(); thisSlay != 0;
274 thisSlay = thisSlay->next()) {
275 bool noGoodYet = true;
276 islay++;
277
278 if (thisSlay == seedSlay) continue;
279 if (thisSlay->whichView() != 0) continue;//Axial slayer
280 firstGood[iply] = 0;
281
282 // Loop over the segs, marking start & end of valid region for this seed
283 firstBad[iply] = 0;
284 if (segList[islay-1].length() != 0) {
285 isValid[iply] = new bool[segList[islay-1].length()];
286 }
287
288 if(3 == _debug && segList[islay-1].length()>0) {
289 std::cout<<std::endl<< "--match axial seg by phi in slayer "
290 <<thisSlay->slayNum()<<"--"<<std::endl;
291 //std::cout<< "reference seg: "; seed->plotSeg();
292 //std::cout<< std::endl;
293 }
294
295 for (int i = 0; i < (int) segList[islay-1].length(); i++) {
296 MdcSeg *aSeg = segList[islay-1][i];
297 int invalid = incompWithSeg(seed, aSeg);
298 isValid[iply][i] = true;
299 if (invalid < 0) {
300 firstBad[iply] = i;
301 isValid[iply][i] = false;
302 if (noGoodYet) firstGood[iply] = i+1;
303 } else if (invalid > 0) {
304 // No more valid segs in this slayer
305 firstBad[iply] = i;
306 for (int j = i; j < (int) segList[islay-1].length(); j++)
307 isValid[iply][j] = false;
308 break;
309 } else {
310 firstBad[iply] = i+1;
311 noGoodYet = false;
312 }
313 }
314
315 //if(3 == _debug) std::cout<<iply<<" islay "<<islay<<" firstGood "<<firstGood[iply]<<" "<<firstBad[iply]<< std::endl;
316 if (firstGood[iply] > firstBad[iply]) firstGood[iply] = firstBad[iply];
317 if (firstGood[iply] == firstBad[iply]) {
318 // If there are no valid segs for this ply, drop it
319 delete [] isValid[iply];
320 isValid[iply] = 0;
321 continue;
322 }
323 // Associate correct seglist with this ply
324 combList[iply] = &segList[islay-1];
325 leaveGap[iply] = false;
326 iply++;
327 }
328 nPlyFilled = iply;
330 maxNull = nPlyFilled - 2;
331 maxNull++;
332}
const MdcSuperLayer * firstSlay(void) const
Definition MdcDetector.h:46
virtual int incompWithSeg(const MdcSeg *refSeg, const MdcSeg *testSeg)
HepAList< MdcSeg > ** combList
const MdcSuperLayer * next(void) const

◆ storePar()

MdcTrack * MdcSegGrouperAx::storePar ( MdcTrack * trk,
double parms[2],
double chisq,
TrkContext & context,
double trackT0 )
virtual

Implements MdcSegGrouper.

Definition at line 334 of file MdcSegGrouperAx.cxx.

336 {
337 //---------------------------------------------------------------------
338 // cout << "storePar in MdcSegGrouperAx" <<endl;//yzhang debug
339 assert(trk == 0);
340 BesAngle foundPhi0(parms[0]);
341 // factor of two to convert to BaBar def of curvature (omega)
342 //std::cout<< "stored par " << parms[0]<< " "<<parms[1]
343 //<<" store: "<<foundPhi0.rad()<<" "<<2.*parms[1]<<std::endl;
344 TrkExchangePar par(0.0, foundPhi0.rad(), 2.*parms[1], 0.0, 0.0);
345 return new MdcTrack(_gm->nSuper(), par, chisq, context, t0);
346}

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