#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 MdcCosWire * | getWire (int iwire) const |
const MdcCosWire * | getWire (int ilay, int icell) const |
const MdcCosLayer * | getLayer (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 MdcCosWire * | getWire (int iwire) const |
const MdcCosWire * | getWire (int ilay, int icell) const |
const MdcCosLayer * | getLayer (int ilay) const |
const void | getAlignPar (double alignPar[]) const |
Private Member Functions | |
bool | initAlign () |
bool | initAlign () |
Private Attributes | |
std::string | m_fwconf |
std::string | m_falign |
MdcCosWire * | m_pwire [WIRENMAX] |
MdcCosLayer * | m_player [LAYERNMAX] |
int | m_nLayer |
int | m_nWire |
int | m_wiretable [LAYERNMAX][CELLNMAX] |
int | m_fan [LAYERNMAX][100] |
double | m_alignPar [96] |
double | m_rot |
int | m_iTXf |
int | m_iTXb |
int | m_iTYf |
int | m_iTYb |
int | m_iTZf |
int | m_iTZb |
int | m_iRXf |
int | m_iRXb |
int | m_iRYf |
int | m_iRYb |
int | m_iRZf |
int | m_iRZb |
MdcCosWire * | m_pwire [WIRENMAX] |
MdcCosLayer * | m_player [LAYERNMAX] |
Definition at line 16 of file MdcCosGeom.h.
MdcCosGeom::MdcCosGeom | ( | std::string | fwireconf, | |
std::string | fAlign | |||
) |
Definition at line 11 of file MdcCosGeom.cpp.
References Alignment::CELLNMAX, genRecEmupikp::i, Alignment::LAYERNMAX, m_fan, m_iRXb, m_iRXf, m_iRYb, m_iRYf, m_iRZb, m_iRZf, m_iTXb, m_iTXf, m_iTYb, m_iTYf, m_iTZb, m_iTZf, m_rot, and m_wiretable.
00011 : 00012 m_fwconf(fwireconf), m_falign(falign) 00013 { 00014 // constructor 00015 int ilay; 00016 int icell; 00017 for(ilay=0; ilay<LAYERNMAX; ilay++){ 00018 for(icell=0; icell<CELLNMAX; icell++){ 00019 m_wiretable[ilay][icell] = -1; 00020 } 00021 } 00022 00023 for(int i=0; i<12; i++){ 00024 m_iTXf = 0; 00025 m_iTXb = 8; 00026 m_iTYf = 16; 00027 m_iTYb = 24; 00028 m_iTZf = 32; 00029 m_iTZb = 40; 00030 00031 m_iRXf = 48; 00032 m_iRXb = 56; 00033 m_iRYf = 64; 00034 m_iRYb = 72; 00035 m_iRZf = 80; 00036 m_iRZb = 88; 00037 } 00038 00039 m_rot = 0.0; 00040 00041 int ipream; 00042 for(ilay=0; ilay<LAYERNMAX; ilay++){ 00043 for(ipream=0; ipream<100; ipream++){ 00044 m_fan[ilay][ipream] = -999; 00045 } 00046 } 00047 00048 cout << "INFO: MdcCosGeom created." << endl; 00049 }
MdcCosGeom::~MdcCosGeom | ( | ) |
Definition at line 51 of file MdcCosGeom.cpp.
References genRecEmupikp::i, Alignment::LAYERNMAX, m_player, m_pwire, and Alignment::WIRENMAX.
00051 { 00052 // destructor 00053 int i; 00054 for(i=0; i<WIRENMAX; i++){ 00055 delete m_pwire[i]; 00056 } 00057 for(i=0; i<LAYERNMAX; i++){ 00058 delete m_player[i]; 00059 } 00060 00061 cout << "INFO: MdcCosGeom has been destructed." << endl; 00062 }
MdcCosGeom::MdcCosGeom | ( | std::string | fwireconf, | |
std::string | fAlign | |||
) |
MdcCosGeom::~MdcCosGeom | ( | ) |
void MdcCosGeom::check | ( | std::string | fchk | ) | const |
void MdcCosGeom::check | ( | std::string | fchk | ) | const |
const void MdcCosGeom::getAlignPar | ( | double | alignPar[] | ) | const |
const void MdcCosGeom::getAlignPar | ( | double | alignPar[] | ) | const |
Definition at line 387 of file MdcCosGeom.cpp.
References genRecEmupikp::i, m_alignPar, m_iRXf, m_iRYf, and m_iRZf.
00387 { 00388 for(int i=0; i<96; i++){ 00389 alignPar[i] = m_alignPar[i]; 00390 } 00391 00392 for(int k=0; k<8; k++){ 00393 alignPar[k+m_iRXf] *= 1000.0; 00394 alignPar[k+m_iRYf] *= 1000.0; 00395 alignPar[k+m_iRZf] *= 1000.0; 00396 } 00397 }
const MdcCosLayer* MdcCosGeom::getLayer | ( | int | ilay | ) | const [inline] |
const MdcCosLayer* MdcCosGeom::getLayer | ( | int | ilay | ) | const [inline] |
Definition at line 36 of file MdcCosGeom.h.
References m_player.
Referenced by getWire(), and IniCalib::init().
00036 { return m_player[ilay]; }
const int MdcCosGeom::getLayerSize | ( | ) | const [inline] |
const int MdcCosGeom::getLayerSize | ( | ) | const [inline] |
const MdcCosWire* MdcCosGeom::getWire | ( | int | ilay, | |
int | icell | |||
) | const |
const MdcCosWire* MdcCosGeom::getWire | ( | int | iwire | ) | const [inline] |
const MdcCosWire * MdcCosGeom::getWire | ( | int | ilay, | |
int | icell | |||
) | const |
Definition at line 378 of file MdcCosGeom.cpp.
References getLayer(), Alignment::LAYERNMAX, m_pwire, and m_wiretable.
00378 { 00379 assert( ilay < LAYERNMAX ); 00380 assert( icell < getLayer(ilay)->getNcell() ); 00381 00382 int iwire = m_wiretable[ilay][icell]; 00383 00384 return m_pwire[iwire]; 00385 }
const MdcCosWire* MdcCosGeom::getWire | ( | int | iwire | ) | const [inline] |
Definition at line 33 of file MdcCosGeom.h.
References m_pwire.
Referenced by PreT0Calib::calib(), and IniCalib::calib().
00033 { return m_pwire[iwire]; }
const int MdcCosGeom::getWireSize | ( | ) | const [inline] |
const int MdcCosGeom::getWireSize | ( | ) | const [inline] |
bool MdcCosGeom::initAlign | ( | ) | [private] |
bool MdcCosGeom::initAlign | ( | ) | [private] |
Definition at line 282 of file MdcCosGeom.cpp.
References genRecEmupikp::i, m_alignPar, m_falign, m_iRXb, m_iRXf, m_iRYb, m_iRYf, m_iRZb, m_iRZf, m_iTXb, m_iTXf, m_iTYb, m_iTYf, m_iTZb, m_iTZf, and deljobs::string.
Referenced by initWire().
00282 { 00283 ifstream falign( m_falign.c_str() ); 00284 if( ! falign.is_open() ){ 00285 cout << "ERROR: can not open alignment data file " 00286 << m_falign << endl; 00287 return false; 00288 } 00289 00290 cout << "INFO: Alignment data file is " << m_falign << endl; 00291 00292 int i; 00293 string str; 00294 getline(falign, str); 00295 00296 for(i=0; i<8; i++){ 00297 falign >> str >> m_alignPar[i+m_iTXf] >> m_alignPar[i+m_iTYf] 00298 >> m_alignPar[i+m_iTZf] >> m_alignPar[i+m_iRXf] 00299 >> m_alignPar[i+m_iRYf] >> m_alignPar[i+m_iRZf]; 00300 00301 // mrad -> rad 00302 m_alignPar[i+m_iRXf] *= 0.001; 00303 m_alignPar[i+m_iRYf] *= 0.001; 00304 m_alignPar[i+m_iRZf] *= 0.001; 00305 } 00306 00307 for(i=0; i<8; i++){ 00308 falign >> str >> m_alignPar[i+m_iTXb] >> m_alignPar[i+m_iTYb] 00309 >> m_alignPar[i+m_iTZb] >> m_alignPar[i+m_iRXb] 00310 >> m_alignPar[i+m_iRYb] >> m_alignPar[i+m_iRZb]; 00311 00312 // mrad -> rad 00313 m_alignPar[i+m_iRXb] *= 0.001; 00314 m_alignPar[i+m_iRYb] *= 0.001; 00315 m_alignPar[i+m_iRZb] *= 0.001; 00316 } 00317 00318 falign.close(); 00319 00320 return true; 00321 }
bool MdcCosGeom::initialize | ( | double | rot | ) |
bool MdcCosGeom::initialize | ( | double | rot | ) |
Definition at line 64 of file MdcCosGeom.cpp.
References initWire(), m_rot, and PI.
00064 { 00065 m_rot = rot * PI / 180.0; 00066 if( ! initWire() ){ 00067 cout << "ERROR: Intialize wire failed !!!" << endl; 00068 return false; 00069 } 00070 return true; 00071 }
bool MdcCosGeom::initPream | ( | ) |
bool MdcCosGeom::initPream | ( | ) |
Definition at line 323 of file MdcCosGeom.cpp.
References fname, genRecEmupikp::i, and m_fan.
Referenced by initWire().
00323 { 00324 int i; 00325 int k; 00326 int iEnd; 00327 char fname[100]; 00328 00329 int lay; 00330 int ipream; 00331 00332 for(k=0; k<2; k++){ 00333 for(i=0; i<8; i++){ 00334 if(0 == k){ 00335 sprintf(fname, "pream/east%d.dat", i+1); 00336 iEnd = 1; 00337 } else{ 00338 sprintf(fname, "pream/west%d.dat", i+1); 00339 iEnd = -1; 00340 } 00341 00342 ifstream fin(fname); 00343 while(fin >> lay){ 00344 fin >> ipream; 00345 m_fan[lay-1][ipream-1] = (i+1) * iEnd; 00346 } 00347 fin.close(); 00348 fin.clear(); 00349 } 00350 } 00351 return true; 00352 }
bool MdcCosGeom::initWire | ( | ) |
bool MdcCosGeom::initWire | ( | ) |
Definition at line 73 of file MdcCosGeom.cpp.
References abs, cos(), first, initAlign(), initPream(), Alignment::INNERNMAX, Alignment::LAYERNMAX, m_alignPar, m_fan, m_fwconf, m_iRXb, m_iRXf, m_iRYb, m_iRYf, m_iRZb, m_iRZf, m_iTXb, m_iTXf, m_iTYb, m_iTYf, m_iTZb, m_iTZf, m_nLayer, m_nWire, m_player, m_pwire, m_rot, m_wiretable, PI, setTension(), sin(), and deljobs::string.
Referenced by initialize().
00073 { 00074 int iwire = 0; 00075 int ilay; 00076 int icell; 00077 int ampid; 00078 int channel; 00079 int iFan; 00080 00081 char wirelabel[100]; 00082 char wiretag[100]; 00083 00084 int ncell; 00085 int first; 00086 double radius; 00087 double twist; 00088 double length; 00089 double offset; 00090 string strtmp; 00091 00092 double aglstart; 00093 double angleforwini; 00094 double angleforw; 00095 double angleback; 00096 00097 int layertype; 00098 00099 double xf; 00100 double yf; 00101 double zf; 00102 double xb; 00103 double yb; 00104 double zb; 00105 00106 double slant; 00107 00108 double tension[] = {15, 15, 15, 16, 16, 17, 17, 18, 14, 14, 00109 19, 19, 24, 24, 31, 31, 37, 37, 45, 45, 00110 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 00111 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 00112 52, 52, 52}; 00113 00114 int iEle; // index of the element for alignment 00115 int iPar[12]; // index of alignment paramter 00116 00117 if( ! initAlign() ){ 00118 return false; 00119 } 00120 00121 if( ! initPream() ){ 00122 return false; 00123 } 00124 00125 ifstream fin( m_fwconf.c_str() ); 00126 if( ! fin.is_open() ){ 00127 cout << "ERROR: can not open file " << m_fwconf << endl; 00128 return false; 00129 } 00130 00131 for(ilay=0; ilay<LAYERNMAX; ilay++){ 00132 fin >> strtmp >> radius >> ncell >> twist 00133 >> offset >> length >> first; 00134 00135 length -= 4.0; // wulh test on 2007-05-08 00136 ncell /= 2; 00137 00138 if( fabs(twist) > 0.1 ){ 00139 offset = 0.0; 00140 } 00141 00142 aglstart = (PI / ncell) * first + (offset * PI / 180.0); 00143 if( aglstart < -0.000001 ){ 00144 aglstart += 2.0 * PI / ncell; 00145 } 00146 00147 if( twist < -0.1 ){ 00148 layertype = 1; 00149 } else if( twist > 0.1 ){ 00150 layertype = 2; 00151 } else{ 00152 layertype = 0; 00153 } 00154 00155 slant = atan( sin(PI * twist / ncell) 00156 * radius * 2.0 / length ); 00157 00158 m_player[ilay] = new MdcCosLayer; 00159 m_player[ilay] -> setLayerType( layertype ); 00160 m_player[ilay] -> setNcell( ncell ); 00161 m_player[ilay] -> setLayerRad( radius ); 00162 m_player[ilay] -> setLength( length ); 00163 m_player[ilay] -> setTwistCell( twist ); 00164 m_player[ilay] -> setSlant( slant ); 00165 00166 if( ilay < INNERNMAX ) m_player[ilay] -> setFgInner( true ); 00167 else m_player[ilay] -> setFgInner( false ); 00168 00169 // set the index of the element for alignment 00170 if( ilay < 8 ){ 00171 iEle = 0; 00172 } else if( ilay < 10 ){ 00173 iEle = 1; 00174 } else if( ilay < 12 ){ 00175 iEle = 2; 00176 } else if( ilay < 14 ){ 00177 iEle = 3; 00178 } else if( ilay < 16 ){ 00179 iEle = 4; 00180 } else if( ilay < 18 ){ 00181 iEle = 5; 00182 } else if( ilay < 20 ){ 00183 iEle = 6; 00184 } else{ 00185 iEle = 7; 00186 } 00187 00188 iPar[0] = iEle + m_iTXf; // TXf 00189 iPar[1] = iEle + m_iTXb; // TXb 00190 iPar[2] = iEle + m_iTYf; // TYf 00191 iPar[3] = iEle + m_iTYb; // TYb 00192 iPar[4] = iEle + m_iTZf; // TZf 00193 iPar[5] = iEle + m_iTZb; // TZb 00194 iPar[6] = iEle + m_iRXf; // RXf 00195 iPar[7] = iEle + m_iRXb; // RXb 00196 iPar[8] = iEle + m_iRYf; // RYf 00197 iPar[9] = iEle + m_iRYb; // RTb 00198 iPar[10] = iEle + m_iRZf; // RZf 00199 iPar[11] = iEle + m_iRZb; // RZb 00200 00201 m_player[ilay] -> setAlignParId(iPar); 00202 00203 for(icell=0; icell<ncell; icell++){ 00204 m_wiretable[ilay][icell] = iwire; 00205 angleforwini = (double)icell * 2.0 * PI / ncell + aglstart; 00206 00207 // forward endpoint 00208 angleforw = angleforwini + m_alignPar[iEle+m_iRZf]; 00209 angleforw += m_rot; 00210 00211 xf = radius * cos( angleforw ); 00212 yf = radius * sin( angleforw ); 00213 zf = 0.5 * length; 00214 00215 xf += m_alignPar[iEle+m_iTXf]; 00216 yf += m_alignPar[iEle+m_iTYf]; 00217 zf += m_alignPar[iEle+m_iTZf]; 00218 00219 // backward endpoint 00220 angleback = angleforwini + twist * 2.0 * PI / ncell; 00221 angleback += m_alignPar[iEle+m_iRZb]; 00222 angleback += m_rot; 00223 00224 xb = radius * cos( angleback ); 00225 yb = radius * sin( angleback ); 00226 zb = -0.5 * length; 00227 00228 xb += m_alignPar[iEle+m_iTXb]; 00229 yb += m_alignPar[iEle+m_iTYb]; 00230 zb += m_alignPar[iEle+m_iTZb]; 00231 00232 ampid = icell / 8; 00233 channel = icell - 8 * ampid; 00234 sprintf(wirelabel, "%02dS%02d-%d", ilay+1, ampid+1, channel+1); 00235 sprintf(wiretag, "%02d_%02d_%04d_%02d", 00236 ilay, icell, iwire, ampid+1); 00237 00238 m_pwire[iwire] = new MdcCosWire; 00239 00240 m_pwire[iwire] -> setLayerPtr(m_player[ilay]); 00241 00242 m_pwire[iwire] -> setWireId( iwire ); 00243 m_pwire[iwire] -> setLayerId( ilay ); 00244 m_pwire[iwire] -> setCellId( icell ); 00245 m_pwire[iwire] -> setPreAmpId( ampid+1 ); 00246 m_pwire[iwire] -> setChannel( channel ); 00247 00248 // set fanID 00249 iFan = m_fan[ilay][ampid]; 00250 // m_pwire[iwire] -> setFanId( abs(iFan) - 1 ); 00251 m_pwire[iwire] -> setFanId( abs(iFan) ); // begin from 1 00252 if(iFan > 0) m_pwire[iwire] -> setEndId( 1 ); 00253 else m_pwire[iwire] -> setEndId( -1 ); 00254 00255 m_pwire[iwire] -> setWireLabel( wirelabel ); 00256 m_pwire[iwire] -> setWireTag( wiretag ); 00257 00258 m_pwire[iwire] -> setXf( xf ); 00259 m_pwire[iwire] -> setYf( yf ); 00260 m_pwire[iwire] -> setZf( zf ); 00261 00262 m_pwire[iwire] -> setXb( xb ); 00263 m_pwire[iwire] -> setYb( yb ); 00264 m_pwire[iwire] -> setZb( zb ); 00265 00266 if( angleforw < 0 ) angleforw += 2.0 * PI; 00267 m_pwire[iwire] -> setPhiForward( angleforw ); 00268 00269 m_pwire[iwire] -> setTension( tension[ilay] ); 00270 00271 iwire++; 00272 } 00273 } 00274 fin.close(); 00275 cout << "INFO: Number of wires: " << iwire << endl; 00276 m_nWire = iwire; 00277 m_nLayer = LAYERNMAX; 00278 00279 return true; 00280 }
bool MdcCosGeom::setTension | ( | ) |
bool MdcCosGeom::setTension | ( | ) |
double MdcCosGeom::m_alignPar [private] |
Definition at line 65 of file MdcCosGeom.h.
Referenced by getAlignPar(), initAlign(), and initWire().
std::string MdcCosGeom::m_falign [private] |
int MdcCosGeom::m_fan [private] |
Definition at line 59 of file MdcCosGeom.h.
Referenced by initPream(), initWire(), and MdcCosGeom().
std::string MdcCosGeom::m_fwconf [private] |
int MdcCosGeom::m_iRXb [private] |
Definition at line 77 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iRXf [private] |
Definition at line 76 of file MdcCosGeom.h.
Referenced by getAlignPar(), initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iRYb [private] |
Definition at line 79 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iRYf [private] |
Definition at line 78 of file MdcCosGeom.h.
Referenced by getAlignPar(), initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iRZb [private] |
Definition at line 81 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iRZf [private] |
Definition at line 80 of file MdcCosGeom.h.
Referenced by getAlignPar(), initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iTXb [private] |
Definition at line 70 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iTXf [private] |
Definition at line 69 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iTYb [private] |
Definition at line 72 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iTYf [private] |
Definition at line 71 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iTZb [private] |
Definition at line 74 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_iTZf [private] |
Definition at line 73 of file MdcCosGeom.h.
Referenced by initAlign(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_nLayer [private] |
int MdcCosGeom::m_nWire [private] |
MdcCosLayer* MdcCosGeom::m_player[LAYERNMAX] [private] |
Definition at line 53 of file MdcCosGeom.h.
MdcCosLayer* MdcCosGeom::m_player[LAYERNMAX] [private] |
Definition at line 53 of file MdcCosGeom.h.
Referenced by getLayer(), initWire(), and ~MdcCosGeom().
MdcCosWire* MdcCosGeom::m_pwire[WIRENMAX] [private] |
Definition at line 50 of file MdcCosGeom.h.
MdcCosWire* MdcCosGeom::m_pwire[WIRENMAX] [private] |
double MdcCosGeom::m_rot [private] |
Definition at line 67 of file MdcCosGeom.h.
Referenced by initialize(), initWire(), and MdcCosGeom().
int MdcCosGeom::m_wiretable [private] |