CbmRoot
Loading...
Searching...
No Matches
CbmMuchSectorRectangular.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 */
4
6
7#include "CbmMuchAddress.h" // for CbmMuchAddress, kMuchChannel
8#include "CbmMuchPadRectangular.h" // for CbmMuchPadRectangular
9
10#include <TPave.h> // for TPave
11#include <TVector3.h> // for TVector3
12
13// ----- Default constructor -------------------------------------------
16 , TPave()
17 , fPosition()
18 , fSize()
19 , fPadNx(0)
20 , fPadNy(0)
21 , fPadDx(0)
22 , fPadDy(0)
23 , fNeighbours()
24{
25}
26// -------------------------------------------------------------------------
27
28
29// ----- Standard constructor --------------------------------------------
30CbmMuchSectorRectangular::CbmMuchSectorRectangular(UInt_t modAddress, UInt_t index, TVector3 pos, TVector3 size,
31 Int_t padNx, Int_t padNy)
32 : CbmMuchSector(modAddress, index, padNx * padNy)
33 , TPave(pos[0] - size[0] / 2, pos[1] - size[1] / 2, pos[0] + size[0] / 2, pos[1] + size[1] / 2, 1)
34 , fPosition(pos)
35 , fSize(size)
36 , fPadNx(padNx)
37 , fPadNy(padNy)
38 , fPadDx(fSize[0] / padNx)
39 , fPadDy(fSize[1] / padNy)
40 , fNeighbours()
41{
42}
43// -------------------------------------------------------------------------
44
46{
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{
59 for (Int_t ix = 0; ix < fPadNx; ix++) {
60 for (Int_t iy = 0; iy < fPadNy; iy++) {
61 Int_t channelIndex = fPadNy * ix + iy;
62 UInt_t address = CbmMuchAddress::SetElementId(fAddress, kMuchChannel, channelIndex);
63 Double_t x0 = GetXmin() + (ix + 0.5) * fPadDx;
64 Double_t y0 = GetYmin() + (iy + 0.5) * fPadDy;
65 CbmMuchPadRectangular* pad = new CbmMuchPadRectangular(address, x0, y0, fPadDx, fPadDy);
66 fPads.push_back(pad);
67 }
68 }
69}
70// -------------------------------------------------------------------------
71
72// -------------------------------------------------------------------------
74{
75 for (Int_t iChannel = 0; iChannel < fNChannels; iChannel++) {
77 if (!pad) return;
78 pad->DrawPad();
79 }
80}
81// -------------------------------------------------------------------------
82
83
ClassImp(CbmConverterManager)
@ kMuchChannel
Channel.
static constexpr size_t size()
Definition KfSimdPseudo.h:2
static uint32_t SetElementId(uint32_t address, int32_t level, int32_t newId)
CbmMuchPadRectangular * GetPad(Double_t x, Double_t y)
std::vector< CbmMuchPad * > fPads