BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcHit Class Reference

#include <MdcHit.h>

+ Inheritance diagram for MdcHit:

Public Member Functions

 MdcHit (const MdcDigi *&digi, const MdcDetector *&det)
 
 MdcHit (const MdcHit &)
 
virtual ~MdcHit ()
 
MdcHitoperator= (const MdcHit &)
 
bool operator== (const MdcHit &) const
 
const MdcDigidigi () const
 
const MdcLayerlayer () const
 
const MdcSWirewire () const
 
const MdcDetectorgeom () const
 
const MdcCalibFunSvccalibSvc () const
 
Identifier mdcId () const
 
unsigned layernumber () const
 
unsigned wirenumber () const
 
unsigned tdcIndex () const
 
unsigned adcIndex () const
 
double charge () const
 
double rawTime () const
 
double driftTime (double tof, double z) const
 
double driftDist (double, int, double, double, double) const
 
double driftDist (double bunchTime, int ambig) const
 
double sigma (double, int, double, double, double) const
 
double sigma (double driftdist, int ambig=0) const
 
int whichView () const
 
const TrajectoryhitTraj () const
 
TrkEnums::TrkViewInfo whatView () const
 
double phi () const
 
double x () const
 
double y () const
 
const double phi (double z) const
 
double x (double z) const
 
double y (double z) const
 
double rMid () const
 
double zlen () const
 
unsigned status () const
 
void setCalibSvc (const MdcCalibFunSvc *calibSvc)
 
void setCountPropTime (const bool count)
 
void setCosmicFit (const bool cosmicfit)
 
bool isCosmicFit () const
 
void print (std::ostream &o) const
 
void printAll (std::ostream &o) const
 
- Public Member Functions inherited from TrkFundHit
 TrkFundHit ()
 
virtual ~TrkFundHit ()
 
int nUsedHits () const
 
bool usedHit (void) const
 
std::pair< TrkFundHit::hot_iterator, TrkFundHit::hot_iteratorgetUsedHits () const
 
TrkFundHit::hot_iterator begin () const
 
TrkFundHit::hot_iterator end () const
 
bool usedOnTrack (const TrkRecoTrk *t) const
 
const TrkHitOnTrkgetHitOnTrack (const TrkRecoTrk *trk) const
 
const TrkHitOnTrksetUsedHit (const TrkHitOnTrk *hit)
 
const TrkHitOnTrksetUnusedHit (const TrkHitOnTrk *hit)
 
virtual TrkEnums::TrkViewInfo whatView () const =0
 
virtual void printAll (std::ostream &os) const
 

Friends

class MdcMakeHits
 

Additional Inherited Members

- Public Types inherited from TrkFundHit
typedef TrkHitOnTrkIter< TrkFundHithot_iterator
 
- Protected Types inherited from TrkFundHit
typedef std::vector< constTrkHitOnTrk * >::iterator iterator_implementation
 
typedef const TrkHitOnTrk iterator_value_type
 
- Protected Member Functions inherited from TrkFundHit
TrkFundHitoperator= (const TrkFundHit &)
 
- Protected Attributes inherited from TrkFundHit
std::vector< const TrkHitOnTrk * > _hitList
 

Detailed Description

Definition at line 44 of file MdcHit.h.

Constructor & Destructor Documentation

◆ MdcHit() [1/2]

MdcHit::MdcHit ( const MdcDigi *&  digi,
const MdcDetector *&  det 
)

Definition at line 33 of file MdcHit.cxx.

33 :
34 TrkFundHit(), _digiPtr(aDigi), _geomPtr(det)
35{
36 _digiPtr = aDigi;
37 _geomPtr = det;
38 assert( _digiPtr != NULL);
39 assert( _geomPtr != NULL);
40 _id = aDigi->identify();
41 _layerPtr = det->Layer(_id);
42 _wirePtr = det->Wire(_id);
43 assert( _layerPtr != NULL);
44 assert( _wirePtr != NULL);
45 m_mdcCalibFunSvc = NULL;
46 _layer = MdcID::layer(_id);
47 _wire = MdcID::wire (_id);
48 _iTdc = _digiPtr->getTimeChannel();
49 _iAdc = _digiPtr->getChargeChannel();
50 _rawTime = RawDataUtil::MdcTime(_iTdc);
51 _charge = RawDataUtil::MdcCharge(_iAdc);
52 _rmid = _wirePtr->rMid();
53 _zlen = _layerPtr->zLength();
54 _phi = _wirePtr->phi();
55 _cosphi = cos(_phi);
56 _sinphi = sin(_phi);
57 _status = 0;
58}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
const MdcLayer * Layer(unsigned id) const
Definition: MdcDetector.h:33
const MdcSWire * Wire(unsigned id) const
Definition: MdcDetector.h:28
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
double zLength(void) const
Definition: MdcLayer.h:44
double phi(void) const
Definition: MdcSWire.h:52
double rMid(void) const
Definition: MdcSWire.h:50
static double MdcTime(int timeChannel)
Definition: RawDataUtil.h:8
static double MdcCharge(int chargeChannel)
Definition: RawDataUtil.h:11
unsigned int getChargeChannel() const
Definition: RawData.cxx:45
unsigned int getTimeChannel() const
Definition: RawData.cxx:40

Referenced by MdcHit().

◆ MdcHit() [2/2]

MdcHit::MdcHit ( const MdcHit other)

Definition at line 60 of file MdcHit.cxx.

60 :
61 TrkFundHit() , _digiPtr(other._digiPtr), _geomPtr(other._geomPtr),
62 _layerPtr(other._layerPtr), _wirePtr(other._wirePtr), _id(other._id),
63 _layer(other._layer), _wire(other._wire),
64 _iTdc(other._iTdc), _iAdc(other._iAdc),
65 _rawTime(other._rawTime), _charge(other._charge),
66 _rmid(other._rmid), _zlen(other._zlen),
67 _phi(other._phi), _cosphi(other._cosphi), _sinphi(other._sinphi),
68 _status(other._status), _T0Walk(other._T0Walk)
69{
70 m_mdcCalibFunSvc = other.m_mdcCalibFunSvc;
71}
Index other(Index i, Index j)
Definition: EvtCyclic3.cc:118

◆ ~MdcHit()

MdcHit::~MdcHit ( )
virtual

Definition at line 102 of file MdcHit.cxx.

102 {
103 // This is ugly and inefficient. This, along with the rest of
104 // the hitList mess, should be cleaned up by handling the
105 // association in an external map
106
107 // Not written as a loop because removeHit() modifies TrkFundHit::_hitList
108 short count = 0;
109 while (nUsedHits() > count) {
110 bool removed = _hitList[count]->parentTrack()->hits()->removeHit(this);
111 if (!removed) count++;
112 }
113}
DOUBLE_PRECISION count[3]
std::vector< const TrkHitOnTrk * > _hitList
Definition: TrkFundHit.h:97
int nUsedHits() const
Definition: TrkFundHit.cxx:89

Member Function Documentation

◆ adcIndex()

unsigned MdcHit::adcIndex ( ) const
inline

Definition at line 64 of file MdcHit.h.

64{ return _iAdc; }

Referenced by MdcTrack::storeTrack().

◆ calibSvc()

const MdcCalibFunSvc * MdcHit::calibSvc ( ) const
inline

Definition at line 59 of file MdcHit.h.

59{ return m_mdcCalibFunSvc; }

Referenced by setCalibSvc().

◆ charge()

double MdcHit::charge ( ) const
inline

Definition at line 65 of file MdcHit.h.

65{ return _charge; }

Referenced by MdcHitOnTrack::charge(), and MdcTrkRecon::fillTrackList().

◆ digi()

const MdcDigi * MdcHit::digi ( ) const
inline

Definition at line 55 of file MdcHit.h.

55{ return _digiPtr; }

Referenced by MdcTrackList::pickHits(), print(), and MdcTrack::storeTrack().

◆ driftDist() [1/2]

double MdcHit::driftDist ( double  bunchTime,
int  ambig 
) const

Definition at line 178 of file MdcHit.cxx.

178 {
179 return driftDist(bunchTime+crudeTof(), ambig, 0., 0., 0. );
180}
double driftDist(double, int, double, double, double) const
Definition: MdcHit.cxx:156

◆ driftDist() [2/2]

double MdcHit::driftDist ( double  tof,
int  ambig,
double  entranceAngle,
double  ,
double  z 
) const

Definition at line 156 of file MdcHit.cxx.

158{
159 double driftD;
160 //drift time ns, layer id begin with 0, entrance angle rads,
161 //lr ambig: wire ambig 1,-1,0 -> Calib 0,1,2
162 int lrCalib=2;
163 if (ambig==1) lrCalib = 0;
164 else if (ambig==-1) lrCalib = 1;
165
166 // tof in s, driftDist in cm, dirftTime in ns
167 if (fabs(z)>150. || fabs(driftTime(tof,z))>1500.){
168 return 9999.;
169 }
170 driftD = 0.1 * m_mdcCalibFunSvc->driftTimeToDist(driftTime(tof,z),_layer,_wire,lrCalib,entranceAngle);//to cm
171 //std::cout<<"driftDist "<<"("<<_layer <<","<<_wire <<") dd "<<driftD<<" dt "<<driftTime(tof,z) <<" lr "<<lrCalib <<" eAng "<<entranceAngle <<" tof "<<tof*1.e9<<" z "<<z <<" t0walk "<<_T0Walk<<" rawT "<<_rawTime <<" tprop "<< _rawTime - driftTime(tof,z)- _T0Walk-1.e9*tof<<std::endl;
172
173 if (abs(driftD)<Constants::epsilon) driftD = 0.00001;
174 return driftD;
175}
static const double epsilon
Definition: Constants.h:46
double driftTimeToDist(double drifttime, int layid, int cellid, int lr, double entrance=0.0) const
double driftTime(double tof, double z) const
Definition: MdcHit.cxx:142

Referenced by MdcSeg::addHits(), driftDist(), MdcxCosmicSewer::execute(), Hough2D::fit(), Hough3D::fit(), MdcTrackList::pickHits(), printAll(), and MdcSegInfoSterO::zPosition().

◆ driftTime()

double MdcHit::driftTime ( double  tof,
double  z 
) const

Definition at line 142 of file MdcHit.cxx.

142 {
143 // t prop
144 double tprop = 0.;
145 if (m_countPropTime){ tprop = m_mdcCalibFunSvc->getTprop(_layer,z*10.); }
146
147 //tof in s, driftTime in ns, _T0Walk in ns
148 double driftT = _rawTime - _T0Walk -1.e9*tof - tprop;
149
150 //if(driftT >10000)
151 //std::cout<< "driftTime ("<<_layer<<","<<_wire<<") dt "<<driftT<<" rawTime "<<_rawTime<<" z "<<z<<" tprop "<<tprop <<" t0walk "<<_T0Walk<<" tof "<<1.e9*tof<< std::endl;//yzhang debug
152 return driftT;
153}
double getTprop(int lay, double z) const

Referenced by driftDist(), MdcTrackList::dropMultiHotInLayer(), MdcTrkRecon::fillTrackList(), Hough2D::fit(), Hough3D::fit(), printAll(), and MdcTrack::storeTrack().

◆ geom()

const MdcDetector * MdcHit::geom ( ) const
inline

Definition at line 58 of file MdcHit.h.

58{ return _geomPtr; }

◆ hitTraj()

const Trajectory * MdcHit::hitTraj ( ) const

Definition at line 231 of file MdcHit.cxx.

231 {
233}
unsigned wirenumber() const
Definition: MdcHit.h:62
const MdcLayer * layer() const
Definition: MdcHit.h:56
const Trajectory * makeHitTrajInGlobalCoords(int wire, double z=0) const
Definition: MdcLayer.cxx:132

◆ isCosmicFit()

bool MdcHit::isCosmicFit ( ) const
inline

Definition at line 88 of file MdcHit.h.

88{ return m_cosmicFit; }

◆ layer()

const MdcLayer * MdcHit::layer ( ) const
inline

Definition at line 56 of file MdcHit.h.

56{ return _layerPtr; }

Referenced by hitTraj(), MdcHitOnTrack::layer(), MdcHitOnTrack::MdcHitOnTrack(), MdcTrackList::pickHits(), and MdcSegGrouper::transferHits().

◆ layernumber()

◆ mdcId()

Identifier MdcHit::mdcId ( ) const
inline

Definition at line 60 of file MdcHit.h.

60{ return _id; }

◆ operator=()

MdcHit & MdcHit::operator= ( const MdcHit other)

Definition at line 74 of file MdcHit.cxx.

74 {
75 if(&other != this){
76 _digiPtr = other._digiPtr;
77 _geomPtr = other._geomPtr;
78 _layerPtr = other._layerPtr;
79 _wirePtr = other._wirePtr;
80 m_mdcCalibFunSvc = other.m_mdcCalibFunSvc;
81 _id = other._id;
82 _layer = other._layer;
83 _wire = other._wire;
84 _iTdc = other._iTdc;
85 _iAdc = other._iAdc;
86 _rawTime = other._rawTime;
87 _charge = other._charge;
88 _digiPtr = other._digiPtr;
89 _rmid = other._rmid;
90 _zlen = other._zlen;
91 _phi = other._phi;
92 _cosphi = other._cosphi;
93 _sinphi = other._sinphi;
94 _status = other._status;
95 _T0Walk = other._T0Walk;
96 }
97 return *this;
98}

◆ operator==()

bool MdcHit::operator== ( const MdcHit rhs) const

Definition at line 116 of file MdcHit.cxx.

116 {
117 return (this == &rhs);
118}

◆ phi() [1/2]

double MdcHit::phi ( ) const
inline

Definition at line 75 of file MdcHit.h.

75{ return _phi;} // phi at chamber center

Referenced by MdcSeg::addHits(), MdcHitOnTrack::entranceAngle(), MdcxCosmicSewer::execute(), MdcTrackList::pickHits(), and MdcxHit::printAll().

◆ phi() [2/2]

const double MdcHit::phi ( double  z) const
inline

Definition at line 78 of file MdcHit.h.

78{return wire()->phiDC(z);} // phi at z
const MdcSWire * wire() const
Definition: MdcHit.h:57
double phiDC(double z) const
Definition: MdcSWire.h:60

◆ print()

void MdcHit::print ( std::ostream &  o) const

Definition at line 121 of file MdcHit.cxx.

121 {
122 o << "(" << _layer << ","<< _wire <<","<<digi()->getTrackIndex()<<")";
123}
const MdcDigi * digi() const
Definition: MdcHit.h:55
int getTrackIndex() const
Definition: RawData.cxx:50

Referenced by MdcSegInfoSterO::calcStereo(), operator<<(), MdcTrackList::pickHits(), MdcSeg::plotSeg(), MdcSeg::plotSegAll(), MdcSegData::poisonHits(), and MdcSegInfoSterO::zPosition().

◆ printAll()

void MdcHit::printAll ( std::ostream &  o) const
virtual

Reimplemented from TrkFundHit.

Definition at line 126 of file MdcHit.cxx.

126 {
127 o << "Hit:(" << _layer << "," << _wire
128 << ") x:" << x() << " y:" << y()
129 << " rt:" << rawTime()
130 << " dt:" <<driftTime(0.0,0)
131 << " dd:" <<driftDist(0.0,1)
132 << endl;
133}
double x() const
Definition: MdcHit.h:76
double rawTime() const
Definition: MdcHit.h:66
double y() const
Definition: MdcHit.h:77

◆ rawTime()

double MdcHit::rawTime ( ) const
inline

Definition at line 66 of file MdcHit.h.

66{ return _rawTime; }

Referenced by Hough2D::fit(), Hough3D::fit(), printAll(), MdcHitOnTrack::rawTime(), and MdcHitOnTrack::setT0().

◆ rMid()

double MdcHit::rMid ( ) const
inline

Definition at line 81 of file MdcHit.h.

81{ return _rmid; } // R at chamber center

◆ setCalibSvc()

void MdcHit::setCalibSvc ( const MdcCalibFunSvc calibSvc)

Definition at line 136 of file MdcHit.cxx.

136 {
137 m_mdcCalibFunSvc = calibSvc;
138 _T0Walk = m_mdcCalibFunSvc->getT0(_layer,_wire) + m_mdcCalibFunSvc->getTimeWalk(_layer, _iAdc);
139}
double getT0(int layid, int cellid) const
double getTimeWalk(int layid, double Q) const
const MdcCalibFunSvc * calibSvc() const
Definition: MdcHit.h:59

Referenced by MdcMakeHits::execute(), MdcxCosmicSewer::execute(), Hough2D::fit(), Hough3D::fit(), and MdcxCosmicSewer::MdcxHitsToHots().

◆ setCosmicFit()

void MdcHit::setCosmicFit ( const bool  cosmicfit)
inline

Definition at line 87 of file MdcHit.h.

87{ m_cosmicFit = cosmicfit; }

Referenced by MdcMakeHits::execute(), MdcxCosmicSewer::execute(), and MdcxCosmicSewer::MdcxHitsToHots().

◆ setCountPropTime()

void MdcHit::setCountPropTime ( const bool  count)
inline

Definition at line 86 of file MdcHit.h.

86{ m_countPropTime = count;}

Referenced by MdcMakeHits::execute(), MdcxCosmicSewer::execute(), Hough2D::fit(), Hough3D::fit(), and MdcxCosmicSewer::MdcxHitsToHots().

◆ sigma() [1/2]

double MdcHit::sigma ( double  driftdist,
int  ambig = 0 
) const

Definition at line 226 of file MdcHit.cxx.

226 {
227 return sigma(driftdist, ambig, 0., 0., 0.);// cm
228}
TTree * sigma

◆ sigma() [2/2]

double MdcHit::sigma ( double  driftdist,
int  ambig,
double  entranceAngle,
double  dipAngle,
double  z 
) const

Definition at line 184 of file MdcHit.cxx.

185 {
186 double sig = 9999.;
187
188#ifdef MDCPATREC_RESLAYER
189 if (_layer == m_resLayer){
190 //give a huge sigma to skip this layer when fit track
191 return 9999.;
192 }
193#endif
194 //if(fabs(z)>150. || driftdist==9999. ) {
195 // return 9999.;
196 //}
197 if ( m_mdcCalibFunSvc ) {
198 //layid begin with 0, entrance angle in rads,
199 //distance: cm ->Calib mm //z: cm -> Calib mm
200 //Q: MonteCalo eV -> Calib fC FIXME
201 //lr ambig: wire ambig 1,-1,0 -> Calib 0,1,2
202 int lrCalib=2;
203 if (ambig==1) lrCalib = 0;
204 else if (ambig==-1) lrCalib = 1;
205
206 //std::cout<<"layer "<<_layer<< " lrCalib "<< lrCalib<< " driftdist "<< driftdist << " eAngle "<<entranceAngle
207 //<<" tan(dipAngle) "<<tan(dipAngle)<< " z "<<z <<" iAdc "<<_iAdc<<std::endl;
208 sig = 0.1 * m_mdcCalibFunSvc->getSigma(_layer,lrCalib,driftdist*10.,entranceAngle,
209 tan(dipAngle),z*10.,_iAdc); //Calib special resolution mm -> cm
210
211 if(fabs(sig)<Constants::epsilon){
212 sig = 999.;
213 }
214 //if(sig<=0){
215 //std::cout<<__FILE__<<" "<<__LINE__ <<" sigma "<<sig
216 //<<" layer "<<_layer <<" lrCalib "<<lrCalib <<" driftdist "<<driftdist*10
217 //<<" eAngle "<<entranceAngle<<" dipAngle "<<(dipAngle) <<" tanl "<<tan(dipAngle)
218 //<<" z "<<z <<" iAdc "<<_iAdc <<std::endl;
219 //}
220 }
221 //if (_layer<4) sig /=5.;//yzhang TEST 2011-05-27
222 return sig;
223}
double tan(const BesAngle a)
Definition: BesAngle.h:216
double getSigma(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const

Referenced by MdcSeg::addHits(), MdcxCosmicSewer::execute(), MdcTrackList::pickHits(), and MdcSegInfoSterO::zPosition().

◆ status()

unsigned MdcHit::status ( ) const
inline

Definition at line 83 of file MdcHit.h.

83{ return _status;}// status

Referenced by MdcRecoHitOnTrack::status().

◆ tdcIndex()

unsigned MdcHit::tdcIndex ( ) const
inline

Definition at line 63 of file MdcHit.h.

63{ return _iTdc; }

Referenced by MdcTrack::storeTrack(), and MdcRecoHitOnTrack::tdcIndex().

◆ whatView()

TrkEnums::TrkViewInfo MdcHit::whatView ( ) const
inlinevirtual

Implements TrkFundHit.

Definition at line 74 of file MdcHit.h.

int whichView() const
Definition: MdcHit.h:72
@ xyView
Definition: TrkEnums.h:22
@ bothView
Definition: TrkEnums.h:22

Referenced by MdcHitOnTrack::whatView().

◆ whichView()

int MdcHit::whichView ( ) const
inline

Definition at line 72 of file MdcHit.h.

72{ return _layerPtr->view(); }
int view(void) const
Definition: MdcLayer.h:28

Referenced by whatView(), and MdcHitOnTrack::whichView().

◆ wire()

const MdcSWire * MdcHit::wire ( ) const
inline

Definition at line 57 of file MdcHit.h.

57{ return _wirePtr; }

Referenced by phi(), x(), y(), and MdcSegInfoSterO::zPosition().

◆ wirenumber()

◆ x() [1/2]

double MdcHit::x ( ) const
inline

Definition at line 76 of file MdcHit.h.

76{ return _rmid*_cosphi; } // x at chamber center

Referenced by MdcTrackList::pickHits(), printAll(), and MdcSegGrouper::transferHits().

◆ x() [2/2]

double MdcHit::x ( double  z) const
inline

Definition at line 79 of file MdcHit.h.

79{return wire()->xWireDC(z);}// x at global z
double xWireDC(double z) const
Definition: MdcSWire.h:61

◆ y() [1/2]

double MdcHit::y ( ) const
inline

Definition at line 77 of file MdcHit.h.

77{ return _rmid*_sinphi; } // y at chamber center

Referenced by MdcTrackList::pickHits(), printAll(), and MdcSegGrouper::transferHits().

◆ y() [2/2]

double MdcHit::y ( double  z) const
inline

Definition at line 80 of file MdcHit.h.

80{return wire()->yWireDC(z);}// y at global z
double yWireDC(double z) const
Definition: MdcSWire.h:62

◆ zlen()

double MdcHit::zlen ( ) const
inline

Definition at line 82 of file MdcHit.h.

82{ return _zlen; } // chamber extent in z

Friends And Related Function Documentation

◆ MdcMakeHits

friend class MdcMakeHits
friend

Definition at line 103 of file MdcHit.h.


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