BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcCalRecTrk Class Reference

#include <MdcCalRecTrk.h>

Public Member Functions

 MdcCalRecTrk (int pid)
 
 ~MdcCalRecTrk ()
 
void setGeomSvc (IMdcGeomSvc *mdcGeomSvc)
 
void setUtilSvc (IMdcUtilitySvc *mdcUtilitySvc)
 
void setRecTrk (RecMdcTrackCol::iterator it_trk)
 
void setKalTrk (RecMdcKalTrackCol::iterator it_trk)
 
double getDr () const
 
double getPhi0 () const
 
double getKappa () const
 
double getDz () const
 
double getTanLamda () const
 
double getPt () const
 
double getP () const
 
double getChisq () const
 
int getNHits () const
 
HepLorentzVector getP4 () const
 
MdcCalRecHitgetRecHit (int index) const
 
HepVector getHelix () const
 
HepSymMatrix getHelixErr () const
 
bool fgNoiseRatio (double phi0)
 
bool getFgNoiseRatio () const
 
 MdcCalRecTrk (int pid)
 
 ~MdcCalRecTrk ()
 
void setGeomSvc (IMdcGeomSvc *mdcGeomSvc)
 
void setUtilSvc (IMdcUtilitySvc *mdcUtilitySvc)
 
void setRecTrk (RecMdcTrackCol::iterator it_trk)
 
void setKalTrk (RecMdcKalTrackCol::iterator it_trk)
 
double getDr () const
 
double getPhi0 () const
 
double getKappa () const
 
double getDz () const
 
double getTanLamda () const
 
double getPt () const
 
double getP () const
 
double getChisq () const
 
int getNHits () const
 
HepLorentzVector getP4 () const
 
MdcCalRecHitgetRecHit (int index) const
 
HepVector getHelix () const
 
HepSymMatrix getHelixErr () const
 
bool fgNoiseRatio (double phi0)
 
bool getFgNoiseRatio () const
 

Public Attributes

bool m_fgNoiseRatio
 

Detailed Description

Constructor & Destructor Documentation

◆ MdcCalRecTrk() [1/2]

MdcCalRecTrk::MdcCalRecTrk ( int  pid)

Definition at line 14 of file MdcCalRecTrk.cxx.

14 {
15 m_pid = pid;
16}

◆ ~MdcCalRecTrk() [1/2]

MdcCalRecTrk::~MdcCalRecTrk ( )

Definition at line 18 of file MdcCalRecTrk.cxx.

18 {
19 unsigned int i;
20 for(i=0; i<m_rechit.size(); i++){
21 delete m_rechit[i];
22 }
23 m_rechit.clear();
24}

◆ MdcCalRecTrk() [2/2]

MdcCalRecTrk::MdcCalRecTrk ( int  pid)

◆ ~MdcCalRecTrk() [2/2]

MdcCalRecTrk::~MdcCalRecTrk ( )

Member Function Documentation

◆ fgNoiseRatio() [1/2]

bool MdcCalRecTrk::fgNoiseRatio ( double  phi0)

Definition at line 129 of file MdcCalRecTrk.cxx.

129 {
130 IMessageSvc* msgSvc;
131 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
132 MsgStream log(msgSvc, "MdcCalib");
133
134 IDataProviderSvc* eventSvc = NULL;
135 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
136 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc,"/Event/Digi/MdcDigiCol");
137 if (!mdcDigiCol) {
138 log << MSG::FATAL << "Could not find event" << endreq;
139 }
140
141 int lay;
142 int cel;
143 bool hitCel[43][288];
144 for(lay=0; lay<43; lay++){
145 for(cel=0; cel<288; cel++){
146 hitCel[lay][cel] = false;
147 }
148 }
149
150 MdcDigiCol::iterator iter = mdcDigiCol->begin();
151 unsigned fgOverFlow;
152 int digiId = 0;
153 Identifier id;
154 for(; iter != mdcDigiCol->end(); iter++, digiId++) {
155 MdcDigi *aDigi = (*iter);
156 id = (aDigi)->identify();
157 lay = MdcID::layer(id);
158 cel = MdcID::wire(id);
159 fgOverFlow = (aDigi) -> getOverflow();
160
161 bool goodTQ = true;
162 if ( ((fgOverFlow & 3) !=0 ) || ((fgOverFlow & 12) != 0) ||
163 (aDigi->getTimeChannel() == 0x7FFFFFFF) ||
164 (aDigi->getChargeChannel() == 0x7FFFFFFF) ) goodTQ = false;
165
166 bool goodT = true;
167 if ( ((fgOverFlow & 1) !=0 ) || (aDigi->getTimeChannel() == 0x7FFFFFFF) ) goodT = false;
168
169// if(!goodTQ) continue;
170 if(!goodT) continue;
171
172 hitCel[lay][cel] = true;
173 }
174
175 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc, "/Event/Recon/RecMdcTrackCol");
176 if(!newtrkCol){
177 log << MSG::ERROR << "Could not find RecMdcTrackCol" << endreq;
178 return -1;
179 }
180
181 int nNoiRange = 4; // number of cells
182 double dphi = 1.0;
183 RecMdcTrackCol::iterator it_trk = newtrkCol->begin();
184 for(it_trk = newtrkCol->begin(); it_trk != newtrkCol->end(); it_trk++){
185 HitRefVec gothits = (*it_trk) -> getVecHits();
186 HitRefVec::iterator it_hit = gothits.begin();
187 HepVector helix = (*it_trk)->helix();
188 HepSymMatrix helixErr = (*it_trk)->err();
189 double phi0Rec = (*it_trk)->helix(1);
190 double delphi;
191 if(phi0Rec>phi0) delphi = phi0Rec - phi0;
192 else delphi = phi0 - phi0Rec;
193 if(delphi > CLHEP::pi) delphi -= CLHEP::pi;
194 if(delphi > (CLHEP::pi*0.17)) continue;
195
196 int nhitLay1 = 0; // lay0-3
197 int nhitLay2 = 0; // lay4-7
198 int nhitLay3 = 0; // lay8-19
199 int nhitLay4 = 0; // lay20-42
200 int nhitT1 = 0;
201 int nhitT2 = 0;
202 int nhitT3 = 0;
203 int nhitT4 = 0;
204 for(lay=0; lay<8; lay++){
205 double docamin = 0.7; // cm
206 if(lay>7) docamin = 0.9;
207 int celmin = -1;
208 int ncel = m_mdcGeomSvc->Layer(lay)->NCell();
209 for(cel=0; cel<ncel; cel++){
210 double wphi;
211 const MdcGeoWire* pWire = m_mdcGeomSvc -> Wire(lay, cel);
212 double xx = pWire->Backward().x();
213 double yy = pWire->Backward().y();
214 double rr = sqrt( (xx * xx) + (yy * yy) );
215 if( yy >= 0 ) wphi = acos(xx / rr);
216 else wphi = CLHEP::twopi - acos(xx / rr);
217
218 double phiTrk = phi0 + CLHEP::halfpi;
219 if(phiTrk > CLHEP::twopi) phiTrk -= CLHEP::twopi;
220 if( !( (fabs(wphi-phiTrk) < dphi) || (fabs(wphi+CLHEP::twopi-phiTrk) < dphi) ||
221 (fabs(wphi-CLHEP::twopi-phiTrk) < dphi) ) ){
222 continue;
223 }
224
225 double doca = m_mdcUtilitySvc->doca(lay, cel, helix, helixErr);
226// cout << setw(5) << lay << setw(5) << cel << setw(15) << doca << endl;
227 if(fabs(doca) < fabs(docamin)){
228 docamin = doca;
229 celmin = cel;
230 }
231 }
232 if(celmin > -1){
233 if(lay<4) nhitLay1++;
234 else if(lay<8) nhitLay2++;
235 else if(lay<20) nhitLay3++;
236 else nhitLay4++;
237 for(int ii=(-nNoiRange); ii<=nNoiRange; ii++){
238 if(0==ii) continue;
239 int icell = celmin + ii;
240 if(icell >= ncel) icell -= ncel;
241 if(icell < 0) icell += ncel;
242// cout << "hit " << setw(5) << lay << setw(5) << celmin << setw(5) << icell << setw(5) << hitCel[lay][icell]<<endl;
243 if(hitCel[lay][icell]){
244 if(lay<4) nhitT1++;
245 else if(lay<8) nhitT2++;
246 else if(lay<20) nhitT3++;
247 else nhitT4++;
248 }
249 }
250 }
251 }
252 if((nhitLay1<=0) || (nhitLay2<=0) || (nhitLay3<=0) || (nhitLay4<=0)) return false;
253 double ratio1 = (double)nhitT1 / ((double)nhitLay1 * (double)nNoiRange*2.0);
254 double ratio2 = (double)nhitT2 / ((double)nhitLay2 * (double)nNoiRange*2.0);
255 double ratio3 = (double)nhitT3 / ((double)nhitLay3 * (double)nNoiRange*2.0);
256 double ratio4 = (double)nhitT4 / ((double)nhitLay4 * (double)nNoiRange*2.0);
257
258 if((ratio1>0.08) || (ratio2>0.08) || (ratio3>0.03) || (ratio4>0.03)) return false;
259 else return true;
260 }
261 return false;
262}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
SmartRefVector< RecMdcHit > HitRefVec
virtual const MdcGeoLayer *const Layer(unsigned id)=0
virtual double doca(int layer, int cell, const HepVector helix, const HepSymMatrix errMat, bool passCellRequired=true, bool doSag=true) const =0
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition: MdcID.cxx:49
static int wire(const Identifier &id)
Definition: MdcID.cxx:54
unsigned int getChargeChannel() const
Definition: RawData.cxx:45
unsigned int getTimeChannel() const
Definition: RawData.cxx:40

Referenced by setKalTrk(), and setRecTrk().

◆ fgNoiseRatio() [2/2]

bool MdcCalRecTrk::fgNoiseRatio ( double  phi0)

◆ getChisq() [1/2]

double MdcCalRecTrk::getChisq ( ) const
inline

Definition at line 37 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

37{ return m_chisq; }

◆ getChisq() [2/2]

double MdcCalRecTrk::getChisq ( ) const
inline

Definition at line 37 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

37{ return m_chisq; }

◆ getDr() [1/2]

◆ getDr() [2/2]

double MdcCalRecTrk::getDr ( ) const
inline

Definition at line 30 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

30{ return m_dr; }

◆ getDz() [1/2]

◆ getDz() [2/2]

double MdcCalRecTrk::getDz ( ) const
inline

Definition at line 33 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

33{ return m_dz; }

◆ getFgNoiseRatio() [1/2]

bool MdcCalRecTrk::getFgNoiseRatio ( ) const
inline

◆ getFgNoiseRatio() [2/2]

bool MdcCalRecTrk::getFgNoiseRatio ( ) const
inline

◆ getHelix() [1/2]

HepVector MdcCalRecTrk::getHelix ( ) const
inline

Definition at line 41 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

41{ return m_helix; }

◆ getHelix() [2/2]

HepVector MdcCalRecTrk::getHelix ( ) const
inline

Definition at line 41 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

41{ return m_helix; }

◆ getHelixErr() [1/2]

HepSymMatrix MdcCalRecTrk::getHelixErr ( ) const
inline

Definition at line 42 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

42{ return m_helixerr; }

◆ getHelixErr() [2/2]

HepSymMatrix MdcCalRecTrk::getHelixErr ( ) const
inline

Definition at line 42 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

42{ return m_helixerr; }

◆ getKappa() [1/2]

double MdcCalRecTrk::getKappa ( ) const
inline

Definition at line 32 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

32{ return m_kappa; }

◆ getKappa() [2/2]

double MdcCalRecTrk::getKappa ( ) const
inline

Definition at line 32 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

32{ return m_kappa; }

◆ getNHits() [1/2]

int MdcCalRecTrk::getNHits ( ) const
inline

Definition at line 38 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

38{ return m_nhits; }

◆ getNHits() [2/2]

int MdcCalRecTrk::getNHits ( ) const
inline

Definition at line 38 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

38{ return m_nhits; }

◆ getP() [1/2]

double MdcCalRecTrk::getP ( ) const
inline

Definition at line 36 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

36{ return m_p; }

◆ getP() [2/2]

double MdcCalRecTrk::getP ( ) const
inline

Definition at line 36 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

36{ return m_p; }

◆ getP4() [1/2]

HepLorentzVector MdcCalRecTrk::getP4 ( ) const
inline

Definition at line 39 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

39{return m_p4;}

Referenced by MdcCalib::fillHist().

◆ getP4() [2/2]

HepLorentzVector MdcCalRecTrk::getP4 ( ) const
inline

Definition at line 39 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

39{return m_p4;}

◆ getPhi0() [1/2]

double MdcCalRecTrk::getPhi0 ( ) const
inline

Definition at line 31 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

31{ return m_phi0; }

◆ getPhi0() [2/2]

double MdcCalRecTrk::getPhi0 ( ) const
inline

Definition at line 31 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

31{ return m_phi0; }

◆ getPt() [1/2]

double MdcCalRecTrk::getPt ( ) const
inline

Definition at line 35 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

35{ return m_pt; }

◆ getPt() [2/2]

double MdcCalRecTrk::getPt ( ) const
inline

Definition at line 35 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

35{ return m_pt; }

◆ getRecHit() [1/2]

MdcCalRecHit * MdcCalRecTrk::getRecHit ( int  index) const
inline

Definition at line 40 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

40{ return m_rechit[index]; }

◆ getRecHit() [2/2]

MdcCalRecHit * MdcCalRecTrk::getRecHit ( int  index) const
inline

Definition at line 40 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

40{ return m_rechit[index]; }

◆ getTanLamda() [1/2]

double MdcCalRecTrk::getTanLamda ( ) const
inline

Definition at line 34 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

34{ return m_tanl; }

◆ getTanLamda() [2/2]

double MdcCalRecTrk::getTanLamda ( ) const
inline

Definition at line 34 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

34{ return m_tanl; }

◆ setGeomSvc() [1/2]

void MdcCalRecTrk::setGeomSvc ( IMdcGeomSvc mdcGeomSvc)
inline

Definition at line 24 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

24{ m_mdcGeomSvc = mdcGeomSvc; }

◆ setGeomSvc() [2/2]

void MdcCalRecTrk::setGeomSvc ( IMdcGeomSvc mdcGeomSvc)
inline

Definition at line 24 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

24{ m_mdcGeomSvc = mdcGeomSvc; }

◆ setKalTrk() [1/2]

void MdcCalRecTrk::setKalTrk ( RecMdcKalTrackCol::iterator  it_trk)

Definition at line 69 of file MdcCalRecTrk.cxx.

69 {
70 IMessageSvc *msgSvc;
71 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
72 MsgStream log(msgSvc, "MdcCalRecTrk");
73 log << MSG::DEBUG << "MdcCalRecTrk::setKalTrk()" << endreq;
74
80 else if(5 == m_pid) RecMdcKalTrack::setPidType(RecMdcKalTrack::muon); // cosmic-ray
81 else log << MSG::FATAL << "wrong particle type" << endreq;
82
83 m_dr = (*it_trk)->dr();
84 m_phi0 = (*it_trk)->fi0();
85 m_kappa = (*it_trk)->kappa();
86 m_dz = (*it_trk)->dz();
87 m_tanl = (*it_trk)->tanl();
88 m_chisq = (*it_trk)->chi2();
90
91 m_p4.setPx(- sin(m_phi0) / fabs(m_kappa));
92 m_p4.setPy(cos(m_phi0) / fabs(m_kappa));
93 m_p4.setPz(m_tanl / fabs(m_kappa));
94 double p3 = m_p4.mag();
95 double mass;
96 if(0 == m_pid) mass = 0.000511;
97 else if(1 == m_pid) mass = 0.105658;
98 else if(2 == m_pid) mass = 0.139570;
99 else if(3 == m_pid) mass = 0.493677;
100 else if(4 == m_pid) mass = 0.938272;
101 else if(5 == m_pid) mass = 0.139570; // cosmic-ray
102 m_p4.setE(sqrt(p3 * p3 + mass * mass));
103
104 m_dr *= 10.0; // cm -> mm
105 m_dz *= 10.0; // cm -> mm
106
107 m_pt = 1.0 / m_kappa;
108 m_p = m_pt * sqrt( m_tanl * m_tanl + 1.0 );
109
110// cout << setw(15) << m_p << setw(15) << m_dr << setw(15) << m_phi0
111// << setw(15) << m_kappa << setw(15) << m_dz << setw(15) << m_tanl << endl;
112
113 HelixSegRefVec gothelixsegs = (*it_trk)->getVecHelixSegs();
114 HelixSegRefVec::iterator it_hit = gothelixsegs.begin();
115 MdcCalRecHit* rechit;
116
117 int k = 0;
118 for(; it_hit != gothelixsegs.end(); it_hit++){
119 rechit = new MdcCalRecHit();
120 rechit->setKalHit(it_hit);
121 m_rechit.push_back(rechit);
122
123 k++;
124 }
125 m_nhits = k;
126// cout<<"hits "<<m_nhits <<endl;
127}
double mass
double sin(const BesAngle a)
double cos(const BesAngle a)
SmartRefVector< RecMdcKalHelixSeg > HelixSegRefVec
void setKalHit(HelixSegRefVec::iterator it_hit)
bool fgNoiseRatio(double phi0)

◆ setKalTrk() [2/2]

void MdcCalRecTrk::setKalTrk ( RecMdcKalTrackCol::iterator  it_trk)

◆ setRecTrk() [1/2]

void MdcCalRecTrk::setRecTrk ( RecMdcTrackCol::iterator  it_trk)

Definition at line 26 of file MdcCalRecTrk.cxx.

26 {
27 IMessageSvc *msgSvc;
28 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
29 MsgStream log(msgSvc, "MdcCalRecTrk");
30 log << MSG::DEBUG << "MdcCalRecTrk::setRecTrk()" << endreq;
31
32 m_dr = (*it_trk)->helix(0);
33 m_phi0 = (*it_trk)->helix(1);
34 m_kappa = (*it_trk)->helix(2);
35 m_dz = (*it_trk)->helix(3);
36 m_tanl = (*it_trk)->helix(4);
37 m_chisq = (*it_trk)->chi2();
38 m_nhits = (*it_trk)->getNhits();
39 m_helix = (*it_trk)->helix();
40 m_helixerr = (*it_trk)->err();
42
43 double mass;
44 if(0 == m_pid) mass = 0.000511;
45 else if(1 == m_pid) mass = 0.105658;
46 else if(2 == m_pid) mass = 0.139570;
47 else if(3 == m_pid) mass = 0.493677;
48 else if(4 == m_pid) mass = 0.938272;
49 else if(5 == m_pid) mass = 0.139570; // cosmic-ray
50 else log << MSG::FATAL << "wrong particle type" << endreq;
51 m_p4 = (*it_trk)->p4(mass);
52
53 m_dr *= 10.0; // cm -> mm
54 m_dz *= 10.0; // cm -> mm
55
56 m_pt = 1.0 / m_kappa;
57 m_p = m_pt * sqrt( m_tanl * m_tanl + 1.0 );
58
59 HitRefVec gothits = (*it_trk) -> getVecHits();
60 HitRefVec::iterator it_hit = gothits.begin();
61 MdcCalRecHit* rechit;
62 for(; it_hit != gothits.end(); it_hit++){
63 rechit = new MdcCalRecHit();
64 rechit->setRecHit(it_hit);
65 m_rechit.push_back(rechit);
66 }
67}
void setRecHit(HitRefVec::iterator it_hit)

◆ setRecTrk() [2/2]

void MdcCalRecTrk::setRecTrk ( RecMdcTrackCol::iterator  it_trk)

◆ setUtilSvc() [1/2]

void MdcCalRecTrk::setUtilSvc ( IMdcUtilitySvc mdcUtilitySvc)
inline

Definition at line 25 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/MdcCalRecTrk.h.

25{ m_mdcUtilitySvc = mdcUtilitySvc; }

◆ setUtilSvc() [2/2]

void MdcCalRecTrk::setUtilSvc ( IMdcUtilitySvc mdcUtilitySvc)
inline

Definition at line 25 of file Mdc/MdcCalibAlg/MdcCalibAlg-00-09-02/MdcCalibAlg/MdcCalRecTrk.h.

25{ m_mdcUtilitySvc = mdcUtilitySvc; }

Member Data Documentation

◆ m_fgNoiseRatio

bool MdcCalRecTrk::m_fgNoiseRatio

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