CbmRoot
Loading...
Searching...
No Matches
CbmMuchModuleGemRadial.cxx
Go to the documentation of this file.
1/* Copyright (C) 2011-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
13
14#include "CbmMuchPad.h" // for CbmMuchPad
15#include "CbmMuchPadRadial.h" // for CbmMuchPadRadial
16#include "CbmMuchSectorRadial.h" // for CbmMuchSectorRadial
17
18#include <Logger.h> // for LOG
19
20#include <TVector3.h> // for TVector3
21
22#include <algorithm> // for upper_bound
23#include <vector> // for vector<>::iterator, vector
24
25using std::vector;
26
27// -------------------------------------------------------------------------
30 , fSectorRadii()
31 , fDx1(0.)
32 , fDx2(0.)
33 , fDy(0.)
34 , fDz(0.)
35{
36}
37// -------------------------------------------------------------------------
38
39
40// -------------------------------------------------------------------------
41CbmMuchModuleGemRadial::CbmMuchModuleGemRadial(Int_t DetType, Int_t iStation, Int_t iLayer, Bool_t iSide, Int_t iModule,
42 TVector3 pos, Double_t dx1, Double_t dx2, Double_t dy, Double_t dz,
43 Double_t cutRadius)
44 : CbmMuchModuleGem(iStation, iLayer, iSide, iModule, pos, TVector3(dx1 + dx2, 2 * dy, 2 * dz), cutRadius)
45 , fSectorRadii()
46 , fDx1(dx1)
47 , fDx2(dx2)
48 , fDy(dy)
49 , fDz(dz)
50 , fDetType(DetType)
51{
53}
54// -------------------------------------------------------------------------
55
56
57// -------------------------------------------------------------------------
59{
60 vector<Double_t>::iterator i0, ie, i;
61 i0 = fSectorRadii.begin();
62 ie = fSectorRadii.end();
63 i = upper_bound(i0, ie, r);
64 return i - i0 - 1 >= 0 ? (CbmMuchSectorRadial*) fSectors[i - i0 - 1] : nullptr;
65}
66// -------------------------------------------------------------------------
67
68
69// -------------------------------------------------------------------------
71{
72 TVector3 v = TVector3(x, y, 0);
74 return sector->GetPadByPhi(v.Phi());
75}
76// -------------------------------------------------------------------------
77
78
79// -------------------------------------------------------------------------
81{
82 for (Int_t s = 0; s < GetNSectors(); s++) {
84 if (!sector) continue;
85 fSectorRadii.push_back(sector->GetR1());
86 sector->AddPads();
87 }
88 vector<CbmMuchPad*> neighbours;
89 for (Int_t s = 0; s < GetNSectors(); s++) {
91 if (!sector) continue;
92 for (Int_t p = 0; p < sector->GetNChannels(); p++) {
94 if (!pad) continue;
95 if (p > 0) neighbours.push_back(sector->GetPadByChannelIndex(p - 1));
96 if (p < sector->GetNChannels() - 1) neighbours.push_back(sector->GetPadByChannelIndex(p + 1));
97 CbmMuchSectorRadial* sec1 = s > 0 ? (CbmMuchSectorRadial*) GetSectorByIndex(s - 1) : 0;
99 Double_t phi1 = pad->GetPhi1() - 0.001;
100 Double_t phi2 = pad->GetPhi2() + 0.001;
101 if (sec1) {
102 CbmMuchPad* pad11 = sec1->GetPadByPhi(phi1);
103 CbmMuchPad* pad12 = sec1->GetPadByPhi(phi2);
104 Int_t iMin = (pad11) ? pad11->GetChannelIndex() : 0;
105 Int_t iMax = (pad12) ? pad12->GetChannelIndex() : sec1->GetNChannels() - 1;
106 for (Int_t i = iMin; i <= iMax; i++)
107 neighbours.push_back(sec1->GetPadByChannelIndex(i));
108 }
109 if (sec2) {
110 CbmMuchPad* pad21 = sec2->GetPadByPhi(phi1);
111 CbmMuchPad* pad22 = sec2->GetPadByPhi(phi2);
112 Int_t iMin = (pad21) ? pad21->GetChannelIndex() : 0;
113 Int_t iMax = (pad22) ? pad22->GetChannelIndex() : sec2->GetNChannels() - 1;
114 for (Int_t i = iMin; i <= iMax; i++)
115 neighbours.push_back(sec2->GetPadByChannelIndex(i));
116 }
117 pad->SetNeighbours(neighbours);
118 neighbours.clear();
119 }
120 }
121 LOG(debug4) << "Init module successful";
122 return kTRUE;
123}
124// -------------------------------------------------------------------------
125
ClassImp(CbmConverterManager)
fscal v[fmask::Size]
Definition KfSimdPseudo.h:4
std::vector< Double_t > fSectorRadii
CbmMuchPadRadial * GetPad(Double_t x, Double_t y)
CbmMuchSectorRadial * GetSectorByRadius(Double_t r)
std::vector< CbmMuchSector * > fSectors
CbmMuchSector * GetSectorByIndex(Int_t iSector)
Int_t GetNSectors() const
Double_t GetPhi2() const
Double_t GetPhi1() const
void SetNeighbours(std::vector< CbmMuchPad * > neighbours)
Definition CbmMuchPad.h:43
Int_t GetChannelIndex()
Definition CbmMuchPad.h:49
CbmMuchPadRadial * GetPadByPhi(Double_t phi)
Int_t GetNChannels() const
CbmMuchPad * GetPadByChannelIndex(Int_t iChannel) const