CbmRoot
CbmMuchSectorRectangular.cxx
Go to the documentation of this file.
2 
3 #include "CbmMuchAddress.h" // for CbmMuchAddress, kMuchChannel
4 #include "CbmMuchPadRectangular.h" // for CbmMuchPadRectangular
5 
6 #include <TPave.h> // for TPave
7 #include <TVector3.h> // for TVector3
8 
9 // ----- Default constructor -------------------------------------------
11  : CbmMuchSector()
12  , TPave()
13  , fPosition()
14  , fSize()
15  , fPadNx(0)
16  , fPadNy(0)
17  , fPadDx(0)
18  , fPadDy(0)
19  , fNeighbours() {}
20 // -------------------------------------------------------------------------
21 
22 
23 // ----- Standard constructor --------------------------------------------
25  UInt_t index,
26  TVector3 pos,
27  TVector3 size,
28  Int_t padNx,
29  Int_t padNy)
30  : CbmMuchSector(modAddress, index, padNx * padNy)
31  , TPave(pos[0] - size[0] / 2,
32  pos[1] - size[1] / 2,
33  pos[0] + size[0] / 2,
34  pos[1] + size[1] / 2,
35  1)
36  , fPosition(pos)
37  , fSize(size)
38  , fPadNx(padNx)
39  , fPadNy(padNy)
40  , fPadDx(fSize[0] / padNx)
41  , fPadDy(fSize[1] / padNy)
42  , fNeighbours() {}
43 // -------------------------------------------------------------------------
44 
46  Double_t y) {
47  Int_t ix = Int_t((x - GetXmin()) / fPadDx);
48  Int_t iy = Int_t((y - GetYmin()) / fPadDy);
49  if (ix < 0 || ix >= fPadNx) return nullptr;
50  if (iy < 0 || iy >= fPadNy) return nullptr;
51  Int_t channelIndex = fPadNy * ix + iy;
52  return (CbmMuchPadRectangular*) fPads[channelIndex];
53 }
54 
55 
56 // -------------------------------------------------------------------------
58  for (Int_t ix = 0; ix < fPadNx; ix++) {
59  for (Int_t iy = 0; iy < fPadNy; iy++) {
60  Int_t channelIndex = fPadNy * ix + iy;
61  UInt_t address =
63  Double_t x0 = GetXmin() + (ix + 0.5) * fPadDx;
64  Double_t y0 = GetYmin() + (iy + 0.5) * fPadDy;
66  new CbmMuchPadRectangular(address, x0, y0, fPadDx, fPadDy);
67  fPads.push_back(pad);
68  }
69  }
70 }
71 // -------------------------------------------------------------------------
72 
73 // -------------------------------------------------------------------------
75  for (Int_t iChannel = 0; iChannel < fNChannels; iChannel++) {
77  if (!pad) return;
78  pad->DrawPad();
79  }
80 }
81 // -------------------------------------------------------------------------
82 
83 
CbmMuchSectorRectangular::GetPad
CbmMuchPadRectangular * GetPad(Double_t x, Double_t y)
Definition: CbmMuchSectorRectangular.cxx:45
kMuchChannel
@ kMuchChannel
Channel.
Definition: CbmMuchAddress.h:22
CbmMuchSectorRectangular::CbmMuchSectorRectangular
CbmMuchSectorRectangular()
Definition: CbmMuchSectorRectangular.cxx:10
CbmMuchSector
Definition: CbmMuchSector.h:22
CbmMuchSectorRectangular::DrawPads
void DrawPads()
Definition: CbmMuchSectorRectangular.cxx:74
CbmMuchSectorRectangular::fPadDy
Double_t fPadDy
Definition: CbmMuchSectorRectangular.h:66
CbmMuchSectorRectangular::GetXmin
Double_t GetXmin() const
Definition: CbmMuchSectorRectangular.h:43
CbmMuchSectorRectangular.h
CbmMuchSector::fNChannels
Int_t fNChannels
Definition: CbmMuchSector.h:39
CbmMuchSectorRectangular::fPadNy
Int_t fPadNy
Definition: CbmMuchSectorRectangular.h:64
CbmMuchSectorRectangular
Definition: CbmMuchSectorRectangular.h:24
CbmMuchSector::fAddress
UInt_t fAddress
Definition: CbmMuchSector.h:38
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMuchAddress::SetElementId
static UInt_t SetElementId(UInt_t address, Int_t level, Int_t newId)
Definition: CbmMuchAddress.h:140
CbmMuchSector::fPads
std::vector< CbmMuchPad * > fPads
Definition: CbmMuchSector.h:40
CbmMuchPadRectangular.h
CbmMuchAddress.h
CbmMuchSectorRectangular::fPadNx
Int_t fPadNx
Definition: CbmMuchSectorRectangular.h:63
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmMuchSectorRectangular::AddPads
void AddPads()
Definition: CbmMuchSectorRectangular.cxx:57
CbmMuchPadRectangular
Definition: CbmMuchPadRectangular.h:21
CbmMuchSectorRectangular::fPadDx
Double_t fPadDx
Definition: CbmMuchSectorRectangular.h:65
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
pos
TVector3 pos
Definition: CbmMvdSensorDigiToHitTask.cxx:60
CbmMuchPadRectangular::DrawPad
void DrawPad()
Definition: CbmMuchPadRectangular.cxx:52
CbmMuchSectorRectangular::GetYmin
Double_t GetYmin() const
Definition: CbmMuchSectorRectangular.h:44