CbmRoot
Bins.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: Bins.h
9  * Author: tablyaz
10  *
11  * Created on August 3, 2017, 4:01 PM
12  */
13 
14 #ifndef BINS_H
15 #define BINS_H
16 
17 #include "CbmDefs.h"
18 #include "CbmPixelHit.h"
19 #include <cmath>
20 #include <limits>
21 #include <list>
22 
23 class CbmXBin;
24 
25 class CbmTBin {
26 public:
27  struct HitHolder {
29  const CbmPixelHit* hit;
30  Int_t index;
31  bool use;
33  //std::list<HitHolder*> children;
34  char stage;
35  std::list<void*> tracks;
36 
37  void SetUse(bool v) {
38  use = v;
39  bin.SetUseRc(v);
40  }
41  };
42 
43 public:
44  explicit CbmTBin(CbmXBin* owner) : fOwner(owner), fUse(false), fHits() {}
45  CbmTBin(const CbmTBin&) = delete;
46  CbmTBin& operator=(const CbmTBin&) = delete;
47  bool Use() const { return fUse; }
48  void SetUse(bool v) { fUse = v; }
49  void SetUseRc(bool v);
50  std::list<HitHolder>::iterator HitsBegin() { return fHits.begin(); }
51  std::list<HitHolder>::iterator HitsEnd() { return fHits.end(); }
52  void Clear() { fHits.clear(); }
53  void
54  AddHit(ECbmModuleId type, const CbmPixelHit* hit, Int_t index, bool use) {
55  fHits.push_back(
56  {type, hit, index, use, *this, std::numeric_limits<char>::max(), {}});
57  }
58 
59 private:
61  bool fUse;
62  std::list<HitHolder> fHits;
63 };
64 
65 class CbmYBin;
66 
67 class CbmXBin {
68 public:
69  CbmXBin(CbmYBin* owner, int nofTBins)
70  : fOwner(owner)
71  , fUse(false)
72  , fTBins(reinterpret_cast<CbmTBin*>(
73  new unsigned char[nofTBins * sizeof(CbmTBin)])) {
74  for (int i = 0; i < nofTBins; ++i)
75  new (&fTBins[i]) CbmTBin(this);
76  }
77 
78  CbmXBin(const CbmXBin&) = delete;
79  CbmXBin& operator=(const CbmXBin&) = delete;
80  bool Use() const { return fUse; }
81  void SetUse(bool v) { fUse = v; }
82  void SetUseRc(bool v);
83 
84  CbmTBin& operator[](int i) { return fTBins[i]; }
85 
86 private:
88  bool fUse;
90  //int fNofTBins;
91 };
92 
93 inline void CbmTBin::SetUseRc(bool v) {
94  fUse = v;
95  fOwner->SetUseRc(v);
96 }
97 
98 class CbmZBin;
99 
100 class CbmYBin {
101 public:
102  CbmYBin(CbmZBin* owner, int nofXBins, int nofTBins)
103  : fOwner(owner)
104  , fUse(false)
105  , fXBins(reinterpret_cast<CbmXBin*>(
106  new unsigned char[nofXBins * sizeof(CbmXBin)]))
107  // fNofXBins(nofXBins)
108  {
109  for (int i = 0; i < nofXBins; ++i)
110  new (&fXBins[i]) CbmXBin(this, nofTBins);
111  }
112 
113  CbmYBin(const CbmYBin&) = delete;
114  CbmYBin& operator=(const CbmYBin&) = delete;
115  bool Use() const { return fUse; }
116  void SetUse(bool v) { fUse = v; }
117  void SetUseRc(bool v);
118 
119  CbmXBin& operator[](int i) { return fXBins[i]; }
120 
121 private:
123  bool fUse;
125  //int fNofXBins; (VF) unused
126 };
127 
128 inline void CbmXBin::SetUseRc(bool v) {
129  fUse = v;
130  fOwner->SetUseRc(v);
131 }
132 
133 class CbmZBin {
134 public:
135  explicit CbmZBin(int nofYBins, int nofXBins, int nofTBins)
136  : fUse(false)
137  , fYBins(reinterpret_cast<CbmYBin*>(
138  new unsigned char[nofYBins * sizeof(CbmYBin)])) {
139  for (int i = 0; i < nofYBins; ++i)
140  new (&fYBins[i]) CbmYBin(this, nofXBins, nofTBins);
141  }
142 
143  CbmZBin(const CbmZBin&) = delete;
144  CbmZBin& operator=(const CbmZBin&) = delete;
145  bool Use() const { return fUse; }
146  void SetUse(bool v) { fUse = v; }
147 
148  CbmYBin& operator[](int i) { return fYBins[i]; }
149 
150 private:
151  bool fUse;
153  // int fNofYBins; (VF) unused
154 };
155 
156 inline void CbmYBin::SetUseRc(bool v) {
157  fUse = v;
158 
159  if (fOwner) fOwner->SetUse(v);
160 }
161 
162 #endif /* BINS_H */
CbmYBin::CbmYBin
CbmYBin(const CbmYBin &)=delete
CbmXBin
Definition: Bins.h:67
CbmTBin::SetUseRc
void SetUseRc(bool v)
Definition: Bins.h:93
CbmXBin::operator[]
CbmTBin & operator[](int i)
Definition: Bins.h:84
CbmYBin
Definition: Bins.h:100
CbmTBin::HitHolder::use
bool use
Definition: Bins.h:31
CbmYBin::operator[]
CbmXBin & operator[](int i)
Definition: Bins.h:119
CbmTBin::HitHolder::tracks
std::list< void * > tracks
Definition: Bins.h:35
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmYBin::SetUse
void SetUse(bool v)
Definition: Bins.h:116
CbmZBin::fYBins
CbmYBin * fYBins
Definition: Bins.h:152
CbmTBin::fHits
std::list< HitHolder > fHits
Definition: Bins.h:62
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmTBin::fUse
bool fUse
Definition: Bins.h:61
CbmXBin::CbmXBin
CbmXBin(CbmYBin *owner, int nofTBins)
Definition: Bins.h:69
CbmTBin::HitHolder::hit
const CbmPixelHit * hit
Definition: Bins.h:29
CbmTBin::fOwner
CbmXBin * fOwner
Definition: Bins.h:60
CbmYBin::fUse
bool fUse
Definition: Bins.h:123
CbmZBin::CbmZBin
CbmZBin(const CbmZBin &)=delete
CbmZBin::CbmZBin
CbmZBin(int nofYBins, int nofXBins, int nofTBins)
Definition: Bins.h:135
CbmXBin::operator=
CbmXBin & operator=(const CbmXBin &)=delete
CbmTBin::Use
bool Use() const
Definition: Bins.h:47
CbmYBin::SetUseRc
void SetUseRc(bool v)
Definition: Bins.h:156
CbmTBin::HitHolder
Definition: Bins.h:27
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
CbmZBin::operator=
CbmZBin & operator=(const CbmZBin &)=delete
CbmTBin::operator=
CbmTBin & operator=(const CbmTBin &)=delete
CbmPixelHit.h
CbmXBin::fOwner
CbmYBin * fOwner
Definition: Bins.h:87
CbmTBin::AddHit
void AddHit(ECbmModuleId type, const CbmPixelHit *hit, Int_t index, bool use)
Definition: Bins.h:54
CbmZBin::fUse
bool fUse
Definition: Bins.h:151
CbmYBin::fXBins
CbmXBin * fXBins
Definition: Bins.h:124
CbmXBin::SetUse
void SetUse(bool v)
Definition: Bins.h:81
CbmTBin::HitsBegin
std::list< HitHolder >::iterator HitsBegin()
Definition: Bins.h:50
CbmZBin::operator[]
CbmYBin & operator[](int i)
Definition: Bins.h:148
CbmYBin::fOwner
CbmZBin * fOwner
Definition: Bins.h:122
CbmTBin::HitHolder::bin
CbmTBin & bin
Definition: Bins.h:32
CbmTBin::CbmTBin
CbmTBin(const CbmTBin &)=delete
CbmXBin::fUse
bool fUse
Definition: Bins.h:88
CbmYBin::operator=
CbmYBin & operator=(const CbmYBin &)=delete
v
__m128 v
Definition: L1/vectors/P4_F32vec4.h:1
CbmTBin::CbmTBin
CbmTBin(CbmXBin *owner)
Definition: Bins.h:44
CbmTBin::HitHolder::index
Int_t index
Definition: Bins.h:30
CbmXBin::Use
bool Use() const
Definition: Bins.h:80
CbmPixelHit
Definition: CbmPixelHit.h:21
CbmYBin::CbmYBin
CbmYBin(CbmZBin *owner, int nofXBins, int nofTBins)
Definition: Bins.h:102
CbmTBin::HitHolder::SetUse
void SetUse(bool v)
Definition: Bins.h:37
CbmTBin::HitHolder::stage
char stage
Definition: Bins.h:34
CbmXBin::CbmXBin
CbmXBin(const CbmXBin &)=delete
max
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:36
CbmTBin
Definition: Bins.h:25
CbmYBin::Use
bool Use() const
Definition: Bins.h:115
CbmTBin::HitHolder::type
ECbmModuleId type
Definition: Bins.h:28
CbmXBin::SetUseRc
void SetUseRc(bool v)
Definition: Bins.h:128
CbmXBin::fTBins
CbmTBin * fTBins
Definition: Bins.h:89
CbmZBin
Definition: Bins.h:133
CbmZBin::SetUse
void SetUse(bool v)
Definition: Bins.h:146
CbmZBin::Use
bool Use() const
Definition: Bins.h:145
CbmDefs.h