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

policy class for hits in wire detectors (STT and DCH) which do not measure the coordinate along the wire More...

#include "GFWireHitPolicy.h"

Inheritance diagram for genf::GFWireHitPolicy:

Public Member Functions

 GFWireHitPolicy ()
 
const GFDetPlanedetPlane (GFAbsRecoHit *, GFAbsTrackRep *)
 Get detector plane Calls GFAbsTrackRep::extrapolateToLine for POCA. 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 ~GFWireHitPolicy ()
 
double getMaxDistance ()
 
void setMaxDistance (double d)
 
const std::string & getName ()
 

Private Attributes

GFDetPlane fDetPlane
 
double fMaxdistance
 

Static Private Attributes

static const std::string fPolicyName = "GFWireHitPolicy"
 

Detailed Description

policy class for hits in wire detectors (STT and DCH) which do not measure the coordinate along the wire

Author
Christian Höppner (Technische Universität München, original author)
Lia Lavezzi (INFN Pavia, original author)
Sebastian Neubert (Technische Universität München, original author)

This policy is not valid for any kind of plane orientation choice: to use it you MUST choose a plane described by u and v axes with v coincident with the wire (and u orthogonal to it, obviously). The hit will be described by 7 coordinates: w_x1, w_y1, w_z1, w_x2, w_y2, w_z2, rdrift where w_ji (with j = x, y, z and i = 1, 2) are the wire extremities coordinates; rdrift = distance from the wire (u coordinate in the plane)

Definition at line 52 of file GFWireHitPolicy.h.

Constructor & Destructor Documentation

genf::GFWireHitPolicy::GFWireHitPolicy ( )

Definition at line 38 of file GFWireHitPolicy.cxx.

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

Definition at line 74 of file GFWireHitPolicy.h.

74 { ; }

Member Function Documentation

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

Check if the detector plane is valid.

Definition at line 68 of file GFWireHitPolicy.cxx.

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

Referenced by hitCoord(), and hitCov().

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

Get detector plane Calls GFAbsTrackRep::extrapolateToLine for POCA.

Definition at line 89 of file GFWireHitPolicy.cxx.

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

90 {
91 
92  TMatrixT<Double_t> x = hit->getRawHitCoord();
93  assert(x.GetNrows() == 7);
94  TVector3 wire1(x[0][0], x[1][0], x[2][0]);
95  TVector3 wire2(x[3][0], x[4][0], x[5][0]);
96 
97  // distance of one (the first) of the wire extremities from the plane
98  Double_t d_from_refplane = fDetPlane.dist(wire1).Mag();
99  if (d_from_refplane < 1e-5) return fDetPlane;
100 
101  // point of closest approach
102  TVector3 poca, poca_onwire, dirInPoca;
103 
104  rep->extrapolateToLine(wire1, wire2, poca, dirInPoca, poca_onwire);
105 
106  Double_t distance;
107  distance = TMath::Sqrt(fabs(
108  ((wire1 - poca).Mag2() * (wire2 - wire1).Mag2() - pow((wire1 - poca).Dot(wire2 - wire1), 2)) /
109  (wire2 - wire1).Mag2()));
110 
111  // check poca inside tube
112  if (distance > fMaxdistance) {
113  GFException exc("distance poca-wire > maxdistance", __LINE__, __FILE__);
114  throw exc;
115  }
116 
117  // find plane
118  // unitary vector along distance
119  // poca (on track), poca_onwire (on wire)
120  TVector3 fromwiretoextr = poca - poca_onwire;
121  fromwiretoextr.SetMag(1.);
122  // unitary vector along the wire
123  TVector3 wiredirection = wire2 - wire1;
124  wiredirection.SetMag(1.);
125 
126  // check orthogonality
127  if (fabs(fromwiretoextr * wiredirection) > 1e-3) {
128  GFException exc("fromwiretoextr*wiredirection > 1e-3", __LINE__, __FILE__);
129  throw exc;
130  }
131 
132  TVector3 U;
133  U = fromwiretoextr;
134  TVector3 V;
135  V = wiredirection;
136  U.SetMag(1.);
137  V.SetMag(1.);
138 
139  TVector3 O = poca_onwire;
140 
141  fDetPlane = GFDetPlane(O, U, V);
142 
143  return fDetPlane;
144 }
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::GFWireHitPolicy::getMaxDistance ( )
inline

Definition at line 76 of file GFWireHitPolicy.h.

References fMaxdistance.

76 { return fMaxdistance; }
const std::string& genf::GFWireHitPolicy::getName ( )
inline

Definition at line 79 of file GFWireHitPolicy.h.

References fPolicyName.

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

Hit coordinates in detector plane.

Definition at line 43 of file GFWireHitPolicy.cxx.

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

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

Hit covariances in detector plane.

Definition at line 56 of file GFWireHitPolicy.cxx.

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

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

Definition at line 77 of file GFWireHitPolicy.h.

References d, and fMaxdistance.

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

Member Data Documentation

GFDetPlane genf::GFWireHitPolicy::fDetPlane
private

Definition at line 85 of file GFWireHitPolicy.h.

Referenced by detPlane().

double genf::GFWireHitPolicy::fMaxdistance
private

Definition at line 86 of file GFWireHitPolicy.h.

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

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

Definition at line 82 of file GFWireHitPolicy.h.

Referenced by getName().


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