BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcSuperLayer.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: MdcSuperLayer.cxx,v 1.3 2010/03/24 00:40:06 zhangy Exp $
4//
5// Description:
6// Class DchSuperLayer
7// Do not use this for DchSuperLayerd class (foo<T>). use DchSuperLayerDchSuperLayer.hh
8// instead.
9//
10// Environment:
11// Software developed for the BaBar Detector at the SLAC B-Factory.
12//
13// Author List:
14// R. Stroili originator
15// Zhang Yao([email protected]) Migrate to BESIII
16//
17//
18// Copyright Information:
19// Copyright (C) 1997 INFN - Pd
20//
21//------------------------------------------------------------------------
22//#include "BaBar/BaBar.hh"
23
24//-----------------------
25// This Class's Header --
26//-----------------------
28#include <iomanip>
29#include <iostream>
30using namespace std;
31
32//-------------
33// C Headers --
34//-------------
35extern "C" {
36}
37
38//---------------
39// C++ Headers --
40//---------------
41#include <assert.h>
42using std::endl;
43using std::ostream;
44
45//-------------------------------
46// Collaborating Class Headers --
47//-------------------------------
48
49//-----------------------------------------------------------------------
50// Local Macros, Typedefs, Structures, Unions and Forward Declarations --
51//-----------------------------------------------------------------------
52
53static const char rscid[] = "$Id: MdcSuperLayer.cxx,v 1.3 2010/03/24 00:40:06 zhangy Exp $";
54static const int _layInSuper = 4;
55
56// ----------------------------------------
57// -- Public Function Member Definitions --
58// ----------------------------------------
59
60//----------------
61// Constructors --
62//----------------
64{
65 _radius = _delphi = _delphiinv = 0;
66 layers[0] = layers[1] = layers[2] = layers[3] = 0;
67 _nLayers = 0;
68 _view = 0;
69 _next = _prev = _nextInView = _prevInView = 0;
70 _exist = false;
71 _slayer = number;
72}
73
74//--------------
75// Destructor --
76//--------------
78 // delete [] layers;
79}
80
81//-------------
82// Modifiers --
83//-------------
84void
85MdcSuperLayer::addLayer(int index, const MdcLayer* lay) {
86 //----------------------------------------------------------
87 // here |index| is the index of array of pointers to layers
88 // belonging to the superlayer, so this ramges from 0 to 3
89 //----------------------------------------------------------
90 // check on index number
91 assert ( index>=0 && index <4);
92 // check that it was not already set
93 assert ( layer(index) == 0 );
94 // chack that layer stays in this superlayer
95 //assert ( (int)((lay->layNum()-1)/_layInSuper+1) == slayNum() );
96
97 // lay->setSlayer(this);
98 layers[index] = lay;
99 _nLayers++;
100}
101
102void
103MdcSuperLayer::updateInfo( const MdcSuperLayer* prev,
104 const MdcSuperLayer* next ) {
105 //
106 // function to set the data-members of this class
107 //
108 _exist = true;
109 _radius = 0.5 * (firstLayer()->rEnd() + lastLayer()->rEnd());
110 _view = firstLayer()->view();
111 _delphi = firstLayer()->dPhiz();
112 _delphiinv = 0.0;
113 if ( _delphi != 0. ) _delphiinv = 1./_delphi;
114 // now the pointers
115 _next = next;
116 _prev = prev;
117}
118
119void
120MdcSuperLayer::print(ostream& o) const
121{
122 o<< setw(3)<<index()<<
123 setw(3)<<whichView()<<
124 setw(3)<<exist()<< setw(10)<<rEnd()<<
125 setw(10)<<rad0()<<
126 setw(10)<<zEnd()<<
127 setw(10)<<stDip()<<
128 setw(10)<<delPhi()<<
129 setw(10)<<delPhiinv()<<
130 setw(3)<<slayNum()<<
131 setw(3)<<nLayers()<<
132 std::endl;
133}
134
135ostream& operator<<(ostream& o, MdcSuperLayer& sl) {
136 sl.print(o);
137 return o;
138}
ostream & operator<<(ostream &o, MdcSuperLayer &sl)
double rEnd(void) const
Definition: MdcLayer.h:37
int view(void) const
Definition: MdcLayer.h:28
double dPhiz(void) const
Definition: MdcLayer.h:43
const MdcSuperLayer * next(void) const
Definition: MdcSuperLayer.h:39
bool exist(void) const
Definition: MdcSuperLayer.h:22
const MdcLayer * lastLayer(void) const
Definition: MdcSuperLayer.h:38
void print(std::ostream &o=std::cout) const
double rad0(void) const
Definition: MdcSuperLayer.h:24
MdcSuperLayer(int number)
int nLayers(void) const
Definition: MdcSuperLayer.h:44
int whichView(void) const
Definition: MdcSuperLayer.h:21
const MdcLayer * layer(int i) const
Definition: MdcSuperLayer.h:45
double delPhiinv(void) const
Definition: MdcSuperLayer.h:31
const MdcSuperLayer * prev(void) const
Definition: MdcSuperLayer.h:40
const MdcLayer * firstLayer(void) const
Definition: MdcSuperLayer.h:37
int index(void) const
Definition: MdcSuperLayer.h:20
double delPhi(void) const
Definition: MdcSuperLayer.h:30
double stDip(void) const
Definition: MdcSuperLayer.h:28
double zEnd(void) const
Definition: MdcSuperLayer.h:26
int slayNum(void) const
Definition: MdcSuperLayer.h:43
double rEnd(void) const
Definition: MdcSuperLayer.h:23