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