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

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------|
00002 //      [File  ]:                       MucGeoMgr.cxx                               |
00003 //      [Brief ]:       MUC geometry created manager 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<fstream>
00011 
00012 #include "GaudiKernel/MsgStream.h"
00013 #include "GaudiKernel/Bootstrap.h"
00014 #include "GaudiKernel/ISvcLocator.h"
00015 
00016 #include "TFile.h"
00017 #include "TTree.h"
00018 #include "TH1F.h"
00019 
00020 #include "MucGeoCreateAlg/MucGeoMgr.h"
00021 #include "MucGeoCreateAlg/MucIdTransform.h"
00022 
00023 using namespace std;
00024 
00025 // Constructor
00026 MucGeoMgr::MucGeoMgr( const std::string createFlag, bool alignFlag, const std::string alignFile )
00027 {
00028         m_CreateFlag    = createFlag;
00029         m_AlignFlag     = alignFlag;
00030         m_AlignFile     = alignFile;
00031         
00032   Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
00033 
00034         InitOffset();   
00035 }
00036 
00037 // Destructor
00038 MucGeoMgr::~MucGeoMgr()
00039 {
00040         delete []m_BoxOffset;
00041         delete []m_StripPlaneOffset;
00042 
00043         delete m_MucAbsorber;
00044         delete m_MucGap;
00045         delete m_MucBox;
00046         delete m_MucStripPlane;
00047         delete m_MucStrip;
00048         delete m_MucRpc;
00049         delete m_MucGas;
00050         delete m_MucBakelite;
00051         delete m_MucBoxCover;
00052 }
00053 
00054 //========================================= Alignment initialization==================================================
00055 // Offset init
00056 StatusCode MucGeoMgr::InitOffset()
00057 {
00058         MsgStream log(msgSvc, "MucGeoMgr");
00059 
00060   m_IdTr = new MucIdTransform();
00061 
00062         if( m_AlignFlag == true )
00063         {
00064                 log << MSG::INFO << "MucGeoMgr::initOffset()" << endreq;
00065 
00066     TFile* froot = new TFile(m_AlignFile.c_str(), "read");
00067     if( froot->IsZombie() ) 
00068     {
00069       log << MSG:: ERROR << "Open alignment data error!" << endreq;
00070       return StatusCode::FAILURE;
00071     }
00072 
00073     const char OFFSET_NAME[3][5] = {"dx", "dy", "dz"};
00074     double box_offset[3];
00075     double strpln_offset[3];
00076    
00077     TTree* tr_Offset;
00078     
00079     tr_Offset = (TTree*)froot->Get("Offset");
00080     tr_Offset->SetBranchAddress("box_dx", &box_offset[0]);
00081     tr_Offset->SetBranchAddress("box_dy", &box_offset[1]);
00082     tr_Offset->SetBranchAddress("box_dz", &box_offset[2]);
00083     tr_Offset->SetBranchAddress("strpln_dx", &strpln_offset[0]);
00084     tr_Offset->SetBranchAddress("strpln_dy", &strpln_offset[1]);
00085     tr_Offset->SetBranchAddress("strpln_dz", &strpln_offset[2]);
00086 
00087     int part, segment, layer;
00088         part = segment = layer = 0;
00089     
00090                 log << MSG::INFO << "------------------------- offset data--------------------------" << endreq;
00091     log << MSG::INFO << "Part\tSegment\tLayer\tdx0\tdy0\tdz0\tdx1\tdy1\tdz1" << endreq;
00092     for( int i=0; i<BOX_MAX; i++)
00093     {
00094       m_IdTr->SetBoxPos(i, &part, &segment, &layer);
00095       tr_Offset->GetEntry(i);
00096             
00097       log << MSG::INFO << part << "\t" << segment << "\t" << layer << "\t";
00098       for( int j=0; j<3; j++ )
00099       {
00100         log << MSG::INFO << box_offset[j] << "\t";
00101 
00102         if( !CheckBoxOffset(part, segment, layer, j, box_offset[j]) )
00103         {
00104           log << MSG::INFO << endreq << "Box offset P" << part << "S" << segment << "L" << layer
00105               << "_" << OFFSET_NAME[j] << "\tout range!" << endreq;
00106           box_offset[j] = B_X_MAX[j];
00107         }
00108       }
00109 
00110       for( int j=0; j<3; j++ )
00111       {
00112         log << MSG::INFO << strpln_offset[j] << "\t";
00113 
00114         if( !CheckStripPlaneOffset(part, segment, layer, j, strpln_offset[j]) )
00115         {
00116           log << MSG::INFO << endreq << "Strip plane offset P" << part << "S" << segment << "L" << layer
00117               << "_" << OFFSET_NAME[j] << "\tout range!" << endreq;
00118           strpln_offset[j] = STR_OFFSET_MAX[j];
00119         }
00120       }  
00121     
00122       log << MSG::INFO << endreq;   
00123     } // end box    
00124 
00125     froot->Close(); 
00126     log << MSG::INFO << "---------------------------------------------------------------" << endreq;
00127         } // end alignflag
00128         else
00129         {
00130                 for(int i=0; i<PART_MAX; i++)
00131                   for(int j=0; j<B_SEG_NUM; j++)
00132                     for(int k=0; k<B_LAY_NUM; k++)
00133                       for(int m=0; m<3; m++)
00134           {
00135             m_BoxOffset[i][j][k][m] = 0.0;
00136                               m_StripPlaneOffset[i][j][k][m] = 0.0;
00137           }                                                     
00138         } 
00139 
00140         return StatusCode::SUCCESS;
00141 }
00142 
00143 bool MucGeoMgr::CheckBoxOffset( int part, int segment, int layer, int axis, double offset )
00144 {
00145         int outRangeFlag = 0;
00146 
00147         if( part == BRID )
00148         {
00149                 switch( axis )
00150                 {
00151                  case 0:        // x
00152                         int layerFlag;
00153 
00154                         if( layer == 0 )         layerFlag = 0; 
00155                         else if( layer%2 == 1 )  layerFlag = 1; 
00156                         else                     layerFlag = 2; 
00157 
00158                         if( B_X_MAX[layerFlag] - fabs(offset) >= 0.0 ) // |offset|<=B_X_MAX
00159                                 m_BoxOffset[part][segment][layer][axis] = offset;                       
00160                         else
00161                         {       
00162                                 outRangeFlag ++;        
00163                                 m_BoxOffset[part][segment][layer][axis] = B_X_MAX[layerFlag] * MAX_FRACTION;
00164                         }
00165                         break;
00166                  case 1:        // y
00167                         if( B_Y_MAX - fabs(offset) >= 0.0 ) // |offset|<=B_Y_MAX
00168                                 m_BoxOffset[part][segment][layer][axis] = offset;                          
00169                         else
00170                         {
00171                                 outRangeFlag ++;
00172                                 m_BoxOffset[part][segment][layer][axis] = B_Y_MAX * MAX_FRACTION;                       
00173                         }
00174                         break;
00175                  case 2:        // z
00176                         if( B_Z_MAX - fabs(offset) >= 0.0 ) // |offset|<=B_Y_MAX
00177                                 m_BoxOffset[part][segment][layer][axis] = offset;
00178                         else
00179                         {
00180                                 outRangeFlag ++;
00181                                 m_BoxOffset[part][segment][layer][axis] = B_Z_MAX * MAX_FRACTION;
00182                         }
00183                         break;
00184                  default: ;
00185                 }
00186         }       
00187         else
00188         {
00189                 if( E_OFFSET_MAX[axis] - fabs(offset) >= 0.0 ) // |offset|<=B_Y_MAX
00190                         m_BoxOffset[part][segment][layer][axis] = offset;
00191                 else
00192                 {
00193                         outRangeFlag ++;
00194                         m_BoxOffset[part][segment][layer][axis] = E_OFFSET_MAX[axis] * MAX_FRACTION;
00195                 }
00196         }
00197         
00198         if( outRangeFlag > 0 )  return false;
00199         else                    return true;    
00200 }
00201 
00202 bool MucGeoMgr::CheckStripPlaneOffset( int part, int segment, int layer, int axis, double offset )
00203 {
00204         int outRangeFlag = 0;
00205 
00206         if( STR_OFFSET_MAX[axis] - fabs(offset) >= 0.0 ) // |offset|<=STR_OFFSET_MAX
00207                 m_StripPlaneOffset[part][segment][layer][axis] = offset;
00208         else
00209         {
00210                 outRangeFlag ++;
00211                 m_StripPlaneOffset[part][segment][layer][axis] = STR_OFFSET_MAX[axis] * MAX_FRACTION;
00212         }
00213 
00214         if( outRangeFlag > 0 )  return false;
00215         else                    return true;
00216 }
00217 
00218 
00219 //====================================== Geometry entities creating methods=============================================
00220 //
00221 //------------------------------------------Total data of all entities -------------------------------------------------
00222 StatusCode MucGeoMgr::CreateEntities()
00223 {
00224   MsgStream log(msgSvc, "MucGeoMgr");
00225 
00226         StatusCode sc;
00227 
00228         if( m_CreateFlag.size() < ENTITY_NUM )
00229         {
00230                 for( unsigned int i=m_CreateFlag.size(); i<ENTITY_NUM; i++ )
00231                         m_CreateFlag += '0';
00232         }
00233 
00234         int entity = 0;
00235         for( unsigned int i=0; i< ENTITY_NUM; i++ )
00236                 if( m_CreateFlag[i] == '1' ) entity++;
00237         log << MSG::INFO << entity << "\tentities should be created." << endreq << endreq;
00238 
00239         if( m_CreateFlag[0] == '1' )
00240         {
00241                 sc = CreateAbsorber();
00242                 if( sc == StatusCode::SUCCESS )
00243                         log << MSG::INFO << "Create absorber successfully!" << endreq << endreq;
00244                 else
00245                         log << MSG::INFO << "Create absorber failure!" << endreq << endreq;                     
00246         }
00247 
00248         if( m_CreateFlag[1] == '1' )
00249         {
00250                 sc = CreateGap();
00251                 if( sc == StatusCode::SUCCESS )
00252                         log << MSG::INFO << "Create gap successfully!" << endreq << endreq;
00253                 else
00254                         log << MSG::INFO << "Create gap failure!" << endreq << endreq;       
00255         }
00256 
00257         if( m_CreateFlag[2] == '1' )
00258         {
00259                 sc = CreateBox();
00260                 if( sc == StatusCode::SUCCESS )
00261                         log << MSG::INFO << "Create box successfully!" << endreq << endreq;
00262                 else
00263                         log << MSG::INFO << "Create box failure!" << endreq << endreq;       
00264         }
00265 
00266         if( m_CreateFlag[3] == '1' )
00267         {
00268                 sc = CreateStripPlane();
00269                 if( sc == StatusCode::SUCCESS )
00270                         log << MSG::INFO << "Create strip_plane successfully!" << endreq << endreq;
00271                 else
00272                         log << MSG::INFO << "Create strip_plane failure!" << endreq << endreq;       
00273         }
00274 
00275         if( m_CreateFlag[4] == '1' )
00276         {
00277                 sc = CreateStrip();
00278                 if( sc == StatusCode::SUCCESS )
00279                         log << MSG::INFO << "Create strip successfully!" << endreq << endreq;
00280                 else
00281                         log << MSG::INFO << "Create strip failure!" << endreq << endreq;       
00282         }
00283 
00284         if( m_CreateFlag[5] == '1' )
00285         {
00286                 sc = CreateRpc();
00287                 if( sc == StatusCode::SUCCESS )
00288                         log << MSG::INFO << "Create RPC successfully!" << endreq << endreq;
00289                 else
00290                         log << MSG::INFO << "Create RPC failure!" << endreq << endreq;       
00291         }
00292 
00293         if( m_CreateFlag[6] == '1' )
00294         {
00295                 sc = CreateGas();
00296                 if( sc == StatusCode::SUCCESS )
00297                         log << MSG::INFO << "Create gas mixture successfully!" << endreq << endreq;
00298                 else
00299                         log << MSG::INFO << "Create gas mixture failure!" << endreq << endreq;       
00300         }
00301 
00302         if( m_CreateFlag[7] == '1' )
00303         {
00304                 sc = CreateBakelite();
00305                 if( sc == StatusCode::SUCCESS )
00306                         log << MSG::INFO << "Create bakelite successfully!" << endreq << endreq;
00307                 else
00308                         log << MSG::INFO << "Create bakelite failure!" << endreq << endreq;       
00309         }
00310 
00311         if( m_CreateFlag[8] == '1' )
00312         {
00313                 sc = CreateBoxCover();
00314                 if( sc == StatusCode::SUCCESS )
00315                         log << MSG::INFO << "Create box cover successfully!" << endreq << endreq;
00316                 else
00317                         log << MSG::INFO << "Create box cover failure!" << endreq << endreq;       
00318         }
00319 
00320         
00321         return StatusCode::SUCCESS;
00322 }
00323 
00324 //------------------------------------ROOT geometry-----------------------------------------------
00325 StatusCode MucGeoMgr::CreateRootGeo()
00326 {
00327    MsgStream log(msgSvc, "MucGeoMgr");
00328         //StatusCode sc;
00329 
00330 
00331         return StatusCode::SUCCESS;
00332 }       
00333 
00334 
00335 //------------------------------------Strip geometry for online display----------------------------
00336 StatusCode MucGeoMgr::CreateOnlineStripGeo()
00337 {
00338         MsgStream log(msgSvc, "MucGeoMgr");
00339         //StatusCode sc;
00340 
00341   //-------------------------- ideal geometry----------------------
00342   ofstream fEast("EastEndStripGeo.dat", ios::out);
00343   ofstream fBarrel("BarrelStripGeo.dat", ios::out);     
00344   ofstream fWest("WestEndStripGeo.dat", ios::out);      
00345 
00346   if( fEast.bad() || fBarrel.bad() || fWest.bad() )
00347   {
00348         log << MSG::INFO << "Strip: create ouput file error!" << endl;
00349                 return StatusCode::FAILURE;
00350   }
00351   
00352         for( int i=0; i<PART_MAX; i++ )
00353   {
00354         if( i == BRID )
00355     {
00356         for( int j=0; j<B_SEG_NUM; j++ )
00357       {
00358         for( int k=0; k<B_LAY_NUM; k++ )
00359         {
00360                                 // Set maximum strip 
00361           int maxStrip;
00362           if( ( k+1 )%2 == 1 )
00363                 maxStrip = B_ZSTR_NUM;          // odd layer
00364           else if( j != B_TOP )
00365                 maxStrip = B_PHISTR_NUM;        // even layer not top segment
00366           else
00367                 maxStrip = B_TOPSTR_NUM;        // even layer top segment 
00368 
00369           for( int n=0; n<maxStrip; n++ )
00370           {
00371                 MucStrip *aMucStrip = new MucStrip( i, j, k, n );
00372                                                 
00373                                                 fBarrel << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00374                                                         << aMucStrip->GetType()-2                 << "\t"
00375                     << aMucStrip->GetL()                  <<"\t"
00376                                                         << aMucStrip->GetW()              << "\t"
00377                                                         << aMucStrip->GetH()              << "\t"
00378                     << aMucStrip->GetObjOrgInBes(1)   <<"\t"
00379                     << aMucStrip->GetObjOrgInBes(2)   <<"\t"
00380                     << aMucStrip->GetObjOrgInBes(3)   <<"\t"
00381                     << endl;
00382                                                 // delete aMucStrip;
00383           } // for
00384         } // layer
00385       } // segment
00386     } // barrel
00387     else if( i == EEID )
00388     {
00389         for( int j=0; j<E_SEG_NUM; j++ )
00390       {
00391         for( int k=0; k<E_LAY_NUM; k++ )
00392         {
00393                 for( int n=0; n<E_STR_NUM; n++ )
00394           {
00395                 MucStrip *aMucStrip = new MucStrip( i, j, k, n );
00396 
00397                   fEast << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00398                   << aMucStrip->GetType()         << "\t"
00399                   << aMucStrip->GetL()            <<"\t"
00400                   << aMucStrip->GetW()            <<"\t"
00401                   << aMucStrip->GetH()            <<"\t"
00402                   << aMucStrip->GetObjOrgInBes(1)   <<"\t"
00403                   << aMucStrip->GetObjOrgInBes(2)   <<"\t"
00404                   << aMucStrip->GetObjOrgInBes(3)   <<"\t"
00405                   << endl;
00406                                                 // delete aMucStrip;
00407           } // strip
00408         } // layer
00409       } // segment
00410     } // east endcap
00411                 else
00412                 {
00413                 for( int j=0; j<E_SEG_NUM; j++ )
00414       {
00415         for( int k=0; k<E_LAY_NUM; k++ )
00416         {
00417                 for( int n=0; n<E_STR_NUM; n++ )
00418           {
00419                 MucStrip *aMucStrip = new MucStrip( i, j, k, n );
00420 
00421                   fWest << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00422                   << aMucStrip->GetType()         << "\t"
00423                   << aMucStrip->GetL()            <<"\t"
00424                   << aMucStrip->GetW()            <<"\t"
00425                   << aMucStrip->GetH()            <<"\t"
00426                   << aMucStrip->GetObjOrgInBes(1)   <<"\t"
00427                   << aMucStrip->GetObjOrgInBes(2)   <<"\t"
00428                   << aMucStrip->GetObjOrgInBes(3)   <<"\t"
00429                   << endl;
00430                                                 // delete aMucStrip;
00431           } // strip
00432         } // layer
00433       } // segment
00434                 } // west endcap
00435 
00436   } // part
00437 
00438         fEast.close();
00439         fBarrel.close();        
00440         fWest.close();
00441 
00442         log << MSG::INFO << "Online display strips created." << endreq;
00443 
00444         return StatusCode::SUCCESS;
00445 }       
00446 
00447 
00449 //                                   Sub funtions                                            //
00451 //------------------MucAbsorber-------------
00452 // No alignment
00453 StatusCode MucGeoMgr::CreateAbsorber()
00454 {
00455   MsgStream log(msgSvc, "MucGeoMgr");
00456 
00457         ofstream fOrigin("MucAbsorberOrigin.dat", ios::out);
00458         ofstream fPanel("MucAbsorberPanel.dat", ios::out);
00459         ofstream fPos("MucAbsorberPanelPos.dat", ios::out);
00460         
00461         if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
00462         {
00463                 log << MSG::INFO << "Absorber: create ouput file error!" << endreq;
00464                 return StatusCode::FAILURE;
00465         }
00466         fOrigin << "part\tsegment\tlayer\tW\tH\tL\tBes_x\tBes_y\tBes_z\tRot_x\tRot_y\tRot_z" << endl;
00467         fPanel  << "part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;    
00468         fPos    << "part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
00469 
00470         int totalObject = 0;
00471 
00472         for( int i=0; i<PART_MAX; i++ )
00473         {
00474                 if( i == BRID )
00475                 {
00476                         for( int j=0; j<B_SEG_NUM; j++ )
00477                         {
00478                                 for( int k=0; k<B_LAY_NUM; k++ )
00479                                 {
00480                                         for( int n=0; n<B_AS_NUM; n++ )
00481                                         {
00482                                                 MucAbsorber *aMucAbsorber = new MucAbsorber( i, j, k, n );
00483                                                 fOrigin << i << "\t" << j << "\t" << k << "\t" 
00484                                                         << aMucAbsorber->GetW() <<"\t"
00485                                                         << aMucAbsorber->GetH() <<"\t"
00486                                                         << aMucAbsorber->GetL() <<"\t"                          
00487                                                         << aMucAbsorber->GetLocOrgInBes(1)   <<"\t"
00488                                                         << aMucAbsorber->GetLocOrgInBes(2)   <<"\t"
00489                                                         << aMucAbsorber->GetLocOrgInBes(3)   <<"\t"
00490                                                         << aMucAbsorber->GetObjRotToMot(1)   <<"\t"
00491                                                         << aMucAbsorber->GetObjRotToMot(2)   <<"\t"
00492                                                         << aMucAbsorber->GetObjRotToMot(3)   <<"\t"
00493                                                         << endl;
00494                                                 fPanel  <<  i << "\t" << j << "\t" << k << "\t" << n << "\t"
00495                                                         << aMucAbsorber->GetWu() <<"\t"
00496                                                         << aMucAbsorber->GetWd() <<"\t"
00497                                                         << aMucAbsorber->GetH()  <<"\t"
00498                                                         << aMucAbsorber->GetL()  <<"\t" 
00499                                                         << aMucAbsorber->GetObjOrgInLoc(1)   <<"\t"
00500                                                         << aMucAbsorber->GetObjOrgInLoc(2)   <<"\t"
00501                                                         << aMucAbsorber->GetObjOrgInLoc(3)   <<"\t"
00502                                                         << endl;
00503                                                 fPos    << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00504                                                         << aMucAbsorber->GetLocOrgInBes(1)   <<"\t"
00505                                                         << aMucAbsorber->GetLocOrgInBes(2)   <<"\t"
00506                                                         << aMucAbsorber->GetLocOrgInBes(3)   <<"\t"
00507                                                         << aMucAbsorber->GetObjOrgInBes(1)   <<"\t"
00508                                                         << aMucAbsorber->GetObjOrgInBes(2)   <<"\t"
00509                                                         << aMucAbsorber->GetObjOrgInBes(3)   <<"\t"
00510                                                         << aMucAbsorber->GetObjOrgInLoc(1)   <<"\t"
00511                                                         << aMucAbsorber->GetObjOrgInLoc(2)   <<"\t"
00512                                                         << aMucAbsorber->GetObjOrgInLoc(3)   <<"\t"
00513                                                         << endl;
00514 
00515                                                 totalObject++;
00516                                         //      delete aMucAbsorber;
00517                                         }
00518                                 } // layer
00519                         } // segment
00520                 } // barrel
00521                 else
00522                 {
00523                         for( int j=0; j<E_SEG_NUM; j++ )
00524                         {
00525                                 for( int k=0; k<E_ASLAY_NUM; k++ )
00526                                 {
00527                                         for( int n=-1; n<E_PANEL_NUM; n++ )
00528                                         {
00529                                                 MucAbsorber *aMucAbsorber = new MucAbsorber( i, j, k, n );
00530                                                 if( n == -1 )
00531                                                 {
00532                                                  fOrigin<< i << "\t" << j << "\t" << k << "\t"
00533                                                         << aMucAbsorber->GetW() <<"\t"
00534                                                         << aMucAbsorber->GetH() <<"\t"
00535                                                         << aMucAbsorber->GetL() <<"\t"
00536                                                         << aMucAbsorber->GetLocOrgInBes(1)   <<"\t"
00537                                                         << aMucAbsorber->GetLocOrgInBes(2)   <<"\t"
00538                                                         << aMucAbsorber->GetLocOrgInBes(3)   <<"\t"
00539                                                         << aMucAbsorber->GetObjRotToMot(1)   <<"\t"
00540                                                         << aMucAbsorber->GetObjRotToMot(2)   <<"\t"
00541                                                         << aMucAbsorber->GetObjRotToMot(3)   <<"\t"
00542                                                         << endl;
00543 
00544                                                         totalObject ++;
00545                                                         // delete aMucAbsorber;
00546                                                 }
00547                                                 else
00548                                                 {
00549                                                   fPanel<< i << "\t" << j << "\t" << k << "\t" << n << "\t"
00550                                                         << aMucAbsorber->GetWu() <<"\t"
00551                                                         << aMucAbsorber->GetWd() <<"\t"
00552                                                         << aMucAbsorber->GetH()  <<"\t"
00553                                                         << aMucAbsorber->GetL()  <<"\t"
00554                                                         << aMucAbsorber->GetObjOrgInLoc(1)   <<"\t"
00555                                                         << aMucAbsorber->GetObjOrgInLoc(2)   <<"\t"
00556                                                         << aMucAbsorber->GetObjOrgInLoc(3)   <<"\t"
00557                                                         << endl;
00558 
00559                                                 fPos    << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00560                                                         << aMucAbsorber->GetLocOrgInBes(1)   <<"\t"
00561                                                         << aMucAbsorber->GetLocOrgInBes(2)   <<"\t"
00562                                                         << aMucAbsorber->GetLocOrgInBes(3)   <<"\t"
00563                                                         << aMucAbsorber->GetObjOrgInBes(1)   <<"\t"
00564                                                         << aMucAbsorber->GetObjOrgInBes(2)   <<"\t"
00565                                                         << aMucAbsorber->GetObjOrgInBes(3)   <<"\t"
00566                                                         << aMucAbsorber->GetObjOrgInLoc(1)   <<"\t"
00567                                                         << aMucAbsorber->GetObjOrgInLoc(2)   <<"\t"
00568                                                         << aMucAbsorber->GetObjOrgInLoc(3)   <<"\t"
00569                                                         << endl;
00570                                                         // delete aMucAbsorber;
00571                                                 }
00572                                         }
00573                                 } // layer
00574                         } // segment
00575                 } // endcap
00576         } // for
00577         
00578         fOrigin.close();
00579         fPanel.close();
00580         fPos.close();
00581         
00582         log << MSG::INFO << totalObject << "\tabsorbers created." << endreq;
00583         
00584         return StatusCode::SUCCESS;
00585 } // MucAbsorber
00586 
00587 //------------------MucGap-------------
00588 // No alignment
00589 StatusCode MucGeoMgr::CreateGap()
00590 {
00591         MsgStream log(msgSvc, "MucGeoMgr");
00592 
00593         ofstream fOrigin("MucGapOrigin.dat", ios::out);
00594         ofstream fPanel("MucGapPanel.dat", ios::out);
00595         ofstream fPos("MucGapPanelPos.dat", ios::out);
00596 
00597         if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
00598         {
00599                 log << MSG::INFO << "Gap: create ouput file error!" << endreq;
00600                 return StatusCode::FAILURE;
00601         }
00602         fOrigin << "part\tsegment\tlayer\tW\tH\tL\tBes_x\tBes_y\tBes_z\tRot_x\tRot_y\tRot_z" << endl;
00603         fPanel  << "part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
00604         fPos    << "part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
00605 
00606         int totalObject = 0;
00607 
00608         for( int i=0; i<PART_MAX; i++ )
00609         {
00610                 if( i == BRID )
00611                 {
00612                         for( int j=0; j<B_SEG_NUM; j++ )
00613                         {
00614                                 // set panel number
00615                                 int idMin, idMax;
00616                                 if( j != B_TOP ) { idMin = 0; idMax = B_GP_NUM; }
00617                                 else             { idMin = -1; idMax = 3;       }
00618 
00619                                 for( int k=0; k<B_LAY_NUM; k++ )
00620                                 {
00621                                         for( int n=idMin; n<idMax; n++ )
00622                                         {
00623                                                 MucGap *aMucGap = new MucGap( i, j, k, n );
00624 
00625                                                 if( j == B_TOP && n != -1 ) // barrel top segment panels
00626                                                 {
00627                                                   fPanel<< i << "\t" << j << "\t" << k << "\t" << n << "\t"
00628                                                         << aMucGap->GetWu() <<"\t"
00629                                                         << aMucGap->GetWd() <<"\t"
00630                                                         << aMucGap->GetH()  <<"\t"
00631                                                         << aMucGap->GetL()  <<"\t"
00632                                                         << aMucGap->GetObjOrgInLoc(1)   <<"\t"
00633                                                         << aMucGap->GetObjOrgInLoc(2)   <<"\t"
00634                                                         << aMucGap->GetObjOrgInLoc(3)   <<"\t"
00635                                                         << endl;
00636                                                 }
00637 
00638                                                 if( j !=B_TOP || n == -1 )
00639                                                 {
00640                                                  fOrigin<< i << "\t" << j << "\t" << k << "\t"
00641                                                         << aMucGap->GetW() <<"\t"
00642                                                         << aMucGap->GetH() <<"\t"
00643                                                         << aMucGap->GetL() <<"\t"       
00644                                                         << aMucGap->GetLocOrgInBes(1)   <<"\t"
00645                                                         << aMucGap->GetLocOrgInBes(2)   <<"\t"
00646                                                         << aMucGap->GetLocOrgInBes(3)   <<"\t"
00647                                                         << aMucGap->GetObjRotToMot(1)   <<"\t"
00648                                                         << aMucGap->GetObjRotToMot(2)   <<"\t"
00649                                                         << aMucGap->GetObjRotToMot(3)   <<"\t"
00650                                                         << endl;
00651 
00652                                                  totalObject++;
00653                                                  // delete aMucGap;
00654                                                 }                                               
00655 
00656                                                 fPos    << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00657                                                         << aMucGap->GetLocOrgInBes(1)   <<"\t"
00658                                                         << aMucGap->GetLocOrgInBes(2)   <<"\t"
00659                                                         << aMucGap->GetLocOrgInBes(3)   <<"\t"
00660                                                         << aMucGap->GetObjOrgInBes(1)   <<"\t"
00661                                                         << aMucGap->GetObjOrgInBes(2)   <<"\t"
00662                                                         << aMucGap->GetObjOrgInBes(3)   <<"\t"
00663                                                         << aMucGap->GetObjOrgInLoc(1)   <<"\t"
00664                                                         << aMucGap->GetObjOrgInLoc(2)   <<"\t"
00665                                                         << aMucGap->GetObjOrgInLoc(3)   <<"\t"
00666                                                         << endl;
00667                                         }
00668                                 } // layer
00669                         } // segment
00670                 } // barrel
00671                 else
00672                 {
00673                         for( int j=0; j<E_SEG_NUM; j++ )
00674                         {
00675                                 for( int k=0; k<E_LAY_NUM; k++ )
00676                                 {
00677                                         for( int n=-1; n<E_PANEL_NUM; n++ )
00678                                         {
00679                                                 MucGap *aMucGap = new MucGap( i, j, k, n );
00680 
00681                                                 if( n == -1 )
00682                                                 {
00683                                                  fOrigin<< i << "\t" << j << "\t" << k << "\t"
00684                                                         << aMucGap->GetW() <<"\t"
00685                                                         << aMucGap->GetH() <<"\t"
00686                                                         << aMucGap->GetL() <<"\t"       
00687                                                         << aMucGap->GetLocOrgInBes(1)   <<"\t"
00688                                                         << aMucGap->GetLocOrgInBes(2)   <<"\t"
00689                                                         << aMucGap->GetLocOrgInBes(3)   <<"\t"
00690                                                         << aMucGap->GetObjRotToMot(1)   <<"\t"
00691                                                         << aMucGap->GetObjRotToMot(2)   <<"\t"
00692                                                         << aMucGap->GetObjRotToMot(3)   <<"\t"
00693                                                         << endl;
00694 
00695                                                  totalObject++;
00696                                                 }
00697                                                 else
00698                                                 {
00699                                                   fPanel<< i << "\t" << j << "\t" << k << "\t" << n << "\t"
00700                                                         << aMucGap->GetWu() <<"\t"
00701                                                         << aMucGap->GetWd() <<"\t"
00702                                                         << aMucGap->GetH()  <<"\t"
00703                                                         << aMucGap->GetL()  <<"\t"
00704                                                         << aMucGap->GetObjOrgInLoc(1)   <<"\t"
00705                                                         << aMucGap->GetObjOrgInLoc(2)   <<"\t"
00706                                                         << aMucGap->GetObjOrgInLoc(3)   <<"\t"
00707                                                         << endl;
00708 
00709                                                   fPos  << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00710                                                         << aMucGap->GetLocOrgInBes(1)   <<"\t"
00711                                                         << aMucGap->GetLocOrgInBes(2)   <<"\t"
00712                                                         << aMucGap->GetLocOrgInBes(3)   <<"\t"
00713                                                         << aMucGap->GetObjOrgInBes(1)   <<"\t"
00714                                                         << aMucGap->GetObjOrgInBes(2)   <<"\t"
00715                                                         << aMucGap->GetObjOrgInBes(3)   <<"\t"
00716                                                         << aMucGap->GetObjOrgInLoc(1)   <<"\t"
00717                                                         << aMucGap->GetObjOrgInLoc(2)   <<"\t"
00718                                                         << aMucGap->GetObjOrgInLoc(3)   <<"\t"
00719                                                         << endl;
00720                                                   // delete aMucGap;
00721                                                 }
00722                                         }
00723                                 } // layer
00724                         } // segment
00725                 } // endcap
00726         } // for
00727 
00728         fOrigin.close();
00729         fPanel.close();
00730         fPos.close();
00731 
00732         log << MSG::INFO << totalObject << "\tgaps created." << endreq;
00733 
00734         return StatusCode::SUCCESS;
00735 } // MucGap
00736 
00737 //------------------MucBox-------------
00738 // Alignment
00739 StatusCode MucGeoMgr::CreateBox()
00740 {
00741         MsgStream log(msgSvc, "MucGeoMgr");
00742 
00743         //-------------------------- ideal geometry----------------------
00744         ofstream fOrigin("MucBoxOrigin.dat", ios::out);
00745         ofstream fPanel("MucBoxPanel.dat", ios::out);
00746         ofstream fPos("MucBoxPanelPos.dat", ios::out);
00747 
00748         if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
00749         {
00750                 log << MSG::INFO << "Box: create ouput file error!" << endl;
00751                 return StatusCode::FAILURE;
00752         }
00753         fOrigin << "part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
00754         fPanel  << "part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
00755         fPos    << "part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
00756 
00757         int totalObject = 0;
00758         for( int i=0; i<PART_MAX; i++ )
00759         {
00760                 if( i == BRID )
00761                 {
00762                         for( int j=0; j<B_SEG_NUM; j++ )
00763                         {       
00764                                 // set panel number
00765                                 int idMin, idMax;
00766                                 if( j != B_TOP ) { idMin = 0; idMax = B_GP_NUM; }
00767                                 else             { idMin = -1; idMax = 3;       }
00768 
00769                                 for( int k=0; k<B_LAY_NUM; k++ )
00770                                 {
00771                                         for( int n=idMin; n<idMax; n++ )
00772                                         {
00773                                                 MucBox *aMucBox = new MucBox( i, j, k, n );
00774 
00775                                                 if( j == B_TOP && n != -1 ) // barrel top segment panels
00776                                                 {
00777                                                   fPanel<< i << "\t" << j << "\t" << k << "\t" << n << "\t"
00778                                                         << aMucBox->GetWu() <<"\t"
00779                                                         << aMucBox->GetWd() <<"\t"
00780                                                         << aMucBox->GetH()  <<"\t"
00781                                                         << aMucBox->GetL()  <<"\t"
00782                                                         << aMucBox->GetObjOrgInLoc(1)   <<"\t"
00783                                                         << aMucBox->GetObjOrgInLoc(2)   <<"\t"
00784                                                         << aMucBox->GetObjOrgInLoc(3)   <<"\t"
00785                                                         << endl;
00786                                                 }
00787                                                 
00788                                                 if( j !=B_TOP || n == -1 ) // box
00789                                                 {
00790                                                   fOrigin << i << "\t" << j << "\t" << k << "\t"
00791                                                         << aMucBox->GetW() <<"\t"
00792                                                         << aMucBox->GetH() <<"\t"
00793                                                         << aMucBox->GetL() <<"\t"
00794                                                         << aMucBox->GetObjOrgInLoc(1)   <<"\t"
00795                                                         << aMucBox->GetObjOrgInLoc(2)   <<"\t"
00796                                                         << aMucBox->GetObjOrgInLoc(3)   <<"\t"
00797                                                         << endl;
00798 
00799                                                   totalObject++;
00800                                                   // delete aMucBox;
00801                                                 }
00802 
00803                                                 fPos    << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00804                                                         << aMucBox->GetLocOrgInBes(1)   <<"\t"
00805                                                         << aMucBox->GetLocOrgInBes(2)   <<"\t"
00806                                                         << aMucBox->GetLocOrgInBes(3)   <<"\t"
00807                                                         << aMucBox->GetObjOrgInBes(1)   <<"\t"
00808                                                         << aMucBox->GetObjOrgInBes(2)   <<"\t"
00809                                                         << aMucBox->GetObjOrgInBes(3)   <<"\t"
00810                                                         << aMucBox->GetObjOrgInLoc(1)   <<"\t"
00811                                                         << aMucBox->GetObjOrgInLoc(2)   <<"\t"
00812                                                         << aMucBox->GetObjOrgInLoc(3)   <<"\t"
00813                                                         << endl;
00814                                                 // delete aMucBox;
00815                                         } // panel
00816                                 } // layer
00817                         } // segment
00818                 } // barrel
00819                 else
00820                 {
00821                         for( int j=0; j<E_SEG_NUM; j++ )
00822                         {
00823                                 for( int k=0; k<E_LAY_NUM; k++ )
00824                                 {
00825                                         for( int n=-1; n<E_PANEL_NUM; n++ )
00826                                         {
00827                                                 MucBox *aMucBox = new MucBox( i, j, k, n );
00828                                                 if( n == -1 )
00829                                                 {
00830                                                  fOrigin<< i << "\t" << j << "\t" << k << "\t"
00831                                                         << aMucBox->GetW() <<"\t"
00832                                                         << aMucBox->GetH() <<"\t"
00833                                                         << aMucBox->GetL() <<"\t"
00834                                                         << aMucBox->GetObjOrgInLoc(1)   <<"\t"
00835                                                         << aMucBox->GetObjOrgInLoc(2)   <<"\t"
00836                                                         << aMucBox->GetObjOrgInLoc(3)   <<"\t"
00837                                                         << endl;
00838 
00839                                                  totalObject++;
00840                                                  // delete aMucBox;
00841                                                 }
00842                                                 else
00843                                                 {
00844                                                   fPanel<< i << "\t" << j << "\t" << k << "\t" << n << "\t"
00845                                                         << aMucBox->GetWu() <<"\t"
00846                                                         << aMucBox->GetWd() <<"\t"
00847                                                         << aMucBox->GetH()  <<"\t"
00848                                                         << aMucBox->GetL()  <<"\t"
00849                                                         << aMucBox->GetObjOrgInLoc(1)   <<"\t"
00850                                                         << aMucBox->GetObjOrgInLoc(2)   <<"\t"
00851                                                         << aMucBox->GetObjOrgInLoc(3)   <<"\t"
00852                                                         << endl;
00853                                                   // delete aMucBox;
00854                                                 }
00855 
00856                                                   fPos  << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00857                                                         << aMucBox->GetLocOrgInBes(1)   <<"\t"
00858                                                         << aMucBox->GetLocOrgInBes(2)   <<"\t"
00859                                                         << aMucBox->GetLocOrgInBes(3)   <<"\t"
00860                                                         << aMucBox->GetObjOrgInBes(1)   <<"\t"
00861                                                         << aMucBox->GetObjOrgInBes(2)   <<"\t"
00862                                                         << aMucBox->GetObjOrgInBes(3)   <<"\t"
00863                                                         << aMucBox->GetObjOrgInLoc(1)   <<"\t"
00864                                                         << aMucBox->GetObjOrgInLoc(2)   <<"\t"
00865                                                         << aMucBox->GetObjOrgInLoc(3)   <<"\t"
00866                                                         << endl;
00867                                                   // delete aMucBox;
00868                                         }
00869                                 } // layer
00870                         } // segment
00871                 } // endcap
00872         } // for
00873 
00874         fOrigin.close();
00875         fPanel.close();
00876         fPos.close();
00877 
00878         //-----------------------------real geometry-------------------------
00879 
00880         if( m_AlignFlag )
00881         {
00882                 ofstream fOrgAlign("MucBoxOriginAligned.dat", ios::out);
00883                 fOrgAlign  << "part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
00884                 double offset[3];
00885                 for( int i=0; i<PART_MAX; i++ )
00886                 {
00887                         if( i == BRID )
00888                         {
00889                                 for( int j=0; j<B_SEG_NUM; j++ )
00890                                 {
00891                                         for( int k=0; k<B_LAY_NUM; k++ )
00892                                         {
00893                                                 MucBox *aMucBox = new MucBox( i, j, k, ((j==B_TOP)?-1:0) );
00894                                                 offset[0] =m_BoxOffset[i][j][k][0];
00895                                                 offset[1] =m_BoxOffset[i][j][k][1];
00896                                                 offset[2] =m_BoxOffset[i][j][k][2];
00897                                                 aMucBox->SetAlignment( offset[0], offset[1], offset[2] );
00898 
00899                                                 fOrgAlign << i << "\t" << j << "\t" << k << "\t"
00900                                                         << aMucBox->GetW() <<"\t"
00901                                                         << aMucBox->GetH() <<"\t"
00902                                                         << aMucBox->GetL() <<"\t"
00903                                                         << aMucBox->GetObjOrgInLoc(1)   <<"\t"
00904                                                         << aMucBox->GetObjOrgInLoc(2)   <<"\t"
00905                                                         << aMucBox->GetObjOrgInLoc(3)   <<"\t"
00906                                                         << endl;
00907                                                 // delete aMucBox;
00908                                         } // layer
00909                                 } // segment
00910                         } // barrel
00911                         else
00912                         {
00913                                 for( int j=0; j<E_SEG_NUM; j++ )
00914                                 {
00915                                         for( int k=0; k<E_LAY_NUM; k++ )
00916                                         {
00917                                                 MucBox *aMucBox = new MucBox( i, j, k, -1 );
00918                                                 offset[0] =m_BoxOffset[i][j][k][0];
00919                                                 offset[1] =m_BoxOffset[i][j][k][1];
00920                                                 offset[2] =m_BoxOffset[i][j][k][2];
00921                                                 aMucBox->SetAlignment( offset[0], offset[1], offset[2] );
00922                                                 
00923                                                  fOrgAlign<< i << "\t" << j << "\t" << k << "\t"
00924                                                         << aMucBox->GetW() <<"\t"
00925                                                         << aMucBox->GetH() <<"\t"
00926                                                         << aMucBox->GetL() <<"\t"
00927                                                         << aMucBox->GetObjOrgInLoc(1)   <<"\t"
00928                                                         << aMucBox->GetObjOrgInLoc(2)   <<"\t"
00929                                                         << aMucBox->GetObjOrgInLoc(3)   <<"\t"
00930                                                         << endl;
00931                                                 // delete aMucBox;
00932                                         } // layer
00933                                 } // segment
00934                         } // endcap
00935                 } // for
00936                 
00937                 fOrgAlign.close();
00938         } // if
00939 
00940 
00941         log << MSG::INFO << totalObject << "\tboxes created." << endreq;
00942 
00943         return StatusCode::SUCCESS;
00944 } // MucBox
00945 
00946 
00947 //------------------MucStripPlane-------------
00948 // Alignment
00949 StatusCode MucGeoMgr::CreateStripPlane()
00950 {
00951         MsgStream log(msgSvc, "MucGeoMgr");
00952 
00953         //-------------------------- ideal geometry----------------------
00954         ofstream fOrigin("MucStripPlaneOrigin.dat", ios::out);
00955         ofstream fPanel("MucStripPlanePanel.dat", ios::out);
00956         ofstream fPos("MucStripPlanePanelPos.dat", ios::out);
00957 
00958         if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
00959         {
00960                 log << MSG::INFO << "StripPlane: create ouput file error!" << endl;
00961                 return StatusCode::FAILURE;
00962         }
00963         fOrigin << "part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
00964         fPanel  << "part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
00965         fPos    << "part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
00966         
00967         int totalObject = 0;
00968 
00969         for( int i=0; i<PART_MAX; i++ )
00970         {
00971                 if( i == BRID )
00972                 {
00973                         for( int j=0; j<B_SEG_NUM; j++ )
00974                         {
00975                                 for( int k=0; k<B_LAY_NUM; k++ )
00976                                 {       
00977                                         if( j==B_TOP )
00978                                         {
00979                                            for( int n=-1; n<B_STR_PANEL_NUM; n++ )
00980                                            {       
00981                                                 MucStripPlane *aMucStripPlane = new MucStripPlane( i, j, k, n );
00982                                                 if( n == -1 )
00983                                                 {
00984                                                   fOrigin << i << "\t" << j << "\t" << k << "\t"
00985                                                         << aMucStripPlane->GetW() <<"\t"
00986                                                         << aMucStripPlane->GetH() <<"\t"
00987                                                         << aMucStripPlane->GetL() <<"\t"
00988                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
00989                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
00990                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
00991                                                         << endl;
00992                                                   fPos  << i << "\t" << j << "\t" << k << "\t" << n << "\t"
00993                                                         << aMucStripPlane->GetLocOrgInBes(1)   <<"\t"
00994                                                         << aMucStripPlane->GetLocOrgInBes(2)   <<"\t"
00995                                                         << aMucStripPlane->GetLocOrgInBes(3)   <<"\t"
00996                                                         << aMucStripPlane->GetObjOrgInBes(1)   <<"\t"
00997                                                         << aMucStripPlane->GetObjOrgInBes(2)   <<"\t"
00998                                                         << aMucStripPlane->GetObjOrgInBes(3)   <<"\t"
00999                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01000                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01001                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01002                                                         << endl;
01003                                                   totalObject++;
01004                                                   // delete aMucStripPlane;
01005                                                 }
01006                                                 else
01007                                                 {       
01008                                                   fPanel<< i << "\t" << j << "\t" << k << "\t" << n << "\t"
01009                                                         << aMucStripPlane->GetWu() <<"\t"
01010                                                         << aMucStripPlane->GetWd() <<"\t"
01011                                                         << aMucStripPlane->GetH()  <<"\t"
01012                                                         << aMucStripPlane->GetL()  <<"\t"
01013                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01014                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01015                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01016                                                         << endl;
01017 
01018                                                   fPos  << i << "\t" << j << "\t" << k << "\t" << n << "\t"
01019                                                         << aMucStripPlane->GetLocOrgInBes(1)   <<"\t"
01020                                                         << aMucStripPlane->GetLocOrgInBes(2)   <<"\t"
01021                                                         << aMucStripPlane->GetLocOrgInBes(3)   <<"\t"
01022                                                         << aMucStripPlane->GetObjOrgInBes(1)   <<"\t"
01023                                                         << aMucStripPlane->GetObjOrgInBes(2)   <<"\t"
01024                                                         << aMucStripPlane->GetObjOrgInBes(3)   <<"\t"
01025                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01026                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01027                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01028                                                         << endl;
01029                                                   // delete aMucStripPlane;     
01030                                                 }
01031                                            }// for      
01032                                         }// B_TOP
01033                                         else    
01034                                         {
01035                                                 MucStripPlane *aMucStripPlane = new MucStripPlane( i, j, k, 0 );
01036                                                 fOrigin << i << "\t" << j << "\t" << k << "\t"
01037                                                         << aMucStripPlane->GetW() <<"\t"
01038                                                         << aMucStripPlane->GetH() <<"\t"
01039                                                         << aMucStripPlane->GetL() <<"\t"
01040                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01041                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01042                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01043                                                         << endl;
01044                                                 fPos    << i << "\t" << j << "\t" << k << "\t" << "\t"
01045                                                         << aMucStripPlane->GetLocOrgInBes(1)   <<"\t"
01046                                                         << aMucStripPlane->GetLocOrgInBes(2)   <<"\t"
01047                                                         << aMucStripPlane->GetLocOrgInBes(3)   <<"\t"
01048                                                         << aMucStripPlane->GetObjOrgInBes(1)   <<"\t"
01049                                                         << aMucStripPlane->GetObjOrgInBes(2)   <<"\t"
01050                                                         << aMucStripPlane->GetObjOrgInBes(3)   <<"\t"
01051                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01052                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01053                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01054                                                         << endl;
01055                                                 totalObject++;
01056                                                 // delete aMucStripPlane;
01057                                         }
01058                                 } // layer
01059                         } // segment
01060                 } // barrel
01061                 else
01062                 {
01063                         for( int j=0; j<E_SEG_NUM; j++ )
01064                         {
01065                                 for( int k=0; k<E_LAY_NUM; k++ )
01066                                 {
01067                                         for( int n=-1; n<E_PANEL_NUM; n++ )
01068                                         {
01069                                                 MucStripPlane *aMucStripPlane = new MucStripPlane( i, j, k, n );
01070                                                 if( n == -1 )
01071                                                 {
01072                                                  fOrigin<< i << "\t" << j << "\t" << k << "\t"
01073                                                         << aMucStripPlane->GetW() <<"\t"
01074                                                         << aMucStripPlane->GetH() <<"\t"
01075                                                         << aMucStripPlane->GetL() <<"\t"
01076                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01077                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01078                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01079                                                         << endl;
01080 
01081                                                   fPos  << i << "\t" << j << "\t" << k << "\t" << n << "\t"
01082                                                         << aMucStripPlane->GetLocOrgInBes(1)   <<"\t"
01083                                                         << aMucStripPlane->GetLocOrgInBes(2)   <<"\t"
01084                                                         << aMucStripPlane->GetLocOrgInBes(3)   <<"\t"
01085                                                         << aMucStripPlane->GetObjOrgInBes(1)   <<"\t"
01086                                                         << aMucStripPlane->GetObjOrgInBes(2)   <<"\t"
01087                                                         << aMucStripPlane->GetObjOrgInBes(3)   <<"\t"
01088                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01089                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01090                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01091                                                         << endl;
01092                                                  totalObject++;
01093                                                  // delete aMucStripPlane;
01094                                                 }
01095                                                 else
01096                                                 {
01097                                                   fPanel<< i << "\t" << j << "\t" << k << "\t" << n << "\t"
01098                                                         << aMucStripPlane->GetWu() <<"\t"
01099                                                         << aMucStripPlane->GetWd() <<"\t"
01100                                                         << aMucStripPlane->GetH()  <<"\t"
01101                                                         << aMucStripPlane->GetL()  <<"\t"
01102                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01103                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01104                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01105                                                         << endl;
01106 
01107                                                   fPos  << i << "\t" << j << "\t" << k << "\t" << n << "\t"
01108                                                         << aMucStripPlane->GetLocOrgInBes(1)   <<"\t"
01109                                                         << aMucStripPlane->GetLocOrgInBes(2)   <<"\t"
01110                                                         << aMucStripPlane->GetLocOrgInBes(3)   <<"\t"
01111                                                         << aMucStripPlane->GetObjOrgInBes(1)   <<"\t"
01112                                                         << aMucStripPlane->GetObjOrgInBes(2)   <<"\t"
01113                                                         << aMucStripPlane->GetObjOrgInBes(3)   <<"\t"
01114                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01115                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01116                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01117                                                         << endl;
01118                                                   // delete aMucStripPlane;
01119                                                 }
01120                                         }
01121                                 } // layer
01122                         } // segment
01123                 } // endcap
01124         } // for
01125 
01126         fOrigin.close();
01127         fPanel.close();
01128         fPos.close();
01129 
01130         //-----------------------------real geometry-------------------------
01131 
01132         if( m_AlignFlag )
01133         {
01134                 ofstream fOrgAlign("MucStripPlaneOriginAligned.dat", ios::out);
01135                 fOrgAlign  << "part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
01136                 double offset[3]; 
01137                 for( int i=0; i<PART_MAX; i++ )
01138                 {
01139                         if( i == BRID )
01140                         {
01141                                 for( int j=0; j<B_SEG_NUM; j++ )
01142                                 {
01143                                         for( int k=0; k<B_LAY_NUM; k++ )
01144                                         {
01145                                                 MucStripPlane *aMucStripPlane = new MucStripPlane( i, j, k, 0 );
01146                                                 offset[0] =m_StripPlaneOffset[i][j][k][0];
01147                                                 offset[1] =m_StripPlaneOffset[i][j][k][1];
01148                                                 offset[2] =m_StripPlaneOffset[i][j][k][2];
01149                                                 aMucStripPlane->SetAlignment( offset[0], offset[1], offset[2] );
01150                                                 
01151                                                 fOrgAlign << i << "\t" << j << "\t" << k << "\t"
01152                                                         << aMucStripPlane->GetW() <<"\t"
01153                                                         << aMucStripPlane->GetH() <<"\t"
01154                                                         << aMucStripPlane->GetL() <<"\t"
01155                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01156                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01157                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01158                                                         << endl;
01159                                                 // delete aMucStripPlane;
01160                                         } // layer
01161                                 } // segment
01162                         } // barrel
01163                         else
01164                         {
01165                                 for( int j=0; j<E_SEG_NUM; j++ )
01166                                 {
01167                                         for( int k=0; k<E_LAY_NUM; k++ )
01168                                         {
01169                                                 MucStripPlane *aMucStripPlane = new MucStripPlane( i, j, k, -1 );
01170                                                 offset[0] =m_StripPlaneOffset[i][j][k][0];
01171                                                 offset[1] =m_StripPlaneOffset[i][j][k][1];
01172                                                 offset[2] =m_StripPlaneOffset[i][j][k][2];
01173                                                 aMucStripPlane->SetAlignment( offset[0], offset[1], offset[2] );
01174 
01175                                                  fOrgAlign<< i << "\t" << j << "\t" << k << "\t"
01176                                                         << aMucStripPlane->GetW() <<"\t"
01177                                                         << aMucStripPlane->GetH() <<"\t"
01178                                                         << aMucStripPlane->GetL() <<"\t"
01179                                                         << aMucStripPlane->GetObjOrgInLoc(1)   <<"\t"
01180                                                         << aMucStripPlane->GetObjOrgInLoc(2)   <<"\t"
01181                                                         << aMucStripPlane->GetObjOrgInLoc(3)   <<"\t"
01182                                                         << endl;
01183                                                 // delete aMucStripPlane;
01184                                         } // layer
01185                                 } // segment
01186                         } // endcap
01187                 } // for
01188 
01189                 fOrgAlign.close();
01190         } // if
01191         
01192 
01193         log << MSG::INFO << totalObject << "\tstrip_planes created." << endreq;
01194 
01195         return StatusCode::SUCCESS;
01196 
01197 } // MucStripPlane
01198 
01199 //------------------MucStrip------------------
01200 StatusCode MucGeoMgr::CreateStrip()
01201 {
01202         MsgStream log(msgSvc, "MucGeoMgr");
01203 
01204         //-------------------------- ideal geometry----------------------
01205         ofstream fOrigin("MucStrip.dat", ios::out);
01206         ofstream fPos("MucStripPos.dat", ios::out);     
01207 
01208         if( fOrigin.bad() || fPos.bad() )
01209         {
01210                 log << MSG::INFO << "Strip: create ouput file error!" << endl;
01211                 return StatusCode::FAILURE;
01212         }
01213         fOrigin << "part\tsegment\tlayer\tstrip\ttype\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
01214         fPos    << "part\tsegment\tlayer\tstrip\ttype\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
01215         
01216         int totalObject = 0;
01217         
01218         for( int i=0; i<PART_MAX; i++ )
01219         {
01220                 if( i == BRID )
01221                 {
01222                         for( int j=0; j<B_SEG_NUM; j++ )
01223                         {
01224                                 for( int k=0; k<B_LAY_NUM; k++ )
01225                                 {
01226                                         // Set maximum strip 
01227                                         int maxStrip;
01228                                         if( ( k+1 )%2 == 1 )
01229                                                 maxStrip = B_ZSTR_NUM;          // odd layer
01230                                         else if( j != B_TOP )
01231                                                 maxStrip = B_PHISTR_NUM;        // even layer not top segment
01232                                         else
01233                                                 maxStrip = B_TOPSTR_NUM;        // even layer top segment 
01234 
01235                                         for( int n=0; n<maxStrip; n++ )
01236                                         {
01237                                                 MucStrip *aMucStrip = new MucStrip( i, j, k, n );
01238 
01239                                                 fOrigin << i << "\t" << j << "\t" << k << "\t" << n << "\t"
01240                                                         << aMucStrip->GetType()           << "\t"
01241                                                         << aMucStrip->GetW()              << "\t"
01242                                                         << aMucStrip->GetH()              << "\t"
01243                                                         << aMucStrip->GetL()              <<"\t"
01244                                                         << aMucStrip->GetObjOrgInLoc(1)   <<"\t"
01245                                                         << aMucStrip->GetObjOrgInLoc(2)   <<"\t"
01246                                                         << aMucStrip->GetObjOrgInLoc(3)   <<"\t"
01247                                                         << aMucStrip->GetObjOrgInBes(1)   <<"\t"
01248                                                         << aMucStrip->GetObjOrgInBes(2)   <<"\t"
01249                                                         << aMucStrip->GetObjOrgInBes(3)   <<"\t"
01250                                                         << endl;
01251 
01252                                                 fPos    << i << "\t" << j << "\t" << k << "\t" << n << "\t"
01253                                                         << aMucStrip->GetType()           <<"\t"
01254                                                         << aMucStrip->GetLocOrgInBes(1)   <<"\t"
01255                                                         << aMucStrip->GetLocOrgInBes(2)   <<"\t"
01256                                                         << aMucStrip->GetLocOrgInBes(3)   <<"\t"
01257                                                         << aMucStrip->GetObjOrgInBes(1)   <<"\t"
01258                                                         << aMucStrip->GetObjOrgInBes(2)   <<"\t"
01259                                                         << aMucStrip->GetObjOrgInBes(3)   <<"\t"
01260                                                         << aMucStrip->GetObjOrgInLoc(1)   <<"\t"
01261                                                         << aMucStrip->GetObjOrgInLoc(2)   <<"\t"
01262                                                         << aMucStrip->GetObjOrgInLoc(3)   <<"\t"
01263                                                         << endl;
01264 
01265                                                 totalObject++;
01266                                                 // delete aMucStrip;
01267                                         } // for
01268                                 } // layer
01269                         } // segment
01270                 } // barrel
01271                 else
01272                 {
01273                         for( int j=0; j<E_SEG_NUM; j++ )
01274                         {
01275                                 for( int k=0; k<E_LAY_NUM; k++ )
01276                                 {
01277                                         for( int n=0; n<E_STR_NUM; n++ )
01278                                         {
01279                                                 MucStrip *aMucStrip = new MucStrip( i, j, k, n );
01280 
01281                                                 fOrigin << i << "\t" << j << "\t" << k << "\t" << n << "\t"
01282                                                         << aMucStrip->GetType()           << "\t"
01283                                                         << aMucStrip->GetW()              <<"\t"
01284                                                         << aMucStrip->GetH()              <<"\t"
01285                                                         << aMucStrip->GetL()              <<"\t"
01286                                                         << aMucStrip->GetObjOrgInLoc(1)   <<"\t"
01287                                                         << aMucStrip->GetObjOrgInLoc(2)   <<"\t"
01288                                                         << aMucStrip->GetObjOrgInLoc(3)   <<"\t"
01289                                                         << aMucStrip->GetObjOrgInBes(1)   <<"\t"
01290                                                         << aMucStrip->GetObjOrgInBes(2)   <<"\t"
01291                                                         << aMucStrip->GetObjOrgInBes(3)   <<"\t"
01292                                                         << endl;
01293 
01294                                                 fPos    << i << "\t" << j << "\t" << k << "\t" << n << "\t"
01295                                                         << aMucStrip->GetType()           << "\t"
01296                                                         << aMucStrip->GetLocOrgInBes(1)   <<"\t"
01297                                                         << aMucStrip->GetLocOrgInBes(2)   <<"\t"
01298                                                         << aMucStrip->GetLocOrgInBes(3)   <<"\t"
01299                                                         << aMucStrip->GetObjOrgInBes(1)   <<"\t"
01300                                                         << aMucStrip->GetObjOrgInBes(2)   <<"\t"
01301                                                         << aMucStrip->GetObjOrgInBes(3)   <<"\t"
01302                                                         << aMucStrip->GetObjOrgInLoc(1)   <<"\t"
01303                                                         << aMucStrip->GetObjOrgInLoc(2)   <<"\t"
01304                                                         << aMucStrip->GetObjOrgInLoc(3)   <<"\t"
01305                                                         << endl;
01306                                                 totalObject++;
01307                                                 // delete aMucStrip;
01308                                         } // for
01309                                 } // layer
01310                         } // segment
01311                 } // endcap
01312         } // for
01313 
01314         fOrigin.close();
01315         fPos.close();   
01316 
01317         log << MSG::INFO << totalObject << "\tstrips created." << endreq;
01318 
01319         return StatusCode::SUCCESS;
01320 
01321 } // MucStrip
01322 
01323 
01324 //------------------MucRpc--------------------
01325 StatusCode MucGeoMgr::CreateRpc()
01326 {
01327         MsgStream log(msgSvc, "MucGeoMgr");
01328 
01329         //-------------------------- ideal geometry----------------------
01330 
01331         ofstream fOrigin("MucRpc.dat", ios::out);
01332         ofstream fPos("MucRpcPos.dat", ios::out);
01333 
01334         if( fOrigin.bad() || fPos.bad() )
01335         {
01336                 log << MSG::INFO << "Rpc: create ouput file error!" << endl;
01337                 return StatusCode::FAILURE;
01338         }
01339         fOrigin << "part\tsegment\tlayer\tupDown\trpc\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
01340         fPos    << "part\tsegment\tlayer\tupDown\trpc\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
01341 
01342         int totalObject = 0;
01343 
01344         for( int i=0; i<PART_MAX; i++ )
01345         {
01346                 if( i == BRID )
01347                 {
01348                         for( int j=0; j<B_SEG_NUM; j++ )
01349                         {
01350                                 // Set maximum rpc
01351                                 int maxRpc;
01352                                 if( j ==B_TOP )
01353                                         maxRpc = B_TOP_RPC_NUM;    // top segment
01354                                 else
01355                                         maxRpc = B_RPC_NUM;        // not top segment
01356 
01357                                 for( int k=0; k<B_LAY_NUM; k++ )
01358                                 {
01359                                         for( int m=0; m<SL_NUM; m++ )
01360                                         {
01361                                                 for( int n=0; n<maxRpc; n++ )
01362                                                 {
01363                                                         MucRpc *aMucRpc = new MucRpc( i, j, k, m, n );
01364 
01365                                                 fOrigin << i << "\t" << j << "\t" << k << "\t"
01366                                                         << m << "\t" << n << "\t"
01367                                                         << aMucRpc->GetWu()             << "\t"
01368                                                         << aMucRpc->GetWd()             << "\t"
01369                                                         << aMucRpc->GetH()              << "\t"
01370                                                         << aMucRpc->GetL()              <<"\t"
01371                                                         << aMucRpc->GetObjOrgInLoc(1)   <<"\t"
01372                                                         << aMucRpc->GetObjOrgInLoc(2)   <<"\t"
01373                                                         << aMucRpc->GetObjOrgInLoc(3)   <<"\t"
01374                                                         << aMucRpc->GetObjOrgInBes(1)   <<"\t"
01375                                                         << aMucRpc->GetObjOrgInBes(2)   <<"\t"
01376                                                         << aMucRpc->GetObjOrgInBes(3)   <<"\t"
01377                                                         << endl;
01378 
01379                                                 fPos    << i << "\t" << j << "\t" << k << "\t" 
01380                                                         << m << "\t" << n << "\t"
01381                                                         << aMucRpc->GetLocOrgInBes(1)   <<"\t"
01382                                                         << aMucRpc->GetLocOrgInBes(2)   <<"\t"
01383                                                         << aMucRpc->GetLocOrgInBes(3)   <<"\t"
01384                                                         << aMucRpc->GetObjOrgInBes(1)   <<"\t"
01385                                                         << aMucRpc->GetObjOrgInBes(2)   <<"\t"
01386                                                         << aMucRpc->GetObjOrgInBes(3)   <<"\t"
01387                                                         << aMucRpc->GetObjOrgInLoc(1)   <<"\t"
01388                                                         << aMucRpc->GetObjOrgInLoc(2)   <<"\t"
01389                                                         << aMucRpc->GetObjOrgInLoc(3)   <<"\t"
01390                                                         << endl;
01391 
01392                                                 totalObject++;
01393                                                 // delete aMucRpc;
01394                                                 } // for
01395                                         } // super layer
01396                                 } // layer
01397                         } // segment
01398                 } // barrel
01399                 else
01400                 {
01401                         for( int j=0; j<E_SEG_NUM; j++ )
01402                         {
01403                                 for( int k=0; k<E_LAY_NUM; k++ )
01404                                 {
01405                                         for( int m=0; m<SL_NUM; m++ )
01406                                         {
01407                                                 for( int n=0; n<E_RPC_NUM[m]; n++ )
01408                                                 {
01409                                                         MucRpc *aMucRpc = new MucRpc( i, j, k, m, n );
01410 
01411                                                 fOrigin << i << "\t" << j << "\t" << k << "\t"
01412                                                         << m << "\t" << n << "\t"
01413                                                         << aMucRpc->GetWu()              <<"\t"
01414                                                         << aMucRpc->GetWd()              <<"\t"
01415                                                         << aMucRpc->GetH()              <<"\t"
01416                                                         << aMucRpc->GetL()              <<"\t"
01417                                                         << aMucRpc->GetObjOrgInLoc(1)   <<"\t"
01418                                                         << aMucRpc->GetObjOrgInLoc(2)   <<"\t"
01419                                                         << aMucRpc->GetObjOrgInLoc(3)   <<"\t"
01420                                                         << aMucRpc->GetObjOrgInBes(1)   <<"\t"
01421                                                         << aMucRpc->GetObjOrgInBes(2)   <<"\t"
01422                                                         << aMucRpc->GetObjOrgInBes(3)   <<"\t"
01423                                                         << endl;
01424 
01425                                                 fPos    << i << "\t" << j << "\t" << k << "\t"
01426                                                         << m << "\t" << n << "\t"
01427                                                         << aMucRpc->GetLocOrgInBes(1)   <<"\t"
01428                                                         << aMucRpc->GetLocOrgInBes(2)   <<"\t"
01429                                                         << aMucRpc->GetLocOrgInBes(3)   <<"\t"
01430                                                         << aMucRpc->GetObjOrgInBes(1)   <<"\t"
01431                                                         << aMucRpc->GetObjOrgInBes(2)   <<"\t"
01432                                                         << aMucRpc->GetObjOrgInBes(3)   <<"\t"
01433                                                         << aMucRpc->GetObjOrgInLoc(1)   <<"\t"
01434                                                         << aMucRpc->GetObjOrgInLoc(2)   <<"\t"
01435                                                         << aMucRpc->GetObjOrgInLoc(3)   <<"\t"
01436                                                         << endl;
01437                                                 totalObject++;
01438                                                 // delete aMucRpc;
01439                                                 } // for
01440                                         } // super layer
01441                                 } // layer
01442                         } // segment
01443                 } // endcap
01444         } // for, part
01445 
01446         fOrigin.close();
01447         fPos.close();
01448 
01449         log << MSG::INFO << totalObject << "\t RPCs created." << endreq;
01450 
01451         return StatusCode::SUCCESS;
01452 
01453 } // MucRpc
01454 
01455 //------------------MucGas--------------------
01456 StatusCode MucGeoMgr::CreateGas()
01457 {
01458         MsgStream log(msgSvc, "MucGeoMgr");
01459 
01460         //-------------------------- ideal geometry----------------------
01461 
01462         ofstream fOrigin("MucGas.dat", ios::out);
01463         ofstream fPos("MucGasPos.dat", ios::out);
01464 
01465         if( fOrigin.bad() || fPos.bad() )
01466         {
01467                 log << MSG::INFO << "Gas: create ouput file error!" << endl;
01468                 return StatusCode::FAILURE;
01469         }
01470         fOrigin << "part\tsegment\tlayer\tupDown\tgas\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
01471         fPos    << "part\tsegment\tlayer\tupDown\tgas\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
01472 
01473         int totalObject = 0;
01474 
01475         for( int i=0; i<PART_MAX; i++ )
01476         {
01477                 if( i == BRID )
01478                 {
01479                         for( int j=0; j<B_SEG_NUM; j++ )
01480                         {
01481                                 // Set maximum gas
01482                                 int maxRpc;
01483                                 if( j ==B_TOP )
01484                                         maxRpc = B_TOP_RPC_NUM;    // top segment
01485                                 else
01486                                         maxRpc = B_RPC_NUM;        // not top segment
01487 
01488                                 for( int k=0; k<B_LAY_NUM; k++ )
01489                                 {
01490                                         for( int m=0; m<SL_NUM; m++ )
01491                                         {
01492                                                 for( int n=0; n<maxRpc; n++ )
01493                                                 {
01494                                                         MucGas *aMucGas = new MucGas( i, j, k, m, n, 0);
01495 
01496                                                 fOrigin << i << "\t" << j << "\t" << k << "\t"
01497                                                         << m << "\t" << n << "\t"
01498                                                         << aMucGas->GetWu()             <<"\t"
01499                                                         << aMucGas->GetWd()             <<"\t"
01500                                                         << aMucGas->GetH()              <<"\t"
01501                                                         << aMucGas->GetL()              <<"\t"
01502                                                         << aMucGas->GetObjOrgInLoc(1)   <<"\t"
01503                                                         << aMucGas->GetObjOrgInLoc(2)   <<"\t"
01504                                                         << aMucGas->GetObjOrgInLoc(3)   <<"\t"
01505                                                         << aMucGas->GetObjOrgInBes(1)   <<"\t"
01506                                                         << aMucGas->GetObjOrgInBes(2)   <<"\t"
01507                                                         << aMucGas->GetObjOrgInBes(3)   <<"\t"
01508                                                         << endl;
01509 
01510                                                 fPos    << i << "\t" << j << "\t" << k << "\t" << n << "\t"
01511                                                         << aMucGas->GetLocOrgInBes(1)   <<"\t"
01512                                                         << aMucGas->GetLocOrgInBes(2)   <<"\t"
01513                                                         << aMucGas->GetLocOrgInBes(3)   <<"\t"
01514                                                         << aMucGas->GetObjOrgInBes(1)   <<"\t"
01515                                                         << aMucGas->GetObjOrgInBes(2)   <<"\t"
01516                                                         << aMucGas->GetObjOrgInBes(3)   <<"\t"
01517                                                         << aMucGas->GetObjOrgInLoc(1)   <<"\t"
01518                                                         << aMucGas->GetObjOrgInLoc(2)   <<"\t"
01519                                                         << aMucGas->GetObjOrgInLoc(3)   <<"\t"
01520                                                         << endl;
01521 
01522                                                 totalObject++;
01523                                                 // delete aMucGas;
01524                                                 } // for
01525                                         } // super layer
01526                                 } // layer
01527                         } // segment
01528                 } // barrel
01529                 else
01530                 {
01531                         for( int j=0; j<E_SEG_NUM; j++ )
01532                         {
01533                                 for( int k=0; k<E_LAY_NUM; k++ )
01534                                 {
01535                                         for( int m=0; m<SL_NUM; m++ )
01536                                         {
01537                                                 for( int n=0; n<E_RPC_NUM[m]; n++ )
01538                                                 {
01539                                                         MucGas *aMucGas = new MucGas( i, j, k, m, n, 0 );
01540 
01541                                                 fOrigin << i << "\t" << j << "\t" << k << "\t"
01542                                                         << m << "\t" << n << "\t"
01543                                                         << aMucGas->GetWu()              <<"\t"
01544                                                         << aMucGas->GetWd()              <<"\t"
01545                                                         << aMucGas->GetH()              <<"\t"
01546                                                         << aMucGas->GetL()              <<"\t"
01547                                                         << aMucGas->GetObjOrgInLoc(1)   <<"\t"
01548                                                         << aMucGas->GetObjOrgInLoc(2)   <<"\t"
01549                                                         << aMucGas->GetObjOrgInLoc(3)   <<"\t"
01550                                                         << aMucGas->GetObjOrgInBes(1)   <<"\t"
01551                                                         << aMucGas->GetObjOrgInBes(2)   <<"\t"
01552                                                         << aMucGas->GetObjOrgInBes(3)   <<"\t"
01553                                                         << endl;
01554 
01555                                                 fPos    << i << "\t" << j << "\t" << k << "\t"
01556                                                         << m << "\t" << n << "\t"
01557                                                         << aMucGas->GetLocOrgInBes(1)   <<"\t"
01558                                                         << aMucGas->GetLocOrgInBes(2)   <<"\t"
01559                                                         << aMucGas->GetLocOrgInBes(3)   <<"\t"
01560                                                         << aMucGas->GetObjOrgInBes(1)   <<"\t"
01561                                                         << aMucGas->GetObjOrgInBes(2)   <<"\t"
01562                                                         << aMucGas->GetObjOrgInBes(3)   <<"\t"
01563                                                         << aMucGas->GetObjOrgInLoc(1)   <<"\t"
01564                                                         << aMucGas->GetObjOrgInLoc(2)   <<"\t"
01565                                                         << aMucGas->GetObjOrgInLoc(3)   <<"\t"
01566                                                         << endl;
01567                                                 totalObject++;
01568                                                 // delete aMucGas;
01569                                                 } // for
01570                                         } // super layer
01571                                 } // layer
01572                         } // segment
01573                 } // endcap
01574         } // for, part
01575 
01576         fOrigin.close();
01577         fPos.close();
01578 
01579         log << MSG::INFO << totalObject << "\tgases created." << endreq;
01580 
01581         return StatusCode::SUCCESS;
01582 
01583 } // MucGas
01584 
01585 //------------------MucBakelite---------------
01586 StatusCode MucGeoMgr::CreateBakelite()
01587 {
01588         MsgStream log(msgSvc, "MucGeoMgr");
01589 
01590         //-------------------------- ideal geometry----------------------
01591 
01592         ofstream fOrigin("MucBakelite.dat", ios::out);
01593         ofstream fPos("MucBakelitePos.dat", ios::out);
01594 
01595         if( fOrigin.bad() || fPos.bad() )
01596         {
01597                 log << MSG::INFO << "Bakelite: create ouput file error!" << endl;
01598                 return StatusCode::FAILURE;
01599         }
01600         fOrigin << "part\tsegment\tlayer\tupDown\trpcId\tBKLT\t"
01601                 << "Wu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
01602         fPos    << "part\tsegment\tlayer\tupDown\trpcId\tBKLT\t"
01603                 << "LBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
01604 
01605         int totalObject = 0;
01606 
01607         for( int i=0; i<PART_MAX; i++ )
01608         {
01609                 if( i == BRID )
01610                 {
01611                         for( int j=0; j<B_SEG_NUM; j++ )
01612                         {
01613                                 // Set maximum rpc number
01614                                 int maxRpc;
01615                                 if( j ==B_TOP )
01616                                         maxRpc = B_TOP_RPC_NUM;    // top segment
01617                                 else
01618                                         maxRpc = B_RPC_NUM;        // not top segment
01619 
01620                                 for( int k=0; k<B_LAY_NUM; k++ )
01621                                 {
01622                                         for( int m=0; m<SL_NUM; m++ )
01623                                         {
01624                                                 for( int n=0; n<maxRpc; n++ )
01625                                                 {
01626                                                         for( int t=0; t<BKLT_NUM; t++)
01627                                                         {
01628                                                          MucBakelite *aMucBakelite = new MucBakelite( i, j, k, m, n, t );
01629 
01630                                                          fOrigin<< i << "\t" << j << "\t" << k << "\t"
01631                                                                 << m << "\t" << n << "\t" << t << "\t"
01632                                                                 << aMucBakelite->GetWu()             <<"\t"
01633                                                                 << aMucBakelite->GetWd()             <<"\t"
01634                                                                 << aMucBakelite->GetH()              <<"\t"
01635                                                                 << aMucBakelite->GetL()              <<"\t"
01636                                                                 << aMucBakelite->GetObjOrgInLoc(1)   <<"\t"
01637                                                                 << aMucBakelite->GetObjOrgInLoc(2)   <<"\t"
01638                                                                 << aMucBakelite->GetObjOrgInLoc(3)   <<"\t"
01639                                                                 << aMucBakelite->GetObjOrgInBes(1)   <<"\t"
01640                                                                 << aMucBakelite->GetObjOrgInBes(2)   <<"\t"
01641                                                                 << aMucBakelite->GetObjOrgInBes(3)   <<"\t"
01642                                                                 << endl;
01643 
01644                                                          fPos   << i << "\t" << j << "\t" << k << "\t"
01645                                                                 << m << "\t" << n << "\t" << t << "\t"
01646                                                                 << aMucBakelite->GetLocOrgInBes(1)   <<"\t"
01647                                                                 << aMucBakelite->GetLocOrgInBes(2)   <<"\t"
01648                                                                 << aMucBakelite->GetLocOrgInBes(3)   <<"\t"
01649                                                                 << aMucBakelite->GetObjOrgInBes(1)   <<"\t"
01650                                                                 << aMucBakelite->GetObjOrgInBes(2)   <<"\t"
01651                                                                 << aMucBakelite->GetObjOrgInBes(3)   <<"\t"
01652                                                                 << aMucBakelite->GetObjOrgInLoc(1)   <<"\t"
01653                                                                 << aMucBakelite->GetObjOrgInLoc(2)   <<"\t"
01654                                                                 << aMucBakelite->GetObjOrgInLoc(3)   <<"\t"
01655                                                                 << endl;
01656 
01657                                                          totalObject++;
01658                                                          // delete aMucBakelite;        
01659                                                         } // bakelite
01660                                                 } // rpc
01661                                         } // super layer
01662                                 } // layer
01663                         } // segment
01664                 } // barrel
01665                 else
01666                 {
01667                         for( int j=0; j<E_SEG_NUM; j++ )
01668                         {
01669                                 for( int k=0; k<E_LAY_NUM; k++ )
01670                                 {
01671                                         for( int m=0; m<SL_NUM; m++ )
01672                                         {
01673                                                 for( int n=0; n<E_RPC_NUM[m]; n++ )
01674                                                 {
01675                                                         for( int t=0; t<BKLT_NUM; t++ )
01676                                                         {
01677                                                          MucBakelite *aMucBakelite = new MucBakelite( i, j, k, m, n, t );
01678 
01679                                                          fOrigin<< i << "\t" << j << "\t" << k << "\t"
01680                                                                 << m << "\t" << n << "\t" << t << "\t"
01681                                                                 << aMucBakelite->GetWu()             <<"\t"
01682                                                                 << aMucBakelite->GetWd()             <<"\t"
01683                                                                 << aMucBakelite->GetH()              <<"\t"
01684                                                                 << aMucBakelite->GetL()              <<"\t"
01685                                                                 << aMucBakelite->GetObjOrgInLoc(1)   <<"\t"
01686                                                                 << aMucBakelite->GetObjOrgInLoc(2)   <<"\t"
01687                                                                 << aMucBakelite->GetObjOrgInLoc(3)   <<"\t"
01688                                                                 << aMucBakelite->GetObjOrgInBes(1)   <<"\t"
01689                                                                 << aMucBakelite->GetObjOrgInBes(2)   <<"\t"
01690                                                                 << aMucBakelite->GetObjOrgInBes(3)   <<"\t"
01691                                                                 << endl;
01692 
01693                                                          fPos   << i << "\t" << j << "\t" << k << "\t"
01694                                                                 << m << "\t" << n << "\t" << t << "\t"
01695                                                                 << aMucBakelite->GetLocOrgInBes(1)   <<"\t"
01696                                                                 << aMucBakelite->GetLocOrgInBes(2)   <<"\t"
01697                                                                 << aMucBakelite->GetLocOrgInBes(3)   <<"\t"
01698                                                                 << aMucBakelite->GetObjOrgInBes(1)   <<"\t"
01699                                                                 << aMucBakelite->GetObjOrgInBes(2)   <<"\t"
01700                                                                 << aMucBakelite->GetObjOrgInBes(3)   <<"\t"
01701                                                                 << aMucBakelite->GetObjOrgInLoc(1)   <<"\t"
01702                                                                 << aMucBakelite->GetObjOrgInLoc(2)   <<"\t"
01703                                                                 << aMucBakelite->GetObjOrgInLoc(3)   <<"\t"
01704                                                                 << endl;
01705 
01706                                                          totalObject++;
01707                                                          // delete aMucBakelite;
01708                                                         } // bakelite
01709                                                 } // rpc
01710                                         } // super layer
01711                                 } // layer
01712                         } // segment
01713                 } // endcap
01714         } // for, part
01715 
01716         fOrigin.close();
01717         fPos.close();
01718 
01719         log << MSG::INFO << totalObject << "\tbakelites created." << endreq;
01720 
01721         return StatusCode::SUCCESS;
01722 
01723 } // MucBakelite
01724 
01725 //------------------MucBoxCover---------------
01726 StatusCode MucGeoMgr::CreateBoxCover()
01727 {
01728         MsgStream log(msgSvc, "MucGeoMgr");
01729 
01730         //-------------------------- ideal geometry----------------------
01731         ofstream fOrigin("MucBoxCoverOrigin.dat", ios::out);
01732         ofstream fPanel("MucBoxCoverPanel.dat", ios::out);
01733         ofstream fPos("MucBoxCoverPanelPos.dat", ios::out);
01734 
01735         if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
01736         {
01737                 log << MSG::INFO << "BoxCover: create ouput file error!" << endl;
01738                 return StatusCode::FAILURE;
01739         }
01740         fOrigin << "part\tsegment\tlayer\tU/D\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
01741         fPanel  << "part\tsegment\tlayer\tU/D\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
01742         fPos    << "part\tsegment\tlayer\tU/D\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
01743 
01744         int totalObject = 0;
01745 
01746         for( int i=0; i<PART_MAX; i++ )
01747         {
01748                 if( i == BRID )
01749                 {
01750                         for( int j=0; j<B_SEG_NUM; j++ )
01751                         {
01752                                 // set panel number
01753                                 int idMin, idMax;
01754                                 if( j != B_TOP ) { idMin = 0; idMax = B_GP_NUM; }
01755                                 else             { idMin = -1; idMax = 3;       }
01756                                 
01757                                 for( int k=0; k<B_LAY_NUM; k++ )
01758                                 {
01759                                         for( int m=0; m<SL_NUM; m++ )
01760                                         {       
01761                                                 for( int n = idMin; n<idMax; n++ )
01762                                                 {
01763                                                         MucBoxCover *aMucBoxCover = new MucBoxCover( i, j, k, m, n );
01764                                                         if( j == B_TOP || n != -1 ) // barrel top segment panels
01765                                                         {
01766                                                           fPanel << i << "\t" << j << "\t" << k << "\t"
01767                                                                 << m << "\t" << n << "\t"
01768                                                                 << aMucBoxCover->GetW() <<"\t"
01769                                                                 << aMucBoxCover->GetW() <<"\t"
01770                                                                 << aMucBoxCover->GetH() <<"\t"
01771                                                                 << aMucBoxCover->GetL() <<"\t"
01772                                                                 << aMucBoxCover->GetObjOrgInLoc(1)   <<"\t"
01773                                                                 << aMucBoxCover->GetObjOrgInLoc(2)   <<"\t"
01774                                                                 << aMucBoxCover->GetObjOrgInLoc(3)   <<"\t"
01775                                                                 << endl;
01776                                                                 // delete aMucBoxCover;
01777                                                          }
01778 
01779                                                          if( j != B_TOP || n == -1 ) // box cover
01780                                                          {
01781                                                           fOrigin << i << "\t" << j << "\t" << k << "\t" 
01782                                                                 << m << "\t"  
01783                                                                 << aMucBoxCover->GetW() <<"\t"
01784                                                                 << aMucBoxCover->GetH() <<"\t"
01785                                                                 << aMucBoxCover->GetL() <<"\t"
01786                                                                 << aMucBoxCover->GetObjOrgInLoc(1)   <<"\t"
01787                                                                 << aMucBoxCover->GetObjOrgInLoc(2)   <<"\t"
01788                                                                 << aMucBoxCover->GetObjOrgInLoc(3)   <<"\t"
01789                                                                 << endl;
01790         
01791                                                                 totalObject++;
01792                                                                 // delete aMucBoxCover;
01793                                                          }
01794 
01795                                                         fPos << i << "\t" << j << "\t" << k << "\t" 
01796                                                                 << m << "\t" << n << "\t"
01797                                                                 << aMucBoxCover->GetLocOrgInBes(1)   <<"\t"
01798                                                                 << aMucBoxCover->GetLocOrgInBes(2)   <<"\t"
01799                                                                 << aMucBoxCover->GetLocOrgInBes(3)   <<"\t"
01800                                                                 << aMucBoxCover->GetObjOrgInBes(1)   <<"\t"
01801                                                                 << aMucBoxCover->GetObjOrgInBes(2)   <<"\t"
01802                                                                 << aMucBoxCover->GetObjOrgInBes(3)   <<"\t"
01803                                                                 << aMucBoxCover->GetObjOrgInLoc(1)   <<"\t"
01804                                                                 << aMucBoxCover->GetObjOrgInLoc(2)   <<"\t"
01805                                                                 << aMucBoxCover->GetObjOrgInLoc(3)   <<"\t"
01806                                                                 << endl;
01807                                                                 // delete aMucBoxCover;
01808                                                 } // panel
01809                                         }// super layer
01810                                 } // layer
01811                         } // segment
01812                 } // barrel
01813                 else
01814                 {
01815                         for( int j=0; j<E_SEG_NUM; j++ )
01816                         {
01817                                 for( int k=0; k<E_LAY_NUM; k++ )
01818                                 {
01819                                         for( int m=0; m<SL_NUM; m++ )
01820                                         {
01821                                                 for( int n=-1; n<E_PANEL_NUM; n++ )
01822                                                 {
01823                                                         MucBoxCover *aMucBoxCover = new MucBoxCover( i, j, k, m, n );
01824                                                         if( n == -1 )
01825                                                         {
01826                                                          fOrigin<< i << "\t" << j << "\t" << k << "\t" 
01827                                                                 << m << "\t" 
01828                                                                 << aMucBoxCover->GetW() <<"\t"
01829                                                                 << aMucBoxCover->GetH() <<"\t"
01830                                                                 << aMucBoxCover->GetL() <<"\t"
01831                                                                 << aMucBoxCover->GetObjOrgInLoc(1)   <<"\t"
01832                                                                 << aMucBoxCover->GetObjOrgInLoc(2)   <<"\t"
01833                                                                 << aMucBoxCover->GetObjOrgInLoc(3)   <<"\t"
01834                                                                 << endl;
01835                                                          totalObject++;
01836                                                          // delete aMucBoxCover;
01837                                                         }
01838                                                         else
01839                                                         {
01840                                                           fPanel<< i << "\t" << j << "\t" << k << "\t" 
01841                                                                 << m << "\t" << n << "\t"
01842                                                                 << aMucBoxCover->GetWu() <<"\t"
01843                                                                 << aMucBoxCover->GetWd() <<"\t"
01844                                                                 << aMucBoxCover->GetH()  <<"\t"
01845                                                                 << aMucBoxCover->GetL()  <<"\t"
01846                                                                 << aMucBoxCover->GetObjOrgInLoc(1)   <<"\t"
01847                                                                 << aMucBoxCover->GetObjOrgInLoc(2)   <<"\t"
01848                                                                 << aMucBoxCover->GetObjOrgInLoc(3)   <<"\t"
01849                                                                 << endl;
01850                                                          // delete aMucBoxCover;
01851                                                         }
01852 
01853                                                           fPos  << i << "\t" << j << "\t" << k << "\t" 
01854                                                                 << m << "\t" << n << "\t"
01855                                                                 << aMucBoxCover->GetLocOrgInBes(1)   <<"\t"
01856                                                                 << aMucBoxCover->GetLocOrgInBes(2)   <<"\t"
01857                                                                 << aMucBoxCover->GetLocOrgInBes(3)   <<"\t"
01858                                                                 << aMucBoxCover->GetObjOrgInBes(1)   <<"\t"
01859                                                                 << aMucBoxCover->GetObjOrgInBes(2)   <<"\t"
01860                                                                 << aMucBoxCover->GetObjOrgInBes(3)   <<"\t"
01861                                                                 << aMucBoxCover->GetObjOrgInLoc(1)   <<"\t"
01862                                                                 << aMucBoxCover->GetObjOrgInLoc(2)   <<"\t"
01863                                                                 << aMucBoxCover->GetObjOrgInLoc(3)   <<"\t"
01864                                                                 << endl;
01865                                                           // delete aMucBoxCover;
01866                                                 } // panel
01867                                         } // super layer
01868                                 } // layer
01869                         } // segment
01870                 } // endcap
01871         } // for
01872 
01873         fOrigin.close();
01874         fPanel.close();
01875         fPos.close();
01876 
01877         log << MSG::INFO << totalObject << "\tbox_covers created." << endreq;
01878 
01879         return StatusCode::SUCCESS;
01880 
01881 } // MucBoxCover
01882 
01883 
01884 
01885 //=================================== Geometry entities getting methods====================================
01886 MucAbsorber* MucGeoMgr::GetAbsorber( int part, int segment, int layer, int id )
01887 {
01888         if( m_MucAbsorber != NULL ) delete m_MucAbsorber;
01889 
01890         return ( m_MucAbsorber = new MucAbsorber(part, segment, layer, id) );
01891 }
01892 
01893 MucGap* MucGeoMgr::GetGap( int part, int segment, int layer, int id )
01894 {
01895         if( m_MucGap != NULL ) delete m_MucGap;
01896 
01897         return ( m_MucGap = new MucGap(part, segment, layer, id) );
01898 }
01899 
01900 MucBox* MucGeoMgr::GetBox( int part, int segment, int layer, int id )
01901 {
01902         if( m_MucBox != NULL ) delete m_MucBox;
01903 
01904         return ( m_MucBox = new MucBox(part, segment, layer, id) );
01905 }
01906 
01907 MucStripPlane* MucGeoMgr::GetStripPlane( int part, int segment, int layer, int id )
01908 {
01909         if( m_MucStripPlane != NULL ) delete m_MucStripPlane;
01910 
01911         return ( m_MucStripPlane = new MucStripPlane(part, segment, layer, id) );
01912 }
01913 
01914 MucStrip* MucGeoMgr::GetStrip( int part, int segment, int layer, int id )
01915 {
01916         if( m_MucStrip != NULL ) delete m_MucStrip;
01917 
01918         return ( m_MucStrip = new MucStrip(part, segment, layer, id) );
01919 }
01920 
01921 MucRpc* MucGeoMgr::GetRpc( int part, int segment, int layer, int upDown, int id )
01922 {
01923         if( m_MucRpc != NULL ) delete m_MucRpc;
01924 
01925         return ( m_MucRpc = new MucRpc(part, segment, layer, upDown, id) );
01926 }
01927 
01928 MucGas* MucGeoMgr::GetGas( int part, int segment, int layer, int upDown, int rpcId, int id )
01929 {
01930         if( m_MucGas != NULL ) delete m_MucGas;
01931 
01932         return ( m_MucGas = new MucGas(part, segment, layer, upDown, rpcId, id) );
01933 }
01934 
01935 MucBakelite* MucGeoMgr::GetBakelite( int part, int segment, int layer, int upDown, int rpcId, int id )
01936 {
01937         if( m_MucBakelite != NULL ) delete m_MucBakelite;
01938 
01939         return ( m_MucBakelite = new MucBakelite(part, segment, layer, upDown, rpcId, id) );
01940 }
01941 
01942 MucBoxCover* MucGeoMgr::GetBoxCover( int part, int segment, int layer, int upDown, int id )
01943 {
01944         if( m_MucBoxCover != NULL ) delete m_MucBoxCover;
01945 
01946         return ( m_MucBoxCover = new MucBoxCover(part, segment, layer, upDown, id) );
01947 }
01948 
01949 // END

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