CbmRoot
Loading...
Searching...
No Matches
CbmRichRing.cxx
Go to the documentation of this file.
1/* Copyright (C) 2006-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig, Semen Lebedev, Denis Bertini [committer] */
4
5/* $Id: CbmRichRing.cxx,v 1.8 2006/09/13 14:51:28 hoehne Exp $*/
6
7/* History of CVS commits:
8 *
9 * $Log: CbmRichRing.cxx,v $
10 * Revision 1.8 2006/09/13 14:51:28 hoehne
11 * two variables (Selection2D, SelectionNN) added in which values between 0 and 1 are stored for fake rejection
12 * ReconstructedFlag removed
13 *
14 * Revision 1.7 2006/08/11 14:03:57 hoehne
15 * move SetUncertainty and GetUncertainty to SetChi2 and GetChi2
16 *
17 * Revision 1.6 2006/07/12 06:27:54 hoehne
18 * new functions: SetDistance and GetDistance added which set/ give the distance between ring center and track attached to this
19 * ring
20 *
21 * Revision 1.5 2006/02/23 11:24:10 hoehne
22 * RecFlag added (Simeon Lebedev)
23 *
24 * Revision 1.4 2006/01/23 11:40:13 hoehne
25 * MCMotherID added
26 *
27 * Revision 1.3 2006/01/19 10:40:06 hoehne
28 * restructured according to new RinfFinder Class:
29 * array of hits belonging to a certain ring added
30 *
31 *
32 *
33 */
34
35
36// -------------------------------------------------------------------------
37// ----- CbmRichRing source file -----
38// ----- Created 05/07/04 by A. Soloviev <solovjev@cv.jinr.ru> -----
39// -------------------------------------------------------------------------
40
41#include "CbmRichRing.h"
42
43#include <Logger.h> // for Logger, LOG
44
45#include <TObject.h> // for TObject
46
47#include <cmath> // for fabs, sqrt, atan, cos, sin
48
49using std::atan;
50using std::fabs;
51using std::sqrt;
52
53// ----- Default constructor -------------------------------------------
55 : TObject()
56 , fHitCollection()
57 , fAPar(0.)
58 , fBPar(0.)
59 , fCPar(0.)
60 , fDPar(0.)
61 , fEPar(0.)
62 , fFPar(0.)
63 , fCenterX(0.)
64 , fCenterY(0.)
65 , fRadius(0.)
66 , fAaxis(0.)
67 , fBaxis(0.)
68 , fAaxisCor(0.)
69 , fBaxisCor(0.)
70 , fPhi(0.)
71 , fChi2(0.)
72 , fAngle(0.)
73 , fNofHitsOnRing(-1)
74 , fSelectionNN(-1.)
75 , fRecFlag(0)
76 , fTime(0.)
77{
78 fHitCollection.reserve(40);
79}
80// -------------------------------------------------------------------------
81
82
83// ----- Standard constructor ------------------------------------------
84CbmRichRing::CbmRichRing(float x, float y, float r)
85 : TObject()
86 , fHitCollection()
87 , fAPar(0.)
88 , fBPar(0.)
89 , fCPar(0.)
90 , fDPar(0.)
91 , fEPar(0.)
92 , fFPar(0.)
93 , fCenterX(x)
94 , fCenterY(y)
95 , fRadius(r)
96 , fAaxis(0.)
97 , fBaxis(0.)
98 , fAaxisCor(0.)
99 , fBaxisCor(0.)
100 , fPhi(0.)
101 , fChi2(0.)
102 , fAngle(0.)
103 , fNofHitsOnRing(-1)
104 , fSelectionNN(-1.)
105 , fRecFlag(0)
106 , fTime(0.)
107{
108 fHitCollection.reserve(40);
109}
110// -------------------------------------------------------------------------
111
112
113// ----- Destructor ----------------------------------------------------
115// -------------------------------------------------------------------------
116
117void CbmRichRing::SetXYABPhi(double x, double y, double a, double b, double phi)
118{
119 fCenterX = x;
120 fCenterY = y;
121 fAaxis = a;
122 fBaxis = b;
123 fPhi = phi;
124}
125
126bool CbmRichRing::RemoveHit(uint32_t hitId)
127{
128 //int32_t nofHits = fHitCollection.size();
129 std::vector<uint32_t>::iterator it;
130 for (it = fHitCollection.begin(); it != fHitCollection.end(); it++) {
131 if (hitId == *it) {
132 fHitCollection.erase(it);
133 return true;
134 }
135 }
136 return false;
137}
138
140{
141 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
142 double xc = c * cos(fabs(fPhi));
143
144 return fCenterX + xc;
145}
146
148{
149 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
150 double yc = c * sin(fabs(fPhi));
151 if (fPhi >= 0) { return fCenterY + yc; }
152 else {
153 return fCenterY - yc;
154 }
155}
156
158{
159 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
160 double xc = c * cos(fabs(fPhi));
161
162 return fCenterX - xc;
163}
164
166{
167 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
168 double yc = c * sin(fabs(fPhi));
169 if (fPhi >= 0) { return fCenterY - yc; }
170 else {
171 return fCenterY + yc;
172 }
173}
174
175void CbmRichRing::Print(Option_t*) const
176{
177 LOG(info) << " Ring parameters: "
178 << " Aaxis = " << GetAaxis() << ", Baxis = " << GetBaxis() << ", Phi = " << GetPhi()
179 << ", CenterX = " << GetCenterX() << ", CenterY = " << GetCenterY() << ", Radius = " << GetRadius()
180 << ", NofHits = " << GetNofHits() << ", RadialPosition = " << GetRadialPosition()
181 << ", Chi2 = " << GetChi2() << ", Angle() = " << GetAngle() << ", NofHitsOnRing = " << GetNofHitsOnRing();
182}
183
185{
186 if (fCenterY > 0.f) { return sqrt(fCenterX * fCenterX + (fCenterY - 110.f) * (fCenterY - 110.f)); }
187 else {
188 return sqrt(fCenterX * fCenterX + (fCenterY + 110.f) * (fCenterY + 110.f));
189 }
190}
191
193{
194 /* if (fCenterY > 0){
195 return atan((100 - fCenterY) / (0 - fCenterX));
196 } else {
197 return atan((-100 - fCenterY) / (0 - fCenterX));
198 }*/
199
200 if (fCenterX > 0 && fCenterY > 0) { return atan(fabs((100 - fCenterY) / (0 - fCenterX))); }
201 if (fCenterX < 0 && fCenterY > 0) { return M_PI - atan(fabs((100 - fCenterY) / (0 - fCenterX))); }
202 if (fCenterX < 0 && fCenterY < 0) { return M_PI + atan(fabs((-100 - fCenterY) / (0 - fCenterX))); }
203 if (fCenterX > 0 && fCenterY < 0) { return 2 * M_PI - atan(fabs((-100 - fCenterY) / (0 - fCenterX))); }
204
205 return 999.;
206}
207//
208//CbmRichRingLight* CbmRichRing::toLightRing()
209//{
210// CbmRichRingLight* rl = new CbmRichRingLight();
211//
212// for (int i = 0; i < this->GetNofHits(); i ++){
213// rl->AddHit(this->GetHit(i));
214// }
215// rl->SetCenterX(this->GetCenterX());
216// rl->SetCenterY(this->GetCenterY());
217// rl->SetRadius(this->GetRadius());
218// rl->SetAngle(this->GetAngle());
219// rl->SetChi2(this->GetChi2());
220// rl->SetNofHitsOnRing(this->GetNofHitsOnRing());
221// rl->SetSelectionNN(this->GetSelectionNN());
222// rl->SetRecFlag(this->GetRecFlag());
223//
224// return rl;
225//}
226
ClassImp(CbmConverterManager)
friend fvec sqrt(const fvec &a)
friend fvec cos(const fvec &a)
friend fvec sin(const fvec &a)
double GetRadialAngle() const
double fBaxis
float GetRadius() const
Definition CbmRichRing.h:79
double GetXF2() const
double GetAngle() const
Definition CbmRichRing.h:95
double GetYF1() const
double fAaxis
double GetAaxis() const
Definition CbmRichRing.h:80
double GetYF2() const
int32_t GetNofHits() const
Definition CbmRichRing.h:37
virtual void Print(Option_t *opt="") const
float GetCenterX() const
Definition CbmRichRing.h:77
bool RemoveHit(uint32_t hitId)
double GetXF1() const
double GetChi2() const
Definition CbmRichRing.h:92
int32_t GetNofHitsOnRing() const
Definition CbmRichRing.h:96
std::vector< uint32_t > fHitCollection
virtual ~CbmRichRing()
double GetPhi() const
Definition CbmRichRing.h:84
float GetCenterY() const
Definition CbmRichRing.h:78
float GetRadialPosition() const
void SetXYABPhi(double x, double y, double a, double b, double phi)
double GetBaxis() const
Definition CbmRichRing.h:81