HitList.cxx
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////
2 /// \file HitList.cxx
3 /// \brief A convenient packaging of cell information required for
4 /// simple geometric track finding and fitting
5 /// \version $Id: HitList.cxx,v 1.6 2012-09-21 02:32:54 greenc Exp $
6 /// \author messier@indiana.edu
7 /////////////////////////////////////////////////////////////////////////
8 #include "RecoBase/HitList.h"
9 
10 #include "Geometry/Geometry.h"
12 #include "RecoBase/CellHit.h"
13 #include "RecoBase/Cluster.h"
14 
16 
17 namespace rb
18 {
19  //......................................................................
21 
22  //......................................................................
23 
24  HitList::HitList(unsigned int n) { this->resize(n); }
25 
26  //......................................................................
27 
28  HitList::HitList(const rb::Cluster& clust, bool wbyq)
29  {
31 
32  unsigned int n = clust.NCell();
33  this->resize(n);
34 
35  unsigned int i;
36  for (i=0; i<n; ++i) {
37  const rb::CellHit* h = clust.Cell(i).get();
38 
39  unsigned int ip = h->Plane();
40  unsigned int ic = h->Cell();
41 
42  const geo::PlaneGeo* p = geom->Plane(ip);
43  const geo::CellGeo* c = p-> Cell(ic);
44 
45  double xyz[3];
46  c->GetCenter(xyz);
47 
48  double cz = c->HalfD();
49  double cxy = c->HalfW();
50 
51  double xy = 0.0;
52  if (p->View()==geo::kX) xy = xyz[0];
53  if (p->View()==geo::kY) xy = xyz[1];
54 
55  double w = 1.0;
56  if (wbyq) w = h->PE();
57 
58  this->SetHit(i, p->View(), xy, xyz[2], h->TNS(), cxy, cz, w);
59  }
60  }
61 
62  //......................................................................
63 
65  double xy,
66  double z,
67  double t,
68  double cxy,
69  double cz,
70  double w)
71  {
72  this->push_back(Hit2D(v,xy,z,t,cxy,cz,w));
73  }
74 
75  //......................................................................
76 
77  void HitList::SetHit(unsigned int i,
78  geo::View_t v,
79  double xy,
80  double z,
81  double t,
82  double cxy,
83  double cz,
84  double w)
85  {
86  Hit2D& h = (*this)[i];
87  h.fView = v;
88  h.fXY = xy;
89  h.fZ = z;
90  h.fT = t;
91  h.fCXY = cxy;
92  h.fCZ = cz;
93  h.fW = w;
94  }
95 } // end namespace rb
96 ////////////////////////////////////////////////////////////////////////
float TNS() const
Definition: CellHit.h:46
double fCZ
half depth of cell, will be on z axis
Definition: HitList.h:35
double HalfD() const
Definition: CellGeo.cxx:205
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
void SetHit(unsigned int i, geo::View_t, double xy, double z, double t, double cxy, double cz, double w=1.0)
Definition: HitList.cxx:77
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned short Plane() const
Definition: CellHit.h:39
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
double fW
Initial weight of hit.
Definition: HitList.h:36
double HalfW() const
Definition: CellGeo.cxx:191
A collection of associated CellHits.
Definition: Cluster.h:47
TString ip
Definition: loadincs.C:5
const PlaneGeo * Plane(unsigned int i) const
double fCXY
half width of cell, will be on x or y axis
Definition: HitList.h:34
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
unsigned short Cell() const
Definition: CellHit.h:40
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
double fT
time coordinate of hit
Definition: HitList.h:33
void resize(T &x, std::vector< int > dims)
Definition: resize.hpp:41
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
base_types push_back(int_type())
float PE() const
Definition: CellHit.h:42
Perform a "2 point" Hough transform on a collection of hits.
z
Definition: test.py:28
void AddHit(geo::View_t, double xy, double z, double t, double cxy, double cz, double w=1.0)
Definition: HitList.cxx:64
double fXY
x or y coordinate of hit
Definition: HitList.h:31
double fZ
z coordinate of hit
Definition: HitList.h:32
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
geo::View_t fView
View hit belongs in (x or y)
Definition: HitList.h:30
T const * get() const
Definition: Ptr.h:321
void geom(int which=0)
Definition: geom.C:163
Hits from the x or y view.
Definition: HitList.h:18
Encapsulate the cell geometry.
Definition: CellGeo.h:25
Float_t w
Definition: plot.C:20
Encapsulate the geometry of one entire detector (near, far, ndos)