CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcDigiGroup.h
Go to the documentation of this file.
1#ifndef MDC_DIGI_H
2#define MDC_DIGI_H
3
4/*
5 * 2022--05-19 Wang Liangliang
6 The original class is defined in
7 Mdc/MdcCheckUtil/MdcUtilitySvc/MdcUtilitySvc-00-00-10/MdcUtilitySvc/MdcHitGroup.h
8 which was developped by Zhou Hang.
9 This modifcation intends to add more flexibility for DotsConnection.
10 */
11
12
13//#include <CLHEP/Geometry/Point3D.h>
14//#include <iostream>
15//#include <vector>
16#include "MdcRawEvent/MdcDigi.h"
17#include "MdcGeomSvc/MdcGeomSvc.h"
18
19using namespace std;
20using namespace CLHEP;
21
23
24 public:
25 static const int nGap=3;
26
27 // Constructor.
29 {
30 useflag=0;
31 m_totalNearbyHits=0;
32 m_onNode=0;
33 m_inBigSet=0;
34 for(int i=0; i<nGap; i++) {
35 fPrevID[i]=-1;
36 fNextID[i]=-1;
37 fInnerID[i].clear();
38 fOuterID[i].clear();
39 }
40 fAllNeiborID.clear();
41 fHitsOfWire.clear();
42 m_idxTrkCandiVec.clear();
43 fired=false;
44 fWire=NULL;
45 };
46
47 // reset
48 void Reset()
49 {
50 useflag=0;
51 m_totalNearbyHits=0;
52 m_onNode=0;
53 m_inBigSet=0;
54 for(int i=0; i<nGap; i++) {
55 fPrevID[i]=-1;
56 fNextID[i]=-1;
57 fInnerID[i].clear();
58 fOuterID[i].clear();
59 }
60 fAllNeiborID.clear();
61 fHitsOfWire.clear();
62 m_idxTrkCandiVec.clear();
63 fired=false;
64 }
65
66 // Destructor
68
69 public: // Extractors
70 const MdcGeoWire* GetWire(){return fWire;}
71 vector<const MdcDigi*> GetHit() {return fHitsOfWire;}
72 bool HasHit(){
73 if(fHitsOfWire.size()==0) {return false;}
74 else {return true;}
75 }
76 bool Used(){
77 if(fHitsOfWire.size()==0||useflag==1) {return true;}
78 else {return false;}
79 }
80 int getUseFlag() {return useflag;}
81 int GetPrev(int i=0) {
82 if(i<nGap) return fPrevID[i];
83 else return -99;
84 }
85 int GetNext(int i=0) {
86 if(i<nGap) return fNextID[i];
87 else return -99;
88 }
89 vector<int> GetInner(int i=0) {
90 if(i<nGap) return fInnerID[i];
91 else {
92 vector<int> a;
93 return a;
94 }
95 }
96 vector<int> GetOuter(int i=0) {
97 if(i<nGap) return fOuterID[i];
98 else {
99 vector<int> a;
100 return a;
101 }
102 }
103 vector<int> GetOuterTot(int i=0) {
104 vector<int> a;
105 if(i<nGap) for(int j=0; j<=i; j++) a.insert( a.end(), fOuterID[j].begin(), fOuterID[j].end() );
106 return a;
107 }
108 vector<int> GetNextAndOuterTot(int i=0) {
109 vector<int> a=GetOuterTot(i);
110 if(i<nGap) for(int j=0; j<=i; j++) a.push_back( fNextID[j] );
111 return a;
112 }
113 vector<int> GetNeiborHits(){return fAllNeiborID;}
114 vector<int> GetNeiborHits(int i){
115 vector<int> a = fAllNeiborID;
116 if(i>0&&i<nGap) {
117 for(int j=1; j<=i; j++) {
118 a.insert( a.end(), fOuterID[j].begin(), fOuterID[j].end() );
119 a.insert( a.end(), fInnerID[j].begin(), fInnerID[j].end() );
120 }
121 }
122 return a;
123 }
125 return fInnerID[0].size()+fOuterID[0].size()+(fPrevID[0]<0?0:1)+(fNextID[0]<0?0:1);
126 }
128 {
129 return (fInnerID[0].size()>0?1:0)+(fOuterID[0].size()>0?1:0)+(fPrevID[0]<0?0:1)+(fNextID[0]<0?0:1);
130 }
131
132 int GetNhitsNearby() { return m_totalNearbyHits; }
133 int isOnNode() { return m_onNode;}
134 int isInBigSet() {return m_inBigSet;}
135
136 // --- useful functions
138 {
139 return fOuterID[0].size()==0&&fInnerID[0].size()>0;
140 }
142 {
143 if(IsOuterEnd()) return true;
144 //if(GetNTypesNeighborHits()<3) return true;
145 if(GetNTypesNeighborHits()==0) return true;
146 return false;
147 }
148 bool isEnd()
149 {
150 int nTypeNb = GetNTypesNeighborHits();
151 if(nTypeNb==1) return true;
152 else return false;
153 }
155 {
156 bool flag=false;
157 int nTypeNb = GetNTypesNeighborHits();
158 if(nTypeNb==2) if(fInnerID[0].size()>0&&fOuterID[0].size()>0) flag=true;
159 return flag;
160 }
162 {
163 bool flag=false;
164 int nTypeNb = GetNTypesNeighborHits();
165 if(nTypeNb==2) if(fPrevID[0]>=0&&fNextID[0]>=0) flag=true;
166 return flag;
167 }
169 {
170 bool flag=false;
171 int nTypeNb = GetNTypesNeighborHits();
172 if(nTypeNb==1&&fInnerID[0].size()==0&&fOuterID[0].size()==0) flag=true;
173 return flag;
174 }
175 public: // Modifiers
176 void SetWire(const MdcGeoWire* aWire){fWire=aWire;}
177 void AddHit(const MdcDigi* aHit) {fHitsOfWire.push_back(aHit);}
178 void AddPrev(int wireID, int gap=0) {
179 if(gap<nGap) {
180 m_totalNearbyHits++;
181 fPrevID[gap]=wireID;
182 if(gap==0) fAllNeiborID.push_back(wireID);
183 }
184 }
185 void AddNext(int wireID, int gap=0) {
186 if(gap<nGap) {
187 m_totalNearbyHits++;
188 fNextID[gap]=wireID;
189 if(gap==0) fAllNeiborID.push_back(wireID);
190 }
191 }
192 void AddInner(int wireID, int gap=0) {
193 if(gap<nGap) {
194 m_totalNearbyHits++;
195 fInnerID[gap].push_back(wireID);
196 if(gap==0) fAllNeiborID.push_back(wireID);
197 }
198 }
199 void AddOuter(int wireID, int gap=0) {
200 if(gap<nGap) {
201 m_totalNearbyHits++;
202 fOuterID[gap].push_back(wireID);
203 if(gap==0) fAllNeiborID.push_back(wireID);
204 }
205 }
206 void SetUsedFlag(int flag=1){useflag=flag;}
207 void SetOnNode() { m_onNode=1;}
208 void SetInBigSet() { m_inBigSet=1;}
209
210 void AddTrkCandiIdx(int idx) {m_idxTrkCandiVec.push_back(idx);};
211 void RmTrkCandiIdx(int idx) {
212 //int nCandi = m_idxTrkCandiVec.size();
213 //for(int i=0; i<nCandi; i++) {
214 // if(m_idxTrkCandiVec[i]==idx) {
215 // m_idxTrkCandiVec.erase(m_idxTrkCandiVec.begin()+i);
216 // break;
217 // }
218 //}
219
220 vector<int>::iterator iter = std::remove(m_idxTrkCandiVec.begin(), m_idxTrkCandiVec.end(), idx);
221 m_idxTrkCandiVec.erase(iter, m_idxTrkCandiVec.end());
222 }
223
224 private:
225 const MdcGeoWire* fWire;
226 // vector<MdcGeoWire*> fNeiborHitWires;
227 int fPrevID[nGap];
228 int fNextID[nGap];
229 int useflag;// used: 1, unused: 0, not to use: -1
230 int m_totalNearbyHits; // nearby hits with nGap
231 int m_onNode;// if on a node
232 int m_inBigSet;// if in a big hit set (nHits>=3)
233 vector<int> fInnerID[nGap];
234 vector<int> fOuterID[nGap];
235 vector<int> fAllNeiborID;
236 vector<const MdcDigi*> fHitsOfWire;// digi
237 bool fired;
238 vector<int> m_idxTrkCandiVec;
239
240};
241
242
243
244#endif
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
void SetInBigSet()
int GetPrev(int i=0)
vector< int > GetInner(int i=0)
const MdcGeoWire * GetWire()
vector< const MdcDigi * > GetHit()
int GetNhitsNearby()
void RmTrkCandiIdx(int idx)
static const int nGap
void AddOuter(int wireID, int gap=0)
vector< int > GetNeiborHits(int i)
int GetNoNeiborHits()
void SetWire(const MdcGeoWire *aWire)
bool isCircuBridge()
bool isRadialBridge()
vector< int > GetOuter(int i=0)
void AddTrkCandiIdx(int idx)
bool isGoodSeed()
void AddInner(int wireID, int gap=0)
int GetNext(int i=0)
void AddPrev(int wireID, int gap=0)
vector< int > GetOuterTot(int i=0)
int GetNTypesNeighborHits()
void SetUsedFlag(int flag=1)
void AddHit(const MdcDigi *aHit)
vector< int > GetNextAndOuterTot(int i=0)
void AddNext(int wireID, int gap=0)
bool isCircuEnd()
bool IsOuterEnd()
vector< int > GetNeiborHits()