BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
CbmStsStation.cxx
Go to the documentation of this file.
1
// -------------------------------------------------------------------------
2
// ----- CbmStsStation source file -----
3
// ----- Created 31/03/05 by V. Friese -----
4
// -------------------------------------------------------------------------
5
6
#include "
CbmStsStation.h
"
7
8
#include "
CbmStsSector.h
"
9
#include "
CbmStsSectorDigiPar.h
"
10
#include "
CbmStsSensor.h
"
11
#include "
TMath.h
"
12
13
#include <iostream>
14
#include <map>
15
16
using
std::cout;
17
using
std::endl;
18
using
std::map;
19
20
// ----- Default constructor -------------------------------------------
21
CbmStsStation::CbmStsStation
()
22
:
fName
()
23
,
fDetectorId
(0)
24
,
fZ
(0.)
25
,
fD
(0.)
26
,
fRadLength
()
27
,
fRmin
(0.)
28
,
fRmax
(0.)
29
,
fRotation
(0.)
30
,
fSectors
()
31
,
fSectorMap
()
32
,
fMcIdMap
()
33
{
34
fSectors
=
new
TObjArray
(100);
35
fSectorMap
.clear();
36
}
37
38
// ----- Standard constructor ------------------------------------------
39
CbmStsStation::CbmStsStation
(
const
char
* name,
40
Int_t
iStation,
41
Double_t
z,
42
Double_t
d,
43
Double_t
rl,
44
Double_t
rmin,
45
Double_t
rmax,
46
Double_t
rotation)
47
:
TNamed
(name,
"STS station"
)
48
,
fName
()
49
,
fDetectorId
(0)
50
,
fZ
(0.)
51
,
fD
(0.)
52
,
fRadLength
()
53
,
fRmin
(0.)
54
,
fRmax
(0.)
55
,
fRotation
(0.)
56
,
fSectors
()
57
,
fSectorMap
()
58
,
fMcIdMap
()
59
{
60
fDetectorId
= 2 << 24 | iStation << 16;
61
fZ
= z;
62
fD
= d;
63
fRadLength
= rl;
64
fRmin
= rmin;
65
fRmax
= rmax;
66
fRotation
= rotation;
67
fSectors
=
new
TObjArray
(100);
68
fSectorMap
.clear();
69
70
for
(
Int_t
isz = 0; isz < 10; isz++)
71
fSensorZ
[isz] = -666.;
72
fSensorZ
[0] = z;
73
}
74
75
// ----- Destructor ----------------------------------------------------
76
CbmStsStation::~CbmStsStation
()
77
{
78
if
(
fSectors
) {
79
fSectors
->Delete();
80
delete
fSectors
;
81
}
82
}
83
// -------------------------------------------------------------------------
84
85
// ----- Public method GetNChannels ------------------------------------
86
Int_t
CbmStsStation::GetNChannels
()
87
{
88
Int_t
nChan = 0;
89
for
(
Int_t
iSect = 0; iSect <
GetNSectors
(); iSect++)
90
if
(
GetSector
(iSect)->
GetNChannels
() > 0)
91
nChan +=
GetSector
(iSect)->
GetNChannels
();
92
return
nChan;
93
}
94
// -------------------------------------------------------------------------
95
96
// ----- Public method GetSectorByNr -----------------------------------
97
CbmStsSector
*
CbmStsStation::GetSectorByNr
(
Int_t
sectorNr)
98
{
99
if
(
fSectorMap
.find(sectorNr) !=
fSectorMap
.end()) {
100
Int_t
index =
fSectorMap
[sectorNr];
101
return
(
CbmStsSector
*)
fSectors
->At(index);
102
}
else
{
103
cout <<
"-W- CbmStsStation::GetSectorByNr: sector "
<< sectorNr <<
" not found (station "
<<
GetStationNr
()
104
<<
")."
<< endl;
105
return
NULL;
106
}
107
}
108
// -------------------------------------------------------------------------
109
110
// ----- Public method AddSector ---------------------------------------
111
void
CbmStsStation::AddSector
(
CbmStsSectorDigiPar
* sectorPar)
112
{
113
114
// Get digitisation parameters
115
Int_t
iSector = sectorPar->
GetSectorNr
();
116
117
// Check for previous existence of sector
118
if
(
fSectorMap
.find(iSector) !=
fSectorMap
.end()) {
119
cout <<
"-W- "
<<
fName
<<
"::AddSector: Sector number "
<< iSector <<
" already existing for station "
120
<<
GetStationNr
() << endl;
121
return
;
122
}
123
124
// Calculate detectorId and rotation in global c.s.
125
Int_t
detId = 2 << 24 | (
GetStationNr
() << 16) | (iSector << 4);
126
127
// Number of existing sectors
128
Int_t
nSectors =
fSectors
->GetEntries();
129
130
// Create and add new sector
131
fSectors
->Add(
new
CbmStsSector
(
Form
(
"%ssect%d"
,
fName
.Data(), iSector), detId));
132
133
fSectorMap
[iSector] = nSectors;
134
}
135
// -------------------------------------------------------------------------
136
137
// ----- Public method AddSector ---------------------------------------
138
void
CbmStsStation::AddSector
(
CbmStsSector
* sector)
139
{
140
141
Int_t
iSector = sector->
GetSectorNr
();
142
Int_t
nSectors =
fSectors
->GetEntries();
143
144
fSectors
->Add(sector);
145
146
fSectorMap
[iSector] = nSectors;
147
}
148
// -------------------------------------------------------------------------
149
150
// -------------------------------------------------------------------------
151
Double_t
CbmStsStation::GetZ
(
Int_t
it)
152
{
153
if
(
fSensorZ
[it] < -665.) {
154
Int_t
knownZPos = 0;
155
for
(knownZPos = 0; knownZPos < 10; knownZPos++) {
156
if
(
fSensorZ
[knownZPos] < -665.)
157
break
;
158
}
159
160
for
(
Int_t
iSect =
GetNSectors
(); iSect > 0; iSect--) {
161
CbmStsSector
* sector = (
CbmStsSector
*)
GetSector
(iSect - 1);
162
for
(
Int_t
iSens = sector->
GetNSensors
(); iSens > 0; iSens--) {
163
CbmStsSensor
* sensor = (
CbmStsSensor
*)sector->
GetSensor
(iSens - 1);
164
Bool_t
knownAlready =
kFALSE
;
165
for
(
Int_t
isz = 0; isz < knownZPos; isz++)
166
if
(
TMath::Abs
(sensor->
GetZ0
() -
fSensorZ
[isz]) < 0.0001) {
167
knownAlready =
kTRUE
;
168
break
;
169
}
170
171
if
(knownAlready)
172
continue
;
173
174
fSensorZ
[knownZPos] = sensor->
GetZ0
();
175
knownZPos++;
176
}
177
}
178
}
179
return
fSensorZ
[it];
180
}
181
// -------------------------------------------------------------------------
182
183
// -------------------------------------------------------------------------
184
Int_t
CbmStsStation::GetNofZ
()
185
{
186
Int_t
knownZPos = 0;
187
for
(knownZPos = 0; knownZPos < 10; knownZPos++) {
188
if
(
fSensorZ
[knownZPos] < -665.)
189
break
;
190
}
191
192
for
(
Int_t
iSect =
GetNSectors
(); iSect > 0; iSect--) {
193
CbmStsSector
* sector = (
CbmStsSector
*)
GetSector
(iSect - 1);
194
for
(
Int_t
iSens = sector->
GetNSensors
(); iSens > 0; iSens--) {
195
CbmStsSensor
* sensor = (
CbmStsSensor
*)sector->
GetSensor
(iSens - 1);
196
Bool_t
knownAlready =
kFALSE
;
197
for
(
Int_t
isz = 0; isz < knownZPos; isz++)
198
if
(
TMath::Abs
(sensor->
GetZ0
() -
fSensorZ
[isz]) < 0.0001) {
199
knownAlready =
kTRUE
;
200
break
;
201
}
202
203
if
(knownAlready)
204
continue
;
205
206
fSensorZ
[knownZPos] = sensor->
GetZ0
();
207
knownZPos++;
208
}
209
}
210
return
knownZPos;
211
}
212
// -------------------------------------------------------------------------
213
214
// ----- Public method Reset -------------------------------------------
215
void
CbmStsStation::Reset
()
216
{
217
for
(
Int_t
iSector = 0; iSector <
GetNSectors
(); iSector++)
218
GetSector
(iSector)->
Reset
();
219
}
220
// -------------------------------------------------------------------------
221
222
// ----- Public method Print -------------------------------------------
223
void
CbmStsStation::Print
(
Bool_t
kLong)
224
{
225
cout <<
"Station Nr. "
;
226
cout.width(2);
227
cout <<
GetStationNr
() <<
", z = "
;
228
cout.width(3);
229
cout <<
fZ
<<
" cm, Rmin = "
;
230
cout.width(5);
231
cout <<
fRmin
<<
" cm, Rmax = "
<<
fRmax
<<
" cm, angle = "
;
232
cout.width(3);
233
cout <<
fRotation
* 180 /
TMath::Pi
() <<
" deg., sectors: "
;
234
cout.width(4);
235
cout <<
GetNSectors
() <<
", channels: "
;
236
cout.width(8);
237
cout <<
GetNChannels
() << endl;
238
if
(kLong)
239
for
(
Int_t
iSec = 0; iSec <
GetNSectors
(); iSec++)
240
GetSector
(iSec)->
Print
();
241
}
242
// -------------------------------------------------------------------------
Bool_t
bool Bool_t
Int_t
int Int_t
kFALSE
constexpr Bool_t kFALSE
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
TMath.h
Form
char * Form(const char *fmt,...)
CbmStsSectorDigiPar
CbmStsSectorDigiPar.h.
Definition
CbmStsSectorDigiPar.h:29
CbmStsSectorDigiPar::GetSectorNr
Int_t GetSectorNr() const
Accessors.
Definition
CbmStsSectorDigiPar.h:43
CbmStsSector
Definition
CbmStsSector.h:44
CbmStsSector::Reset
void Reset()
Clear the maps of fired strips.
Definition
CbmStsSector.cxx:92
CbmStsSector::GetSectorNr
Int_t GetSectorNr() const
Definition
CbmStsSector.h:63
CbmStsSector::GetNChannels
Int_t GetNChannels() const
Definition
CbmStsSector.h:67
CbmStsSector::Print
void Print()
Screen output.
Definition
CbmStsSector.cxx:101
CbmStsSector::GetSensor
CbmStsSensor * GetSensor(Int_t iSensor)
Definition
CbmStsSector.h:74
CbmStsSector::GetNSensors
Int_t GetNSensors() const
Definition
CbmStsSector.h:71
CbmStsSensor
Definition
CbmStsSensor.h:44
CbmStsSensor::GetZ0
Double_t GetZ0() const
Definition
CbmStsSensor.h:110
CbmStsStation::fRadLength
Double32_t fRadLength
Definition
CbmStsStation.h:86
CbmStsStation::CbmStsStation
CbmStsStation()
Default constructor.
Definition
CbmStsStation.cxx:21
CbmStsStation::GetNChannels
Int_t GetNChannels()
Definition
CbmStsStation.cxx:86
CbmStsStation::Print
virtual void Print(Bool_t kLong)
Output to screen.
Definition
CbmStsStation.cxx:223
CbmStsStation::fRmin
Double32_t fRmin
Definition
CbmStsStation.h:87
CbmStsStation::GetNSectors
Int_t GetNSectors() const
Definition
CbmStsStation.h:62
CbmStsStation::fSectorMap
std::map< Int_t, Int_t > fSectorMap
Definition
CbmStsStation.h:91
CbmStsStation::fMcIdMap
std::map< Int_t, Int_t > fMcIdMap
Map from sector number to index.
Definition
CbmStsStation.h:92
CbmStsStation::fName
TString fName
Definition
CbmStsStation.h:82
CbmStsStation::fRotation
Double32_t fRotation
Definition
CbmStsStation.h:89
CbmStsStation::fD
Double32_t fD
Definition
CbmStsStation.h:85
CbmStsStation::fZ
Double32_t fZ
Definition
CbmStsStation.h:84
CbmStsStation::fDetectorId
Int_t fDetectorId
Definition
CbmStsStation.h:83
CbmStsStation::AddSector
void AddSector(CbmStsSectorDigiPar *sectorPar)
Add one sector to the array.
Definition
CbmStsStation.cxx:111
CbmStsStation::fSectors
TObjArray * fSectors
Definition
CbmStsStation.h:90
CbmStsStation::Reset
void Reset()
Reset all eventwise counters.
Definition
CbmStsStation.cxx:215
CbmStsStation::GetZ
Double_t GetZ(Int_t it=0)
Definition
CbmStsStation.cxx:151
CbmStsStation::fRmax
Double32_t fRmax
Definition
CbmStsStation.h:88
CbmStsStation::GetSectorByNr
CbmStsSector * GetSectorByNr(Int_t sectorNr)
Definition
CbmStsStation.cxx:97
CbmStsStation::GetStationNr
Int_t GetStationNr() const
Definition
CbmStsStation.h:56
CbmStsStation::GetSector
CbmStsSector * GetSector(Int_t iSector)
Definition
CbmStsStation.h:65
CbmStsStation::~CbmStsStation
virtual ~CbmStsStation()
Destructor.
Definition
CbmStsStation.cxx:76
CbmStsStation::fSensorZ
Double_t fSensorZ[30]
Map from McId to index.
Definition
CbmStsStation.h:94
CbmStsStation::GetNofZ
Int_t GetNofZ()
Definition
CbmStsStation.cxx:184
TNamed::TNamed
TNamed()
TObjArray
CbmStsSectorDigiPar.h
CbmStsSector.h
CbmStsSensor.h
CbmStsStation.h
TMath::Pi
constexpr Double_t Pi()
TMath::Abs
Double_t Abs(Double_t d)
detectors
sts
CbmStsStation.cxx
Generated on
for BmnRoot by
1.17.0