BOSS 7.0.2
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),
11 _wires(wires)
12{
13 if (_nwires == 0) _exist = 0;
14 // set pointer to layer for wires
15 for (int wire=0; wire<_nwires; wire++) {
16 getWire(wire)->setLayerPtr(this);
17// _cells.push_back(buildCell(wire));
18 }
19
20 // get nominal values from wire # 0
21 _rend = wires[0]->rEnd();
22 _rmid = wires[0]->rMid();
23 _stdip = _rend - _rmid;
24 // in the local (DC) system frame
25 _zend = wires[0]->zEndDC();
26 _stereo = wires[0]->stereo();
27 // half twist angle
28 _delphi = wires[0]->dPhiz();
29 // stereo view
30 if((_layer>=0 && _layer<=7)||(_layer>=20&&_layer<=35)){
31 _view = (int)(_stereo/(fabs(_stereo)));
32 } else {
33 _view = 0;
34 }
35 _phiOffset = wires[0]->phiE();
36}
37
38
39
40void
41MdcLayer::print( std::ostream& o ) const
42{
43 o<< setw(3)<<layNum()<<
44 setw(3)<<view()<<
45 setw(4)<<nWires()<<
46 setw(3)<<superLayer()<<
47 setw(3)<<subLayer()<<
48 setw(10)<<stDip()<<
49 setw(10)<<zEnd()<<
50 setw(10)<<rMid()<<
51 setw(10)<<rEnd()<<
52 setw(10)<<rIn()<<
53 setw(10)<<rOut()<<
54 setw(10)<<stereo()<<
55 setw(10)<<dPhiz()<<
56 setw(7)<<zLength()<<
57 setw(10)<<sag()<<
58 setw(10)<<dPhi()<<
59 setw(10)<<phiOffset()<<
60 setw(10)<<phiEPOffset()<<
61 setw(10)<<dPhizDC(0.)<<
62 setw(10)<<radiusDC(0.)<<
63 setw(10)<<phiWireDC(0,0.)<<
64 setw(10)<<phiWire(0)<<
65 setw(10)<<xWire(0)<<
66 setw(10)<<yWire(0)<<
67 setw(10)<<cellWidth()<<
68 setw(10)<<cellWidth(0.)<<
69 std::endl;
70}
71
72
73double
74MdcLayer::phiWireDC(int cell, double z) const
75{
76 if ( cell >= 0 && cell < nWires() ) {
77 return getWire(cell)->phiDC(z);
78 } else {
79 std::cout << "phiWireDC: wrong cell # " << cell << "\n"
80 << " number of cells in this layer is " << nWires()
81 << std::endl;
82 return 0.;
83 }
84}
85
86double
87MdcLayer::phiWire(int cell) const
88{
89 // in the middle of the chamber
90 if ( cell >= 0 && cell < nWires() ) {
91 return getWire(cell)->phi();
92 } else {
93 std::cout << "phiWire: wrong cell # " << cell << "\n"
94 << " number of cells in this layer is " << nWires()
95 << std::endl;
96 return 0.;
97 }
98}
99
100double
101MdcLayer::xWire(int cell) const
102{
103 // in the middle of the chamber
104 if ( cell >= 0 && cell < nWires() ) {
105 return getWire(cell)->xMid();
106 } else {
107 std::cout << "xWire: wrong cell # " << cell << "\n"
108 << " number of cells in this layer is " << nWires()
109 << std::endl;
110 return 0.;
111 }
112}
113
114double
115MdcLayer::yWire(int cell) const
116{
117 // in the middle of the chamber
118 if ( cell >= 0 && cell < nWires() ) {
119 return getWire(cell)->yMid();
120 } else {
121 std::cout << "YWire: wrong cell # " << cell << "\n"
122 << " number of cells in this layer is " << nWires()
123 << std::endl;
124 return 0.;
125 }
126}
127
128
129
130
131const Trajectory*
132MdcLayer::makeHitTrajInGlobalCoords(int wire, double /*z*/) const
133{
134 if ( wire >= 0 && wire < nWires() ) {
135 return getWire(wire)->getTraj();
136 } else {
137 std::cout << "Error In makeHitTrajInGlobalCoords: wrong cell # "<< wire << "\n"
138 <<" number of cells in this layer is " << nWires() << std::endl;
139 return getWire(0)->getTraj();
140 }
141}
const Trajectory * makeHitTrajInGlobalCoords(int wire, double z=0) const
Definition: MdcLayer.cxx:132
double yWire(int cell) const
Definition: MdcLayer.cxx:115
MdcLayer(int lay, int nwir, MdcSWire **wires, const MdcDetector &theDet)
Definition: MdcLayer.cxx:9
double phiWire(int cell) const
Definition: MdcLayer.cxx:87
MdcSWire * getWire(int wire) const
double phiWireDC(int cell, double z) const
Definition: MdcLayer.cxx:74
void print(std::ostream &o) const
Definition: MdcLayer.cxx:41
double xWire(int cell) const
Definition: MdcLayer.cxx:101
const MdcSagTraj * getTraj(void) const
void setLayerPtr(const MdcLayer *lay)