CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcGeomSvc-00-01-42/src/MdcGeoWire.cxx
Go to the documentation of this file.
1
2
3
4#include "MdcGeomSvc/MdcGeoWire.h"
5#include "MdcGeomSvc/MdcGeomSvc.h"
6#include <math.h>
7
8// according to the mathematicial formula:
9// Sg = L^2*g*rhol/8*T
10// rhol is the linear density
11// rhol is fixed at 9.47E-3 g/m
12const double MdcGeoWire::Sag(void) const{
13
15 // unit of wire length is mm
16 const double L = (fForward - fBackward).mag();
17 // sag unit is mm
18 return (L*L*1.184E-6/fTension);
19 }
20 // do not consider wire sagita
21 else return 0.;
22}
23
24
25// calculate the sag at length z
26// attention, the z is not the z-coordinate of the point
27// but the length from this point to the backward point
28const double MdcGeoWire::Sagz(const double z) const{
29 return z*0.; //FIXME
30}
31
32
33void MdcGeoWire::AddWireNeighbor(int id,int type){
34 fWireNeighborsID.push_back(id);
35 fNeighborType.push_back(type);
36}
37
39 fWireNeighbors.push_back(awire);
40 fNeighborType.push_back(type);
41}
42
43void MdcGeoWire::AddWireNeighbor(MdcGeoWire* awire,int id,int type){
44 fWireNeighbors.push_back(awire);
45 fNeighborType.push_back(type);
46 fWireNeighborsID.push_back(id);
47}
48
49double MdcGeoWire::GetX(double z) const{
50 return (fForward.x()-fBackward.x())*(z-fBackward.z())/(fForward.z()-fBackward.z())+fBackward.x();
51}
52
53double MdcGeoWire::GetY(double z) const{
54 return (fForward.y()-fBackward.y())*(z-fBackward.z())/(fForward.z()-fBackward.z())+fBackward.y();
55}
56
57vector<int> MdcGeoWire::GetNeighborIDType3(void) const{
58 std::vector<int> NeighborType3;
59 for(unsigned i=0;i<fWireNeighborsID.size();i++){
60 if(fNeighborType.at(i)==3){
61 NeighborType3.push_back(fWireNeighborsID.at(i));
62 }
63 }
64 return NeighborType3;
65}
66
67vector<int> MdcGeoWire::GetNeighborIDType4(void) const{
68 std::vector<int> NeighborType4;
69 for(unsigned i=0;i<fWireNeighborsID.size();i++){
70 if(fNeighborType.at(i)==4){
71 NeighborType4.push_back(fWireNeighborsID.at(i));
72 }
73 }
74 return NeighborType4;
75}
76
77vector<MdcGeoWire*> MdcGeoWire::GetNeighborType3(void) const{
78 std::vector<MdcGeoWire*> NeighborType3;
79 for(unsigned i=0;i<fWireNeighbors.size();i++){
80 if(fNeighborType.at(i)==3){
81 NeighborType3.push_back(fWireNeighbors.at(i));
82 }
83 }
84 return NeighborType3;
85}
86
87vector<MdcGeoWire*> MdcGeoWire::GetNeighborType4(void) const{
88 std::vector<MdcGeoWire*> NeighborType4;
89 for(unsigned i=0;i<fWireNeighbors.size();i++){
90 if(fNeighborType.at(i)==4){
91 NeighborType4.push_back(fWireNeighbors.at(i));
92 }
93 }
94 return NeighborType4;
95}
96
97
98vector<MdcGeoWire*> MdcGeoWire::GetNeighboratZType3(double z) const{
99 std::vector<MdcGeoWire*> NeighborZType3;
100 const double phi = MdcGeoWire::WirePhi(z);
101 double phi2,dPhi1,dPhi2,phiMax,phiMin;
102 std::vector<MdcGeoWire*> NeighborType3 = MdcGeoWire::GetNeighborType3();
103 dPhi1=M_PI/double(fLyr->NCell());
104 if(NeighborType3.size()>0) {
105 dPhi2=M_PI/double(NeighborType3.at(0)->Lyr()->NCell());
106 phiMax=MdcGeoWire::CalculatePhi(phi+dPhi1+dPhi2);
107 phiMin=MdcGeoWire::CalculatePhi(phi-dPhi1-dPhi2);
108 if(fabs(z)<NeighborType3.at(0)->Lyr()->Length()/2.){
109 for(unsigned i=0;i<NeighborType3.size();i++){
110 phi2 =NeighborType3.at(i)->WirePhi(z);
111 if(phi2>phiMin&&phi2<phiMax) NeighborZType3.push_back(NeighborType3.at(i));
112 else if(phiMin>phiMax&&(phi2>phiMin||phi2<phiMax)) NeighborZType3.push_back(NeighborType3.at(i));
113 }
114 }
115 }
116 return NeighborZType3;
117}
118
119vector<MdcGeoWire*> MdcGeoWire::GetNeighboratZType4(double z) const{
120 std::vector<MdcGeoWire*> NeighborZType4;
121 const double phi = MdcGeoWire::WirePhi(z);
122 double phi2,dPhi1,dPhi2,phiMax,phiMin;
123 std::vector<MdcGeoWire*> NeighborType4 = MdcGeoWire::GetNeighborType4();
124 dPhi1=M_PI/double(fLyr->NCell());
125 if(NeighborType4.size()>0) {
126 dPhi2=M_PI/double(NeighborType4.at(0)->Lyr()->NCell());
127 phiMax=MdcGeoWire::CalculatePhi(phi+dPhi1+dPhi2);
128 phiMin=MdcGeoWire::CalculatePhi(phi-dPhi1-dPhi2);
129
130 for(unsigned i=0;i<NeighborType4.size();i++){
131 phi2 =NeighborType4.at(i)->WirePhi(z);
132 if(phi2>phiMin&&phi2<phiMax) NeighborZType4.push_back(NeighborType4.at(i));
133 else if(phiMin>phiMax&&(phi2>phiMin||phi2<phiMax)) NeighborZType4.push_back(NeighborType4.at(i));
134 }
135
136 }
137 return NeighborZType4;
138}
139
141 fWireNeighborsID.clear();
142 fWireNeighbors.clear();
143 fNeighborType.clear();
144}
145
146double MdcGeoWire::WirePhi(double z) const{
147 double x,y;
148 double phi;
149 x = MdcGeoWire::GetX(z);
150 y = MdcGeoWire::GetY(z);
151 if(y>=0){
152 phi = acos(x/sqrt(pow(x,2.)+pow(y,2.)));
153 }
154 else {
155 phi =2*M_PI-acos(x/sqrt(pow(x,2.)+pow(y,2.)));
156 }
157 return phi;
158}
159
160double MdcGeoWire::CalculatePhi(double phi) const{
161 if(0<phi&&phi<2*M_PI){
162 return phi;
163 }
164 else if(phi>2*M_PI){
165 return phi-2*M_PI;
166 }
167 else {
168 return phi+2*M_PI;
169 }
170 }
Double_t phi2
Double_t x[10]
#define M_PI
Definition TConstant.h:4
double GetX(const double z) const
vector< MdcGeoWire * > GetNeighborType3(void) const
vector< int > GetNeighborIDType4(void) const
double GetY(const double z) const
const double Sagz(const double z) const
vector< MdcGeoWire * > GetNeighborType4(void) const
double WirePhi(double z) const
vector< MdcGeoWire * > GetNeighboratZType3(double z) const
vector< MdcGeoWire * > GetNeighboratZType4(double z) const
void AddWireNeighbor(int id, int type)
vector< int > GetNeighborIDType3(void) const
double CalculatePhi(double phi) const