Chunk.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file Chunk.h
3 // \version $Id: Chunk.h,v 1.13 2012-10-30 23:33:08 bckhouse Exp $
4 // \author Christopher Backhouse - bckhouse@caltech.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef DTCHUNK_H
8 #define DTCHUNK_H
9 
10 #include "RecoBase/Cluster.h"
11 
13 
14 namespace dt
15 {
16  /// Sequence of contiguous hits and dead cells all on the same plane
17  class Chunk
18  {
19  public:
20  Chunk(){}
21  Chunk(int plane, int cellInLo, int cellInHi, int cellOutLo, int cellOutHi, bool up,
23  int Plane() const {return fPlane;}
24  int EntryHitCell() const {return fUp ? fEntryCellHi : fEntryCellLo;}
25  int ExitHitCell() const {return fUp ? fExitCellLo : fExitCellHi; }
26  int EntryExtremeCell() const {return fUp ? fEntryCellLo : fEntryCellHi;}
27  int ExitExtremeCell() const {return fUp ? fExitCellHi : fExitCellLo; }
28  int TopHitCell() const {return fUp ? fExitCellLo : fEntryCellLo;}
29  int BottomHitCell() const {return fUp ? fEntryCellHi : fExitCellHi; }
30  int TopExtremeCell() const {return fUp ? fExitCellHi : fEntryCellHi;}
31  int BottomExtremeCell() const {return fUp ? fEntryCellLo : fExitCellLo; }
32  bool Up() const;
33  void SetUp(bool up);
34  bool Matches(const Chunk& ch) const;
35  bool HasHits() const {return !fHits.empty();}
36  bool AllDead() const {return fHits.empty();}
38  art::PtrVector<rb::CellHit> HitsOnLine(double grad, double icept) const;
39  // TODO: variants taking a Direction and returning only one?
40  std::pair<Segment, Segment> GetSegs() const;
41 
42  bool IsWorthShowering() const;
43  bool IsShowerChunk() const {return fShowerChunk;}
44  void SetShowerChunk(){fSegsDirty = true; fShowerChunk = true;}
45 
46  bool operator<(const Chunk& rhs) const {return fPlane < rhs.fPlane;}
47  protected:
48  /// \param v0 lowest point not in a neighbouring cell
49  /// \param v1 lowest point in this cell
50  /// \param v2 highest point in this cell
51  /// \param v3 highest point not in a neighbouring cell
52  void CellPoints(const geo::PlaneGeo* plane, int cell,
53  double& v0, double& v1, double& v2, double& v3,
54  double& z0, double& z1) const;
55  /// \param v0 cell centre
56  /// \param v1 cell half-width
58  double& v0, double& dv,
59  double& z0, double& dz) const;
60  int fPlane;
62  bool fUp;
63  bool fShowerChunk; ///< "Shower chunk" can enter and exit anywhere
64 
65  mutable bool fSegsDirty;
66  mutable std::pair<Segment, Segment> fSegs;
67 
69  };
70 
71 } // namespace
72 
73 #endif
int ExitHitCell() const
Definition: Chunk.h:25
void CellPoints(const geo::PlaneGeo *plane, int cell, double &v0, double &v1, double &v2, double &v3, double &z0, double &z1) const
Definition: Chunk.cxx:203
int Plane() const
Definition: Chunk.h:23
bool fShowerChunk
"Shower chunk" can enter and exit anywhere
Definition: Chunk.h:63
std::pair< Segment, Segment > GetSegs() const
Definition: Chunk.cxx:102
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Sequence of contiguous hits and dead cells all on the same plane.
Definition: Chunk.h:17
bool IsShowerChunk() const
Definition: Chunk.h:43
int fEntryCellLo
Definition: Chunk.h:61
int BottomExtremeCell() const
Definition: Chunk.h:31
bool Up() const
Definition: Chunk.cxx:49
art::PtrVector< rb::CellHit > fHits
Definition: Chunk.h:68
int fEntryCellHi
Definition: Chunk.h:61
static void grad(vari *vi)
Definition: grad.hpp:30
bool fSegsDirty
Definition: Chunk.h:65
int TopExtremeCell() const
Definition: Chunk.h:30
Definition: Cand.cxx:23
void hits()
Definition: readHits.C:15
art::PtrVector< rb::CellHit > AllHits() const
Definition: Chunk.h:37
int TopHitCell() const
Definition: Chunk.h:28
bool Matches(const Chunk &ch) const
Definition: Chunk.cxx:35
double dz[NP][NC]
bool fUp
Definition: Chunk.h:62
art::PtrVector< rb::CellHit > HitsOnLine(double grad, double icept) const
Definition: Chunk.cxx:67
void SetShowerChunk()
Definition: Chunk.h:44
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
int fPlane
Definition: Chunk.h:60
bool IsWorthShowering() const
Definition: Chunk.cxx:194
int BottomHitCell() const
Definition: Chunk.h:29
void CellMeasurements(geo::View_t view, const geo::CellGeo *cell, double &v0, double &dv, double &z0, double &dz) const
Definition: Chunk.cxx:245
bool empty() const
Definition: PtrVector.h:336
bool AllDead() const
Definition: Chunk.h:36
int EntryHitCell() const
Definition: Chunk.h:24
void SetUp(bool up)
Definition: Chunk.cxx:55
std::pair< Segment, Segment > fSegs
Definition: Chunk.h:66
int EntryExtremeCell() const
Definition: Chunk.h:26
bool HasHits() const
Definition: Chunk.h:35
int ExitExtremeCell() const
Definition: Chunk.h:27
Chunk()
Definition: Chunk.h:20
Encapsulate the cell geometry.
Definition: CellGeo.h:25
int fExitCellHi
Definition: Chunk.h:61
int fExitCellLo
Definition: Chunk.h:61
bool operator<(const Chunk &rhs) const
Definition: Chunk.h:46