CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
RecMdcTrack.cxx
Go to the documentation of this file.
1/*
2* @class : RecMdcTrack
3* this class models "Track" used in Mdc Reconstruction
4*
5*1.add constructor information of m_ncluster,m_vecclusters,m_matchChi2. 2016-09-28
6* ********************************************************/
7
8#include "MdcRecEvent/RecMdcTrack.h"
9#include "Identifier/MdcID.h"
10#include <set>
11
12 const CLID& RecMdcTrack::clID() const {
13 return RecMdcTrack::classID();
14 }
15
16 const CLID& RecMdcTrack::classID() {
17 return CLID_RecMdcTrack;
18 }
19
21 : m_pivot(0,0,0),
22 m_fiTerm(0.0),
23 m_nhits(0),
24 m_ncluster(0),
25 m_matchChi2(9999.0)
26 {
27 }
28
30 : DstMdcTrack(rectrk),
31 m_pivot(rectrk.m_pivot),
32 m_fiTerm(rectrk.m_fiTerm),
33 m_nhits(rectrk.m_nhits),
34 m_vechits(rectrk.m_vechits),
35 m_ncluster(rectrk.m_ncluster),
36 m_matchChi2(rectrk.m_matchChi2),
37 m_vecclusters(rectrk.m_vecclusters)
38 {
39 }
40
42 : DstMdcTrack(dstrk),
43 m_pivot(-99.,-99.,-99.),
44 m_fiTerm(-99.),
45 m_nhits(-99)
46 {
47 }
48
50 {
51 if( &rectrk != this ){
53 m_pivot = rectrk.m_pivot;
54 m_fiTerm = rectrk. m_fiTerm;
55 m_nhits = rectrk. m_nhits;
56 m_vechits = rectrk.m_vechits;
57 m_ncluster = rectrk.m_ncluster;
58 m_matchChi2 = rectrk.m_matchChi2;
59 m_vecclusters = rectrk.m_vecclusters;
60 }
61 return *this;
62 }
63
65 {
66 if( &dstrk != this ){
68 m_pivot[0] = -99.;
69 m_pivot[1] = -99.;
70 m_pivot[2] = -99.;
71 m_fiTerm = -99.;
72 m_nhits = -99;
73 }
74 return *this;
75 }
76
78 }
79
81{
82 m_vechits = vechits;
84}
85
87{
88 m_vecclusters = vecclusters;
90}
91
92void RecMdcTrack::setVecClusters(ClusterRefVec vecclusters,map<int,int> clusterFitStat)
93{
94 m_vecclusters = vecclusters;
95 m_clusterFitStat = clusterFitStat;
97}
98
100{
101 set<int> mdc_layers;
102 set<int> cgem_layers;
103
104 int nDof = 0;
105 int nSter = 0;
106 int maxLayerId = -1;
107 int minLayerId = 43;
108 int nLayer = 0;
109 double fiTerm = 999.;
110
111 MdcID* mdcID = new MdcID();
112 int nHits = m_vechits.size();
113 HitRefVec::iterator iterHit = m_vechits.begin();
114 for( ; iterHit != m_vechits.end(); iterHit++){
115 Identifier mdcid = (*iterHit)->getMdcId();
116 int layerId = MdcID::layer(mdcid);
117 //count nDof
118 //cout<< (*iterHit)->getStat()<<endl;
119 if ((*iterHit)->getStat()==1){
120 nDof++;
121 }
122 //count nSter
123 //cout<<layerId<<" "<<mdcID->is_axial(mdcid)<<endl;
124 if (!(mdcID->is_axial(mdcid))){
125 //if (layerId >=20 &&layerId <36){
126 nSter++;
127 }
128 // find maxLayerId and minLayerId
129 if (layerId >= maxLayerId){
130 maxLayerId = layerId;
131 //fiTerm=(1./sqrt(1.+m_helix[4]*m_helix[4]))*(*iterHit)->getFltLen()*m_helix[3]/333.567;
132 }
133 if (layerId < minLayerId){
134 minLayerId = layerId;
135 }
136 //count nlayer
137 mdc_layers.insert(layerId);
138 //count nHits
139 //nHits++;
140 }
141
142 //cout<<__FILE__ <<" "<<__LINE__ << endl;
143 //cout<<"nDof "<<nDof-5<<endl;
144 //cout<<"nSter "<<nSter<<endl;
145 //cout<<"maxLayerId "<<maxLayerId<<endl;
146 //cout<<"minLayerId "<<minLayerId<<endl;
147 //cout<<"nHits "<<nHits<<endl;
148 //cout<<endl;
149
150 int nCgemXClusters=0;
151 int nCgemVClusters=0;
152 int nCluster=m_vecclusters.size();
153 ClusterRefVec::iterator iterCluster = m_vecclusters.begin();
154 for( ; iterCluster != m_vecclusters.end(); iterCluster++){
155 (*iterCluster)->setTrkId(trackId());
156 int flag = (*iterCluster)->getflag();
157 int clusterid = (*iterCluster)->getclusterid();
158 map<int,int>::iterator iter = m_clusterFitStat.find(clusterid);
159 int stat =1;
160 if(iter != m_clusterFitStat.end())stat = iter->second;
161 switch(flag){
162 case 0:
163 nCgemXClusters++;
164 if(stat)nDof++;
165 break;
166 case 1:
167 nCgemVClusters++;
168 if(stat)nDof++;
169 nSter++;
170 break;
171 case 2:
172 nCgemXClusters++;
173 nCgemVClusters++;
174 if(stat)nDof+=2;
175 nSter++;
176 break;
177 case 3:
178 nCgemXClusters++;
179 nCgemVClusters++;
180 if(stat)nDof+=2;
181 nSter++;
182 break;
183 default: break;
184 }
185 int layerId = (*iterCluster)->getlayerid();
186 if (layerId >= maxLayerId){
187 maxLayerId = layerId;
188 //fiTerm=(1./sqrt(1.+m_helix[4]*m_helix[4]))*(*iterHit)->getFltLen()*m_helix[3]/333.567;
189 }
190 if (layerId < minLayerId){
191 minLayerId = layerId;
192 }
193 cgem_layers.insert(layerId);
194 nCluster++;
195 }
196
197 nLayer = mdc_layers.size() + cgem_layers.size();
198
199 //cout<<__FILE__ <<" "<<__LINE__ << endl;
200 //cout<<"nDof "<<nDof-5<<endl;
201 //cout<<"nSter "<<nSter<<endl;
202 //cout<<"maxLayerId "<<maxLayerId<<endl;
203 //cout<<"minLayerId "<<minLayerId<<endl;
204 //cout<<"nCluster "<<nCluster<<endl;
205 //cout<<"nLayer "<<nLayer<<endl;
206 //cout<<endl;
207
208 setNdof(nDof-5);
209 setNster(nSter);
210 setFirstLayer(minLayerId);
211 setLastLayer(maxLayerId);
212 setNlayer(nLayer);
213 setNCgemXCluster(nCgemXClusters);
214 setNCgemVCluster(nCgemVClusters);
215 setNhits(nHits);
216 setNcluster(nCluster);
217
218 //cout<<"mdc nlayer:"<<mdc_layers.size()<<endl;
219 //cout<<"cgem nlayer:"<<cgem_layers.size()<<endl;
220}
221
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
const CLID & CLID_RecMdcTrack
Definition: EventModel.cxx:339
SmartRefVector< RecCgemCluster > ClusterRefVec
DstMdcTrack & operator=(const DstMdcTrack &)
Definition: DstMdcTrack.cxx:69
bool is_axial(const Identifier &id)
Test for axial and stereo wire.
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
virtual const CLID & clID() const
Definition: RecMdcTrack.cxx:12
void setVecClusters(ClusterRefVec vecclusters)
Definition: RecMdcTrack.cxx:86
void updateStatistics()
Definition: RecMdcTrack.cxx:99
void setVecHits(HitRefVec vechits)
Definition: RecMdcTrack.cxx:80
RecMdcTrack & operator=(const RecMdcTrack &)
Definition: RecMdcTrack.cxx:49
static const CLID & classID()
Definition: RecMdcTrack.cxx:16