BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcLayer.cxx
Go to the documentation of this file.
1#include "MdcGeom/MdcLayer.h"
2#include "MdcGeom/MdcDetector.h"
3#include <iomanip>
4#include <iostream>
5using namespace std;
6
7// Constructor.
8
9MdcLayer::MdcLayer( int lay, int nwir, MdcSWire** wires, const MdcDetector& theDet )
10 : _mdcDet( theDet ), _exist( 1 ), _layer( lay ), _nwires( nwir ), _wires( wires ) {
11 if ( _nwires == 0 ) _exist = 0;
12 // set pointer to layer for wires
13 for ( int wire = 0; wire < _nwires; wire++ )
14 {
15 getWire( wire )->setLayerPtr( this );
16 // _cells.push_back(buildCell(wire));
17 }
18
19 // get nominal values from wire # 0
20 _rend = wires[0]->rEnd();
21 _rmid = wires[0]->rMid();
22 _stdip = _rend - _rmid;
23 // in the local (DC) system frame
24 _zend = wires[0]->zEndDC();
25 _stereo = wires[0]->stereo();
26 // half twist angle
27 _delphi = wires[0]->dPhiz();
28 // stereo view
29 if ( ( _layer >= 0 && _layer <= 7 ) || ( _layer >= 20 && _layer <= 35 ) )
30 { _view = (int)( _stereo / ( fabs( _stereo ) ) ); }
31 else { _view = 0; }
32 _phiOffset = wires[0]->phiE();
33}
34
35void MdcLayer::print( std::ostream& o ) const {
36 o << setw( 3 ) << layNum() << setw( 3 ) << view() << setw( 4 ) << nWires() << setw( 3 )
37 << superLayer() << setw( 3 ) << subLayer() << setw( 10 ) << stDip() << setw( 10 ) << zEnd()
38 << setw( 10 ) << rMid() << setw( 10 ) << rEnd() << setw( 10 ) << rIn() << setw( 10 )
39 << rOut() << setw( 10 ) << stereo() << setw( 10 ) << dPhiz() << setw( 7 ) << zLength()
40 << setw( 10 ) << sag() << setw( 10 ) << dPhi() << setw( 10 ) << phiOffset() << setw( 10 )
41 << phiEPOffset() << setw( 10 ) << dPhizDC( 0. ) << setw( 10 ) << radiusDC( 0. )
42 << setw( 10 ) << phiWireDC( 0, 0. ) << setw( 10 ) << phiWire( 0 ) << setw( 10 )
43 << xWire( 0 ) << setw( 10 ) << yWire( 0 ) << setw( 10 ) << cellWidth() << setw( 10 )
44 << cellWidth( 0. ) << std::endl;
45}
46
47double MdcLayer::phiWireDC( int cell, double z ) const {
48 if ( cell >= 0 && cell < nWires() ) { return getWire( cell )->phiDC( z ); }
49 else
50 {
51 std::cout << "phiWireDC: wrong cell # " << cell << "\n"
52 << " number of cells in this layer is " << nWires() << std::endl;
53 return 0.;
54 }
55}
56
57double MdcLayer::phiWire( int cell ) const {
58 // in the middle of the chamber
59 if ( cell >= 0 && cell < nWires() ) { return getWire( cell )->phi(); }
60 else
61 {
62 std::cout << "phiWire: wrong cell # " << cell << "\n"
63 << " number of cells in this layer is " << nWires() << std::endl;
64 return 0.;
65 }
66}
67
68double MdcLayer::xWire( int cell ) const {
69 // in the middle of the chamber
70 if ( cell >= 0 && cell < nWires() ) { return getWire( cell )->xMid(); }
71 else
72 {
73 std::cout << "xWire: wrong cell # " << cell << "\n"
74 << " number of cells in this layer is " << nWires() << std::endl;
75 return 0.;
76 }
77}
78
79double MdcLayer::yWire( int cell ) const {
80 // in the middle of the chamber
81 if ( cell >= 0 && cell < nWires() ) { return getWire( cell )->yMid(); }
82 else
83 {
84 std::cout << "YWire: wrong cell # " << cell << "\n"
85 << " number of cells in this layer is " << nWires() << std::endl;
86 return 0.;
87 }
88}
89
90const Trajectory* MdcLayer::makeHitTrajInGlobalCoords( int wire, double /*z*/ ) const {
91 if ( wire >= 0 && wire < nWires() ) { return getWire( wire )->getTraj(); }
92 else
93 {
94 std::cout << "Error In makeHitTrajInGlobalCoords: wrong cell # " << wire << "\n"
95 << " number of cells in this layer is " << nWires() << std::endl;
96 return getWire( 0 )->getTraj();
97 }
98}
const Trajectory * makeHitTrajInGlobalCoords(int wire, double z=0) const
Definition MdcLayer.cxx:90
double yWire(int cell) const
Definition MdcLayer.cxx:79
MdcLayer(int lay, int nwir, MdcSWire **wires, const MdcDetector &theDet)
Definition MdcLayer.cxx:9
double phiWire(int cell) const
Definition MdcLayer.cxx:57
double phiWireDC(int cell, double z) const
Definition MdcLayer.cxx:47
void print(std::ostream &o) const
Definition MdcLayer.cxx:35
double xWire(int cell) const
Definition MdcLayer.cxx:68