00001 #include "MdcGeom/MdcLayer.h"
00002 #include "MdcGeom/MdcDetector.h"
00003 #include <iomanip>
00004 #include <iostream>
00005 using namespace std;
00006
00007
00008
00009 MdcLayer::MdcLayer(int lay, int nwir, MdcSWire** wires, const MdcDetector &theDet)
00010 : _mdcDet(theDet), _exist(1), _layer(lay), _nwires(nwir),
00011 _wires(wires)
00012 {
00013 if (_nwires == 0) _exist = 0;
00014
00015 for (int wire=0; wire<_nwires; wire++) {
00016 getWire(wire)->setLayerPtr(this);
00017
00018 }
00019
00020
00021 _rend = wires[0]->rEnd();
00022 _rmid = wires[0]->rMid();
00023 _stdip = _rend - _rmid;
00024
00025 _zend = wires[0]->zEndDC();
00026 _stereo = wires[0]->stereo();
00027
00028 _delphi = wires[0]->dPhiz();
00029
00030 if((_layer>=0 && _layer<=7)||(_layer>=20&&_layer<=35)){
00031 _view = (int)(_stereo/(fabs(_stereo)));
00032 } else {
00033 _view = 0;
00034 }
00035 _phiOffset = wires[0]->phiE();
00036 }
00037
00038
00039
00040 void
00041 MdcLayer::print( std::ostream& o ) const
00042 {
00043 o<< setw(3)<<layNum()<<
00044 setw(3)<<view()<<
00045 setw(4)<<nWires()<<
00046 setw(3)<<superLayer()<<
00047 setw(3)<<subLayer()<<
00048 setw(10)<<stDip()<<
00049 setw(10)<<zEnd()<<
00050 setw(10)<<rMid()<<
00051 setw(10)<<rEnd()<<
00052 setw(10)<<rIn()<<
00053 setw(10)<<rOut()<<
00054 setw(10)<<stereo()<<
00055 setw(10)<<dPhiz()<<
00056 setw(7)<<zLength()<<
00057 setw(10)<<sag()<<
00058 setw(10)<<dPhi()<<
00059 setw(10)<<phiOffset()<<
00060 setw(10)<<phiEPOffset()<<
00061 setw(10)<<dPhizDC(0.)<<
00062 setw(10)<<radiusDC(0.)<<
00063 setw(10)<<phiWireDC(0,0.)<<
00064 setw(10)<<phiWire(0)<<
00065 setw(10)<<xWire(0)<<
00066 setw(10)<<yWire(0)<<
00067 setw(10)<<cellWidth()<<
00068 setw(10)<<cellWidth(0.)<<
00069 std::endl;
00070 }
00071
00072
00073 double
00074 MdcLayer::phiWireDC(int cell, double z) const
00075 {
00076 if ( cell >= 0 && cell < nWires() ) {
00077 return getWire(cell)->phiDC(z);
00078 } else {
00079 std::cout << "phiWireDC: wrong cell # " << cell << "\n"
00080 << " number of cells in this layer is " << nWires()
00081 << std::endl;
00082 return 0.;
00083 }
00084 }
00085
00086 double
00087 MdcLayer::phiWire(int cell) const
00088 {
00089
00090 if ( cell >= 0 && cell < nWires() ) {
00091 return getWire(cell)->phi();
00092 } else {
00093 std::cout << "phiWire: wrong cell # " << cell << "\n"
00094 << " number of cells in this layer is " << nWires()
00095 << std::endl;
00096 return 0.;
00097 }
00098 }
00099
00100 double
00101 MdcLayer::xWire(int cell) const
00102 {
00103
00104 if ( cell >= 0 && cell < nWires() ) {
00105 return getWire(cell)->xMid();
00106 } else {
00107 std::cout << "xWire: wrong cell # " << cell << "\n"
00108 << " number of cells in this layer is " << nWires()
00109 << std::endl;
00110 return 0.;
00111 }
00112 }
00113
00114 double
00115 MdcLayer::yWire(int cell) const
00116 {
00117
00118 if ( cell >= 0 && cell < nWires() ) {
00119 return getWire(cell)->yMid();
00120 } else {
00121 std::cout << "YWire: wrong cell # " << cell << "\n"
00122 << " number of cells in this layer is " << nWires()
00123 << std::endl;
00124 return 0.;
00125 }
00126 }
00127
00128
00129
00130
00131 const Trajectory*
00132 MdcLayer::makeHitTrajInGlobalCoords(int wire, double ) const
00133 {
00134 if ( wire >= 0 && wire < nWires() ) {
00135 return getWire(wire)->getTraj();
00136 } else {
00137 std::cout << "Error In makeHitTrajInGlobalCoords: wrong cell # "<< wire << "\n"
00138 <<" number of cells in this layer is " << nWires() << std::endl;
00139 return getWire(0)->getTraj();
00140 }
00141 }