Belle II Software  release-05-02-19
CellHit.h
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : CellHit.h
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a cell hit in CDC.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #ifndef TRGCDCCellHit_FLAG_
15 #define TRGCDCCellHit_FLAG_
16 
17 #include <string>
18 #include "CLHEP/Geometry/Point3D.h"
19 
20 #ifdef TRGCDC_SHORT_NAMES
21 #define TCCHit TRGCDCCellHit
22 #endif
23 
24 #define CellHitLeft 0
25 #define CellHitRight 1
26 
27 //...Masks for state()...
28 
29 #define CellHitTimeValid 1048576
30 #define CellHitChargeValid 2097152
31 #define CellHitFindingValid 4194304
32 #define CellHitFittingValid 0x40000000
33 #define CellHitAxial 8
34 #define CellHitStereo 48
35 
36 #define CellHitPatternLeft 256
37 #define CellHitPatternRight 512
38 #define CellHitIsolated 1024
39 #define CellHitContinuous 2048
40 #define CellHitNeighborHit 12
41 #define CellHitNeighborPatternMask 0x7f000
42 #define CellHitNeighborHit0 4096
43 #define CellHitNeighborHit1 8192
44 #define CellHitNeighborHit2 16384
45 #define CellHitNeighborHit3 32768
46 #define CellHitNeighborHit4 65536
47 #define CellHitNeighborHit5 131072
48 #define CellHitNeighborHit6 262144
49 
50 #define CellHitLocked 128
51 #define CellHitUsed 64
52 #define CellHitLeftMask 1
53 #define CellHitRightMask 2
54 #define CellHitMultiTrack 8388608
55 #define CellHitConformalFinder 16777216
56 #define CellHitCurlFinder 33554432
57 #define CellHitClustFinder 67108864
58 #define CellHitHoughFinder 67108864
59 #define CellHitTrackManager 134217728
60 #define CellHitInvalidForFit 268435456
61 #define CellHitFastFinder 536870912
62 
63 namespace Belle2 {
69  class CDCHit;
70  class CDCSimHit;
71  class MCParticle;
72  class TRGCDCCell;
73 
75  class TRGCDCCellHit {
76 
77  public:
78 
80  explicit TRGCDCCellHit(const TRGCDCCell&,
81  unsigned indexCDCHit = 0,
82  unsigned indexCDCSimHit = 0,
83  unsigned indexMCParticle = 0,
84  float driftLeft = 0,
85  float driftLeftError = 0,
86  float driftRight = 0,
87  float driftRightError = 0,
88  int mcLRflag = 0,
89  float fudgeFacgtor = 1);
90 
92  virtual ~TRGCDCCellHit();
93 
94  public:// Selectors
95 
97  virtual void dump(const std::string& message = std::string(""),
98  const std::string& prefix = std::string("")) const;
99 
101  int mcLR(void) const;
102 
104  virtual const TRGCDCCell& cell(void) const;
105 
107  unsigned state(void) const;
108 
110  float drift(unsigned) const;
111 
113  float dDrift(unsigned) const;
114 
116  float drift(void) const;
117 
119  float dDrift(void) const;
120 
122  const HepGeom::Point3D<double>& xyPosition(void) const;
123 
125  HepGeom::Point3D<double> position(unsigned) const;
126 
128  const void* track(void) const;
129 
132  unsigned sequence(void) const;
133 
135  unsigned iCDCHit(void) const;
136 
138  unsigned iCDCSimHit(void) const;
139 
141  unsigned iMCParticle(void) const;
142 
144  const CDCHit* hit(void) const;
145 
147  const CDCSimHit* simHit(void) const;
148 
150  const MCParticle* mcParticle(void) const;
151 
152  public:// Modifiers
154  unsigned state(unsigned newState);
155 
157  unsigned state(unsigned newState) const;
158 
160  const void* track(const void*);
161 
163  const void* track(const void*) const;
164 
166  unsigned sequence(unsigned) const;
167 
169  void setDriftTime(double driftTime, unsigned i);
170 
171  public:// Static utility functions
172 
174  static int sortById(const TRGCDCCellHit** a, const TRGCDCCellHit** b);
175 
176  private:
177 
179  int _mcLR;
180 
182  mutable unsigned _state;
184  float _drift[2]; // 0:left, 1:right
186  float _driftError[2];
192  mutable const void* _track;
194  mutable unsigned _sequentialLength;
195 
197  unsigned _iCDCHit;
198 
200  unsigned _iCDCSimHit;
201 
203  unsigned _iMCParticle;
204 
205  // _state bit definition
206 
207  // Pre-detemined
208  // 20 : drift time valid
209  // 21 : charge(dE/dx) valid
210  // 22 : valid for finding
211  // 30 : valid for fit
212  // 3 : axial hit
213  // 4, 5 : stereo hit
214 
215  // Hit pattern
216  // 8 : hit pattern left
217  // 9 : hit pattern right
218  // 10 : isolated hit pattern
219  // 11 : continuous hit pattern
220  // 12 : neighbor hit 0
221  // 13 : neighbor hit 1
222  // 14 : neighbor hit 2
223  // 15 : neighbor hit 3
224  // 16 : neighbor hit 4
225  // 17 : neighbor hit 5
226  // 18 : neighbor hit 6
227 
228  // Tracking results
229  // 7 : locked
230  // 6 : used for tracking
231  // 0 : left hit
232  // 1 : right hit
233  // 23 : shared by multi-track
234  // 24 : found by conforaml finder
235  // 25 : found by curl finder
236  // 26 : found by clust finder
237  // 27 : found by track manager
238  // 28 : NOT valid for fitting
239 
240  // Fitting results
241  };
242 
243 //-----------------------------------------------------------------------------
244 
245  inline
246  int TRGCDCCellHit::mcLR(void) const
247  {
248  return _mcLR;
249  }
250 
251  inline
252  const TRGCDCCell&
254  {
255  return _cell;
256  }
257 
258  inline
259  unsigned
261  {
262  return _state;
263  }
264 
265  inline
266  float
267  TRGCDCCellHit::drift(unsigned i) const
268  {
269  if (i) return _drift[1];
270  return _drift[0];
271  }
272 
273  inline
274  float
275  TRGCDCCellHit::dDrift(unsigned i) const
276  {
277  if (i) return _driftError[1];
278  return _driftError[0];
279  }
280 
281  inline
282  float
284  {
285  return (_drift[0] + _drift[1]) / 2.;
286  }
287 
288  inline
289  float
291  {
292  return (_driftError[0] + _driftError[1]) / 2.;
293  }
294 
295  inline
298  {
299  return _xyPosition;
300  }
301 
302  inline
303  unsigned
305  {
306  return _state = i;
307  }
308 
309  inline
310  unsigned
311  TRGCDCCellHit::state(unsigned i) const
312  {
313  return _state = i;
314  }
315 
316  inline
317  const void*
319  {
320  return _track;
321  }
322 
323  inline
324  const void*
325  TRGCDCCellHit::track(const void* a)
326  {
327  return _track = a;
328  }
329 
330  inline
331  const void*
332  TRGCDCCellHit::track(const void* a) const
333  {
334  return _track = a;
335  }
336 
337  inline
338  unsigned
340  {
341  return _sequentialLength;
342  }
343 
344  inline
345  unsigned
346  TRGCDCCellHit::sequence(unsigned a) const
347  {
348  return _sequentialLength = a;
349  }
350 
351  inline
352  void
353  TRGCDCCellHit::setDriftTime(double driftTime, unsigned i)
354  {
355  if (i) _drift[1] = driftTime;
356  else _drift[0] = driftTime;
357  }
358 
359  inline
360  unsigned
362  {
363  return _iCDCHit;
364  }
365 
366  inline
367  unsigned
369  {
370  return _iCDCSimHit;
371  }
372 
373  inline
374  unsigned
376  {
377  return _iMCParticle;
378  }
379 
381 } // namespace Belle2
382 
383 #endif /* TRGCDCCellHit_FLAG_ */
Belle2::TRGCDCCellHit::dump
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: CellHit.cc:70
Belle2::TRGCDCCellHit::hit
const CDCHit * hit(void) const
Access to CDCHit.
Definition: CellHit.cc:134
Belle2::TRGCDCCellHit::iMCParticle
unsigned iMCParticle(void) const
returns an index to MCParticle.
Definition: CellHit.h:375
Belle2::TRGCDCCellHit::state
unsigned state(void) const
returns state.
Definition: CellHit.h:260
Belle2::CDCHit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:51
Belle2::TRGCDCCellHit::_iCDCSimHit
unsigned _iCDCSimHit
Index to CDCSimHit array.
Definition: CellHit.h:200
Belle2::TRGCDCCellHit::_track
const void * _track
a pointer to a TTrack
Definition: CellHit.h:192
Belle2::TRGCDCCellHit::TRGCDCCellHit
TRGCDCCellHit(const TRGCDCCell &, unsigned indexCDCHit=0, unsigned indexCDCSimHit=0, unsigned indexMCParticle=0, float driftLeft=0, float driftLeftError=0, float driftRight=0, float driftRightError=0, int mcLRflag=0, float fudgeFacgtor=1)
Constructor.
Definition: CellHit.cc:35
Belle2::CDCSimHit
Example Detector.
Definition: CDCSimHit.h:33
Belle2::TRGCDCCellHit::_xyPosition
const HepGeom::Point3D< double > & _xyPosition
position in the middle of wire. z is always zero, however.
Definition: CellHit.h:190
Belle2::TRGCDCCellHit::_drift
float _drift[2]
drift distance
Definition: CellHit.h:184
Belle2::TRGCDCCellHit::_mcLR
int _mcLR
mc left/right information
Definition: CellHit.h:179
Belle2::TRGCDCCellHit::_state
unsigned _state
state, defined above
Definition: CellHit.h:182
Belle2::TRGCDCCellHit::simHit
const CDCSimHit * simHit(void) const
Access to CDCSimHit.
Definition: CellHit.cc:141
Belle2::TRGCDCCellHit::_cell
const TRGCDCCell & _cell
a pointer to a TRGCDCWire
Definition: CellHit.h:188
Belle2::TRGCDCCellHit::~TRGCDCCellHit
virtual ~TRGCDCCellHit()
Destructor.
Definition: CellHit.cc:64
Belle2::TRGCDCCell
A class to represent a wire in CDC.
Definition: Cell.h:41
Belle2::TRGCDCCellHit
A class to represent a wire hit in CDC.
Definition: CellHit.h:75
Belle2::TRGCDCCellHit::sortById
static int sortById(const TRGCDCCellHit **a, const TRGCDCCellHit **b)
Sort function.
Definition: CellHit.cc:123
Belle2::TRGCDCCellHit::position
HepGeom::Point3D< double > position(unsigned) const
returns left position. z is always zero.
Definition: CellHit.cc:103
Belle2::TRGCDCCellHit::iCDCHit
unsigned iCDCHit(void) const
returns an index to CDCHit.
Definition: CellHit.h:361
Belle2::TRGCDCCellHit::_driftError
float _driftError[2]
drift distance error
Definition: CellHit.h:186
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCCellHit::_iCDCHit
unsigned _iCDCHit
Index to CDCHit array.
Definition: CellHit.h:197
Belle2::TRGCDCCellHit::_iMCParticle
unsigned _iMCParticle
Index to MCParticle array.
Definition: CellHit.h:203
Belle2::TRGCDCCellHit::xyPosition
const HepGeom::Point3D< double > & xyPosition(void) const
returns position in the middle of wire. z is always zero, however.
Definition: CellHit.h:297
Belle2::TRGCDCCellHit::cell
virtual const TRGCDCCell & cell(void) const
returns a pointer to a TRGCDCWire.
Definition: CellHit.h:253
HepGeom::Point3D< double >
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::TRGCDCCellHit::drift
float drift(void) const
returns drift distance.
Definition: CellHit.h:283
Belle2::TRGCDCCellHit::track
const void * track(void) const
assigns a pointer to a TTrack.
Definition: CellHit.h:318
Belle2::TRGCDCCellHit::setDriftTime
void setDriftTime(double driftTime, unsigned i)
Sets drift time.
Definition: CellHit.h:353
Belle2::TRGCDCCellHit::mcParticle
const MCParticle * mcParticle(void) const
Access to MCParticle.
Definition: CellHit.cc:148
Belle2::TRGCDCCellHit::mcLR
int mcLR(void) const
returns mc left/right information
Definition: CellHit.h:246
Belle2::TRGCDCCellHit::_sequentialLength
unsigned _sequentialLength
sequential Length in one segment
Definition: CellHit.h:194
Belle2::TRGCDCCellHit::sequence
unsigned sequence(void) const
returns sequential Length in one segment : this parameter is used in TCurlFinder now.
Definition: CellHit.h:339
Belle2::TRGCDCCellHit::iCDCSimHit
unsigned iCDCSimHit(void) const
returns an index to CDCSimHit.
Definition: CellHit.h:368
Belle2::TRGCDCCellHit::dDrift
float dDrift(void) const
returns drift distance error.
Definition: CellHit.h:290