FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PndGemStation Class Reference

#include <PndGemStation.h>

Inheritance diagram for PndGemStation:

Public Member Functions

 PndGemStation ()
 
 PndGemStation (const char *name, Int_t stationNr, Double_t z, Double_t rotation)
 
virtual ~PndGemStation ()
 
void SetDetectorId (Int_t stationNr)
 
Int_t GetDetectorId () const
 
Int_t GetSystemId () const
 
Int_t GetStationNr () const
 
Double_t GetZ (Int_t it=0)
 
Int_t GetNSensors () const
 
Int_t GetNChannels ()
 
TObjArray * GetSensors ()
 
PndGemSensorGetSensor (Int_t iSensor)
 
PndGemSensorGetSensorByNr (Int_t sensorNr)
 
void AddSensor (PndGemSensor *sensor)
 
Int_t GetNofZ ()
 
void Reset ()
 
virtual void Print (Bool_t kLong)
 

Protected Member Functions

 ClassDef (PndGemStation, 1)
 

Protected Attributes

Int_t fDetectorId
 
Double32_t fZ
 
Double32_t fRotation
 
TObjArray * fSensors
 
std::map< Int_t, Int_t > fSensorMap
 
std::map< Int_t, Int_t > fMcIdMap
 Map from sensor number to index. More...
 
Double_t fSensorZ [10]
 Map from McId to index. More...
 

Detailed Description

Definition at line 28 of file PndGemStation.h.

Constructor & Destructor Documentation

PndGemStation::PndGemStation ( )

Default constructor

Definition at line 22 of file PndGemStation.cxx.

References fDetectorId, fSensorMap, fSensors, and fZ.

22  {
23  fDetectorId = 0;
24  fZ = 0.;
25  fSensors = new TObjArray(100);
26  fSensorMap.clear();
27 }
TObjArray * fSensors
Definition: PndGemStation.h:84
Double32_t fZ
Definition: PndGemStation.h:82
std::map< Int_t, Int_t > fSensorMap
Definition: PndGemStation.h:85
PndGemStation::PndGemStation ( const char *  name,
Int_t  stationNr,
Double_t  z,
Double_t  rotation 
)

Standard constructor

Parameters
nameVolume name of station
stationNrstationNr
zz position of station centre [cm]
rotationRotation angle in global c.s. [rad]

Definition at line 33 of file PndGemStation.cxx.

References fRotation, fSensorMap, fSensors, fSensorZ, fZ, rotation, SetDetectorId(), and z.

35  : TNamed(name, "GEM station") {
36  SetDetectorId(stationNr);
37  fZ = z;
39  fSensors = new TObjArray(100);
40  fSensorMap.clear();
41 
42  for ( Int_t isz = 0 ; isz < 10 ; isz++ )
43  fSensorZ[isz] = -666.;
44  fSensorZ[0] = z;
45 }
TGeoRotation rotation
Double32_t fRotation
Definition: PndGemStation.h:83
Double_t fSensorZ[10]
Map from McId to index.
Definition: PndGemStation.h:88
Double_t z
TString name
TObjArray * fSensors
Definition: PndGemStation.h:84
Double32_t fZ
Definition: PndGemStation.h:82
std::map< Int_t, Int_t > fSensorMap
Definition: PndGemStation.h:85
void SetDetectorId(Int_t stationNr)
Definition: PndGemStation.h:52
PndGemStation::~PndGemStation ( )
virtual

Destructor

Definition at line 51 of file PndGemStation.cxx.

References fSensors.

51  {
52  if ( fSensors ) {
53  fSensors->Delete();
54  delete fSensors;
55  }
56 }
TObjArray * fSensors
Definition: PndGemStation.h:84

Member Function Documentation

void PndGemStation::AddSensor ( PndGemSensor sensor)

Add one sensor to the array

Definition at line 89 of file PndGemStation.cxx.

References fSensorMap, fSensors, and PndGemSensor::GetSensorNr().

Referenced by PndGemDigiPar::CreateStations(), and MyMainFrame::ReadParameters().

89  {
90 
91  Int_t iSensor = sensor->GetSensorNr();
92  Int_t nSensors = fSensors->GetEntries();
93 
94  fSensors->Add(sensor);
95 
96  fSensorMap[iSensor] = nSensors;
97 
98 }
TObjArray * fSensors
Definition: PndGemStation.h:84
Int_t GetSensorNr() const
Definition: PndGemSensor.h:95
std::map< Int_t, Int_t > fSensorMap
Definition: PndGemStation.h:85
PndGemStation::ClassDef ( PndGemStation  ,
 
)
protected
Int_t PndGemStation::GetDetectorId ( ) const
inline

Definition at line 54 of file PndGemStation.h.

References fDetectorId.

54 { return fDetectorId; }
Int_t PndGemStation::GetNChannels ( )

Definition at line 62 of file PndGemStation.cxx.

References PndGemSensor::GetNChannels(), GetNSensors(), and GetSensor().

Referenced by Print().

62  {
63  Int_t nChan = 0;
64  for (Int_t iSect=0; iSect<GetNSensors(); iSect++)
65  nChan += GetSensor(iSect)->GetNChannels();
66  return nChan;
67 }
PndGemSensor * GetSensor(Int_t iSensor)
Definition: PndGemStation.h:63
Int_t GetNSensors() const
Definition: PndGemStation.h:60
Int_t GetNChannels() const
Definition: PndGemSensor.h:110
Int_t PndGemStation::GetNofZ ( )

Definition at line 130 of file PndGemStation.cxx.

References CAMath::Abs(), Bool_t, fSensorZ, GetNSensors(), GetSensor(), PndGemSensor::GetZ0(), and sensor.

131 {
132  Int_t knownZPos = 0;
133  for ( knownZPos = 0 ; knownZPos < 10 ; knownZPos++ ) {
134  if ( fSensorZ[knownZPos] < -665. ) break;
135  }
136 
137  for (Int_t iSect=GetNSensors(); iSect > 0 ; iSect--) {
139  Bool_t knownAlready = kFALSE;
140  for ( Int_t isz = 0 ; isz < knownZPos ; isz++ )
141  if ( TMath::Abs(sensor->GetZ0()-fSensorZ[isz]) < 0.0001 ) {
142  knownAlready = kTRUE;
143  break;
144  }
145 
146  if ( knownAlready ) continue;
147 
148  fSensorZ[knownZPos] = sensor->GetZ0();
149  knownZPos++;
150  }
151  return knownZPos;
152 }
TGeoVolume * sensor
PndGemSensor * GetSensor(Int_t iSensor)
Definition: PndGemStation.h:63
static T Abs(const T &x)
Definition: PndCAMath.h:39
Int_t GetNSensors() const
Definition: PndGemStation.h:60
Double_t fSensorZ[10]
Map from McId to index.
Definition: PndGemStation.h:88
Double_t GetZ0() const
Definition: PndGemSensor.h:100
Int_t PndGemStation::GetNSensors ( ) const
inline
PndGemSensor* PndGemStation::GetSensor ( Int_t  iSensor)
inline
PndGemSensor * PndGemStation::GetSensorByNr ( Int_t  sensorNr)

Definition at line 74 of file PndGemStation.cxx.

References fSensorMap, fSensors, and GetStationNr().

Referenced by MyMainFrame::DoInfoStatusBar(), and MyMainFrame::DrawDigis().

74  {
75  if ( fSensorMap.find(sensorNr) != fSensorMap.end() ) {
76  Int_t index = fSensorMap[sensorNr];
77  return (PndGemSensor*) fSensors->At(index);
78  }
79  else {
80  cout << "-W- PndGemStation::GetSensorByNr: sensor " << sensorNr
81  << " not found (station " << GetStationNr() << ")." << endl;
82  return NULL;
83  }
84 }
Int_t GetStationNr() const
Definition: PndGemStation.h:57
TObjArray * fSensors
Definition: PndGemStation.h:84
std::map< Int_t, Int_t > fSensorMap
Definition: PndGemStation.h:85
TObjArray* PndGemStation::GetSensors ( )
inline

Definition at line 62 of file PndGemStation.h.

References fSensors.

62 { return fSensors; }
TObjArray * fSensors
Definition: PndGemStation.h:84
Int_t PndGemStation::GetStationNr ( ) const
inline

Definition at line 57 of file PndGemStation.h.

References fDetectorId.

Referenced by PndGemFindHits::Exec(), GetSensorByNr(), and Print().

57  {
58  return ( ( fDetectorId & (8191<< 8) ) >> 8 ); }
Int_t PndGemStation::GetSystemId ( ) const
inline

Definition at line 55 of file PndGemStation.h.

References fDetectorId.

55  {
56  return ( ( fDetectorId & ( 31<<27) ) >> 27); }
Double_t PndGemStation::GetZ ( Int_t  it = 0)

Definition at line 102 of file PndGemStation.cxx.

References CAMath::Abs(), Bool_t, fSensorZ, GetNSensors(), GetSensor(), PndGemSensor::GetZ0(), and sensor.

Referenced by PndGemMagneticFieldVsTrackParameters::Fill2StationsHistograms(), PndGemTrackFinderOnHits::FindTrackSegments(), PndMvdGemTrackFinderOnHits::FindTrackSegments(), PndGemMagneticFieldVsTrackParameters::Finish(), and MyMainFrame::ReadParameters().

103 {
104  if ( fSensorZ[it] < -665. ) {
105  Int_t knownZPos = 0;
106  for ( knownZPos = 0 ; knownZPos < 10 ; knownZPos++ ) {
107  if ( fSensorZ[knownZPos] < -665. ) break;
108  }
109 
110  for (Int_t iSect=GetNSensors(); iSect > 0 ; iSect--) {
112  Bool_t knownAlready = kFALSE;
113  for ( Int_t isz = 0 ; isz < knownZPos ; isz++ )
114  if ( TMath::Abs(sensor->GetZ0()-fSensorZ[isz]) < 0.0001 ) {
115  knownAlready = kTRUE;
116  break;
117  }
118 
119  if ( knownAlready ) continue;
120 
121  fSensorZ[knownZPos] = sensor->GetZ0();
122  knownZPos++;
123  }
124  }
125  return fSensorZ[it];
126 }
TGeoVolume * sensor
PndGemSensor * GetSensor(Int_t iSensor)
Definition: PndGemStation.h:63
static T Abs(const T &x)
Definition: PndCAMath.h:39
Int_t GetNSensors() const
Definition: PndGemStation.h:60
Double_t fSensorZ[10]
Map from McId to index.
Definition: PndGemStation.h:88
Double_t GetZ0() const
Definition: PndGemSensor.h:100
void PndGemStation::Print ( Bool_t  kLong)
virtual

Output to screen

Definition at line 166 of file PndGemStation.cxx.

References fDetectorId, fRotation, fZ, GetNChannels(), GetNSensors(), GetSensor(), GetStationNr(), Pi, and PndGemSensor::Print().

166  {
167  cout << "Station Nr. ";
168  cout.width(2);
169  cout << GetStationNr() << ", z = ";
170  cout.width(3);
171  cout << fZ << " cm, angle = ";
172  cout.width(3);
173  cout << fRotation * 180 / TMath::Pi() << " deg., sensors: ";
174  cout.width(4);
175  cout << GetNSensors() << ", channels: ";
176  cout.width(8);
177  cout << GetNChannels() << endl;
178 
179  Int_t tempSId = fDetectorId;
180  Int_t bc = 0;
181  cout << "STATION: " << flush;
182  while ( tempSId > 0 ) {
183  bc++;
184  cout << "\b" << tempSId%2 << "\b" << flush;
185  if ( bc == 27 || bc == 21 || bc == 8 || bc == 6 || bc == 5 )
186  cout << "\b|\b" << flush;
187  tempSId = tempSId/2;
188  }
189  cout << endl;
190 
191  if ( kLong )
192  for (Int_t iSec=0; iSec<GetNSensors(); iSec++)
193  GetSensor(iSec)->Print();
194 }
Int_t GetStationNr() const
Definition: PndGemStation.h:57
PndGemSensor * GetSensor(Int_t iSensor)
Definition: PndGemStation.h:63
Int_t GetNSensors() const
Definition: PndGemStation.h:60
Double32_t fRotation
Definition: PndGemStation.h:83
Int_t GetNChannels()
Double32_t fZ
Definition: PndGemStation.h:82
Double_t Pi
void PndGemStation::Reset ( )

Reset all eventwise counters

Definition at line 157 of file PndGemStation.cxx.

References GetNSensors(), GetSensor(), and PndGemSensor::Reset().

157  {
158  for (Int_t iSensor=0; iSensor<GetNSensors(); iSensor++)
159  GetSensor(iSensor)->Reset();
160 }
PndGemSensor * GetSensor(Int_t iSensor)
Definition: PndGemStation.h:63
Int_t GetNSensors() const
Definition: PndGemStation.h:60
void PndGemStation::SetDetectorId ( Int_t  stationNr)
inline

Accessors

Definition at line 52 of file PndGemStation.h.

References fDetectorId, and kGEM.

Referenced by PndGemStation().

52  {
53  fDetectorId = kGEM << 27 | 0 << 21 | stationNr << 8 | 0 << 6; }

Member Data Documentation

Int_t PndGemStation::fDetectorId
protected
std::map<Int_t, Int_t> PndGemStation::fMcIdMap
protected

Map from sensor number to index.

Definition at line 86 of file PndGemStation.h.

Double32_t PndGemStation::fRotation
protected

Definition at line 83 of file PndGemStation.h.

Referenced by PndGemStation(), and Print().

std::map<Int_t, Int_t> PndGemStation::fSensorMap
protected

Definition at line 85 of file PndGemStation.h.

Referenced by AddSensor(), GetSensorByNr(), and PndGemStation().

TObjArray* PndGemStation::fSensors
protected
Double_t PndGemStation::fSensorZ[10]
protected

Map from McId to index.

Definition at line 88 of file PndGemStation.h.

Referenced by GetNofZ(), GetZ(), and PndGemStation().

Double32_t PndGemStation::fZ
protected

Definition at line 82 of file PndGemStation.h.

Referenced by PndGemStation(), and Print().


The documentation for this class was generated from the following files: