BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
KalFitWire.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// File from KalFit module
3//
4// Filename : KalFitWire.cc
5//------------------------------------------------------------------------
6// Description : Description of a Mdc Wire
7//------------------------------------------------------------------------
8// Modif :
9//------------------------------------------------------------------------
10#include "CLHEP/Geometry/Point3D.h"
11#ifndef ENABLE_BACKWARDS_COMPATIBILITY
13#endif
17
18const double KalFitWire::A[NREGION] = { 8.5265E-7,
19 1.1368E-6,
20 1.2402E-6};
21const double KalFitWire::F[NLAYER] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
22 47.2,46.6,47.0,46,45,46.7,46,45,44.6,
23 45.9,45.9,45.3,44.5,44.0,46.0,45.6,
24 44.2,43.6,44.0,43.5,43.1,42.9,42.4,
25 42.7,42.5,42.2,41,42,42,42,41.4,42.5,
26 43.0,43.2,43.4,43.4};
27const double L49_2 = 220.4*220.4;
28
29// constructor
30KalFitWire::KalFitWire(const int localID,
31 const KalFitLayer_Mdc & layer,
32 const HepPoint3D & fwd,
33 const HepPoint3D & bck,
34 KalFitWire * const vt,
35 unsigned int geoID,
36 unsigned int stereo):
37 localId_(localID), fwd_(fwd), bck_(bck), layer_(layer),
38 state_(WireHitInvalid), geoID_(geoID), stereo_(stereo),
39 ddl_(0), ddr_(0), distance_(0) {
40
41 int layer_ID = layer_.layerId();
42 xyPosition_ = 0.5 * (fwd_+bck_);
43 if (!stereo_){
44 dx_ = 0;
45 dy_ = 0;
46 x_ = xyPosition_.x();
47 y_ = xyPosition_.y();
48 } else {
49 dx_ = (double)fwd_.x() - (double)bck_.x();
50 dy_ = (double)fwd_.y() - (double)bck_.y();
51 x_ = bck_.x();
52 y_ = bck_.y();
53 }
54 // Wire sag coeff
55 Hep3Vector wire_;
56 wire_ = (CLHEP::Hep3Vector)fwd - (CLHEP::Hep3Vector)bck;
57 lzx_ = sqrt(wire_.z()*wire_.z()+wire_.x()*wire_.x());
58
59 // problem with layer_ and its id inside sagcoef ?!!
60 // sagcoef();
61 if (layer_ID < 3)
62 A_ = A[0];
63 else {
64 if (layer_ID< 14)
65 A_ = A[1];
66 else if (layer_ID < 50){
67 double f_current(F[layer_ID]);
68 double l(wire_.mag());
69 A_ = A[2]*F[49]*F[49]*L49_2/(f_current*f_current*l*l);
70 } else
71 std::cout << "*** PROBLEM WIRE !!!!! " << std::endl;
72 }
73
74 // Neighbor :
75 neighbor_[0] = (KalFitWire *) innerLeft(vt);
76 neighbor_[1] = (KalFitWire *) innerRight(vt);
77
78 neighbor_[2] = (KalFitWire *) left();
79 neighbor_[3] = (KalFitWire *) right();
80
81 neighbor_[4] = (KalFitWire *) outerLeft(vt);
82 neighbor_[5] = (KalFitWire *) outerRight(vt);
83
84}
85
87 localId_(0), fwd_(0,0,0), bck_(0,0,0), layer_(*(KalFitLayer_Mdc *)NULL),
88 state_(WireHitInvalid), x_(0), y_(0), dx_(0), dy_(0)
89{
90 // Neighbor :
91 neighbor_[0] = NULL;
92 neighbor_[1] = NULL;
93 neighbor_[2] = NULL;
94 neighbor_[3] = NULL;
95 neighbor_[4] = NULL;
96 neighbor_[5] = NULL;
97}
98
99// destructor
101
102// wire sag coefficient determination :
104
105 Hep3Vector wire_;
106 wire_ =(CLHEP::Hep3Vector)fwd_ - (CLHEP::Hep3Vector)bck_;
107 int layer_ID = layer_.layerId();
108
109 if (layer_ID < 3){
110 A_ = A[0];
111 } else {
112 if (layer_ID< 14){
113 A_ = A[1];
114 } else if (layer_ID < 50){
115 double f_current(F[layer_ID]);
116 double l(wire_.mag());
117 A_ = A[2]*F[49]*F[49]*L49_2/(f_current*f_current*l*l);
118 } else {
119 std::cout << "*** PROBLEM WIRE !!!!! " << std::endl;
120 }
121 }
122}
123
124const KalFitWire * KalFitWire::left(void) const{
125 const KalFitWire * tmp = this;
126 if (!localId_) tmp += layer_.superLayer().nWire();
127 return --tmp;
128}
129
130const KalFitWire * KalFitWire::right(void) const{
131 const KalFitWire * tmp = this;
132 if (localId_==layer_.superLayer().localMaxId()){
133 tmp -= layer_.superLayer().nWire();
134 }
135 return ++tmp;
136}
137
138const KalFitWire * KalFitWire::innerLeft(KalFitWire * const vtWire) const{
139
140 if (!layer_.localLayerId()) return vtWire;
141 const KalFitWire * tmp = this;
142 if (layer_.offset()&1){
143 tmp -= layer_.superLayer().nWire();
144 }else{
145 if (localId_) tmp -= layer_.superLayer().nWire();
146 --tmp;
147 }
148 return tmp;
149}
150
151const KalFitWire * KalFitWire::innerRight(KalFitWire * const vtWire) const{
152 if (!layer_.localLayerId()) return vtWire;
153 const KalFitWire * tmp = this;
154 if (layer_.offset()&1){
155 if (localId_==layer_.superLayer().localMaxId()){
156 tmp -= layer_.superLayer().nWire();
157 }
158 tmp -= (layer_.superLayer().nWire()-1);
159 }else{
160 tmp -= layer_.superLayer().nWire();
161 }
162 return tmp;
163}
164
165const KalFitWire * KalFitWire::outerLeft(KalFitWire * const vtWire) const{
166 if (layer_.localLayerId()==layer_.superLayer().layerMaxId()) return vtWire;
167 const KalFitWire * tmp = this;
168 if (layer_.offset()&1){
169 tmp += layer_.superLayer().nWire();
170 }else{
171 if (!localId_) tmp += layer_.superLayer().nWire();
172 tmp += (layer_.superLayer().nWire()-1);
173 }
174 return tmp;
175}
176
177const KalFitWire * KalFitWire::outerRight(KalFitWire * const vtWire) const{
178 if (layer_.localLayerId()==layer_.superLayer().layerMaxId()) return vtWire;
179 const KalFitWire * tmp = this;
180 if (layer_.offset()&1){
181 if (localId_^layer_.superLayer().localMaxId()){
182 tmp += layer_.superLayer().nWire();
183 }
184 tmp++;
185 }else{
186 tmp += layer_.superLayer().nWire();
187 }
188 return tmp;
189}
190
191// Check left and right side to see if there is hit valid
193 if (((**(neighbor_+2)).state_&WireHit)&&
194 ((**(neighbor_+3)).state_&WireHit)){
195 state_ |= WireHitInvalid;
196 (**(neighbor_+2)).state_ |= WireHitInvalid;
197 (**(neighbor_+3)).state_ |= WireHitInvalid;
198 }
199}
200
201
HepGeom::Point3D< double > HepPoint3D
Definition: KalFitWire.cxx:12
const double L49_2
Definition: KalFitWire.cxx:27
#define WireHit
Definition: KalFitWire.h:13
#define WireHitInvalid
Definition: KalFitWire.h:14
const int localLayerId(void) const
returns local-layer ID
const KalFitSuper_Mdc & superLayer(void) const
returns super-layer
const int layerId(void) const
returns layer ID
const int offset(void) const
returns offset of numbering(local ID)
const int localMaxId(void) const
returns local max ID
const int nWire(void) const
returns number of wires
const int layerMaxId(void) const
returns layer max ID
Description of a Wire class.
Definition: KalFitWire.h:46
~KalFitWire(void)
destructor
Definition: KalFitWire.cxx:100
void sagcoef(void)
Definition: KalFitWire.cxx:103
HepPoint3D bck(void) const
Definition: KalFitWire.h:93
HepPoint3D fwd(void) const
Geometry :
Definition: KalFitWire.h:92
void chk_left_and_right(void)
Definition: KalFitWire.cxx:192