29 , fUseModuleDesign(kFALSE)
43 TVector3 position, TVector3
size, Double_t cutRadius)
45 , fUseModuleDesign(kFALSE)
60 if (ix < 0 || ix >=
fGridNx)
return nullptr;
61 if (iy < 0 || iy >=
fGridNy)
return nullptr;
62 Long64_t iSector =
fGrid[ix][iy];
63 if (iSector == -1)
return nullptr;
80 Double_t mlx =
fSize[0];
81 Double_t msx = mx0 > 0 ? +1 : -1;
82 Double_t mx1 = mx0 - msx * mlx / 2;
83 return Int_t((
x - mx1) / msx /
fGridDx);
91 Double_t mly =
fSize[1];
92 Double_t msy = my0 > 0 ? +1 : -1;
93 Double_t my1 = my0 - msy * mly / 2;
94 return Int_t((
y - my1) / msy /
fGridDy);
102 if (!sector)
return nullptr;
112 if (!nSectors)
return kFALSE;
117 Double_t mlx =
fSize[0];
118 Double_t mly =
fSize[1];
119 Double_t msx = mx0 > 0 ? +1 : -1;
120 Double_t msy = my0 > 0 ? +1 : -1;
121 Double_t mx1 = mx0 - msx * mlx / 2;
122 Double_t my1 = my0 - msy * mly / 2;
125 fGridDx = std::numeric_limits<Double_t>::max();
126 fGridDy = std::numeric_limits<Double_t>::max();
127 for (Int_t iSector = 0; iSector < nSectors; iSector++) {
142 for (Int_t ix = 0; ix <
fGridNx; ix++) {
144 for (Int_t iy = 0; iy <
fGridNy; iy++) {
145 Double_t
x = mx1 + msx *
fGridDx * (ix + 1e-3);
146 Double_t
y = my1 + msy *
fGridDy * (iy + 1e-3);
148 for (
int iSector = 0; iSector < nSectors; iSector++) {
164 vector<CbmMuchSectorRectangular*> neighbours;
165 vector<CbmMuchSectorRectangular*>::iterator it;
166 for (Int_t iSector = 0; iSector <
GetNSectors(); iSector++) {
168 Double_t x1 = sector->GetX1() - 1e-3;
169 Double_t x2 = sector->GetX2() + 1e-3;
170 Double_t y1 = sector->GetY1() - 1e-3;
171 Double_t y2 = sector->GetY2() + 1e-3;
176 Double_t ixmin = (ix1 < ix2) ? ix1 : ix2;
177 Double_t ixmax = (ix1 < ix2) ? ix2 : ix1;
178 Double_t iymin = (iy1 < iy2) ? iy1 : iy2;
179 Double_t iymax = (iy1 < iy2) ? iy2 : iy1;
180 if (ixmin < 0) ixmin = 0;
182 if (iymin < 0) iymin = 0;
185 for (Int_t ix = ixmin; ix <= ixmax; ix++) {
186 for (Int_t iy = iymin; iy <= iymax; iy++) {
187 Int_t iSec =
fGrid[ix][iy];
188 if (iSec < 0)
continue;
189 if (iSec == iSector)
continue;
191 it = find(neighbours.begin(), neighbours.end(), sec);
192 if (it == neighbours.end()) neighbours.push_back(sec);
204 vector<CbmMuchPad*>::iterator it;
205 vector<CbmMuchPad*> neighbours;
208 for (Int_t iSector = 0; iSector <
GetNSectors(); iSector++) {
210 if (!sector)
continue;
211 Double_t mindx = sector->
GetPadDx();
212 Double_t mindy = sector->
GetPadDy();
213 vector<CbmMuchSectorRectangular*> neighbourSectors = sector->
GetNeighbours();
214 for (UInt_t iSec = 0; iSec < neighbourSectors.size(); iSec++) {
218 if (dx < mindx) mindx = dx;
219 if (dy < mindy) mindy = dy;
222 for (Int_t iChannel = 0; iChannel < sector->
GetNChannels(); iChannel++) {
224 Double_t x1 = pad->GetX1();
225 Double_t x2 = pad->GetX2();
226 Double_t y1 = pad->GetY1();
227 Double_t y2 = pad->GetY2();
228 for (Double_t
x = x1 - mindx / 2;
x < x2 + mindx / 2 + 1e-3;
x += mindx) {
229 for (Double_t
y = y1 - mindy / 2;
y < y2 + mindy / 2 + 1e-3;
y += mindy) {
232 if (p == pad)
continue;
233 it = find(neighbours.begin(), neighbours.end(), p);
234 if (it == neighbours.end()) neighbours.push_back(p);
247 Bool_t useModuleDesign = TMath::Abs(
fPosition[0]) > 1e-5 || TMath::Abs(
fPosition[1]) > 1e-5;
248 if (!
InitGrid(useModuleDesign))
return kFALSE;
250 for (Int_t iSector = 0; iSector <
GetNSectors(); iSector++) {
252 if (!sector)
continue;
ClassImp(CbmConverterManager)
static constexpr size_t size()
virtual Bool_t InitModule()
Bool_t InitGrid(Bool_t useModuleDesign)
CbmMuchModuleGemRectangular()
CbmMuchSectorRectangular * GetSector(Double_t x, Double_t y)
std::vector< std::vector< Int_t > > fGrid
void InitNeighbourSectors()
Int_t GetGridIndexX(Double_t x)
Int_t GetGridIndexY(Double_t y)
CbmMuchPadRectangular * GetPad(Double_t x, Double_t y)
std::vector< CbmMuchSector * > fSectors
Int_t GetNSectors() const
void SetNeighbours(std::vector< CbmMuchPad * > neighbours)
CbmMuchPadRectangular * GetPad(Double_t x, Double_t y)
std::vector< CbmMuchSectorRectangular * > GetNeighbours()
Double_t GetPadDx() const
Double_t GetPadDy() const
void SetNeighbours(std::vector< CbmMuchSectorRectangular * > neighbours)
Bool_t Inside(Double_t x, Double_t y)
Int_t GetNChannels() const
CbmMuchPad * GetPadByChannelIndex(Int_t iChannel) const
UInt_t GetSectorIndex() const