BOSS 8.0.0
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/share/distAlign/src/MdcCosGeom.cpp.

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

◆ ~MdcCosGeom() [1/2]

MdcCosGeom::~MdcCosGeom ( )

Definition at line 49 of file MdcAlignAlg/share/distAlign/src/MdcCosGeom.cpp.

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

◆ 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 366 of file MdcAlignAlg/share/distAlign/src/MdcCosGeom.cpp.

366 {
367 for ( int i = 0; i < 96; i++ ) { alignPar[i] = m_alignPar[i]; }
368
369 for ( int k = 0; k < 8; k++ )
370 {
371 alignPar[k + m_iRXf] *= 1000.0;
372 alignPar[k + m_iRYf] *= 1000.0;
373 alignPar[k + m_iRZf] *= 1000.0;
374 }
375}

◆ 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/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/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/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/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 357 of file MdcAlignAlg/share/distAlign/src/MdcCosGeom.cpp.

357 {
358 assert( ilay < LAYERNMAX );
359 assert( icell < getLayer( ilay )->getNcell() );
360
361 int iwire = m_wiretable[ilay][icell];
362
363 return m_pwire[iwire];
364}
const MdcCosLayer * getLayer(int ilay) const

◆ 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/share/distAlign/src/include/MdcCosGeom.h.

33{ return m_pwire[iwire]; }

Referenced by T0Calib::init().

◆ getWire() [4/4]

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

Definition at line 33 of file MdcCalibAlg/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/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/share/distcalib/src/include/MdcCosGeom.h.

31{ return m_nWire; }

◆ initialize() [1/2]

bool MdcCosGeom::initialize ( double rot)

Definition at line 58 of file MdcAlignAlg/share/distAlign/src/MdcCosGeom.cpp.

58 {
59 m_rot = rot * PI / 180.0;
60 if ( !initWire() )
61 {
62 cout << "ERROR: Intialize wire failed !!!" << endl;
63 return false;
64 }
65 return true;
66}
#define PI

Referenced by main().

◆ initialize() [2/2]

bool MdcCosGeom::initialize ( double rot)

◆ initPream() [1/2]

bool MdcCosGeom::initPream ( )

Definition at line 297 of file MdcAlignAlg/share/distAlign/src/MdcCosGeom.cpp.

297 {
298 int i;
299 int k;
300 int iEnd;
301 char fname[100];
302
303 int lay;
304 int ipream;
305
306 for ( k = 0; k < 2; k++ )
307 {
308 for ( i = 0; i < 8; i++ )
309 {
310 if ( 0 == k )
311 {
312 sprintf( fname, "pream/east%d.dat", i + 1 );
313 iEnd = 1;
314 }
315 else
316 {
317 sprintf( fname, "pream/west%d.dat", i + 1 );
318 iEnd = -1;
319 }
320
321 ifstream fin( fname );
322 while ( fin >> lay )
323 {
324 fin >> ipream;
325 m_fan[lay - 1][ipream - 1] = ( i + 1 ) * iEnd;
326 }
327 fin.close();
328 fin.clear();
329 }
330 }
331 return true;
332}
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 68 of file MdcAlignAlg/share/distAlign/src/MdcCosGeom.cpp.

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

Referenced by initialize().

◆ initWire() [2/2]

bool MdcCosGeom::initWire ( )

◆ setTension() [1/2]

bool MdcCosGeom::setTension ( )

Definition at line 334 of file MdcAlignAlg/share/distAlign/src/MdcCosGeom.cpp.

334{ return true; }

◆ setTension() [2/2]

bool MdcCosGeom::setTension ( )

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