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

#include <MdcSegFinder.h>

Public Member Functions

 MdcSegFinder (int useAllAmbig)
 ~MdcSegFinder ()
int createSegs (const MdcDetector *gm, MdcSegList &segs, const MdcMap< const MdcHit *, MdcSegUsage * > &usedHits, const MdcHitMap *map, double tbunch)
MdcSegPatternsthePattList ()
 MdcSegFinder (int useAllAmbig)
 ~MdcSegFinder ()
int createSegs (const MdcDetector *gm, MdcSegList &segs, const MdcMap< const MdcHit *, MdcSegUsage * > &usedHits, const MdcHitMap *map, double tbunch)
MdcSegPatternsthePattList ()
 MdcSegFinder (int useAllAmbig)
 ~MdcSegFinder ()
int createSegs (const MdcDetector *gm, MdcSegList &segs, const MdcMap< const MdcHit *, MdcSegUsage * > &usedHits, const MdcHitMap *map, double tbunch)
MdcSegPatternsthePattList ()

Detailed Description

Constructor & Destructor Documentation

◆ MdcSegFinder() [1/3]

MdcSegFinder::MdcSegFinder ( int useAllAmbig)

Definition at line 59 of file MdcSegFinder.cxx.

59 : patternList( useAllAmbig ) {
60 //-------------------------------------------------------------------------
61}

◆ ~MdcSegFinder() [1/3]

MdcSegFinder::~MdcSegFinder ( )
inline

◆ MdcSegFinder() [2/3]

MdcSegFinder::MdcSegFinder ( int useAllAmbig)

◆ ~MdcSegFinder() [2/3]

MdcSegFinder::~MdcSegFinder ( )
inline

◆ MdcSegFinder() [3/3]

MdcSegFinder::MdcSegFinder ( int useAllAmbig)

◆ ~MdcSegFinder() [3/3]

MdcSegFinder::~MdcSegFinder ( )
inline

Member Function Documentation

◆ createSegs() [1/3]

int MdcSegFinder::createSegs ( const MdcDetector * gm,
MdcSegList & segs,
const MdcMap< const MdcHit *, MdcSegUsage * > & usedHits,
const MdcHitMap * map,
double tbunch )

Definition at line 63 of file MdcSegFinder.cxx.

65 {
66 //-------------------------------------------------------------------------
67 // Forms all possible Segs of hits to act as candidate tracks
68 // Construct group of 8 hits; translate hit wires into bit-mapped word
69 // and look up valid patterns (if any) for this group.
70
71 _addHits = segs.segPar()->addHits;
72 int nSegs = 0;
73 int newSegs;
74 unsigned int groupWord;
75 MdcHit* groupHits[8];
76 int lPrevHit = 0; // flags that 2nd layer was hit in last group
77 // which layer/wire to look at for each hit in group
78 static const int layerWire[8][2] = { { 0, -1 }, { 0, 0 }, { 1, 0 }, { 2, -1 },
79 { 2, 0 }, { 3, -1 }, { 3, 0 }, { 3, 1 } };
80
81 // Loop through the superlayers
82 const MdcSuperLayer* slayer = gm->firstSlay();
83 while ( slayer != 0 )
84 {
85 const MdcLayer* layArray[4];
86 int wireIndex[4];
87
88 // layArray[0] = slayer->firstLayer();
89 // for (int i = 1; i < 4; i++) layArray[i] = gm->nextLayer(layArray[i-1]);
90 int nslay = slayer->nLayers();
91 for ( int i = 0; i < nslay; i++ ) layArray[i] = slayer->layer( i );
92 if ( nslay != 4 ) layArray[3] = 0;
93
94 // std::cout<<"-------------super layer----- "<<slayer->Id() << " nlayer
95 // "<<nslay<<std::endl;
96 // for (int i = 0; i < nslay; i++) std::cerr<<layArray[i]->Id()<<"
97 // "<<layArray[i]->nWires()<<"\n"; slayer = slayer->next();continue;
98
99 // Loop over cells (index refers to cells in 2nd layer of superlayer)
100 for ( int cellIndex = 0; cellIndex < layArray[1]->nWires(); cellIndex++ )
101 {
102 // yzhang change FIXME
103 double phi = layArray[1]->getWire( cellIndex )->phiE();
104 for ( int i = 0; i < 4; i++ )
105 {
106 wireIndex[i] = cellIndex;
107 if ( slayer->slayNum() > 4 ) continue; // nWires over No.4 slayer is uniform
108 if ( ( slayer->slayNum() > 9 ) && ( i == 3 ) ) break; // stop when get last layer
109 if ( i == 1 ) continue;
110 if ( i == 3 ) phi = layArray[2]->getWire( wireIndex[2] )->phiE();
111 BesAngle tmp( phi - layArray[i]->phiEPOffset() );
112 int wlow = (int)floor( layArray[i]->nWires() * tmp.rad() / twopi );
113 int wbig = (int)ceil( layArray[i]->nWires() * tmp.rad() / twopi );
114 if ( tmp == 0 )
115 {
116 wlow = -1;
117 wbig = 1;
118 }
119 if ( i != 3 ) { wireIndex[i] = wbig; }
120 else { wireIndex[i] = wlow; }
121 // zhangy change
122 wireIndex[i] = mdcWrapWire( wireIndex[i], layArray[i]->nWires() );
123 }
124 // Form group of 8 wires
125 groupWord = 0u;
126 unsigned bitWord = 1u;
127 int nGroup = 0;
128 for ( int ii = 0; ii < 8; ii++ )
129 {
130 groupHits[ii] = 0;
131 //-----------------------------
132 if ( layArray[layerWire[ii][0]] == 0 ) continue;
133 //-----------------------------
134 int laynum = layArray[layerWire[ii][0]]->layNum();
135 int wire = wireIndex[layerWire[ii][0]] + layerWire[ii][1];
136 wire = mdcWrapWire( wire, layArray[layerWire[ii][0]]->nWires() ); // handle wrap-around
137 MdcHit* thisHit = map->hitWire( laynum, wire );
138 if ( thisHit != 0 )
139 {
140 if ( !usedHits.get( thisHit )->deadHit() )
141 {
142 groupHits[ii] = thisHit;
143 groupWord |= bitWord;
144 nGroup++;
145 }
146 else
147 {
148 // cout << "Skipping hit " << endl;
149 }
150 }
151 // Quit if no hits in 1st 2 layers or 1 hit in 3 layers
152 if ( ( ii == 2 && nGroup < 1 ) || ( ii == 4 && nGroup < 2 ) ) break;
153 bitWord <<= 1;
154 }
155 if ( nGroup < 3 ) continue;
156
157 // int lastWire = mdcWrapWire(cellIndex - 1, layArray[1]->nWires());//2011-08-10
158 int lastWire = mdcWrapWire( cellIndex - 1, layArray[0]->nWires() );
159 if ( map->hitWire( layArray[1]->layNum(), lastWire ) != 0 ) lPrevHit = 1;
160 // if (layArray[1]->hitWire(lastWire) != 0) lPrevHit = 1;
161 else lPrevHit = 0;
162
163 // Try all allowed 4-hit patterns for this group (if any)
164 int nPatt = patternList.npatt4[groupWord];
165
166 if ( ( layArray[1]->layNum() == 5 ) && ( cellIndex == 46 ) )
167 {
168 for ( int i = 0; i < 4; i++ )
169 {
170 // std::cout<<__FILE__<<" "<<__LINE__<<"====("<<layArray[i]->layNum()<<","<<
171 // wireIndex[i]<<")" << std::endl;
172 }
173 // std::cout<<__FILE__<<" "<<__LINE__<< " groupWord:"<<groupWord<<" nPatt:"<<nPatt<<
174 // std::endl;
175 }
176
177 if ( nPatt > 0 )
178 {
179 newSegs = tryPatterns( groupHits, groupWord, 4, lPrevHit, nPatt,
180 patternList.allowedPatt4[groupWord], slayer, segs, usedHits,
181 map, bunchTime );
182 nSegs += newSegs;
183 }
184
185 // If unsuccessful, try 3-hit patterns ???? may want to try 2nd pass here
186 if ( !segs.segPar()->find3[slayer->index()] ) continue;
187 int nUnused = 0;
188 for ( int i = 0; i < 8; i++ )
189 {
190 if ( groupHits[i] != 0 )
191 {
192 if ( usedHits.get( groupHits[i] )->usedSeg() == 0 ) nUnused++;
193 }
194 }
195 if ( nUnused > 0 )
196 {
197 nPatt = patternList.npatt3[groupWord];
198 if ( nPatt > 0 )
199 {
200
201 newSegs = tryPatterns( groupHits, groupWord, 3, lPrevHit, nPatt,
202 patternList.allowedPatt3[groupWord], slayer, segs, usedHits,
203 map, bunchTime );
204 nSegs += newSegs;
205 }
206 }
207 } // cellIndex loop
208
209 slayer = slayer->next();
210 } // superlayer loop
211
212 if ( nSegs > 0 )
213 {
214 segs.massageSegs();
215 segs.resetSeed( gm );
216 }
217
218 nSegs = segs.count();
219
220 if ( 5 == segs.segPar()->lPrint ) { cout << "Number of Segs found: " << nSegs << "\n"; }
221
222 return nSegs;
223}
bool get(const K &theKey, V &theAnswer) const
int count() const
void resetSeed(const MdcDetector *gm)

◆ createSegs() [2/3]

int MdcSegFinder::createSegs ( const MdcDetector * gm,
MdcSegList & segs,
const MdcMap< const MdcHit *, MdcSegUsage * > & usedHits,
const MdcHitMap * map,
double tbunch )

◆ createSegs() [3/3]

int MdcSegFinder::createSegs ( const MdcDetector * gm,
MdcSegList & segs,
const MdcMap< const MdcHit *, MdcSegUsage * > & usedHits,
const MdcHitMap * map,
double tbunch )

◆ thePattList() [1/3]

MdcSegPatterns * MdcSegFinder::thePattList ( )
inline

Definition at line 44 of file InstallArea/x86_64-el9-gcc13-dbg/include/MdcTrkRecon/MdcSegFinder.h.

44{ return &patternList; }

◆ thePattList() [2/3]

MdcSegPatterns * MdcSegFinder::thePattList ( )
inline

Definition at line 44 of file InstallArea/x86_64-el9-gcc13-opt/include/MdcTrkRecon/MdcSegFinder.h.

44{ return &patternList; }

◆ thePattList() [3/3]

MdcSegPatterns * MdcSegFinder::thePattList ( )
inline

Definition at line 44 of file Reconstruction/MdcPatRec/MdcTrkRecon/include/MdcTrkRecon/MdcSegFinder.h.

44{ return &patternList; }

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