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

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------|
00002 //      [File  ]:                       MucAbsorber.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/MucAbsorber.h"
00013 
00014 using namespace std;
00015 
00016 // Constructor
00017 MucAbsorber::MucAbsorber( int part, int segment, int layer, int id ) : MucEntity( part, segment, layer, id )
00018 {
00019         MucAbsorber::Init();
00020 }
00021 
00022 // Copy constructor             
00023 MucAbsorber::MucAbsorber( const MucAbsorber &other ) : MucEntity( other ) { ; }
00024 
00025 // Operator =
00026 MucAbsorber& MucAbsorber::operator =( const MucAbsorber &other )
00027 {
00028         if( this == &other)
00029                 return *this;
00030         
00031         MucEntity::operator =(other);
00032 
00033         return *this;
00034 }
00035 
00036 // Destructor
00037 MucAbsorber::~MucAbsorber() { ; }
00038                 
00039 // Initialize
00040 void MucAbsorber::Init()
00041 {
00042         SetTheta();
00043         SetRin();
00044         SetRout();
00045         SetRc();
00046 
00047         SetThin();
00048         SetW(); 
00049         SetWu();
00050         SetWd();
00051         SetH();
00052         SetL();
00053         SetLocOrgInBes();
00054         SetObjRotToMot();
00055         SetObjOrgInBes();
00056         SetObjOrgInLoc();
00057 }
00058 
00059 
00060 // -------------------------- Set motheds -------------------
00061 void MucAbsorber::SetTheta()
00062 {
00063         if( m_Part == BRID )
00064                 m_Theta = m_Segment * ( MUC_PI/4.0 );
00065         else
00066         {
00067                 if( m_ID == -1 )
00068                         m_Theta = ( 2*m_Segment + 1 ) * ( MUC_PI/4.0 );
00069                 else
00070                         m_Theta = ( MUC_PI/4.0 ) + ( m_ID - 1) * MUC_PI / 8.0 ;
00071         }
00072 }
00073 
00074 void MucAbsorber::SetRin()
00075 {
00076         if( m_Part == BRID )
00077                 m_Rin = B_AS_RMIN[m_Layer];
00078         else
00079         {
00080                 if( m_ID == -1 )
00081                         m_Rin = 0.0;
00082                 else
00083                         m_Rin = E_AS_RMIN[m_Layer];
00084         }
00085 }
00086 
00087 void MucAbsorber::SetRout()
00088 {
00089         if( m_Part == BRID )
00090                 m_Rout = B_AS_RMIN[m_Layer] + B_AS_TH[m_Layer] ;
00091         else
00092                 m_Rout = E_AS_RMAX;
00093 }
00094 
00095 
00096 void MucAbsorber::SetRc()
00097 {
00098         if( m_Part == BRID )
00099                 m_Rc = B_AS_RMIN[m_Layer] + B_AS_TH[m_Layer]/2.0;
00100         else
00101         {
00102                 if( m_ID == -1 )
00103                         m_Rc = sqrt(2.0) * E_AS_RMAX / 2.0;
00104                 else
00105                         m_Rc = (m_Rin + m_Rout)/2.0;
00106         }
00107 }
00108 
00109 void MucAbsorber::SetThin()
00110 {
00111         if( m_Part == BRID )
00112                 m_Thin = B_AS_TH[m_Layer];
00113         else
00114                 m_Thin = E_AS_TH[m_Layer];
00115 }
00116 
00117 void MucAbsorber::SetW()
00118 {
00119         if( m_Part == BRID)
00120                 m_W = 2.0 * VALUE * m_Rout;
00121         else
00122         {
00123                 if( m_ID == -1 ) // temporary local 
00124                         m_W = E_AS_RMAX;
00125                 else
00126                         m_W = 0;
00127         }
00128 }
00129 
00130 void MucAbsorber::SetH()
00131 {
00132         if( m_Part == BRID )
00133                 m_H = B_AS_TH[m_Layer];
00134         else
00135         {
00136                 if( m_ID == -1 ) // temporary local
00137                         m_H = E_AS_RMAX;
00138                 else
00139                         m_H = E_AS_RMAX - E_AS_RMIN[m_Layer];
00140         }
00141 }
00142 
00143 void MucAbsorber::SetL()
00144 {
00145         if( m_Part == BRID )
00146                 m_L = B_AS_LMAX;
00147         else
00148                 m_L = E_AS_TH[m_Layer];
00149 }
00150 
00151 void MucAbsorber::SetWu()
00152 {
00153         if( m_Part == BRID )
00154                 m_Wu = 2 * VALUE * m_Rin;
00155         else
00156         {
00157                 if( m_ID == -1 )        // temporary local
00158                         m_Wu = m_W;
00159                 else if( m_ID == 1 )    // center panel 
00160                         m_Wu = 2 * VALUE * m_Rin;
00161                 else
00162                         m_Wu = VALUE * m_Rin;
00163         }
00164 
00165         m_Wu -= 0.8; //mm, avoid overlaping
00166 }
00167 
00168 void MucAbsorber::SetWd()
00169 {
00170          if( m_Part == BRID )
00171                   m_Wd = 2.0 * VALUE * m_Rout;
00172         else
00173         {
00174                 if( m_ID == -1 )        // temporary local
00175                         m_Wd = m_W;
00176                 if( m_ID == 1 )         // center panel 
00177                         m_Wd = 2.0 * VALUE * E_AS_RMAX;
00178                 else
00179                         m_Wd = VALUE * E_AS_RMAX;
00180         }
00181 
00182         m_Wd -= 0.8;  //mm, avoid overlaping
00183 }
00184 
00185 
00186 void MucAbsorber::SetLocOrgInBes()
00187 {
00188         double x, y, z;
00189   x = y = z = 0.0;
00190         
00191         //---------- set x and y --------
00192         if( m_Part == BRID || m_ID == -1 ) // the local(mother) in BES
00193         {       
00194                 x = m_Rc * cos( m_Theta );
00195                 y = m_Rc * sin( m_Theta );
00196         } // barrel
00197         else // for endcap panel, calculate the origin of temporary local in BES
00198         {       
00199                 // set x and y  
00200                 double tempR, tempTheta;
00201                 tempR = sqrt(2.0) * E_AS_RMAX / 2.0;
00202                 tempTheta = ( 2*m_Segment + 1 ) * ( MUC_PI / 4.0 );
00203                 
00204                 x = tempR * cos( tempTheta );
00205                 y = tempR * sin( tempTheta );
00206                 
00207         }// endcap
00208         
00209         //---------- set z  ----------- 
00210         if( m_Part == BRID ) z = 0.;
00211         else
00212         {
00213                 for( int i=0; i<m_Layer+1; i++ ) z += E_AS_TH[i];
00214 
00215                 z += m_Layer * AS_GAP;
00216                 z += (E_AS_ZMAX - E_AS_TOTAL_TH ) - m_Thin/2.0;  
00217                 z *= cos( m_Part*MUC_PI/2.0 );
00218         }
00219 
00220         m_LocOrgInBes[0] = x;
00221         m_LocOrgInBes[1] = y;
00222         m_LocOrgInBes[2] = z;
00223 
00224         // limit cut
00225         for(int i=0; i<3; i++) {
00226                 if( fabs(m_LocOrgInBes[i]) < ERR_LIMIT ) m_LocOrgInBes[i] = 0; 
00227         }               
00228 }
00229 
00230 void MucAbsorber::SetObjRotToMot()
00231 {
00232         m_ObjRotToMot[0] = 0.;
00233         m_ObjRotToMot[1] = 0.;
00234 
00235         if( m_Part == BRID )
00236                 m_ObjRotToMot[2] = MUC_PI * (m_Segment - 2) / 4.0;
00237         else
00238                 m_ObjRotToMot[2] = 0.;
00239 }
00240 
00241 void MucAbsorber::SetObjOrgInBes()
00242 {
00243         double x, y;
00244 
00245         if( m_Part == BRID || m_ID == -1 ) // object is concided with local
00246         {
00247                 m_ObjOrgInBes[0] = m_LocOrgInBes[0];
00248                 m_ObjOrgInBes[1] = m_LocOrgInBes[1];
00249                 m_ObjOrgInBes[2] = m_LocOrgInBes[2];
00250 
00251         } // local              
00252         else 
00253         {
00254                 //-------- set x and y ------------  
00255                 // endcap panels
00256                 // setting segment 0 as reference 
00257                 if( m_ID == 0 )
00258                 {
00259                         x = m_Rc;
00260                         y = m_Rc * tan( m_Theta ) / 2.0;
00261                 }
00262                 else if ( m_ID ==1 )
00263                 {
00264                         x = m_Rc * cos( m_Theta );
00265                         y = m_Rc * sin( m_Theta );      
00266                 }
00267                 else // m_ID == 2
00268                 {
00269                         x = m_Rc / tan( m_Theta ) / 2.0;
00270                         y = m_Rc;
00271                 }
00272                         
00273                 // x, y signs of coordinate different by segment 
00274                 if( m_Segment == 0 )       {    ;               }
00275                 else if ( m_Segment == 1 ) {    x = -x;         }
00276                 else if ( m_Segment == 2 ) {    x = -x; y = -y; }
00277                 else                       {    y = -y;         }
00278 
00279                 m_ObjOrgInBes[0] = x;
00280                 m_ObjOrgInBes[1] = y;
00281 
00282                 // limit cut
00283                 for( int i=0; i<2; i++ ) {
00284                         if( fabs(m_ObjOrgInBes[i]) < ERR_LIMIT ) m_ObjOrgInBes[i] = 0;
00285                 }
00286                 
00287                 //---------- set z--------------
00288                 m_ObjOrgInBes[2] = m_LocOrgInBes[2];
00289 
00290         } // else, endcap panels
00291 }
00292 
00293 void MucAbsorber::SetObjOrgInLoc()
00294 {
00295         if( m_Part == BRID || m_ID == -1 ) // for barrel and endcap local
00296                 for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = 0.;
00297         else                               // for endcap panels
00298                 for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = m_ObjOrgInBes[i] - m_LocOrgInBes[i];
00299 }
00300 
00301 
00302 // END

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