00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: MdcSuperLayer.cxx,v 1.3 2010/03/24 00:40:06 zhangy Exp $ 00004 // 00005 // Description: 00006 // Class DchSuperLayer 00007 // Do not use this for DchSuperLayerd class (foo<T>). use DchSuperLayerDchSuperLayer.hh 00008 // instead. 00009 // 00010 // Environment: 00011 // Software developed for the BaBar Detector at the SLAC B-Factory. 00012 // 00013 // Author List: 00014 // R. Stroili originator 00015 // Zhang Yao(zhangyao@ihep.ac.cn) Migrate to BESIII 00016 // 00017 // 00018 // Copyright Information: 00019 // Copyright (C) 1997 INFN - Pd 00020 // 00021 //------------------------------------------------------------------------ 00022 //#include "BaBar/BaBar.hh" 00023 00024 //----------------------- 00025 // This Class's Header -- 00026 //----------------------- 00027 #include "MdcGeom/MdcSuperLayer.h" 00028 #include <iomanip> 00029 #include <iostream> 00030 using namespace std; 00031 00032 //------------- 00033 // C Headers -- 00034 //------------- 00035 extern "C" { 00036 } 00037 00038 //--------------- 00039 // C++ Headers -- 00040 //--------------- 00041 #include <assert.h> 00042 using std::endl; 00043 using std::ostream; 00044 00045 //------------------------------- 00046 // Collaborating Class Headers -- 00047 //------------------------------- 00048 00049 //----------------------------------------------------------------------- 00050 // Local Macros, Typedefs, Structures, Unions and Forward Declarations -- 00051 //----------------------------------------------------------------------- 00052 00053 static const char rscid[] = "$Id: MdcSuperLayer.cxx,v 1.3 2010/03/24 00:40:06 zhangy Exp $"; 00054 static const int _layInSuper = 4; 00055 00056 // ---------------------------------------- 00057 // -- Public Function Member Definitions -- 00058 // ---------------------------------------- 00059 00060 //---------------- 00061 // Constructors -- 00062 //---------------- 00063 MdcSuperLayer::MdcSuperLayer( int number ) 00064 { 00065 _radius = _delphi = _delphiinv = 0; 00066 layers[0] = layers[1] = layers[2] = layers[3] = 0; 00067 _nLayers = 0; 00068 _view = 0; 00069 _next = _prev = _nextInView = _prevInView = 0; 00070 _exist = false; 00071 _slayer = number; 00072 } 00073 00074 //-------------- 00075 // Destructor -- 00076 //-------------- 00077 MdcSuperLayer::~MdcSuperLayer() { 00078 // delete [] layers; 00079 } 00080 00081 //------------- 00082 // Modifiers -- 00083 //------------- 00084 void 00085 MdcSuperLayer::addLayer(int index, const MdcLayer* lay) { 00086 //---------------------------------------------------------- 00087 // here |index| is the index of array of pointers to layers 00088 // belonging to the superlayer, so this ramges from 0 to 3 00089 //---------------------------------------------------------- 00090 // check on index number 00091 assert ( index>=0 && index <4); 00092 // check that it was not already set 00093 assert ( layer(index) == 0 ); 00094 // chack that layer stays in this superlayer 00095 //assert ( (int)((lay->layNum()-1)/_layInSuper+1) == slayNum() ); 00096 00097 // lay->setSlayer(this); 00098 layers[index] = lay; 00099 _nLayers++; 00100 } 00101 00102 void 00103 MdcSuperLayer::updateInfo( const MdcSuperLayer* prev, 00104 const MdcSuperLayer* next ) { 00105 // 00106 // function to set the data-members of this class 00107 // 00108 _exist = true; 00109 _radius = 0.5 * (firstLayer()->rEnd() + lastLayer()->rEnd()); 00110 _view = firstLayer()->view(); 00111 _delphi = firstLayer()->dPhiz(); 00112 _delphiinv = 0.0; 00113 if ( _delphi != 0. ) _delphiinv = 1./_delphi; 00114 // now the pointers 00115 _next = next; 00116 _prev = prev; 00117 } 00118 00119 void 00120 MdcSuperLayer::print(ostream& o) const 00121 { 00122 o<< setw(3)<<index()<< 00123 setw(3)<<whichView()<< 00124 setw(3)<<exist()<< setw(10)<<rEnd()<< 00125 setw(10)<<rad0()<< 00126 setw(10)<<zEnd()<< 00127 setw(10)<<stDip()<< 00128 setw(10)<<delPhi()<< 00129 setw(10)<<delPhiinv()<< 00130 setw(3)<<slayNum()<< 00131 setw(3)<<nLayers()<< 00132 std::endl; 00133 } 00134 00135 ostream& operator<<(ostream& o, MdcSuperLayer& sl) { 00136 sl.print(o); 00137 return o; 00138 }