/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Muc/MucGeoCreateAlg/MucGeoCreateAlg-00-01-00/src/MucStripPlane.cxx

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------|
00002 //      [File  ]:                       MucStripPlane.cxx                       |
00003 //      [Brief ]:       MUC geometry strip plane creating class                 |
00004 //      [Author]:       Xie Yuguang, <ygxie@mail.ihep.ac.cn>                    |
00005 //      [Date  ]:       May 22, 2005                                            |
00006 //------------------------------------------------------------------------------|
00007 
00008 #include <iostream>
00009 #include <cmath>
00010 
00011 #include "MucGeoCreateAlg/MucGeoConst.h"
00012 #include "MucGeoCreateAlg/MucStripPlane.h"
00013 
00014 using namespace std;
00015 
00016 // Constructor
00017 MucStripPlane::MucStripPlane( int part, int segment, int layer, int id ) : MucEntity( part, segment, layer, id )
00018 {
00019         MucStripPlane::Init();
00020         m_MucStrip = NULL;
00021 }
00022 
00023 // Copy constructor             
00024 MucStripPlane::MucStripPlane( const MucStripPlane &other ) : MucEntity( other )
00025 {
00026         m_MucStrip      = other.m_MucStrip;
00027 }
00028 
00029 // Operator =
00030 MucStripPlane& MucStripPlane::operator =( const MucStripPlane &other )
00031 {
00032         if( this == &other)
00033                 return *this;
00034 
00035         MucEntity::operator =(other);
00036 
00037         m_MucStrip      = other.m_MucStrip;
00038 
00039         return *this;   
00040 }
00041 
00042 // Destructor
00043 MucStripPlane::~MucStripPlane()
00044 {       
00045         delete m_MucStrip;
00046 }
00047 
00048 // Initialize
00049 void MucStripPlane::Init()
00050 {
00051         SetTheta();
00052         SetRin();
00053         SetRout();
00054         SetRc();
00055 
00056         SetThin();
00057         SetW();
00058         SetWu();
00059         SetWd();
00060         SetH();
00061         SetL();
00062 
00063         SetLocOrgInBes();
00064         SetObjOrgInBes();
00065         SetObjOrgInLoc();
00066 }
00067                 
00068 // -------------------------- Get methods ----------------------------
00069 
00070 MucStrip* MucStripPlane::GetStrip( int id )
00071 {
00072         if( m_MucStrip != NULL ) delete m_MucStrip;
00073 
00074         return ( m_MucStrip = new MucStrip( m_Part, m_Segment, m_Layer, id ) );
00075 }
00076 
00077 // ---------------------------Set motheds -----------------------------
00078 void MucStripPlane::SetTheta()
00079 {
00080         if( m_Part == BRID )
00081                 m_Theta = m_Segment * ( MUC_PI/4.0 );
00082         else
00083         {
00084                 if( m_ID == -1 )
00085                         m_Theta = ( 2*m_Segment + 1 ) * ( MUC_PI/4.0 );
00086                 else
00087                         m_Theta = ( MUC_PI/4.0 ) + ( m_ID - 1) * MUC_PI / 8.0 ;
00088         }
00089 }
00090 
00091 void MucStripPlane::SetRin()
00092 {
00093         if( m_Part == BRID )
00094                 m_Rin = B_AS_RMIN[m_Layer] - ( AS_GAP + STR_TH ) / 2.0;
00095         else
00096         {
00097                 if( m_ID == -1 )
00098                         m_Rin = 0.;
00099                 else
00100                         m_Rin = E_GP_RMIN[m_Layer] + E_STRPLN_DR;
00101         }
00102 }
00103 
00104 void MucStripPlane::SetRout()
00105 {
00106         if( m_Part == BRID )
00107                 m_Rout = B_AS_RMIN[m_Layer] - ( AS_GAP - STR_TH ) / 2.0;
00108         else
00109                 m_Rout = E_AS_RMAX - E_BOX_DR - E_STRPLN_DB[(m_Layer==0)?0:1];
00110 }
00111 
00112 void MucStripPlane::SetRc()
00113 {
00114         if( m_Part == BRID )
00115                 m_Rc = B_AS_RMIN[m_Layer] - AS_GAP/2.0;
00116         else
00117         {
00118                 if( m_ID == -1 )
00119                         m_Rc = sqrt(2.0) * ( E_AS_RMAX - E_BOX_DR - E_STRPLN_DB[(m_Layer==0)?0:1] ) / 2.0;
00120                 else
00121                         m_Rc = (m_Rin + m_Rout)/2.0;
00122         }
00123 }
00124 
00125 void MucStripPlane::SetThin()
00126 {
00127         m_Thin = STR_TH;
00128 }
00129 
00130 void MucStripPlane::SetW()
00131 {
00132         double offset = 0;
00133         if( (m_Layer+1)%2 == 0 ) offset = 2*B_BOX_DZ[1]; // even layers
00134         else                     offset = 2*B_BOX_DT[1]; // odd layers
00135 
00136         if( m_Part == BRID)
00137         {       
00138            if( m_Segment == B_TOP ) 
00139            {               
00140                 if(m_ID == -1 || m_ID == 2)
00141                         m_W = B_BOX_WT[m_Layer] - offset;
00142                 else
00143                         m_W = (B_BOX_WT[m_Layer] - offset - B_PHISTR_CUT)/2.0;  
00144            }       
00145            else
00146                  m_W = B_BOX_WT[m_Layer] - offset;
00147         }       
00148         else
00149         {
00150                 if( m_ID == -1 ) // temparory strip plane  
00151                         m_W = E_AS_RMAX - E_BOX_DR - E_GP_DX - (E_STRPLN_DA + E_STRPLN_DB[(m_Layer==0)?0:1]);
00152                 else
00153                         m_W = 0.;
00154         }
00155 }
00156 
00157 void MucStripPlane::SetH()
00158 {
00159         if( m_Part == BRID )
00160                 m_H = STR_TH;
00161         else
00162         {
00163                 if( m_ID == -1 ) // temparory strip plane
00164                         m_H = E_AS_RMAX - E_BOX_DR - E_GP_DY - (E_STRPLN_DA + E_STRPLN_DB[(m_Layer==0)?0:1]);
00165                 else
00166                 {
00167                         m_H = E_AS_RMAX - E_BOX_DR - E_GP_RMIN[m_Layer] - E_STRPLN_DR - E_STRPLN_DB[(m_Layer==0)?0:1];
00168                         if(m_ID==1) m_H += (E_STR_DST+5.0)/sqrt(2.0);
00169 
00170                         m_H += 4*OVERLAP_WIDTH;
00171                 }
00172         }
00173 }
00174 
00175 void MucStripPlane::SetL()
00176 {
00177         if( m_Part == BRID )
00178         {
00179            if( m_Segment == B_TOP )
00180            {
00181                 // 0,1,2,3,7: CUT = 1; 2,4,6,8: CUT = 0;   
00182                 if( m_ID == -1) m_L = B_BOX_LT - 2*B_BOX_DZ[SL_DOWN];
00183                 else if( m_ID == 2 ) m_L = B_BOX_LT - 2*B_BOX_DZ[SL_DOWN] - B_ZSTR_CUT[(m_Layer==0)?1:(m_Layer%2)];
00184                 else            m_L = B_ZSTR_CUT[(m_Layer==0)?1:(m_Layer%2)];
00185            }
00186            else    
00187                 m_L = B_BOX_LT - 2*B_BOX_DZ[SL_DOWN];
00188         }       
00189         else
00190                 m_L = STR_TH;
00191 }
00192 
00193 void MucStripPlane::SetWu()
00194 {
00195         if( m_Part == BRID )
00196                 m_Wu = m_W;
00197         else
00198         {       
00199                 if( m_ID == -1 )     //  temparory strip plane 
00200                         m_Wu = m_W;
00201                 else if( m_ID == 1 ) // center panel
00202                 {       
00203                         m_Wu = 2 * VALUE * m_Rin ;
00204                         m_Wu -= VALUE*(E_STR_DST+5.0)/sqrt(2.0);
00205                 }       
00206                 else if( m_ID == 0 )
00207                         m_Wu = VALUE * m_Rin - E_GP_DY - E_STRPLN_DA;
00208                 else
00209                         m_Wu = VALUE * m_Rin - E_GP_DX - E_STRPLN_DA;
00210 
00211                 //m_Wu += (1-VALUE)*OVERLAP_WIDTH;
00212                 //m_Wu += 2*OVERLAP_WIDTH;
00213         }
00214 }
00215 
00216 void MucStripPlane::SetWd()
00217 {
00218          if( m_Part == BRID )
00219                 m_Wd = m_W;
00220         else
00221         {       
00222                 if( m_ID == -1 )     // temparory strip plane
00223                         m_Wd = m_W;
00224                 else if( m_ID == 1 ) // center panel 
00225                 {       
00226                         m_Wd = 2 * VALUE * m_Rout;
00227                         // zoom in with a small dimension for covering strips 
00228                         m_Wd += VALUE*(E_STR_DST+5.0)/sqrt(2.0);
00229                 }       
00230                 else if( m_ID == 0 )
00231                         m_Wd = VALUE * m_Rout - E_GP_DY - E_STRPLN_DA;
00232                 else
00233                         m_Wd = VALUE * m_Rout - E_GP_DX - E_STRPLN_DA;
00234 
00235                 // for "AND" operation of panels
00236                 //m_Wd += (VALUE + 1.0)*OVERLAP_WIDTH;
00237                 m_Wd += 4*OVERLAP_WIDTH;
00238         }
00239 }
00240 
00241 
00242 
00243 
00244 void MucStripPlane::SetLocOrgInBes()
00245 {
00246         double x, y, z=0;
00247 
00248         if( m_Part == BRID )
00249         {
00250                 x = m_Rc*cos( m_Theta );
00251                 y = m_Rc*sin( m_Theta );
00252                 z = 0.;
00253         } // barrel
00254         else
00255         {
00256                 //-------------- set x and y ----------------------
00257                 // segment 0 as reference
00258                 if( m_ID == -1 )
00259                 {       
00260                         x = (E_AS_RMAX - E_BOX_DR + E_GP_DX) / 2.0;
00261                         y = (E_AS_RMAX - E_BOX_DR + E_GP_DY) / 2.0;                     
00262                 }
00263                 else
00264                 {
00265                         x = (E_AS_RMAX+E_GP_DX+E_STRPLN_DA -E_BOX_DR-E_STRPLN_DB[(m_Layer==0)?0:1])/2.0;
00266                         y = (E_AS_RMAX+E_GP_DY+E_STRPLN_DA -E_BOX_DR-E_STRPLN_DB[(m_Layer==0)?0:1])/2.0;
00267                 }
00268         
00269                 // x, y signs of coordinate different by segment 
00270                 if( m_Segment == 0 )       {    ;               }
00271                 else if ( m_Segment == 1 ) {    x = -x;         }
00272                 else if ( m_Segment == 2 ) {    x = -x; y = -y; }
00273                 else                       {    y = -y;         }
00274 
00275                 //-------------- set z -----------------------------
00276                 for( int i=0; i<m_Layer+1; i++ ) z += E_AS_TH[i];
00277 
00278                 z += m_Layer * AS_GAP;
00279                 z += (E_AS_ZMAX - E_AS_TOTAL_TH + z) + AS_GAP/2.0;
00280                 z *= cos( m_Part*MUC_PI/2.0 );
00281 
00282         }// endcap
00283 
00284         m_LocOrgInBes[0] = x;
00285         m_LocOrgInBes[1] = y;
00286         m_LocOrgInBes[2] = z;
00287 
00288         // limit cut
00289         for(int i=0;i<3;i++) {
00290                 if( fabs(m_LocOrgInBes[i]) < ERR_LIMIT ) m_LocOrgInBes[i] = 0.;
00291         }
00292 }
00293 
00294 void MucStripPlane::SetObjOrgInBes()
00295 {
00296         if( m_Part == BRID )
00297         {
00298                 for( int i=0; i<3; i++ )
00299                         m_ObjOrgInBes[i] = m_LocOrgInBes[i];
00300         }
00301         else // endcap
00302         {
00303                 //------------- set x and y --------------------
00304                 // segment 0 as reference 
00305                 double x, y;
00306                 if( m_ID == -1 )
00307                 {
00308                         x = E_GP_DX + E_STRPLN_DA + m_W/2.0;
00309                         y = E_GP_DY + E_STRPLN_DA + m_H/2.0;
00310                 }
00311                 else if( m_ID == 0 )
00312                 {
00313                         x = m_Rc;
00314                         y = ( m_Rc * tan( m_Theta ) + E_GP_DY + E_STRPLN_DA ) / 2.0;
00315                 }
00316                 else if ( m_ID ==1 )
00317                 {
00318                         x = m_Rc * cos( m_Theta );
00319                         y = m_Rc * sin( m_Theta );
00320                 }
00321                 else // m_ID == 2
00322                 {
00323                         x = ( m_Rc / tan( m_Theta ) + E_GP_DX + E_STRPLN_DA ) / 2.0;
00324                         y = m_Rc;
00325                 }
00326 
00327                 // x, y signs of coordinate different by segment 
00328                 if( m_Segment == 0 )       {    ;               }
00329                 else if ( m_Segment == 1 ) {    x = -x;         }
00330                 else if ( m_Segment == 2 ) {    x = -x; y = -y; }
00331                 else                       {    y = -y;         }
00332 
00333                 m_ObjOrgInBes[0] = x;   
00334                 m_ObjOrgInBes[1] = y;
00335 
00336                 // limit cut
00337                 for( int i=0; i<2; i++ ) {
00338                         if( fabs(m_ObjOrgInBes[i]) < ERR_LIMIT ) m_ObjOrgInBes[i] = 0.;
00339                 }
00340 
00341                 // ---------------- set z ----------------------
00342                 m_ObjOrgInBes[2] = m_LocOrgInBes[2];
00343 
00344         } // else, endcap
00345 }
00346 
00347 void MucStripPlane::SetObjOrgInLoc()
00348 {
00349         double x, y, z;
00350         if( m_Part == BRID )
00351         {
00352                 if( m_Segment == B_TOP && m_ID !=-1 )
00353                 {
00354                         // x
00355                         if(m_ID == 2)      x = 0.0;
00356                         else if(m_ID == 0) x = (B_PHISTR_CUT + m_W)/2.0;
00357                         else               x = -(B_PHISTR_CUT + m_W)/2.0;
00358 
00359                         // y
00360                         y = 0.0;
00361 
00362                         // z
00363                         if(m_ID == 2)      z =  - B_ZSTR_CUT[(m_Layer==0)?1:(m_Layer%2)]/2.0;
00364                         else               z =  B_BOX_LT/2.0 - B_BOX_DZ[SL_DOWN] - B_ZSTR_CUT[(m_Layer==0)?1:(m_Layer%2)]/2;
00365 
00366                         m_ObjOrgInLoc[0] = x;
00367                         m_ObjOrgInLoc[1] = y;
00368                         m_ObjOrgInLoc[2] = z;
00369                 }
00370                 else    
00371                 {       for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = 0.;  }
00372         }       
00373         else
00374                 for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = m_ObjOrgInBes[i] - m_LocOrgInBes[i];
00375 }
00376 
00377 void MucStripPlane::SetAlignment( double dx, double dy, double dz )
00378 {
00379         
00380         if( m_Part == BRID || m_ID == -1 )
00381         {
00382                 m_ObjOrgInLoc[0] += dx;
00383                 m_ObjOrgInLoc[1] += dy;
00384                 m_ObjOrgInLoc[2] += dz;
00385         }
00386 }
00387 
00388 // END

Generated on Tue Nov 29 23:12:56 2016 for BOSS_7.0.2 by  doxygen 1.4.7