Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CBMRICHRINGLIGHT_H_
00009 #define CBMRICHRINGLIGHT_H_
00010
00011 #include <vector>
00012 #include <cmath>
00013
00014 using std::vector;
00015
00016 class CbmRichHitLight
00017 {
00018 public:
00022 CbmRichHitLight():
00023 fX(0.),
00024 fY(0.){}
00025
00029 virtual ~CbmRichHitLight(){}
00030
00036 CbmRichHitLight(
00037 float x,
00038 float y):
00039 fX(x),
00040 fY(y) {}
00041
00042 float fX;
00043 float fY;
00044 };
00045
00046 class CbmRichRingLight
00047 {
00048 public:
00049
00053 CbmRichRingLight():
00054 fHits(),
00055 fHitIds(),
00056
00057 fCenterX(0.f),
00058 fCenterY(0.f),
00059 fRadius(0.f),
00060
00061 fAaxis(0.f),
00062 fBaxis(0.f),
00063 fPhi(0.f),
00064
00065 fAPar(0.f),
00066 fBPar(0.f),
00067 fCPar(0.f),
00068 fDPar(0.f),
00069 fEPar(0.f),
00070 fFPar(0.f),
00071
00072 fRecFlag(0),
00073
00074 fChi2(0.f),
00075 fAngle(0.f),
00076 fNofHitsOnRing(0),
00077 fSelectionNN(0.f)
00078
00079 {
00080 fHits.reserve(30);
00081 fHitIds.reserve(30);
00082 }
00083
00087 virtual ~CbmRichRingLight()
00088 {
00089 fHits.clear();
00090 fHitIds.clear();
00091 }
00092
00098 void AddHit(
00099 CbmRichHitLight hit,
00100 unsigned short id = -1)
00101 {
00102 fHits.push_back(hit);
00103 fHitIds.push_back(id);
00104 }
00105
00111 bool RemoveHit(
00112 int hitId)
00113 {
00114 vector<unsigned short>::iterator it;
00115 for (it = fHitIds.begin(); it!= fHitIds.end(); it++){
00116 if (hitId == *it){
00117 fHitIds.erase(it);
00118 return true;
00119 }
00120 }
00121 return false;
00122 }
00123
00127 int GetNofHits() const {return fHitIds.size(); }
00128
00133 CbmRichHitLight GetHit(int ind) {return fHits[ind];}
00134
00139 unsigned short GetHitId(int ind) {return fHitIds[ind];}
00140
00141 void SetCenterX(float x) {fCenterX = x;}
00142 void SetCenterY(float y) {fCenterY = y;}
00143 void SetRadius(float r) {fRadius = r;}
00144
00151 void SetXYR(
00152 float x,
00153 float y,
00154 float r)
00155 {
00156 fCenterX = x;
00157 fCenterY = y;
00158 fRadius = r;
00159 }
00160
00169 void SetXYABP(
00170 float x,
00171 float y,
00172 float a,
00173 float b,
00174 float p)
00175 {
00176 fCenterX = x;
00177 fCenterY = y;
00178 fAaxis = a;
00179 fBaxis = b;
00180 fPhi = p;
00181 }
00182
00183 void SetChi2(float chi2) {fChi2 = chi2;}
00184 void SetAngle( float angle) {fAngle = angle;}
00185 void SetNofHitsOnRing(unsigned short onring) {fNofHitsOnRing = onring;}
00186 void SetSelectionNN (float selectionNN ) {fSelectionNN = selectionNN;}
00187
00188 float GetCenterX() const {return fCenterX;}
00189 float GetCenterY() const {return fCenterY;}
00190 float GetRadius() const {return fRadius;}
00191
00192 float GetAaxis() const {return fAaxis;}
00193 float GetBaxis() const {return fBaxis;}
00194 float GetPhi() const {return fPhi;}
00195 void SetAaxis(double a) {fAaxis = a;}
00196 void SetBaxis(double b) {fBaxis = b;}
00197 void SetPhi(double phi) {fPhi = phi;}
00198
00202 double GetXF1() const
00203 {
00204 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
00205 double xc = c*cos(fabs(fPhi));
00206
00207 return fCenterX+xc;
00208 }
00209
00213 double GetYF1() const
00214 {
00215 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
00216 double yc = c * sin(fabs(fPhi));
00217 if (fPhi >=0){
00218 return fCenterY+yc;
00219 }else{
00220 return fCenterY-yc;
00221 }
00222 }
00223
00227 double GetXF2() const
00228 {
00229 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
00230 double xc = c*cos(fabs(fPhi));
00231
00232 return fCenterX-xc;
00233 }
00234
00238 double GetYF2() const
00239 {
00240 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
00241 double yc = c * sin(fabs(fPhi));
00242 if (fPhi >= 0){
00243 return fCenterY - yc;
00244 }else{
00245 return fCenterY + yc;
00246 }
00247 }
00248
00258 void SetABCDEF(
00259 float a,
00260 float b,
00261 float c,
00262 float d,
00263 float e,
00264 float f)
00265 {
00266 fAPar = a;
00267 fBPar = b;
00268 fCPar = c;
00269 fDPar = d;
00270 fEPar = e;
00271 fFPar = f;
00272 }
00273
00274 float GetAPar() const {return fAPar;}
00275 float GetBPar() const {return fBPar;}
00276 float GetCPar() const {return fCPar;}
00277 float GetDPar() const {return fDPar;}
00278 float GetEPar() const {return fEPar;}
00279 float GetFPar() const {return fFPar;}
00280
00281 float GetSelectionNN() const {return fSelectionNN;}
00282 float GetChi2() const {return fChi2;}
00283
00287 float GetRadialPosition() const{
00288 if (fCenterY > 0.f){
00289 return sqrt(fCenterX * fCenterX + (fCenterY - 110.f) * (fCenterY - 110.f));
00290 } else {
00291 return sqrt(fCenterX * fCenterX + (fCenterY + 110.f) * (fCenterY + 110.f));
00292 };
00293 return 0.;
00294 }
00295
00296 float GetAngle() const {return fAngle;}
00297
00298 unsigned short GetNofHitsOnRing() const {return fNofHitsOnRing;}
00299
00300 int GetRecFlag() const {return fRecFlag;}
00301 void SetRecFlag(int r) { fRecFlag = r;}
00302
00303 private:
00304 vector<CbmRichHitLight> fHits;
00305 vector<unsigned short> fHitIds;
00306
00307 float fCenterX;
00308 float fCenterY;
00309 float fRadius;
00310
00311 float fAaxis;
00312 float fBaxis;
00313 float fPhi;
00314
00315 float fAPar;
00316 float fBPar;
00317 float fCPar;
00318 float fDPar;
00319 float fEPar;
00320 float fFPar;
00321
00322 int fRecFlag;
00323
00324 float fChi2;
00325 float fAngle;
00326 unsigned short fNofHitsOnRing;
00327 float fSelectionNN;
00328 };
00329
00330 #endif