BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcCosGeom Class Reference

#include <MdcCosGeom.h>

Public Member Functions

 MdcCosGeom (std::string fwireconf, std::string fAlign)
 
 ~MdcCosGeom ()
 
bool initialize (double rot)
 
bool initWire ()
 
bool initPream ()
 
bool setTension ()
 
void check (std::string fchk) const
 
const int getLayerSize () const
 
const int getWireSize () const
 
const MdcCosWiregetWire (int iwire) const
 
const MdcCosWiregetWire (int ilay, int icell) const
 
const MdcCosLayergetLayer (int ilay) const
 
const void getAlignPar (double alignPar[]) const
 
 MdcCosGeom (std::string fwireconf, std::string fAlign)
 
 ~MdcCosGeom ()
 
bool initialize (double rot)
 
bool initWire ()
 
bool initPream ()
 
bool setTension ()
 
void check (std::string fchk) const
 
const int getLayerSize () const
 
const int getWireSize () const
 
const MdcCosWiregetWire (int iwire) const
 
const MdcCosWiregetWire (int ilay, int icell) const
 
const MdcCosLayergetLayer (int ilay) const
 
const void getAlignPar (double alignPar[]) const
 

Detailed Description

Constructor & Destructor Documentation

◆ MdcCosGeom() [1/2]

MdcCosGeom::MdcCosGeom ( std::string  fwireconf,
std::string  fAlign 
)

Definition at line 11 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcCosGeom.cpp.

11 :
12 m_fwconf(fwireconf), m_falign(falign)
13{
14 // constructor
15 int ilay;
16 int icell;
17 for(ilay=0; ilay<LAYERNMAX; ilay++){
18 for(icell=0; icell<CELLNMAX; icell++){
19 m_wiretable[ilay][icell] = -1;
20 }
21 }
22
23 for(int i=0; i<12; i++){
24 m_iTXf = 0;
25 m_iTXb = 8;
26 m_iTYf = 16;
27 m_iTYb = 24;
28 m_iTZf = 32;
29 m_iTZb = 40;
30
31 m_iRXf = 48;
32 m_iRXb = 56;
33 m_iRYf = 64;
34 m_iRYb = 72;
35 m_iRZf = 80;
36 m_iRZb = 88;
37 }
38
39 m_rot = 0.0;
40
41 int ipream;
42 for(ilay=0; ilay<LAYERNMAX; ilay++){
43 for(ipream=0; ipream<100; ipream++){
44 m_fan[ilay][ipream] = -999;
45 }
46 }
47
48 cout << "INFO: MdcCosGeom created." << endl;
49}

◆ ~MdcCosGeom() [1/2]

MdcCosGeom::~MdcCosGeom ( )

Definition at line 51 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcCosGeom.cpp.

51 {
52 // destructor
53 int i;
54 for(i=0; i<WIRENMAX; i++){
55 delete m_pwire[i];
56 }
57 for(i=0; i<LAYERNMAX; i++){
58 delete m_player[i];
59 }
60
61 cout << "INFO: MdcCosGeom has been destructed." << endl;
62}

◆ MdcCosGeom() [2/2]

MdcCosGeom::MdcCosGeom ( std::string  fwireconf,
std::string  fAlign 
)

◆ ~MdcCosGeom() [2/2]

MdcCosGeom::~MdcCosGeom ( )

Member Function Documentation

◆ check() [1/2]

void MdcCosGeom::check ( std::string  fchk) const

◆ check() [2/2]

void MdcCosGeom::check ( std::string  fchk) const

◆ getAlignPar() [1/2]

const void MdcCosGeom::getAlignPar ( double  alignPar[]) const

Definition at line 387 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcCosGeom.cpp.

387 {
388 for(int i=0; i<96; i++){
389 alignPar[i] = m_alignPar[i];
390 }
391
392 for(int k=0; k<8; k++){
393 alignPar[k+m_iRXf] *= 1000.0;
394 alignPar[k+m_iRYf] *= 1000.0;
395 alignPar[k+m_iRZf] *= 1000.0;
396 }
397}

◆ getAlignPar() [2/2]

const void MdcCosGeom::getAlignPar ( double  alignPar[]) const

◆ getLayer() [1/2]

const MdcCosLayer * MdcCosGeom::getLayer ( int  ilay) const
inline

Definition at line 36 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/include/MdcCosGeom.h.

36{ return m_player[ilay]; }

Referenced by getWire(), and IniCalib::init().

◆ getLayer() [2/2]

const MdcCosLayer * MdcCosGeom::getLayer ( int  ilay) const
inline

Definition at line 36 of file MdcCalibAlg/MdcCalibAlg-00-09-02/share/distcalib/src/include/MdcCosGeom.h.

36{ return m_player[ilay]; }

◆ getLayerSize() [1/2]

const int MdcCosGeom::getLayerSize ( ) const
inline

Definition at line 30 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/include/MdcCosGeom.h.

30{ return m_nLayer; }

◆ getLayerSize() [2/2]

const int MdcCosGeom::getLayerSize ( ) const
inline

Definition at line 30 of file MdcCalibAlg/MdcCalibAlg-00-09-02/share/distcalib/src/include/MdcCosGeom.h.

30{ return m_nLayer; }

◆ getWire() [1/4]

const MdcCosWire * MdcCosGeom::getWire ( int  ilay,
int  icell 
) const

Definition at line 378 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcCosGeom.cpp.

378 {
379 assert( ilay < LAYERNMAX );
380 assert( icell < getLayer(ilay)->getNcell() );
381
382 int iwire = m_wiretable[ilay][icell];
383
384 return m_pwire[iwire];
385}

◆ getWire() [2/4]

const MdcCosWire * MdcCosGeom::getWire ( int  ilay,
int  icell 
) const

◆ getWire() [3/4]

const MdcCosWire * MdcCosGeom::getWire ( int  iwire) const
inline

Definition at line 33 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/include/MdcCosGeom.h.

33{ return m_pwire[iwire]; }

Referenced by IniCalib::calib(), and PreT0Calib::calib().

◆ getWire() [4/4]

const MdcCosWire * MdcCosGeom::getWire ( int  iwire) const
inline

Definition at line 33 of file MdcCalibAlg/MdcCalibAlg-00-09-02/share/distcalib/src/include/MdcCosGeom.h.

33{ return m_pwire[iwire]; }

◆ getWireSize() [1/2]

const int MdcCosGeom::getWireSize ( ) const
inline

Definition at line 31 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/include/MdcCosGeom.h.

31{ return m_nWire; }

◆ getWireSize() [2/2]

const int MdcCosGeom::getWireSize ( ) const
inline

Definition at line 31 of file MdcCalibAlg/MdcCalibAlg-00-09-02/share/distcalib/src/include/MdcCosGeom.h.

31{ return m_nWire; }

◆ initialize() [1/2]

bool MdcCosGeom::initialize ( double  rot)

Definition at line 64 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcCosGeom.cpp.

64 {
65 m_rot = rot * PI / 180.0;
66 if( ! initWire() ){
67 cout << "ERROR: Intialize wire failed !!!" << endl;
68 return false;
69 }
70 return true;
71}
const double PI
Definition: PipiJpsi.cxx:55

◆ initialize() [2/2]

bool MdcCosGeom::initialize ( double  rot)

◆ initPream() [1/2]

bool MdcCosGeom::initPream ( )

Definition at line 323 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcCosGeom.cpp.

323 {
324 int i;
325 int k;
326 int iEnd;
327 char fname[100];
328
329 int lay;
330 int ipream;
331
332 for(k=0; k<2; k++){
333 for(i=0; i<8; i++){
334 if(0 == k){
335 sprintf(fname, "pream/east%d.dat", i+1);
336 iEnd = 1;
337 } else{
338 sprintf(fname, "pream/west%d.dat", i+1);
339 iEnd = -1;
340 }
341
342 ifstream fin(fname);
343 while(fin >> lay){
344 fin >> ipream;
345 m_fan[lay-1][ipream-1] = (i+1) * iEnd;
346 }
347 fin.close();
348 fin.clear();
349 }
350 }
351 return true;
352}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)

Referenced by initWire().

◆ initPream() [2/2]

bool MdcCosGeom::initPream ( )

◆ initWire() [1/2]

bool MdcCosGeom::initWire ( )

Definition at line 73 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcCosGeom.cpp.

73 {
74 int iwire = 0;
75 int ilay;
76 int icell;
77 int ampid;
78 int channel;
79 int iFan;
80
81 char wirelabel[100];
82 char wiretag[100];
83
84 int ncell;
85 int first;
86 double radius;
87 double twist;
88 double length;
89 double offset;
90 string strtmp;
91
92 double aglstart;
93 double angleforwini;
94 double angleforw;
95 double angleback;
96
97 int layertype;
98
99 double xf;
100 double yf;
101 double zf;
102 double xb;
103 double yb;
104 double zb;
105
106 double slant;
107
108 double tension[] = {15, 15, 15, 16, 16, 17, 17, 18, 14, 14,
109 19, 19, 24, 24, 31, 31, 37, 37, 45, 45,
110 46, 47, 47, 47, 47, 48, 48, 48, 48, 49,
111 49, 49, 49, 50, 50, 50, 51, 51, 51, 52,
112 52, 52, 52};
113
114 int iEle; // index of the element for alignment
115 int iPar[12]; // index of alignment paramter
116
117 if( ! initAlign() ){
118 return false;
119 }
120
121 if( ! initPream() ){
122 return false;
123 }
124
125 ifstream fin( m_fwconf.c_str() );
126 if( ! fin.is_open() ){
127 cout << "ERROR: can not open file " << m_fwconf << endl;
128 return false;
129 }
130
131 for(ilay=0; ilay<LAYERNMAX; ilay++){
132 fin >> strtmp >> radius >> ncell >> twist
133 >> offset >> length >> first;
134
135 length -= 4.0; // wulh test on 2007-05-08
136 ncell /= 2;
137
138 if( fabs(twist) > 0.1 ){
139 offset = 0.0;
140 }
141
142 aglstart = (PI / ncell) * first + (offset * PI / 180.0);
143 if( aglstart < -0.000001 ){
144 aglstart += 2.0 * PI / ncell;
145 }
146
147 if( twist < -0.1 ){
148 layertype = 1;
149 } else if( twist > 0.1 ){
150 layertype = 2;
151 } else{
152 layertype = 0;
153 }
154
155 slant = atan( sin(PI * twist / ncell)
156 * radius * 2.0 / length );
157
158 m_player[ilay] = new MdcCosLayer;
159 m_player[ilay] -> setLayerType( layertype );
160 m_player[ilay] -> setNcell( ncell );
161 m_player[ilay] -> setLayerRad( radius );
162 m_player[ilay] -> setLength( length );
163 m_player[ilay] -> setTwistCell( twist );
164 m_player[ilay] -> setSlant( slant );
165
166 if( ilay < INNERNMAX ) m_player[ilay] -> setFgInner( true );
167 else m_player[ilay] -> setFgInner( false );
168
169 // set the index of the element for alignment
170 if( ilay < 8 ){
171 iEle = 0;
172 } else if( ilay < 10 ){
173 iEle = 1;
174 } else if( ilay < 12 ){
175 iEle = 2;
176 } else if( ilay < 14 ){
177 iEle = 3;
178 } else if( ilay < 16 ){
179 iEle = 4;
180 } else if( ilay < 18 ){
181 iEle = 5;
182 } else if( ilay < 20 ){
183 iEle = 6;
184 } else{
185 iEle = 7;
186 }
187
188 iPar[0] = iEle + m_iTXf; // TXf
189 iPar[1] = iEle + m_iTXb; // TXb
190 iPar[2] = iEle + m_iTYf; // TYf
191 iPar[3] = iEle + m_iTYb; // TYb
192 iPar[4] = iEle + m_iTZf; // TZf
193 iPar[5] = iEle + m_iTZb; // TZb
194 iPar[6] = iEle + m_iRXf; // RXf
195 iPar[7] = iEle + m_iRXb; // RXb
196 iPar[8] = iEle + m_iRYf; // RYf
197 iPar[9] = iEle + m_iRYb; // RTb
198 iPar[10] = iEle + m_iRZf; // RZf
199 iPar[11] = iEle + m_iRZb; // RZb
200
201 m_player[ilay] -> setAlignParId(iPar);
202
203 for(icell=0; icell<ncell; icell++){
204 m_wiretable[ilay][icell] = iwire;
205 angleforwini = (double)icell * 2.0 * PI / ncell + aglstart;
206
207 // forward endpoint
208 angleforw = angleforwini + m_alignPar[iEle+m_iRZf];
209 angleforw += m_rot;
210
211 xf = radius * cos( angleforw );
212 yf = radius * sin( angleforw );
213 zf = 0.5 * length;
214
215 xf += m_alignPar[iEle+m_iTXf];
216 yf += m_alignPar[iEle+m_iTYf];
217 zf += m_alignPar[iEle+m_iTZf];
218
219 // backward endpoint
220 angleback = angleforwini + twist * 2.0 * PI / ncell;
221 angleback += m_alignPar[iEle+m_iRZb];
222 angleback += m_rot;
223
224 xb = radius * cos( angleback );
225 yb = radius * sin( angleback );
226 zb = -0.5 * length;
227
228 xb += m_alignPar[iEle+m_iTXb];
229 yb += m_alignPar[iEle+m_iTYb];
230 zb += m_alignPar[iEle+m_iTZb];
231
232 ampid = icell / 8;
233 channel = icell - 8 * ampid;
234 sprintf(wirelabel, "%02dS%02d-%d", ilay+1, ampid+1, channel+1);
235 sprintf(wiretag, "%02d_%02d_%04d_%02d",
236 ilay, icell, iwire, ampid+1);
237
238 m_pwire[iwire] = new MdcCosWire;
239
240 m_pwire[iwire] -> setLayerPtr(m_player[ilay]);
241
242 m_pwire[iwire] -> setWireId( iwire );
243 m_pwire[iwire] -> setLayerId( ilay );
244 m_pwire[iwire] -> setCellId( icell );
245 m_pwire[iwire] -> setPreAmpId( ampid+1 );
246 m_pwire[iwire] -> setChannel( channel );
247
248 // set fanID
249 iFan = m_fan[ilay][ampid];
250// m_pwire[iwire] -> setFanId( abs(iFan) - 1 );
251 m_pwire[iwire] -> setFanId( abs(iFan) ); // begin from 1
252 if(iFan > 0) m_pwire[iwire] -> setEndId( 1 );
253 else m_pwire[iwire] -> setEndId( -1 );
254
255 m_pwire[iwire] -> setWireLabel( wirelabel );
256 m_pwire[iwire] -> setWireTag( wiretag );
257
258 m_pwire[iwire] -> setXf( xf );
259 m_pwire[iwire] -> setYf( yf );
260 m_pwire[iwire] -> setZf( zf );
261
262 m_pwire[iwire] -> setXb( xb );
263 m_pwire[iwire] -> setYb( yb );
264 m_pwire[iwire] -> setZb( zb );
265
266 if( angleforw < 0 ) angleforw += 2.0 * PI;
267 m_pwire[iwire] -> setPhiForward( angleforw );
268
269 m_pwire[iwire] -> setTension( tension[ilay] );
270
271 iwire++;
272 }
273 }
274 fin.close();
275 cout << "INFO: Number of wires: " << iwire << endl;
276 m_nWire = iwire;
277 m_nLayer = LAYERNMAX;
278
279 return true;
280}
double sin(const BesAngle a)
double cos(const BesAngle a)
Index first(Pair i)
Definition: EvtCyclic3.cc:195

Referenced by initialize().

◆ initWire() [2/2]

bool MdcCosGeom::initWire ( )

◆ setTension() [1/2]

bool MdcCosGeom::setTension ( )

Definition at line 354 of file MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcCosGeom.cpp.

354 {
355 return true;
356}

Referenced by initWire().

◆ setTension() [2/2]

bool MdcCosGeom::setTension ( )

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