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

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------|
00002 //      [File  ]:                       MucGap.cxx                              |
00003 //      [Brief ]:       MUC geometry yoke 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/MucGap.h"
00013 
00014 using namespace std;
00015 
00016 // Constructor
00017 MucGap::MucGap( int part, int segment, int layer, int id ) : MucEntity( part, segment, layer, id )
00018 {
00019         MucGap::Init();
00020         m_MucBox = NULL;
00021 }
00022 
00023 // Copy constructor             
00024 MucGap::MucGap( const MucGap &other ) : MucEntity( other )
00025 {
00026         m_MucBox        = other.m_MucBox;
00027 }
00028 
00029 // Operator =
00030 MucGap& MucGap::operator =( const MucGap &other )
00031 {
00032         if( this == &other)
00033                 return *this;
00034 
00035         MucEntity::operator =(other);
00036 
00037         m_MucBox        = other.m_MucBox;
00038 
00039         return *this;   
00040 }
00041 
00042 // Destructor
00043 MucGap::~MucGap()
00044 {       
00045         delete m_MucBox ;
00046 }
00047 
00048 // Initialize
00049 void MucGap::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         SetObjRotToMot();
00065         SetObjOrgInBes();
00066         SetObjOrgInLoc();
00067 }
00068                 
00069 
00070 // ------------------- Get methods --------------------
00071 
00072 MucBox* MucGap::GetBox( )
00073 {
00074         if( m_MucBox != NULL ) 
00075                 return m_MucBox;
00076         else
00077                 return ( m_MucBox = new MucBox(m_Part, m_Segment, m_Layer, ((m_Part==BRID)?0:-1) ) );
00078 }
00079 
00080 
00081 // --------------------- Set motheds ----------------------
00082 void MucGap::SetTheta()
00083 {
00084         if( m_Part == BRID )
00085                 m_Theta = m_Segment * ( MUC_PI/4.0 );
00086         else
00087         {
00088                 if( m_ID == -1 )
00089                         m_Theta = ( 2*m_Segment + 1 ) * ( MUC_PI/4.0 );
00090                 else
00091                         m_Theta = ( MUC_PI/4.0 ) + ( m_ID - 1) * MUC_PI / 8.0 ;
00092         }
00093 }
00094 
00095 void MucGap::SetRin()
00096 {
00097         if( m_Part == BRID )
00098                 m_Rin = B_AS_RMIN[m_Layer] - AS_GAP;
00099         else
00100         {
00101                 if( m_ID == -1 )
00102                         m_Rin = 0.;
00103                 else
00104                         m_Rin = E_GP_RMIN[m_Layer];
00105         }
00106 }
00107 
00108 void MucGap::SetRout()
00109 {
00110         if( m_Part == BRID )
00111                 m_Rout = B_AS_RMIN[m_Layer];
00112         else
00113                 m_Rout = E_AS_RMAX;
00114 }
00115 
00116 void MucGap::SetRc()
00117 {
00118         if( m_Part == BRID )
00119                 m_Rc = B_AS_RMIN[m_Layer] - AS_GAP/2.0;
00120         else
00121         {
00122                 if( m_ID == -1 )
00123                         m_Rc = sqrt(2.0) * E_AS_RMAX / 2.0;
00124                 else
00125                         m_Rc = (m_Rin + m_Rout)/2.0;
00126         }
00127 }
00128 
00129 void MucGap::SetThin()
00130 {
00131         m_Thin = AS_GAP;
00132 }
00133 
00134 void MucGap::SetW()
00135 {
00136         if( m_Part == BRID)
00137         {       
00138                 if( m_Segment != B_TOP )
00139                         m_W = B_GP_WT[m_Layer];
00140                 else    // top segment
00141                 {
00142                         if( m_ID == -1 || m_ID == 2 )
00143                                 m_W = B_GP_WT[m_Layer];
00144                         else
00145                                 m_W = ( B_GP_WT[m_Layer] - B_GP_SLOT_WT )/2.0;
00146                 }               
00147         }       
00148         else
00149         {
00150                 if( m_ID == -1 ) // virtual encap gap 
00151                         m_W = E_AS_RMAX - E_GP_DX;
00152                 else
00153                         m_W = 0.;
00154         }
00155 }
00156 
00157 void MucGap::SetH()
00158 {
00159         if( m_Part == BRID )
00160                 m_H = AS_GAP-0.2; // avoid overlap between absorber and gap
00161         else
00162         {
00163                 if( m_ID == -1 ) // virtual encap gap
00164                         m_H = E_AS_RMAX - E_GP_DY;
00165                 else if( m_ID == 1 )
00166                 {       // for panel logical operation "AND" valid;
00167                         m_H = E_AS_RMAX - E_GP_RMIN[m_Layer] +1.5*OVERLAP_WIDTH;
00168                 }
00169                 else
00170                         m_H = E_AS_RMAX - E_GP_RMIN[m_Layer];
00171         }
00172 }
00173 
00174 void MucGap::SetL()
00175 {
00176         if( m_Part == BRID )
00177         {
00178                 if( m_Segment != B_TOP || m_ID == -1 )
00179                         m_L = B_AS_LMAX;
00180                 else // top segment
00181                 {
00182                         if( m_ID == 2 )
00183                                 m_L = B_AS_LMAX - B_GP_SLOT_LT;
00184                         else
00185                                 m_L = B_GP_SLOT_LT;
00186                 }
00187         }
00188         else
00189                 m_L = AS_GAP;
00190 }
00191 
00192 void MucGap::SetWu()
00193 {
00194         if( m_Part == BRID )
00195                 m_Wu = m_W;
00196         else
00197         {       
00198                 if( m_ID == -1 )     // temporary local 
00199                         m_Wu = m_W;
00200                 else if( m_ID == 1 ) // center fraction
00201                 {       
00202                         m_Wu = 2 * VALUE * m_Rin ;
00203                         m_Wu -= 2*VALUE*(2.0/2); // for panel operation "AND" valid
00204                         m_Wu += 1.5*OVERLAP_WIDTH;
00205                 }       
00206                 else if( m_ID == 0 )
00207                         m_Wu = VALUE * m_Rin - E_GP_DY;
00208                 else
00209                         m_Wu = VALUE * m_Rin - E_GP_DX;
00210 
00211                 if( m_ID != -1 ) m_Wu+=OVERLAP_WIDTH; // avoid panels overlap
00212 
00213         }
00214 }
00215 
00216 void MucGap::SetWd()
00217 {
00218          if( m_Part == BRID )
00219                 m_Wd = m_W;
00220         else
00221         {       
00222                 if( m_ID == -1 )     // temporary local
00223                         m_Wd = m_W;
00224                 else if( m_ID == 1 ) // center fraction
00225                 {
00226                         m_Wd = 2 * VALUE * m_Rout;
00227                         m_Wd += 2*VALUE*(2.0/2); // for panel operation "AND" valid
00228                         m_Wd += 1.5*OVERLAP_WIDTH;
00229                 }       
00230                 else if( m_ID == 0 )
00231                         m_Wd = VALUE * m_Rout - E_GP_DY;
00232                 else
00233                         m_Wd = VALUE * m_Rout - E_GP_DX;
00234 
00235                 if( m_ID != -1 ) m_Wd+=OVERLAP_WIDTH; // avoid panels overlap
00236         }
00237 }
00238 
00239 
00240 void MucGap::SetLocOrgInBes()
00241 {
00242         double x, y, z;
00243         x = y = z = 0.;
00244         
00245         if( m_Part == BRID )
00246         {
00247                 x = m_Rc*cos( m_Theta );
00248                 y = m_Rc*sin( m_Theta );
00249                 z = 0.;
00250         } // barrel
00251         else
00252         {
00253                 //---------- set x and y ------------
00254                 // segment 0 as reference 
00255                 x = (E_AS_RMAX + E_GP_DX) / 2.0;
00256                 y = (E_AS_RMAX + E_GP_DY) / 2.0;
00257 
00258                 // x, y signs of coordinate different by segment 
00259                 if( m_Segment == 0 )       {    ;               }
00260                 else if ( m_Segment == 1 ) {    x = -x;         }
00261                 else if ( m_Segment == 2 ) {    x = -x; y = -y; }
00262                 else                       {    y = -y;         }
00263 
00264                 //----------- set z ----------------
00265                 for( int i=0; i<m_Layer+1; i++ ) z += E_AS_TH[i];
00266                 z += m_Layer * AS_GAP;
00267                 z += (E_AS_ZMAX - E_AS_TOTAL_TH ) + AS_GAP/2.0;
00268                 z *= cos( m_Part*MUC_PI/2.0 );
00269 
00270         }// endcap
00271 
00272         m_LocOrgInBes[0] = x;
00273         m_LocOrgInBes[1] = y;
00274         m_LocOrgInBes[2] = z;
00275 
00276         // limit cut
00277         for(int i=0;i<3;i++) {
00278                 if( fabs(m_LocOrgInBes[i]) < ERR_LIMIT ) m_LocOrgInBes[i] = 0;
00279         }
00280 }
00281 
00282 void MucGap::SetObjRotToMot()
00283 {
00284         m_ObjRotToMot[0] = 0.;
00285         m_ObjRotToMot[1] = 0.;
00286 
00287         if( m_Part == BRID )
00288                 m_ObjRotToMot[2] = MUC_PI * (m_Segment - 2) / 4.0;
00289         else
00290                 m_ObjRotToMot[2] = 0.;
00291 }
00292 
00293 void MucGap::SetObjOrgInBes()
00294 {
00295         double x, y, z;
00296         x = y = z = 0.;
00297 
00298         if( m_Part == BRID )
00299         {
00300                 if( m_Segment != B_TOP  || m_ID == -1 )
00301                         for( int i=0; i<3; i++ ) m_ObjOrgInBes[i] = m_LocOrgInBes[i];
00302                 else // top segment
00303                 {
00304                         // set x
00305                         if( m_ID == 2 ) x = 0.;
00306                         else            x = (1-2*m_ID) * ( B_GP_WT[m_Layer] + B_GP_SLOT_WT )/4.0; 
00307                         
00308 
00309                         // set z
00310                         if( m_ID == 2 ) z = -B_GP_SLOT_LT / 2.0;
00311                         else            z = ( B_AS_LMAX - B_GP_SLOT_LT )/2.0;
00312                         
00313                         m_ObjOrgInBes[0] = x;
00314                         m_ObjOrgInBes[2] = z;
00315                         
00316                         // set y
00317                         m_ObjOrgInBes[1] = m_LocOrgInBes[1];
00318 
00319                         // limit cut
00320                         for( int i=0; i<3; i++ ) {
00321                                 if( fabs(m_ObjOrgInBes[i]) < ERR_LIMIT ) m_ObjOrgInBes[i] = 0;
00322 
00323                         }
00324                 }
00325         }
00326         else
00327         {
00328                 // -------------- set x and y --------------------
00329                 // setting segment 0 as reference 
00330                 if( m_ID == 0 )
00331                 {
00332                         x = m_Rc;
00333                         y = ( m_Rc * tan( m_Theta ) + E_GP_DY ) / 2.0;
00334                 }
00335                 else if ( m_ID ==1 )
00336                 {
00337                         x = m_Rc * cos( m_Theta );
00338                         y = m_Rc * sin( m_Theta );
00339                 }
00340                 else // m_ID == 2
00341                 {
00342                         x = ( m_Rc / tan( m_Theta ) + E_GP_DX ) / 2.0;
00343                         y = m_Rc;
00344                 }
00345 
00346                 // x, y signs of coordinate different by segment 
00347                 if( m_Segment == 0 )       {    ;               }
00348                 else if ( m_Segment == 1 ) {    x = -x;         }
00349                 else if ( m_Segment == 2 ) {    x = -x; y = -y; }
00350                 else                       {    y = -y;         }
00351         
00352                 m_ObjOrgInBes[0] = x;
00353                 m_ObjOrgInBes[1] = y;
00354 
00355                 // limit cut
00356                 for( int i=0; i<2; i++ ) {
00357                         if( fabs(m_ObjOrgInBes[i]) < ERR_LIMIT ) m_ObjOrgInBes[i] = 0;
00358                 }
00359 
00360                 // ------------- set z ------------------------
00361                 m_ObjOrgInBes[2] = m_LocOrgInBes[2];
00362                 
00363         } // else
00364 }
00365 
00366 void MucGap::SetObjOrgInLoc()
00367 {
00368         if( m_Part == BRID)
00369         {       
00370                 if( m_Segment != B_TOP )
00371                         for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = 0.;
00372                 else
00373                         for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = m_ObjOrgInBes[i] - m_LocOrgInBes[i];          
00374         }       
00375         else
00376                 for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = m_ObjOrgInBes[i] - m_LocOrgInBes[i];
00377 }
00378 
00379 
00380 // END

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