CbmRoot
Loading...
Searching...
No Matches
CbmMuchSectorRadial.cxx
Go to the documentation of this file.
1
/* Copyright (C) 2012-2020 Petersburg Nuclear Physics Institute named by B.P.Konstantinov of National Research Centre "Kurchatov Institute", Gatchina
2
SPDX-License-Identifier: GPL-3.0-only
3
Authors: Evgeny Kryshen [committer], Florian Uhlig , Apar Agarwal */
4
13
#include "
CbmMuchSectorRadial.h
"
14
15
#include "
CbmMuchAddress.h
"
// for CbmMuchAddress, kMuchChannel
16
#include "
CbmMuchPadRadial.h
"
// for CbmMuchPadRadial
17
18
#include <Logger.h>
// for Logger, LOG
19
20
#include <TMath.h>
// for Ceil, Floor, Pi, TwoPi
21
22
#include <vector>
// for vector
23
24
25
// ----- Default constructor -------------------------------------------
26
CbmMuchSectorRadial::CbmMuchSectorRadial
() :
CbmMuchSector
(), fR1(0.), fR2(0.), fPhi1(0.), fPhi2(0.), fPadDphi(0.) {}
27
// -------------------------------------------------------------------------
28
29
30
// ----- Standard constructor --------------------------------------------
31
CbmMuchSectorRadial::CbmMuchSectorRadial
(Int_t detId, Int_t secId, Double_t r1, Double_t r2, Double_t phi1,
32
Double_t phi2)
33
:
CbmMuchSector
(detId, secId, 0)
34
, fR1(r1)
35
, fR2(r2)
36
, fPhi1(0.)
37
, fPhi2(0.)
38
, fPadDphi((r2 - r1) / r1)
39
{
40
if
(phi2 < phi1) LOG(error) <<
"Error in description of module paramaters (phi1 > phi2)"
;
41
fNChannels
= TMath::Ceil(((phi2 - phi1) /
fPadDphi
) - DBL_EPSILON);
42
fPhi1
= phi1;
43
fPhi2
= phi2;
44
}
45
// -----------------o--------------------------------------------------------
46
47
48
// ----- Public method GetChannel --------------------------------------
49
Int_t
CbmMuchSectorRadial::GetPadIndexByPhi
(Double_t phi)
50
{
51
if
(
fPhi2
> TMath::Pi() && phi <
fPhi1
) phi += TMath::TwoPi();
52
if
(phi < fPhi1 || phi >
fPhi2
)
return
-1;
53
return
TMath::Floor((
fPhi2
- phi) /
fPadDphi
);
54
}
55
// -------------------------------------------------------------------------
56
57
58
// ----- Public method GetChannel --------------------------------------
59
CbmMuchPadRadial
*
CbmMuchSectorRadial::GetPadByPhi
(Double_t phi)
60
{
61
Int_t i =
GetPadIndexByPhi
(phi);
62
// printf("i=%i\n",i);
63
if
(i == -1)
return
nullptr
;
64
65
return
(
CbmMuchPadRadial
*)
GetPadByChannelIndex
(i);
66
}
67
// -------------------------------------------------------------------------
68
69
70
// -------------------------------------------------------------------------
71
void
CbmMuchSectorRadial::AddPads
()
72
{
73
for
(Int_t iChannel = 0; iChannel <
fNChannels
; iChannel++) {
74
UInt_t address =
CbmMuchAddress::SetElementId
(
fAddress
,
kMuchChannel
, iChannel);
75
Double_t r1, r2, phi1, phi2;
76
r1 =
fR1
;
77
r2 =
fR2
;
78
phi1 =
fPhi2
- iChannel *
fPadDphi
;
79
phi2 = phi1 -
fPadDphi
;
80
CbmMuchPad
* pad =
new
CbmMuchPadRadial
(address, r1, r2, phi1, phi2);
81
fPads
.push_back(pad);
82
LOG(debug) <<
"iChannel="
<< iChannel <<
" fPads.size()="
<<
fPads
.size() <<
" fNChannels="
<<
fNChannels
;
83
}
84
}
85
// -------------------------------------------------------------------------
86
87
// -------------------------------------------------------------------------
88
void
CbmMuchSectorRadial::DrawPads
()
89
{
90
for
(Int_t iChannel = 0; iChannel <
fNChannels
; iChannel++) {
91
CbmMuchPadRadial
* pad = (
CbmMuchPadRadial
*)
fPads
[iChannel];
92
pad->
DrawPad
();
93
// pad->Draw();
94
}
95
}
96
// -------------------------------------------------------------------------
97
98
99
ClassImp
(
CbmMuchSectorRadial
)
ClassImp
ClassImp(CbmConverterManager)
CbmMuchAddress.h
kMuchChannel
@ kMuchChannel
Channel.
Definition
CbmMuchAddress.h:28
CbmMuchPadRadial.h
CbmMuchSectorRadial.h
CbmMuchAddress::SetElementId
static uint32_t SetElementId(uint32_t address, int32_t level, int32_t newId)
Definition
CbmMuchAddress.cxx:112
CbmMuchPadRadial
Definition
CbmMuchPadRadial.h:21
CbmMuchPadRadial::DrawPad
void DrawPad()
Definition
CbmMuchPadRadial.cxx:49
CbmMuchPad
Definition
CbmMuchPad.h:25
CbmMuchSectorRadial
Definition
CbmMuchSectorRadial.h:23
CbmMuchSectorRadial::DrawPads
void DrawPads()
Definition
CbmMuchSectorRadial.cxx:88
CbmMuchSectorRadial::fPhi2
Double_t fPhi2
Definition
CbmMuchSectorRadial.h:39
CbmMuchSectorRadial::fR2
Double_t fR2
Definition
CbmMuchSectorRadial.h:37
CbmMuchSectorRadial::AddPads
void AddPads()
Definition
CbmMuchSectorRadial.cxx:71
CbmMuchSectorRadial::fPadDphi
Double_t fPadDphi
Definition
CbmMuchSectorRadial.h:40
CbmMuchSectorRadial::CbmMuchSectorRadial
CbmMuchSectorRadial()
Definition
CbmMuchSectorRadial.cxx:26
CbmMuchSectorRadial::fR1
Double_t fR1
Definition
CbmMuchSectorRadial.h:36
CbmMuchSectorRadial::fPhi1
Double_t fPhi1
Definition
CbmMuchSectorRadial.h:38
CbmMuchSectorRadial::GetPadByPhi
CbmMuchPadRadial * GetPadByPhi(Double_t phi)
Definition
CbmMuchSectorRadial.cxx:59
CbmMuchSectorRadial::GetPadIndexByPhi
Int_t GetPadIndexByPhi(Double_t phi)
Definition
CbmMuchSectorRadial.cxx:49
CbmMuchSector
Definition
CbmMuchSector.h:26
CbmMuchSector::GetPadByChannelIndex
CbmMuchPad * GetPadByChannelIndex(Int_t iChannel) const
Definition
CbmMuchSector.cxx:27
CbmMuchSector::fAddress
UInt_t fAddress
Definition
CbmMuchSector.h:40
CbmMuchSector::fPads
std::vector< CbmMuchPad * > fPads
Definition
CbmMuchSector.h:42
CbmMuchSector::fNChannels
Int_t fNChannels
Definition
CbmMuchSector.h:41
core
detectors
much
CbmMuchSectorRadial.cxx
Generated on Sun Dec 22 2024 23:04:09 for CbmRoot by
1.12.0