Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dt::Chunk Class Reference

Sequence of contiguous hits and dead cells all on the same plane. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/DiscreteTracker/Chunk.h"

Public Member Functions

 Chunk ()
 
 Chunk (int plane, int cellInLo, int cellInHi, int cellOutLo, int cellOutHi, bool up, art::PtrVector< rb::CellHit > hits)
 
int Plane () const
 
int EntryHitCell () const
 
int ExitHitCell () const
 
int EntryExtremeCell () const
 
int ExitExtremeCell () const
 
int TopHitCell () const
 
int BottomHitCell () const
 
int TopExtremeCell () const
 
int BottomExtremeCell () const
 
bool Up () const
 
void SetUp (bool up)
 
bool Matches (const Chunk &ch) const
 
bool HasHits () const
 
bool AllDead () const
 
art::PtrVector< rb::CellHitAllHits () const
 
art::PtrVector< rb::CellHitHitsOnLine (double grad, double icept) const
 
std::pair< Segment, SegmentGetSegs () const
 
bool IsWorthShowering () const
 
bool IsShowerChunk () const
 
void SetShowerChunk ()
 
bool operator< (const Chunk &rhs) const
 

Protected Member Functions

void CellPoints (const geo::PlaneGeo *plane, int cell, double &v0, double &v1, double &v2, double &v3, double &z0, double &z1) const
 
void CellMeasurements (geo::View_t view, const geo::CellGeo *cell, double &v0, double &dv, double &z0, double &dz) const
 

Protected Attributes

int fPlane
 
int fEntryCellLo
 
int fEntryCellHi
 
int fExitCellLo
 
int fExitCellHi
 
bool fUp
 
bool fShowerChunk
 "Shower chunk" can enter and exit anywhere More...
 
bool fSegsDirty
 
std::pair< Segment, SegmentfSegs
 
art::PtrVector< rb::CellHitfHits
 

Detailed Description

Sequence of contiguous hits and dead cells all on the same plane.

Definition at line 17 of file Chunk.h.

Constructor & Destructor Documentation

dt::Chunk::Chunk ( )
inline

Definition at line 20 of file Chunk.h.

References hits(), and NDAPDHVSetting::plane.

20 {}
dt::Chunk::Chunk ( int  plane,
int  cellInLo,
int  cellInHi,
int  cellOutLo,
int  cellOutHi,
bool  up,
art::PtrVector< rb::CellHit hits 
)

Definition at line 21 of file Chunk.cxx.

References ana::assert().

23  : fPlane(plane),
24  fEntryCellLo(cellInLo), fEntryCellHi(cellInHi),
25  fExitCellLo(cellOutLo), fExitCellHi(cellOutHi),
26  fUp(up), fShowerChunk(false),
27  fSegsDirty(true),
28  fHits(hits)
29  {
30  assert(cellInLo <= cellInHi);
31  assert(cellOutLo <= cellOutHi);
32  }
bool fShowerChunk
"Shower chunk" can enter and exit anywhere
Definition: Chunk.h:63
int fEntryCellLo
Definition: Chunk.h:61
art::PtrVector< rb::CellHit > fHits
Definition: Chunk.h:68
int fEntryCellHi
Definition: Chunk.h:61
bool fSegsDirty
Definition: Chunk.h:65
bool fUp
Definition: Chunk.h:62
int fPlane
Definition: Chunk.h:60
assert(nhit_max >=nhit_nbins)
int fExitCellHi
Definition: Chunk.h:61
int fExitCellLo
Definition: Chunk.h:61

Member Function Documentation

bool dt::Chunk::AllDead ( ) const
inline

Definition at line 36 of file Chunk.h.

References art::PtrVector< T >::empty(), and fHits.

36 {return fHits.empty();}
art::PtrVector< rb::CellHit > fHits
Definition: Chunk.h:68
bool empty() const
Definition: PtrVector.h:336
art::PtrVector<rb::CellHit> dt::Chunk::AllHits ( ) const
inline

Definition at line 37 of file Chunk.h.

References fHits, GetSegs(), stan::math::grad(), HitsOnLine(), and IsWorthShowering().

Referenced by dt::DiscreteTracker::BestSeed().

37 {return fHits;}
art::PtrVector< rb::CellHit > fHits
Definition: Chunk.h:68
int dt::Chunk::BottomExtremeCell ( ) const
inline

Definition at line 31 of file Chunk.h.

References fEntryCellLo, fExitCellLo, fUp, Matches(), SetUp(), and Up().

Referenced by GetSegs(), and Matches().

31 {return fUp ? fEntryCellLo : fExitCellLo; }
int fEntryCellLo
Definition: Chunk.h:61
bool fUp
Definition: Chunk.h:62
int fExitCellLo
Definition: Chunk.h:61
int dt::Chunk::BottomHitCell ( ) const
inline

Definition at line 29 of file Chunk.h.

References fEntryCellHi, fExitCellHi, and fUp.

Referenced by GetSegs(), Matches(), and dt::Chain::ToTrack().

29 {return fUp ? fEntryCellHi : fExitCellHi; }
int fEntryCellHi
Definition: Chunk.h:61
bool fUp
Definition: Chunk.h:62
int fExitCellHi
Definition: Chunk.h:61
void dt::Chunk::CellMeasurements ( geo::View_t  view,
const geo::CellGeo cell,
double &  v0,
double &  dv,
double &  z0,
double &  dz 
) const
protected
Parameters
v0cell centre
v1cell half-width

Definition at line 245 of file Chunk.cxx.

References geo::CellGeo::GetCenter(), geo::CellGeo::HalfD(), geo::CellGeo::HalfW(), and POTSpillRate::view.

Referenced by CellPoints(), and operator<().

248  {
249  double xyz[3];
250  cell->GetCenter(xyz);
251  v0 = xyz[view];
252  dv = cell->HalfW();
253  z0 = xyz[2];
254  dz = cell->HalfD();
255  }
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
double HalfW() const
Definition: CellGeo.cxx:191
double dz[NP][NC]
void dt::Chunk::CellPoints ( const geo::PlaneGeo plane,
int  cell,
double &  v0,
double &  v1,
double &  v2,
double &  v3,
double &  z0,
double &  z1 
) const
protected
Parameters
v0lowest point not in a neighbouring cell
v1lowest point in this cell
v2highest point in this cell
v3highest point not in a neighbouring cell

Definition at line 203 of file Chunk.cxx.

References geo::PlaneGeo::Cell(), CellMeasurements(), dz, POTSpillRate::view, and geo::PlaneGeo::View().

Referenced by GetSegs(), and operator<().

206  {
207  const geo::View_t view = plane->View();
208 
209  // Measurements of the cell itself
210  double vc, dv, zc, dz;
211  CellMeasurements(view, plane->Cell(cell), vc, dv, zc, dz);
212  v1 = vc-dv;
213  v2 = vc+dv;
214  z0 = zc-dz;
215  z1 = zc+dz;
216 
217  // Would handle bad channels by walking these until the channel they're on
218  // is good.
219  const geo::CellGeo* cellabove = plane->Cell(cell+1);
220  const geo::CellGeo* cellbelow = plane->Cell(cell-1);
221 
222  double junk;
223  if(cellbelow){
224  // Lowest point not in another cell
225  CellMeasurements(view, cellbelow, v0, dv, junk, junk);
226  v0 += dv;
227  }
228  else{
229  // No cell below, must be edge of the detector, could be anywhere low
230  v0 = -1e3;
231  }
232 
233  if(cellabove){
234  // Highest point not in another cell
235  CellMeasurements(view, cellabove, v3, dv, junk, junk);
236  v3 -= dv;
237  }
238  else{
239  // No cell above, must be edge of the detector, could be anywhere high
240  v3 = +1e3;
241  }
242  }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
double dz[NP][NC]
void CellMeasurements(geo::View_t view, const geo::CellGeo *cell, double &v0, double &dv, double &z0, double &dz) const
Definition: Chunk.cxx:245
Encapsulate the cell geometry.
Definition: CellGeo.h:25
int dt::Chunk::EntryExtremeCell ( ) const
inline

Definition at line 26 of file Chunk.h.

References fEntryCellHi, fEntryCellLo, and fUp.

26 {return fUp ? fEntryCellLo : fEntryCellHi;}
int fEntryCellLo
Definition: Chunk.h:61
int fEntryCellHi
Definition: Chunk.h:61
bool fUp
Definition: Chunk.h:62
int dt::Chunk::EntryHitCell ( ) const
inline

Definition at line 24 of file Chunk.h.

References fEntryCellHi, fEntryCellLo, and fUp.

24 {return fUp ? fEntryCellHi : fEntryCellLo;}
int fEntryCellLo
Definition: Chunk.h:61
int fEntryCellHi
Definition: Chunk.h:61
bool fUp
Definition: Chunk.h:62
int dt::Chunk::ExitExtremeCell ( ) const
inline

Definition at line 27 of file Chunk.h.

References fExitCellHi, fExitCellLo, and fUp.

27 {return fUp ? fExitCellHi : fExitCellLo; }
bool fUp
Definition: Chunk.h:62
int fExitCellHi
Definition: Chunk.h:61
int fExitCellLo
Definition: Chunk.h:61
int dt::Chunk::ExitHitCell ( ) const
inline

Definition at line 25 of file Chunk.h.

References fExitCellHi, fExitCellLo, and fUp.

25 {return fUp ? fExitCellLo : fExitCellHi; }
bool fUp
Definition: Chunk.h:62
int fExitCellHi
Definition: Chunk.h:61
int fExitCellLo
Definition: Chunk.h:61
std::pair< Segment, Segment > dt::Chunk::GetSegs ( ) const

Definition at line 102 of file Chunk.cxx.

References BottomExtremeCell(), BottomHitCell(), CellPoints(), art::PtrVector< T >::empty(), fEntryCellHi, fEntryCellLo, fExitCellHi, fExitCellLo, fHits, fPlane, fSegs, fSegsDirty, fShowerChunk, fUp, geom(), geo::GeometryBase::Plane(), NDAPDHVSetting::plane, TopExtremeCell(), and TopHitCell().

Referenced by AllHits(), dt::DiscreteTracker::BestSeed(), dt::Cand::MaybeFlip(), and dt::DiscreteTracker::PossibleNextSegs().

103  {
104  if(!fSegsDirty) return fSegs;
105  fSegsDirty = false;
106 
108 
109  const geo::PlaneGeo* plane = geom->Plane(fPlane);
110 
111  double v0lo, v1lo, v2lo, v3lo, z1lo, z2lo;
112  CellPoints(plane, BottomExtremeCell(),
113  v0lo, v1lo, v2lo, v3lo,
114  z1lo, z2lo);
115 
116  double v0hi, v1hi, v2hi, v3hi, z1hi, z2hi;
117  CellPoints(plane, TopExtremeCell(),
118  v0hi, v1hi, v2hi, v3hi,
119  z1hi, z2hi);
120 
121  double junk;
122  if(BottomHitCell() != BottomExtremeCell()){
123  CellPoints(plane, BottomHitCell(),
124  junk, junk, v2lo, v3lo,
125  junk, junk);
126  }
127  if(TopHitCell() != TopExtremeCell()){
128  CellPoints(plane, TopHitCell(),
129  v0hi, v1hi, junk, junk,
130  junk, junk);
131  }
132 
133  // If this is a completely dead chunk, it's OK to enter in the crack part
134  // on one side and exit in that same part without ever traversing any real
135  // cell.
136  if(fHits.empty()){
137  v1lo = v0lo;
138  v1hi = v0hi;
139  v2lo = v3lo;
140  v2hi = v3hi;
141  }
142 
143  // If the track is upgoing it can enter the plane in plastic below the
144  // lowest cell, and exit in the plastic above the highest cell. But it
145  // mustn't enter higher than the scintillator of the first cell, or lower
146  // than the scintillator of the last cell. Vice versa for downgoing.
147 
148  if(fShowerChunk){
149  if(fUp){
150  fSegs.first = Segment(z1lo, v0lo-kCornerR, v2hi,
151  z1lo+kCornerR, v0lo, v3hi,
153  fSegs.second = Segment(z2hi-kCornerR, v0lo, v3hi,
154  z2hi, v1lo, v3hi+kCornerR,
155  false, fPlane, fExitCellLo, fExitCellHi);
156  }
157  else{
158  fSegs.first = Segment(z1hi, v1lo, v3hi+kCornerR,
159  z1hi+kCornerR, v0lo, v3hi,
161  fSegs.second = Segment(z2lo-kCornerR, v0lo, v3hi,
162  z2lo, v0lo-kCornerR, v2hi,
163  false, fPlane, fExitCellLo, fExitCellHi);
164  }
165 
166  return fSegs;
167  }
168 
169  if(fUp){
170  // bottom left
171  fSegs.first = Segment(z1lo, v0lo-kCornerR, v2lo,
172  z1lo+kCornerR, v0lo, v3hi,
174  // top right
175  fSegs.second = Segment(z2hi-kCornerR, v0lo, v3hi,
176  z2hi, v1hi, v3hi+kCornerR,
177  false, fPlane, fExitCellLo, fExitCellHi);
178  }
179  else{
180  // top left
181  fSegs.first = Segment(z1hi, v1hi, v3hi+kCornerR,
182  z1hi+kCornerR, v0lo, v3hi,
184  // bottom right
185  fSegs.second = Segment(z2lo-kCornerR, v0lo, v3hi,
186  z2lo, v0lo-kCornerR, v2lo,
187  false, fPlane, fExitCellLo, fExitCellHi);
188  }
189 
190  return fSegs;
191  }
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
bool fShowerChunk
"Shower chunk" can enter and exit anywhere
Definition: Chunk.h:63
int fEntryCellLo
Definition: Chunk.h:61
const PlaneGeo * Plane(unsigned int i) const
int BottomExtremeCell() const
Definition: Chunk.h:31
art::PtrVector< rb::CellHit > fHits
Definition: Chunk.h:68
int fEntryCellHi
Definition: Chunk.h:61
bool fSegsDirty
Definition: Chunk.h:65
int TopExtremeCell() const
Definition: Chunk.h:30
int TopHitCell() const
Definition: Chunk.h:28
bool fUp
Definition: Chunk.h:62
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
int fPlane
Definition: Chunk.h:60
int BottomHitCell() const
Definition: Chunk.h:29
bool empty() const
Definition: PtrVector.h:336
std::pair< Segment, Segment > fSegs
Definition: Chunk.h:66
void geom(int which=0)
Definition: geom.C:163
const double kCornerR
Definition: Chunk.cxx:18
int fExitCellHi
Definition: Chunk.h:61
int fExitCellLo
Definition: Chunk.h:61
bool dt::Chunk::HasHits ( ) const
inline

Definition at line 35 of file Chunk.h.

References art::PtrVector< T >::empty(), and fHits.

Referenced by dt::Cand::AddChunk().

35 {return !fHits.empty();}
art::PtrVector< rb::CellHit > fHits
Definition: Chunk.h:68
bool empty() const
Definition: PtrVector.h:336
art::PtrVector< rb::CellHit > dt::Chunk::HitsOnLine ( double  grad,
double  icept 
) const

Definition at line 67 of file Chunk.cxx.

References rb::CellHit::Cell(), geo::PlaneGeo::Cell(), dz, fHits, fPlane, geom(), geo::CellGeo::GetCenter(), geo::CellGeo::HalfD(), geo::CellGeo::HalfW(), getGoodRuns4SAM::n, geo::GeometryBase::Plane(), art::PtrVector< T >::push_back(), runNovaSAM::ret, art::PtrVector< T >::size(), std::swap(), and rb::CellHit::View().

Referenced by AllHits().

69  {
71 
72  const geo::PlaneGeo* geoplane = geom->Plane(fPlane);
73 
75 
76  for(unsigned int n = 0; n < fHits.size(); ++n){
77  const art::Ptr<rb::CellHit>& hit = fHits[n];
78 
79  double xyz[3];
80  const geo::CellGeo* geocell = geoplane->Cell(hit->Cell());
81  geocell->GetCenter(xyz);
82  const double z0 = xyz[2];
83  const double dz = geocell->HalfD();
84  const double z1 = z0-dz;
85  const double z2 = z0+dz;
86  const double v0 = xyz[hit->View()];
87  const double dv = geocell->HalfW();
88  const double vlo = v0-dv;
89  const double vhi = v0+dv;
90 
91  double v1 = icept+grad*z1;
92  double v2 = icept+grad*z2;
93  if(v1 > v2) std::swap(v1, v2);
94 
95  if(v1 <= vhi && v2 >= vlo) ret.push_back(hit);
96  } // end for n
97 
98  return ret;
99  }
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
geo::View_t View() const
Definition: CellHit.h:41
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
double HalfW() const
Definition: CellGeo.cxx:191
const PlaneGeo * Plane(unsigned int i) const
art::PtrVector< rb::CellHit > fHits
Definition: Chunk.h:68
static void grad(vari *vi)
Definition: grad.hpp:30
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
unsigned short Cell() const
Definition: CellHit.h:40
double dz[NP][NC]
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
int fPlane
Definition: Chunk.h:60
size_type size() const
Definition: PtrVector.h:308
Definition: structs.h:12
void geom(int which=0)
Definition: geom.C:163
Encapsulate the cell geometry.
Definition: CellGeo.h:25
bool dt::Chunk::IsShowerChunk ( ) const
inline

Definition at line 43 of file Chunk.h.

References fShowerChunk.

Referenced by dt::DiscreteTracker::TryExtendCand().

43 {return fShowerChunk;}
bool fShowerChunk
"Shower chunk" can enter and exit anywhere
Definition: Chunk.h:63
bool dt::Chunk::IsWorthShowering ( ) const

Definition at line 194 of file Chunk.cxx.

References fEntryCellHi, fEntryCellLo, fExitCellHi, and fExitCellLo.

Referenced by AllHits(), dt::DiscreteTracker::PossibleNextSegs(), and dt::DiscreteTracker::TryExtendCand().

195  {
196  // Single hit
197  if(fEntryCellLo == fExitCellHi &&
198  fEntryCellHi == fExitCellLo) return false;
199  return true;
200  }
int fEntryCellLo
Definition: Chunk.h:61
int fEntryCellHi
Definition: Chunk.h:61
int fExitCellHi
Definition: Chunk.h:61
int fExitCellLo
Definition: Chunk.h:61
bool dt::Chunk::Matches ( const Chunk ch) const

Definition at line 35 of file Chunk.cxx.

References BottomExtremeCell(), BottomHitCell(), fPlane, TopExtremeCell(), and TopHitCell().

Referenced by BottomExtremeCell().

36  {
37  if(fPlane != ch.fPlane) return false;
38 
39  if(BottomExtremeCell() != ch.BottomExtremeCell()) return false;
40  if(TopExtremeCell() != ch.TopExtremeCell()) return false;
41 
42  if(BottomHitCell() != ch.BottomHitCell()) return false;
43  if(TopHitCell() != ch.TopHitCell()) return false;
44 
45  return true;
46  }
int BottomExtremeCell() const
Definition: Chunk.h:31
int TopExtremeCell() const
Definition: Chunk.h:30
int TopHitCell() const
Definition: Chunk.h:28
int fPlane
Definition: Chunk.h:60
int BottomHitCell() const
Definition: Chunk.h:29
bool dt::Chunk::operator< ( const Chunk rhs) const
inline

Definition at line 46 of file Chunk.h.

References getBrightness::cell, CellMeasurements(), CellPoints(), dz, fPlane, and POTSpillRate::view.

46 {return fPlane < rhs.fPlane;}
int fPlane
Definition: Chunk.h:60
int dt::Chunk::Plane ( ) const
inline
void dt::Chunk::SetShowerChunk ( )
inline

Definition at line 44 of file Chunk.h.

References fSegsDirty, and fShowerChunk.

Referenced by dt::DiscreteTracker::PossibleNextSegs().

44 {fSegsDirty = true; fShowerChunk = true;}
bool fShowerChunk
"Shower chunk" can enter and exit anywhere
Definition: Chunk.h:63
bool fSegsDirty
Definition: Chunk.h:65
void dt::Chunk::SetUp ( bool  up)

Definition at line 55 of file Chunk.cxx.

References fEntryCellHi, fEntryCellLo, fExitCellHi, fExitCellLo, fSegsDirty, fUp, and std::swap().

Referenced by BottomExtremeCell(), dt::Cand::MaybeFlip(), and dt::DiscreteTracker::PossibleNextSegs().

56  {
57  fSegsDirty = true;
58 
59  if(up != fUp){
62  }
63  fUp = up;
64  }
int fEntryCellLo
Definition: Chunk.h:61
int fEntryCellHi
Definition: Chunk.h:61
bool fSegsDirty
Definition: Chunk.h:65
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
bool fUp
Definition: Chunk.h:62
int fExitCellHi
Definition: Chunk.h:61
int fExitCellLo
Definition: Chunk.h:61
int dt::Chunk::TopExtremeCell ( ) const
inline

Definition at line 30 of file Chunk.h.

References fEntryCellHi, fExitCellHi, and fUp.

Referenced by GetSegs(), and Matches().

30 {return fUp ? fExitCellHi : fEntryCellHi;}
int fEntryCellHi
Definition: Chunk.h:61
bool fUp
Definition: Chunk.h:62
int fExitCellHi
Definition: Chunk.h:61
int dt::Chunk::TopHitCell ( ) const
inline

Definition at line 28 of file Chunk.h.

References fEntryCellLo, fExitCellLo, and fUp.

Referenced by GetSegs(), Matches(), and dt::Chain::ToTrack().

28 {return fUp ? fExitCellLo : fEntryCellLo;}
int fEntryCellLo
Definition: Chunk.h:61
bool fUp
Definition: Chunk.h:62
int fExitCellLo
Definition: Chunk.h:61
bool dt::Chunk::Up ( ) const

Definition at line 49 of file Chunk.cxx.

References fUp.

Referenced by dt::Cand::AddChunk(), dt::DiscreteTracker::BestSeed(), BottomExtremeCell(), and dt::DiscreteTracker::PossibleNextSegs().

50  {
51  return fUp;
52  }
bool fUp
Definition: Chunk.h:62

Member Data Documentation

int dt::Chunk::fEntryCellHi
protected
int dt::Chunk::fEntryCellLo
protected
int dt::Chunk::fExitCellHi
protected
int dt::Chunk::fExitCellLo
protected
art::PtrVector<rb::CellHit> dt::Chunk::fHits
protected

Definition at line 68 of file Chunk.h.

Referenced by AllDead(), AllHits(), GetSegs(), HasHits(), and HitsOnLine().

int dt::Chunk::fPlane
protected

Definition at line 60 of file Chunk.h.

Referenced by GetSegs(), HitsOnLine(), Matches(), operator<(), and Plane().

std::pair<Segment, Segment> dt::Chunk::fSegs
mutableprotected

Definition at line 66 of file Chunk.h.

Referenced by GetSegs().

bool dt::Chunk::fSegsDirty
mutableprotected

Definition at line 65 of file Chunk.h.

Referenced by GetSegs(), SetShowerChunk(), and SetUp().

bool dt::Chunk::fShowerChunk
protected

"Shower chunk" can enter and exit anywhere

Definition at line 63 of file Chunk.h.

Referenced by GetSegs(), IsShowerChunk(), and SetShowerChunk().

bool dt::Chunk::fUp
protected

The documentation for this class was generated from the following files: