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