CGEM BOSS 6.6.5.f
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.1.1.1 2017/07/13 00:11:01 huangzhen Exp $
4//
5// Author(s): Steve Schaffner
6//------------------------------------------------------------------------
7
8#include "MdcTrkRecon/MdcSegData.h"
9#include "MdcData/MdcHit.h"
10#include "MdcTrkRecon/MdcSegUsage.h"
11#include "MdcGeom/MdcDetector.h"
12#include "MdcData/MdcHitMap.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
37//------------------------------------------------------------------------
38 return _theHits->size();
39}
40
41//------------------------------------------------------------------------
42void
43MdcSegData::loadevent(MdcHitCol *hitcol, MdcHitMap *hitmap, double tb) {
44//------------------------------------------------------------------------
45 _bunchTime = tb;
46 _theHits = hitcol;
47 _hitMap = hitmap;
48 assert (_hitMap != 0);
49
50 _segUsageDict.clear();
51 delete [] _segUsage;
52 _segUsage = 0;
53 eventNumber++;
54
55 _segUsage = new MdcSegUsage[nhits()];
56
57 MdcHit* aHit = 0;
58 MdcHitCol::iterator iter = _theHits->begin();
59 int index = 0;
60 for (;iter != _theHits->end(); iter++) {
61 aHit = *iter;
62 _segUsageDict.put(aHit, &(_segUsage[index]));
63 if (skippingUsed() && aHit->usedHit()) {
64 // Mark for later skipping
65 _segUsage[index].killHit();
66 }
67 index++;
68 }
69}
70
71//------------------------------------------------------------------------
72const MdcHit*
73MdcSegData::hit(int hitno) const {
74//------------------------------------------------------------------------
75return (*_theHits)[hitno];
76}
77
78
79//------------------------------------------------------------------------
80void
81MdcSegData::poisonHits(const MdcDetector *gm, int debug) {
82//------------------------------------------------------------------------
83 // Mark hits as poor candidates for segment-finding, if they are located
84 // within a string of consecutive hits in the same layer (end hits are
85 // not marked).
86 for (int ilayer = 0; ilayer < gm->nLayer(); ilayer++) {
87 int nwire = gm->Layer(ilayer)->nWires();
88 for (int iwire=0; iwire < nwire;++iwire) {
89 int wireNext = mdcWrapWire(iwire+1, nwire);
90 if ( 0 == hitMap()->hitWire(ilayer, wireNext) ) {
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; continue;
97 }
98
99 MdcHit* theHit = hitMap()->hitWire(ilayer, iwire);
100 if (theHit == 0) {
101 // 0 1 2 3 4
102 // next wire is there, this one isn't : o x ? ? ?
103 // and the next candidate to check is + 2
104 ++iwire; continue;
105 }
106
107 int wirePrev = mdcWrapWire(iwire-1, nwire);
108 if ( 0 != hitMap()->hitWire(ilayer, wirePrev)) {
109 segUsage().get(theHit)->killHit();
110 if(debug>1){
111 theHit->print(std::cout);
112 std::cout<< " killed " << std::endl;
113 }
114 }else{
115 if(debug>1){
116 theHit->print(std::cout);
117 std::cout<< " ok " << std::endl;
118 }
119 }
120 } // end wire loop
121 } // end layer loop
122
123 return;
124}
125
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
ObjectVector< MdcHit > MdcHitCol
int mdcWrapWire(int wireIn, int nCell)
const MdcLayer * Layer(unsigned id) const
MdcHit * hitWire(int lay, int wire) const
void print(std::ostream &o) const
bool get(const K &theKey, V &theAnswer) const
void clear()
void put(const K &, const V &)
void poisonHits(const MdcDetector *gm, int debug=0)
Definition: MdcSegData.cxx:81
int nhits() const
Definition: MdcSegData.cxx:36
void loadevent(MdcHitCol *col, MdcHitMap *hmap, double tbunch)
Definition: MdcSegData.cxx:43
MdcSegData(bool skipUsedHit)
Definition: MdcSegData.cxx:16
virtual ~MdcSegData()
Definition: MdcSegData.cxx:29
const MdcHit * hit(int hitno) const
Definition: MdcSegData.cxx:73
void killHit()
Definition: MdcSegUsage.cxx:21