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,
125 ifstream fin( m_fwconf.c_str() );
126 if( ! fin.is_open() ){
127 cout <<
"ERROR: can not open file " << m_fwconf << endl;
132 fin >> strtmp >> radius >> ncell >> twist
133 >> offset >>
length >> first;
138 if( fabs(twist) > 0.1 ){
142 aglstart = (
PI / ncell) * first + (offset *
PI / 180.0);
143 if( aglstart < -0.000001 ){
144 aglstart += 2.0 *
PI / ncell;
149 }
else if( twist > 0.1 ){
155 slant = atan(
sin(
PI * twist / ncell)
156 * radius * 2.0 /
length );
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 );
166 if( ilay <
INNERNMAX ) m_player[ilay] -> setFgInner(
true );
167 else m_player[ilay] -> setFgInner(
false );
172 }
else if( ilay < 10 ){
174 }
else if( ilay < 12 ){
176 }
else if( ilay < 14 ){
178 }
else if( ilay < 16 ){
180 }
else if( ilay < 18 ){
182 }
else if( ilay < 20 ){
188 iPar[0] = iEle + m_iTXf;
189 iPar[1] = iEle + m_iTXb;
190 iPar[2] = iEle + m_iTYf;
191 iPar[3] = iEle + m_iTYb;
192 iPar[4] = iEle + m_iTZf;
193 iPar[5] = iEle + m_iTZb;
194 iPar[6] = iEle + m_iRXf;
195 iPar[7] = iEle + m_iRXb;
196 iPar[8] = iEle + m_iRYf;
197 iPar[9] = iEle + m_iRYb;
198 iPar[10] = iEle + m_iRZf;
199 iPar[11] = iEle + m_iRZb;
201 m_player[ilay] -> setAlignParId(iPar);
203 for(icell=0; icell<ncell; icell++){
204 m_wiretable[ilay][icell] = iwire;
205 angleforwini = (double)icell * 2.0 *
PI / ncell + aglstart;
208 angleforw = angleforwini + m_alignPar[iEle+m_iRZf];
211 xf = radius *
cos( angleforw );
212 yf = radius *
sin( angleforw );
215 xf += m_alignPar[iEle+m_iTXf];
216 yf += m_alignPar[iEle+m_iTYf];
217 zf += m_alignPar[iEle+m_iTZf];
220 angleback = angleforwini + twist * 2.0 *
PI / ncell;
221 angleback += m_alignPar[iEle+m_iRZb];
224 xb = radius *
cos( angleback );
225 yb = radius *
sin( angleback );
228 xb += m_alignPar[iEle+m_iTXb];
229 yb += m_alignPar[iEle+m_iTYb];
230 zb += m_alignPar[iEle+m_iTZb];
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);
240 m_pwire[iwire] -> setLayerPtr(m_player[ilay]);
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 );
249 iFan = m_fan[ilay][ampid];
251 m_pwire[iwire] -> setFanId(
abs(iFan) );
252 if(iFan > 0) m_pwire[iwire] -> setEndId( 1 );
253 else m_pwire[iwire] -> setEndId( -1 );
255 m_pwire[iwire] -> setWireLabel( wirelabel );
256 m_pwire[iwire] -> setWireTag( wiretag );
258 m_pwire[iwire] -> setXf( xf );
259 m_pwire[iwire] -> setYf( yf );
260 m_pwire[iwire] -> setZf( zf );
262 m_pwire[iwire] -> setXb( xb );
263 m_pwire[iwire] -> setYb( yb );
264 m_pwire[iwire] -> setZb( zb );
266 if( angleforw < 0 ) angleforw += 2.0 *
PI;
267 m_pwire[iwire] -> setPhiForward( angleforw );
269 m_pwire[iwire] ->
setTension( tension[ilay] );
275 cout <<
"INFO: Number of wires: " << iwire << endl;