CbmRoot
Station3D.h
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 
7 /*
8  * File: Station3D.h
9  * Author: tablyaz
10  *
11  * Created on August 7, 2017, 2:08 PM
12  */
13 
14 #ifndef STATION3D_H
15 #define STATION3D_H
16 
17 #include "Station.h"
18 #include <list>
19 #include <utility>
20 
22 public:
24  Double_t minZ,
25  Double_t maxZ,
26  int nofYBins,
27  int nofXBins,
28  int nofTBins)
29  : CbmBinnedStation(stationType, minZ, maxZ, nofYBins, nofXBins, nofTBins)
30  , fYBins(reinterpret_cast<CbmYBin*>(
31  new unsigned char[nofYBins * sizeof(CbmYBin)])) {
32  for (int i = 0; i < nofYBins; ++i)
33  new (&fYBins[i]) CbmYBin(0, nofXBins, nofTBins);
34  }
35 
36  void Clear() {
38 
39  for (int i = 0; i < fNofYBins; ++i) {
40  CbmYBin& yBin = fYBins[i];
41  yBin.SetUse(false);
42 
43  for (int j = 0; j < fNofXBins; ++j) {
44  CbmXBin& xBin = yBin[j];
45  xBin.SetUse(false);
46 
47  for (int k = 0; k < fNofTBins; ++k) {
48  CbmTBin& tBin = xBin[k];
49  tBin.SetUse(false);
50  tBin.Clear();
51  }
52  }
53  }
54  }
55 
56  void AddHit(ECbmModuleId type, const CbmPixelHit* hit, Int_t index) {
57  Double_t y = hit->GetY();
58 
59  if (y < fMinY || y >= fMaxY) return;
60 
61  Double_t x = hit->GetX();
62 
63  if (x < fMinX || x >= fMaxX) return;
64 
65  Double_t t = hit->GetTime();
66 
67  //if (t < fMinT || t >= fMaxT)
68  //return;
69 
70  int yInd = (y - fMinY) / fYBinSize;
71  int xInd = (x - fMinX) / fXBinSize;
72  int tInd = (t - fMinT) / fTBinSize;
73 
74  if (tInd < 0)
75  tInd = 0;
76  else if (tInd >= fNofTBins)
77  tInd = fNofTBins - 1;
78 
79  CbmYBin& yBin = fYBins[yInd];
80  CbmXBin& xBin = yBin[xInd];
81  CbmTBin& tBin = xBin[tInd];
82  tBin.AddHit(type, hit, index, fDefaultUse);
83  SetDx(hit->GetDx());
84  SetDy(hit->GetDy());
85  SetDt(hit->GetTimeError());
86 
87  if (fDefaultUse) {
88  yBin.SetUse(true);
89  xBin.SetUse(true);
90  tBin.SetUse(true);
91  }
92  }
93 
94  void IterateHits(std::function<void(CbmTBin::HitHolder&)> handleHit) {
95  for (int i = 0; i < fNofYBins; ++i) {
96  CbmYBin& yBin = fYBins[i];
97 
98  //if (!yBin.Use())
99  //continue;
100 
101  for (int j = 0; j < fNofXBins; ++j) {
102  CbmXBin& xBin = yBin[j];
103 
104  //if (!xBin.Use())
105  //continue;
106 
107  for (int k = 0; k < fNofTBins; ++k) {
108  CbmTBin& tBin = xBin[k];
109 
110  //if (!tBin.Use())
111  //continue;
112 
113  for (std::list<CbmTBin::HitHolder>::iterator hi = tBin.HitsBegin();
114  hi != tBin.HitsEnd();
115  ++hi) {
116  CbmTBin::HitHolder& hitHolder = *hi;
117 
118  if (fStage > hitHolder.stage) continue;
119 
120  handleHit(hitHolder);
121  }
122  }
123  }
124  }
125  }
126 
127  void SearchHits(const CbmTrackParam2& stateVec,
128  Double_t stateZ,
129  std::function<void(CbmTBin::HitHolder&)> handleHit);
130  void SearchHits(Segment& segment,
131  std::function<void(CbmTBin::HitHolder&)> handleHit);
132  void SearchHits(Double_t minZ,
133  Double_t maxZ,
134  Double_t minY,
135  Double_t maxY,
136  Double_t minX,
137  Double_t maxX,
138  Double_t minT,
139  Double_t maxT,
140  std::function<void(CbmTBin::HitHolder&)> handleHit);
141 
142 private:
145 
146 private:
148 };
149 
150 #endif /* STATION3D_H */
CbmXBin
Definition: Bins.h:67
CbmBinnedStation::fStage
char fStage
Definition: Station.h:647
CbmYBin
Definition: Bins.h:100
CbmBinnedStation::SetDt
void SetDt(Double_t v)
Definition: Station.h:473
CbmPixelHit::GetX
Double_t GetX() const
Definition: CbmPixelHit.h:83
CbmBinnedStation::fMinX
Double_t fMinX
Definition: Station.h:621
CbmBinnedStation::SetDx
void SetDx(Double_t v)
Definition: Station.h:455
CbmPixelHit::GetY
Double_t GetY() const
Definition: CbmPixelHit.h:84
CbmBinned3DStation::CbmBinned3DStation
CbmBinned3DStation(const CbmBinned3DStation &)=delete
CbmPixelHit::GetDx
Double_t GetDx() const
Definition: CbmPixelHit.h:85
CbmBinnedStation::fDefaultUse
bool fDefaultUse
Definition: Station.h:631
CbmBinnedStation::SetDy
void SetDy(Double_t v)
Definition: Station.h:464
CbmBinned3DStation::operator=
CbmBinned3DStation & operator=(const CbmBinned3DStation &)=delete
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmYBin::SetUse
void SetUse(bool v)
Definition: Bins.h:116
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmBinned3DStation::SearchHits
void SearchHits(const CbmTrackParam2 &stateVec, Double_t stateZ, std::function< void(CbmTBin::HitHolder &)> handleHit)
Definition: Station3D.cxx:12
CbmPixelHit::GetDy
Double_t GetDy() const
Definition: CbmPixelHit.h:86
CbmBinnedStation::fYBinSize
Double_t fYBinSize
Definition: Station.h:616
CbmHit::GetTimeError
Double_t GetTimeError() const
Definition: CbmHit.h:76
Station.h
CbmBinned3DStation::CbmBinned3DStation
CbmBinned3DStation(ECbmModuleId stationType, Double_t minZ, Double_t maxZ, int nofYBins, int nofXBins, int nofTBins)
Definition: Station3D.h:23
CbmBinnedStation::fXBinSize
Double_t fXBinSize
Definition: Station.h:617
CbmBinnedStation::fNofYBins
int fNofYBins
Definition: Station.h:613
CbmBinned3DStation::Clear
void Clear()
Definition: Station3D.h:36
CbmBinnedStation::fMinY
Double_t fMinY
Definition: Station.h:619
CbmBinnedStation
Definition: Station.h:29
CbmTBin::HitHolder
Definition: Bins.h:27
CbmHit::GetTime
Double_t GetTime() const
Definition: CbmHit.h:75
CbmTBin::Clear
void Clear()
Definition: Bins.h:52
CbmTBin::HitsEnd
std::list< HitHolder >::iterator HitsEnd()
Definition: Bins.h:51
CbmTBin::SetUse
void SetUse(bool v)
Definition: Bins.h:48
CbmBinnedStation::fMaxY
Double_t fMaxY
Definition: Station.h:620
CbmBinned3DStation::fYBins
CbmYBin * fYBins
Definition: Station3D.h:147
CbmBinned3DStation::IterateHits
void IterateHits(std::function< void(CbmTBin::HitHolder &)> handleHit)
Definition: Station3D.h:94
CbmBinned3DStation
Definition: Station3D.h:21
CbmBinned3DStation::AddHit
void AddHit(ECbmModuleId type, const CbmPixelHit *hit, Int_t index)
Definition: Station3D.h:56
CbmTrackParam2
Definition: CbmTrackParam2.h:68
CbmBinnedStation::fTBinSize
Double_t fTBinSize
Definition: Station.h:618
CbmTBin::AddHit
void AddHit(ECbmModuleId type, const CbmPixelHit *hit, Int_t index, bool use)
Definition: Bins.h:54
CbmXBin::SetUse
void SetUse(bool v)
Definition: Bins.h:81
CbmTBin::HitsBegin
std::list< HitHolder >::iterator HitsBegin()
Definition: Bins.h:50
CbmBinnedStation::fNofXBins
int fNofXBins
Definition: Station.h:614
CbmBinnedStation::fNofTBins
int fNofTBins
Definition: Station.h:615
Segment
Definition: CbmGlobalTrackingTof.cxx:106
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmPixelHit
Definition: CbmPixelHit.h:21
CbmTBin::HitHolder::stage
char stage
Definition: Bins.h:34
CbmBinnedStation::fMinT
Double_t fMinT
Definition: Station.h:623
CbmTBin
Definition: Bins.h:25
CbmBinnedStation::Clear
virtual void Clear()
Definition: Station.h:552
CbmBinnedStation::fMaxX
Double_t fMaxX
Definition: Station.h:622