CbmRoot
Loading...
Searching...
No Matches
CbmMuchModuleGem.cxx
Go to the documentation of this file.
1/* Copyright (C) 2008-2020 St. Petersburg Polytechnic University, St. Petersburg
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Mikhail Ryzhinskiy [committer], Evgeny Kryshen, Florian Uhlig */
4
13#include "CbmMuchModuleGem.h"
14
15#include "CbmMuchAddress.h" // for CbmMuchAddress
16#include "CbmMuchModule.h" // for CbmMuchModule
17#include "CbmMuchPad.h" // for CbmMuchPad
18#include "CbmMuchSector.h" // for CbmMuchSector
19
20#include <TVector3.h> // for TVector3
21
22#include <vector> // for vector
23
24using std::vector;
25
26// -------------------------------------------------------------------------
28// -------------------------------------------------------------------------
29
30
31// -------------------------------------------------------------------------
32CbmMuchModuleGem::CbmMuchModuleGem(Int_t iStation, Int_t iLayer, Bool_t iSide, Int_t iModule, TVector3 position,
33 TVector3 size, Double_t cutRadius)
34 : CbmMuchModule(iStation, iLayer, iSide, iModule, position, size, cutRadius)
35 , fSectors()
36{
37}
38// -------------------------------------------------------------------------
39
40
41// ----- Public method GetPads -------------------------------------------
42vector<CbmMuchPad*> CbmMuchModuleGem::GetPads()
43{
44 vector<CbmMuchPad*> pads;
45 for (Int_t iSector = 0; iSector < GetNSectors(); ++iSector) {
46 CbmMuchSector* sector = GetSectorByIndex(iSector);
47 if (!sector) continue;
48 for (Int_t iPad = 0; iPad < sector->GetNChannels(); ++iPad) {
49 CbmMuchPad* pad = sector->GetPadByChannelIndex(iPad);
50 if (!pad) continue;
51 pads.push_back(pad);
52 }
53 }
54 return pads;
55}
56// -------------------------------------------------------------------------
57
58
59// ----- Public method GetNPads ------------------------------------------
61{
62 Int_t nChannels = 0;
63 for (Int_t iSector = 0; iSector < GetNSectors(); ++iSector) {
64 CbmMuchSector* sector = GetSectorByIndex(iSector);
65 if (!sector) continue;
66 nChannels += sector->GetNChannels();
67 }
68 return nChannels;
69}
70// -------------------------------------------------------------------------
71
72
73// ----- Public method GetSector ---------------------------------------
75{
76 Int_t iSector = CbmMuchAddress::GetSectorIndex(address);
77 return (CbmMuchSector*) fSectors[iSector];
78}
79// -------------------------------------------------------------------------
80
81
82// ----- Public method GetPad -------------------------------------------
84{
85 CbmMuchSector* sector = GetSector(address);
86 Int_t iChannel = CbmMuchAddress::GetChannelIndex(address);
87 return sector ? sector->GetPadByChannelIndex(iChannel) : nullptr;
88}
89// -------------------------------------------------------------------------
90
91
92// -------------------------------------------------------------------------
94{
95 for (UInt_t s = 0; s < fSectors.size(); s++) {
96 // CbmMuchSector* sector = (CbmMuchSector*) fSectors[s];
97 // TODO
98 // sector->SetFillColor(color);
99 // sector->Draw("f");
100 // sector->Draw();
101 }
102}
103// -------------------------------------------------------------------------
104
105
106// -------------------------------------------------------------------------
108{
109 for (UInt_t s = 0; s < fSectors.size(); s++) {
110 CbmMuchSector* sector = (CbmMuchSector*) fSectors[s];
111 sector->DrawPads();
112 }
113}
114// -------------------------------------------------------------------------
115
116
117void CbmMuchModuleGem::SetPadFired(Int_t address, Int_t digiIndex, Int_t adcCharge)
118{
119 CbmMuchPad* pad = GetPad(address);
120 if (pad) pad->SetFired(digiIndex, adcCharge);
121}
ClassImp(CbmConverterManager)
static constexpr size_t size()
Definition KfSimdPseudo.h:2
static int32_t GetSectorIndex(int32_t address)
static int32_t GetChannelIndex(int32_t address)
std::vector< CbmMuchSector * > fSectors
void DrawModule(Color_t color)
CbmMuchSector * GetSectorByIndex(Int_t iSector)
Int_t GetNSectors() const
CbmMuchSector * GetSector(Int_t address)
void SetPadFired(Int_t address, Int_t digiIndex, Int_t adcCharge)
CbmMuchPad * GetPad(Int_t address)
std::vector< CbmMuchPad * > GetPads()
virtual void SetFired(Int_t, Int_t, Int_t=256)
Definition CbmMuchPad.h:46
Int_t GetNChannels() const
CbmMuchPad * GetPadByChannelIndex(Int_t iChannel) const
virtual void DrawPads()