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

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------|
00002 //      [File  ]:                       MucEntity.cxx                           |
00003 //      [Brief ]:       MUC geometry entity class                               |
00004 //      [Author]:       Xie Yuguang, <ygxie@mail.ihep.ac.cn>                    |
00005 //      [Date  ]:       Mar 28, 2006                                            |
00006 //------------------------------------------------------------------------------|
00007 
00008 #include<iostream>
00009 #include<string>
00010 #include<cmath>
00011 
00012 #include "MucGeoCreateAlg/MucEntity.h"
00013 
00014 using namespace std;
00015 
00016 // Constructor
00017 MucEntity::MucEntity( int part, int segment, int layer )
00018 {
00019         m_Part          = part;
00020         m_Segment       = segment;
00021         m_Layer         = layer;
00022         m_UpDown        = -1;           // no up/down distinction
00023         m_RpcId         = 0;
00024         m_ID            = 0;            // only 1 entity, default
00025 
00026         MucEntity::Init();
00027 }
00028 
00029 MucEntity::MucEntity( int part, int segment, int layer, int id )
00030 {
00031         m_Part          = part;
00032         m_Segment       = segment;
00033         m_Layer         = layer;
00034         m_ID            = id;
00035         m_UpDown        = -1;           
00036         m_RpcId         = 0;
00037 
00038         Init();
00039 }
00040 
00041 MucEntity::MucEntity( int part, int segment, int layer, int upDown, int id )
00042 {
00043         m_Part          = part;
00044         m_Segment       = segment;
00045         m_Layer         = layer;
00046         m_UpDown        = upDown;          
00047         m_ID            = id;
00048         m_RpcId         = id;
00049 
00050         MucEntity::Init();
00051 }
00052 
00053 MucEntity::MucEntity( int part, int segment, int layer, int upDown, int rpcId, int id )
00054 {
00055         m_Part          = part;
00056         m_Segment       = segment; 
00057         m_Layer         = layer;
00058         m_UpDown        = upDown;           
00059         m_RpcId         = rpcId;
00060         m_ID            = id;
00061 
00062         MucEntity::Init();
00063 }
00064 
00065 MucEntity::MucEntity( const MucEntity &other )
00066 {
00067         m_Part          = other.m_Part;
00068         m_Segment       = other.m_Segment;
00069         m_Layer         = other.m_Layer;
00070         m_UpDown        = other.m_UpDown;
00071         m_RpcId         = other.m_RpcId;
00072         m_ID            = other.m_ID;
00073         
00074         m_Theta         = other.m_Theta;
00075         m_Thin          = other.m_Thin;
00076         m_W             = other.m_W;
00077         m_H             = other.m_H;
00078         m_L             = other.m_L;
00079         m_Wu            = other.m_Wu;
00080         m_Wd            = other.m_Wd;
00081         m_Area          = other.m_Area;
00082 
00083          for(int i=0; i<3; i++)
00084         {
00085                 m_LocOrgInBes[i] = other.m_LocOrgInBes[i];
00086                 m_ObjRotToMot[i] = other.m_ObjRotToMot[i];
00087                 m_ObjOrgInBes[i] = other.m_ObjOrgInBes[i];
00088                 m_ObjOrgInLoc[i] = other.m_ObjOrgInLoc[i];
00089         }
00090 }
00091 
00092 MucEntity& MucEntity::operator =( const MucEntity &other )
00093 {
00094         if( this == &other)
00095                 return *this;
00096         
00097         m_Part          = other.m_Part;
00098         m_Segment       = other.m_Segment;
00099         m_Layer         = other.m_Layer;
00100         m_UpDown        = other.m_UpDown;
00101         m_RpcId         = other.m_RpcId;
00102         m_ID            = other.m_ID;
00103 
00104         m_Theta         = other.m_Theta;        
00105         m_Thin          = other.m_Thin; 
00106         m_W             = other.m_W;
00107         m_H             = other.m_H;
00108         m_L             = other.m_L;
00109         m_Wu            = other.m_Wu;
00110         m_Wd            = other.m_Wd;
00111         m_Area          = other.m_Area;
00112 
00113           for(int i=0; i<3; i++)
00114         {
00115                 m_LocOrgInBes[i] = other.m_LocOrgInBes[i];
00116                 m_ObjRotToMot[i] = other.m_ObjRotToMot[i];
00117                 m_ObjOrgInBes[i] = other.m_ObjOrgInBes[i];
00118                 m_ObjOrgInLoc[i] = other.m_ObjOrgInLoc[i];
00119         }
00120 
00121         return *this;
00122 }
00123 
00124 // Destructor
00125 MucEntity::~MucEntity()
00126 {
00127         delete [] m_LocOrgInBes;
00128         delete [] m_ObjRotToMot;
00129         delete [] m_ObjOrgInBes;
00130         delete [] m_ObjOrgInLoc;
00131 }
00132 
00133 // Get methods
00134 int MucEntity::GetPart()        { return m_Part;        }
00135 int MucEntity::GetSegment()     { return m_Segment;     }
00136 int MucEntity::GetLayer()       { return m_Layer;       }
00137 int MucEntity::GetUpDown()      { return m_UpDown;      }
00138 int MucEntity::GetRpcId()       { return m_RpcId;       }
00139 int MucEntity::GetID()          { return m_ID;          }
00140 double MucEntity::GetTheta()    { return m_Theta;       }
00141 double MucEntity::GetRin()      { return m_Rin;         }
00142 double MucEntity::GetRout()     { return m_Rout;        }
00143 double MucEntity::GetRc()       { return m_Rc;          }
00144 double MucEntity::GetThin()     { return m_Thin;        } 
00145 double MucEntity::GetW()        { return m_W;           }
00146 double MucEntity::GetH()        { return m_H;           }
00147 double MucEntity::GetL()        { return m_L;           }
00148 double MucEntity::GetWu()       { return m_Wu;          }
00149 double MucEntity::GetWd()       { return m_Wd;          }
00150 double MucEntity::GetArea()     { return m_Area;        }
00151 
00152 double MucEntity::GetLocOrgInBes( int i )
00153 {
00154         if( i<1 || i>3 ) i=1;
00155         return m_LocOrgInBes[i-1];
00156 }
00157 
00158 double MucEntity::GetObjRotToMot( int i )
00159 {
00160         if( i<1 || i>3 ) i=1;
00161         return m_ObjRotToMot[i-1];
00162 }
00163 
00164 double MucEntity::GetObjOrgInBes( int i )
00165 {
00166         if( i<1 || i>3 ) i=1;
00167         return m_ObjOrgInBes[i-1];
00168 }
00169 
00170 double MucEntity::GetObjOrgInLoc( int i )
00171 {
00172         if( i<1 || i>3 ) i=1;
00173         return m_ObjOrgInLoc[i-1];
00174 }
00175 
00176 double* MucEntity::GetLocOrgInBes() { return &m_LocOrgInBes[0]; }
00177 double* MucEntity::GetObjRotToMot() { return &m_ObjRotToMot[0]; }
00178 double* MucEntity::GetObjOrgInBes() { return &m_ObjOrgInBes[0]; }
00179 double* MucEntity::GetObjOrgInLoc() { return &m_ObjOrgInLoc[0]; }
00180 
00181 
00182 // Set methods
00183 void MucEntity::Init()
00184 {
00185         MucEntity::SetTheta();
00186         MucEntity::SetRin();
00187         MucEntity::SetRout();
00188         MucEntity::SetRc();
00189         MucEntity::SetThin();
00190         MucEntity::SetW();
00191         MucEntity::SetWu();
00192         MucEntity::SetWd();
00193         MucEntity::SetH();
00194         MucEntity::SetL();
00195         MucEntity::SetArea();
00196         MucEntity::SetLocOrgInBes();
00197         MucEntity::SetObjRotToMot();
00198         MucEntity::SetObjOrgInBes();
00199         MucEntity::SetObjOrgInLoc();
00200 }
00201 
00202 void MucEntity::SetTheta(){ m_Theta     = 0.;   }
00203 void MucEntity::SetRin()  { m_Rin       = 0.;   }
00204 void MucEntity::SetRout() { m_Rout      = 0.;   }
00205 void MucEntity::SetRc()   { m_Rc        = 0.;   }
00206 void MucEntity::SetThin() { m_Thin      = 0.;   }
00207 void MucEntity::SetW()    { m_W         = 0.;   }
00208 void MucEntity::SetWu()   { m_Wu        = 0.;   }
00209 void MucEntity::SetWd()   { m_Wd        = 0.;   }
00210 void MucEntity::SetH()    { m_H         = 0.;   }
00211 void MucEntity::SetL()    { m_L         = 0.;   }
00212 void MucEntity::SetArea() { m_Area      = 0.;   }
00213 
00214 void MucEntity::SetLocOrgInBes() { for( int i=0; i<3; i++) m_LocOrgInBes[i] = 0.; }
00215 void MucEntity::SetObjRotToMot() { for( int i=0; i<3; i++) m_ObjRotToMot[i] = 0.; }
00216 void MucEntity::SetObjOrgInBes() { for( int i=0; i<3; i++) m_ObjOrgInBes[i] = 0.; }
00217 void MucEntity::SetObjOrgInLoc() { for( int i=0; i<3; i++) m_ObjOrgInLoc[i] = 0.; }
00218 
00219 void MucEntity::SetAlignment( double dx, double dy, double dz ) { ; }
00220 
00221 // Coordinate transform function, from global(BES) to local 
00222 // Z coordinate is parellel, phi is the inclination angle of the BES coordinate x direction and the Loc one
00223 void MucEntity::TransBesToLoc( double LocCoord[], double BesCoord[], double LocOrgInBes[], double Rot_z )
00224 {
00225        LocCoord[0] = (BesCoord[0] - LocOrgInBes[0])*cos(Rot_z) + (BesCoord[1] - LocOrgInBes[1])*sin(Rot_z);
00226        LocCoord[1] = -(BesCoord[0] - LocOrgInBes[0])*sin(Rot_z) + (BesCoord[1] - LocOrgInBes[1])*cos(Rot_z);
00227        LocCoord[2] = BesCoord[2] - LocOrgInBes[2];
00228 }
00229 
00230 // Coordinate transform function, from local to global(BES)
00231 // Z coordinate is parellel, phi is the inclination angle of the BES coordinate x direction and the Loc one 
00232 void MucEntity::TransLocToBes( double BesCoord[], double LocCoord[], double LocOrgInBes[], double Rot_z )
00233 {
00234         BesCoord[0] = LocCoord[0]*cos(Rot_z) - LocCoord[1]*sin(Rot_z) + LocOrgInBes[0];
00235         BesCoord[1] = LocCoord[0]*sin(Rot_z) + LocCoord[1]*cos(Rot_z) + LocOrgInBes[1];
00236         BesCoord[2] = LocCoord[2] + LocOrgInBes[2];
00237 }
00238 
00239 
00240 // END
00241 
00242 

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