BOSS 8.0.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(zhangyao@ihep.ac.cn) 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//-----------------------
27#include "MdcGeom/MdcSuperLayer.h"
28#include <iomanip>
29#include <iostream>
30using namespace std;
31
32//-------------
33// C Headers --
34//-------------
35extern "C" {}
36
37//---------------
38// C++ Headers --
39//---------------
40#include <assert.h>
41using std::endl;
42using std::ostream;
43
44//-------------------------------
45// Collaborating Class Headers --
46//-------------------------------
47
48//-----------------------------------------------------------------------
49// Local Macros, Typedefs, Structures, Unions and Forward Declarations --
50//-----------------------------------------------------------------------
51
52static const char rscid[] = "$Id: MdcSuperLayer.cxx,v 1.3 2010/03/24 00:40:06 zhangy Exp $";
53static const int _layInSuper = 4;
54
55// ----------------------------------------
56// -- Public Function Member Definitions --
57// ----------------------------------------
58
59//----------------
60// Constructors --
61//----------------
63 _radius = _delphi = _delphiinv = 0;
64 layers[0] = layers[1] = layers[2] = layers[3] = 0;
65 _nLayers = 0;
66 _view = 0;
67 _next = _prev = _nextInView = _prevInView = 0;
68 _exist = false;
69 _slayer = number;
70}
71
72//--------------
73// Destructor --
74//--------------
76 // delete [] layers;
77}
78
79//-------------
80// Modifiers --
81//-------------
82void MdcSuperLayer::addLayer( int index, const MdcLayer* lay ) {
83 //----------------------------------------------------------
84 // here |index| is the index of array of pointers to layers
85 // belonging to the superlayer, so this ramges from 0 to 3
86 //----------------------------------------------------------
87 // check on index number
88 assert( index >= 0 && index < 4 );
89 // check that it was not already set
90 assert( layer( index ) == 0 );
91 // chack that layer stays in this superlayer
92 // assert ( (int)((lay->layNum()-1)/_layInSuper+1) == slayNum() );
93
94 // lay->setSlayer(this);
95 layers[index] = lay;
96 _nLayers++;
97}
98
99void MdcSuperLayer::updateInfo( const MdcSuperLayer* prev, const MdcSuperLayer* next ) {
100 //
101 // function to set the data-members of this class
102 //
103 _exist = true;
104 _radius = 0.5 * ( firstLayer()->rEnd() + lastLayer()->rEnd() );
105 _view = firstLayer()->view();
106 _delphi = firstLayer()->dPhiz();
107 _delphiinv = 0.0;
108 if ( _delphi != 0. ) _delphiinv = 1. / _delphi;
109 // now the pointers
110 _next = next;
111 _prev = prev;
112}
113
114void MdcSuperLayer::print( ostream& o ) const {
115 o << setw( 3 ) << index() << setw( 3 ) << whichView() << setw( 3 ) << exist() << setw( 10 )
116 << rEnd() << setw( 10 ) << rad0() << setw( 10 ) << zEnd() << setw( 10 ) << stDip()
117 << setw( 10 ) << delPhi() << setw( 10 ) << delPhiinv() << setw( 3 ) << slayNum()
118 << setw( 3 ) << nLayers() << std::endl;
119}
120
121ostream& operator<<( ostream& o, MdcSuperLayer& sl ) {
122 sl.print( o );
123 return o;
124}
ostream & operator<<(ostream &o, MdcSuperLayer &sl)
void print(std::ostream &o=std::cout) const
MdcSuperLayer(int number)