LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
genf::GFWirepointHitPolicy Class Reference

#include "GFWirepointHitPolicy.h"

Inheritance diagram for genf::GFWirepointHitPolicy:

Public Member Functions

 GFWirepointHitPolicy ()
 
const GFDetPlanedetPlane (GFAbsRecoHit *, GFAbsTrackRep *)
 Get detector plane. More...
 
TMatrixT< Double_t > hitCoord (GFAbsRecoHit *, const GFDetPlane &)
 Hit coordinates in detector plane. More...
 
TMatrixT< Double_t > hitCov (GFAbsRecoHit *, const GFDetPlane &)
 Hit covariances in detector plane. More...
 
void checkPlane (GFAbsRecoHit *, const GFDetPlane &)
 Check if the detector plane is valid. More...
 
virtual ~GFWirepointHitPolicy ()
 
double getMaxDistance ()
 
void setMaxDistance (double d)
 
const std::string & getName ()
 

Private Attributes

GFDetPlane fDetPlane
 
double fMaxdistance
 

Static Private Attributes

static const std::string fPolicyName = "GFWirepointHitPolicy"
 

Detailed Description

Definition at line 53 of file GFWirepointHitPolicy.h.

Constructor & Destructor Documentation

genf::GFWirepointHitPolicy::GFWirepointHitPolicy ( )

Definition at line 37 of file GFWirepointHitPolicy.cxx.

37  : fMaxdistance(1.E50)
38 {
39  ;
40 }
virtual genf::GFWirepointHitPolicy::~GFWirepointHitPolicy ( )
inlinevirtual

Definition at line 74 of file GFWirepointHitPolicy.h.

74 { ; }

Member Function Documentation

void genf::GFWirepointHitPolicy::checkPlane ( GFAbsRecoHit hit,
const GFDetPlane plane 
)

Check if the detector plane is valid.

Definition at line 71 of file GFWirepointHitPolicy.cxx.

References e, genf::GFAbsRecoHit::getRawHitCoord(), and genf::GFDetPlane::getV().

Referenced by hitCoord(), and hitCov().

72 {
73  // raw x1, y1, z1, x2, y2, z2, rdrift, zreco
74  TMatrixT<Double_t> rC = hit->getRawHitCoord();
75 
76  assert(rC.GetNrows() == 8);
77 
78  TVector3 wire1(rC[0][0], rC[1][0], rC[2][0]);
79  TVector3 wire2(rC[3][0], rC[4][0], rC[5][0]);
80  TVector3 wiredirection = wire1 - wire2;
81 
82  TVector3 vaxis = plane.getV();
83  wiredirection.SetMag(1.);
84  vaxis.SetMag(1.);
85 
86  if (fabs(TMath::Abs(wiredirection.Dot(vaxis)) - 1) > 1e-3) {
87 
88  std::cout << "GFWirepointHitPolicy: plane not valid!!" << std::endl;
89  }
90 }
Detector simulation of raw signals on wires.
Float_t e
Definition: plot.C:35
const genf::GFDetPlane & genf::GFWirepointHitPolicy::detPlane ( GFAbsRecoHit hit,
GFAbsTrackRep rep 
)

Get detector plane.

Definition at line 92 of file GFWirepointHitPolicy.cxx.

References genf::GFDetPlane::dist(), e, genf::GFAbsTrackRep::extrapolateToLine(), fDetPlane, fMaxdistance, genf::GFAbsRecoHit::getRawHitCoord(), and x.

93 {
94 
95  TMatrixT<Double_t> x = hit->getRawHitCoord();
96  assert(x.GetNrows() == 8);
97  TVector3 wire1(x[0][0], x[1][0], x[2][0]);
98  TVector3 wire2(x[3][0], x[4][0], x[5][0]);
99 
100  // distance of one (the first) of the wire extremities from the plane
101  Double_t d_from_refplane = fDetPlane.dist(wire1).Mag();
102  if (d_from_refplane < 1e-5) return fDetPlane;
103 
104  // point of closest approach
105  TVector3 poca, poca_onwire, dirInPoca;
106 
107  rep->extrapolateToLine(wire1, wire2, poca, dirInPoca, poca_onwire);
108 
109  Double_t distance;
110  distance = TMath::Sqrt(fabs(
111  ((wire1 - poca).Mag2() * (wire2 - wire1).Mag2() - pow((wire1 - poca).Dot(wire2 - wire1), 2)) /
112  (wire2 - wire1).Mag2()));
113 
114  // check poca inside tube
115  if (distance > fMaxdistance) {
116  throw GFException("distance poca-wire > maxdistance", __LINE__, __FILE__) /* .setFatal() */;
117  }
118 
119  // find plane
120  // unitary vector along distance
121  // poca (on track), poca_onwire (on wire)
122  TVector3 fromwiretoextr = poca - poca_onwire;
123  fromwiretoextr.SetMag(1.);
124  // unitary vector along the wire
125  TVector3 wiredirection = wire2 - wire1;
126  wiredirection.SetMag(1.);
127 
128  // check orthogonality
129  if (fabs(fromwiretoextr * wiredirection) > 1e-3) {
130  throw GFException("fromwiretoextr*wiredirection > 1e-3", __LINE__, __FILE__) /* .setFatal() */;
131  }
132 
133  TVector3 U;
134  U = fromwiretoextr;
135  TVector3 V;
136  V = wiredirection;
137  U.SetMag(1.);
138  V.SetMag(1.);
139 
140  TVector3 O = (wire1 + wire2) * 0.5;
141 
142  fDetPlane = GFDetPlane(O, U, V);
143 
144  return fDetPlane;
145 }
Float_t x
Definition: compare.C:6
TVector3 dist(const TVector3 &point) const
Definition: GFDetPlane.cxx:199
Detector simulation of raw signals on wires.
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
Float_t e
Definition: plot.C:35
double genf::GFWirepointHitPolicy::getMaxDistance ( )
inline

Definition at line 76 of file GFWirepointHitPolicy.h.

References fMaxdistance.

const std::string& genf::GFWirepointHitPolicy::getName ( )
inline

Definition at line 79 of file GFWirepointHitPolicy.h.

References fPolicyName.

79 { return fPolicyName; }
static const std::string fPolicyName
TMatrixT< Double_t > genf::GFWirepointHitPolicy::hitCoord ( GFAbsRecoHit hit,
const GFDetPlane plane 
)

Hit coordinates in detector plane.

Definition at line 42 of file GFWirepointHitPolicy.cxx.

References checkPlane(), and genf::GFAbsRecoHit::getRawHitCoord().

43 {
44  TMatrixT<Double_t> returnMat(2, 1);
45 
46  checkPlane(hit, plane);
47 
48  // raw x1, y1, z1, x2, y2, z2, rdrift, zreco
49  TMatrixT<Double_t> rC = hit->getRawHitCoord();
50 
51  returnMat[0][0] = rC[6][0];
52  returnMat[1][0] = rC[7][0];
53  return returnMat;
54 }
Detector simulation of raw signals on wires.
void checkPlane(GFAbsRecoHit *, const GFDetPlane &)
Check if the detector plane is valid.
TMatrixT< Double_t > genf::GFWirepointHitPolicy::hitCov ( GFAbsRecoHit hit,
const GFDetPlane plane 
)

Hit covariances in detector plane.

Definition at line 56 of file GFWirepointHitPolicy.cxx.

References checkPlane(), and genf::GFAbsRecoHit::getRawHitCov().

57 {
58  checkPlane(hit, plane);
59 
60  TMatrixT<Double_t> returnCov(2, 2);
61  TMatrixT<Double_t> rawCov = hit->getRawHitCov();
62 
63  returnCov[0][0] = rawCov[6][6];
64  returnCov[1][0] = rawCov[7][6];
65  returnCov[0][1] = rawCov[6][7];
66  returnCov[1][1] = rawCov[7][7];
67 
68  return returnCov;
69 }
Detector simulation of raw signals on wires.
void checkPlane(GFAbsRecoHit *, const GFDetPlane &)
Check if the detector plane is valid.
void genf::GFWirepointHitPolicy::setMaxDistance ( double  d)
inline

Definition at line 77 of file GFWirepointHitPolicy.h.

References d, and fMaxdistance.

77 { fMaxdistance = d; }
Float_t d
Definition: plot.C:235

Member Data Documentation

GFDetPlane genf::GFWirepointHitPolicy::fDetPlane
private

Definition at line 85 of file GFWirepointHitPolicy.h.

Referenced by detPlane().

double genf::GFWirepointHitPolicy::fMaxdistance
private

Definition at line 86 of file GFWirepointHitPolicy.h.

Referenced by detPlane(), getMaxDistance(), and setMaxDistance().

const std::string genf::GFWirepointHitPolicy::fPolicyName = "GFWirepointHitPolicy"
staticprivate

Definition at line 82 of file GFWirepointHitPolicy.h.

Referenced by getName().


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