BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcSegData.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: MdcSegData.cxx,v 1.5 2011/09/26 01:06:37 zhangy Exp $
4//
5// Author(s): Steve Schaffner
6//------------------------------------------------------------------------
7
8#include "MdcTrkRecon/MdcSegData.h"
9#include "MdcData/MdcHit.h"
10#include "MdcData/MdcHitMap.h"
11#include "MdcGeom/MdcDetector.h"
12#include "MdcTrkRecon/MdcSegUsage.h"
13#include "MdcTrkRecon/mdcWrapWire.h"
14
15//------------------------------------------------------------------------
17//------------------------------------------------------------------------
18{
19 eventNumber = 0;
20 _segUsage = 0;
21 _hitMap = 0;
22 _bunchTime = 0;
23 _skipUsed = skip;
24
25 _theHits = 0;
26}
27
28//------------------------------------------------------------------------
30 //------------------------------------------------------------------------
31 delete[] _segUsage;
32}
33
34//------------------------------------------------------------------------
35int MdcSegData::nhits() const {
36 //------------------------------------------------------------------------
37 return _theHits->size();
38}
39
40//------------------------------------------------------------------------
41void MdcSegData::loadevent( MdcHitCol* hitcol, MdcHitMap* hitmap, double tb ) {
42 //------------------------------------------------------------------------
43 _bunchTime = tb;
44 _theHits = hitcol;
45 _hitMap = hitmap;
46 assert( _hitMap != 0 );
47
48 _segUsageDict.clear();
49 delete[] _segUsage;
50 _segUsage = 0;
51 eventNumber++;
52
53 _segUsage = new MdcSegUsage[nhits()];
54
55 MdcHit* aHit = 0;
56 MdcHitCol::iterator iter = _theHits->begin();
57 int index = 0;
58 for ( ; iter != _theHits->end(); iter++ )
59 {
60 aHit = *iter;
61 _segUsageDict.put( aHit, &( _segUsage[index] ) );
62 if ( skippingUsed() && aHit->usedHit() )
63 {
64 // Mark for later skipping
65 _segUsage[index].killHit();
66 }
67 index++;
68 }
69}
70
71//------------------------------------------------------------------------
72const MdcHit* MdcSegData::hit( int hitno ) const {
73 //------------------------------------------------------------------------
74 return ( *_theHits )[hitno];
75}
76
77//------------------------------------------------------------------------
78void MdcSegData::poisonHits( const MdcDetector* gm, int debug ) {
79 //------------------------------------------------------------------------
80 // Mark hits as poor candidates for segment-finding, if they are located
81 // within a string of consecutive hits in the same layer (end hits are
82 // not marked).
83 for ( int ilayer = 0; ilayer < gm->nLayer(); ilayer++ )
84 {
85 int nwire = gm->Layer( ilayer )->nWires();
86 for ( int iwire = 0; iwire < nwire; ++iwire )
87 {
88 int wireNext = mdcWrapWire( iwire + 1, nwire );
89 if ( 0 == hitMap()->hitWire( ilayer, wireNext ) )
90 {
91 // 0 1 2 3 4
92 // next wire not there: ? o ? ? ?
93 // so the next-to-next wire shouldn't be poisened
94 // (it's left neighbour is empty)
95 // and the next candidate to check is + 3
96 iwire += 2;
97 continue;
98 }
99
100 MdcHit* theHit = hitMap()->hitWire( ilayer, iwire );
101 if ( theHit == 0 )
102 {
103 // 0 1 2 3 4
104 // next wire is there, this one isn't : o x ? ? ?
105 // and the next candidate to check is + 2
106 ++iwire;
107 continue;
108 }
109
110 int wirePrev = mdcWrapWire( iwire - 1, nwire );
111 if ( 0 != hitMap()->hitWire( ilayer, wirePrev ) )
112 {
113 segUsage().get( theHit )->killHit();
114 if ( debug > 1 )
115 {
116 theHit->print( std::cout );
117 std::cout << " killed " << std::endl;
118 }
119 }
120 else
121 {
122 if ( debug > 1 )
123 {
124 theHit->print( std::cout );
125 std::cout << " ok " << std::endl;
126 }
127 }
128 } // end wire loop
129 } // end layer loop
130
131 return;
132}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
void print(std::ostream &o) const
bool get(const K &theKey, V &theAnswer) const
void poisonHits(const MdcDetector *gm, int debug=0)
int nhits() const
void loadevent(MdcHitCol *col, MdcHitMap *hmap, double tbunch)
MdcSegData(bool skipUsedHit)
virtual ~MdcSegData()
const MdcHit * hit(int hitno) const