Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DFDCPseudo_factory_WIRESONLY.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DFDCPseudo_factory_WIRESONLY.cc
4 // Created: Fri Nov 9 09:57:12 EST 2007
5 // Creator: davidl (on Darwin fwing-dhcp95.jlab.org 8.10.1 i386)
6 //
7 
8 #include <cmath>
9 using namespace std;
10 
11 #include "DVector2.h"
12 #include "FDC/DFDCIntersection.h"
13 #include "DMatrix.h"
15 
16 //------------------
17 // evnt
18 //------------------
19 jerror_t DFDCPseudo_factory_WIRESONLY::evnt(JEventLoop *loop, uint64_t eventnumber)
20 {
21  vector<const DFDCIntersection*> fdcintersections;
22  loop->Get(fdcintersections);
23 
24  for(unsigned int i=0; i<fdcintersections.size(); i++){
25  const DFDCIntersection *fdcintersection = fdcintersections[i];
26 
27  // Here we add 2 pseudo points for each intersection point
28  MakePseudo(fdcintersection->hit1, fdcintersection->wire1, fdcintersection->pos);
29  MakePseudo(fdcintersection->hit2, fdcintersection->wire2, fdcintersection->pos);
30 
31  }
32 
33  return NOERROR;
34 }
35 
36 //------------------
37 // MakePseudo
38 //------------------
39 void DFDCPseudo_factory_WIRESONLY::MakePseudo(const DFDCHit *hit, const DFDCWire *wire, const DVector3 &pos)
40 {
41  DFDCPseudo *pseudo = new DFDCPseudo;
42 
43  DVector2 R(pos.X(), pos.Y());
44  DVector2 udir(wire->udir.X(), wire->udir.Y());
45  DVector2 a(wire->origin.X(), wire->origin.Y());
46 
47  pseudo->w = R*a;
48  pseudo->dw = 1.0/sqrt(12.0); // cm
49  pseudo->s = (R-a)*udir;
50  pseudo->ds = 1.0/sqrt(12.0); // cm
51  pseudo->wire = wire;
52  pseudo->time = hit->t;
53  pseudo->status = 1; // 1 external hit used to find intersection
54  pseudo->xy.Set(pos.X(),pos.Y());
55 
56  // Intialize covariance matrix in w/s coordinate system
57  DMatrix cov(2,2);
58  cov(0,0) = pseudo->dw*pseudo->dw; cov(1,0) = 0.0;
59  cov(0,1) = 0.0; cov(1,1) = pseudo->ds*pseudo->ds;
60 
61  // Build rotation matrix for rotating into x/y coordinate system
62  DMatrix Rot(2,2);
63  double cos_angle = cos(wire->angle);
64  double sin_angle = sin(wire->angle);
65  Rot(0,0) = cos_angle; Rot(1,0) = sin_angle;
66  Rot(0,1) = -sin_angle; Rot(1,1) = cos_angle;
67  DMatrix RotT(DMatrix::kTransposed, Rot);
68  DMatrix RotCov=RotT*cov*Rot;
69 
70  pseudo->covxx=RotCov(0,0);
71  pseudo->covxy=RotCov(1,0);
72  pseudo->covyy=RotCov(1,1);
73 
74  _data.push_back(pseudo);
75 }
76 
DVector2 xy
rough x,y coordinates in lab coordinate system
Definition: DFDCPseudo.h:100
TMatrixD DMatrix
Definition: DMatrix.h:14
double covxx
Definition: DFDCPseudo.h:95
const DFDCWire * wire1
TVector2 DVector2
Definition: DVector2.h:9
float angle
radians
Definition: DFDCWire.h:19
TVector3 DVector3
Definition: DVector3.h:14
int status
status word for pseudopoint
Definition: DFDCPseudo.h:94
const DFDCHit * hit1
const DFDCWire * wire
DFDCWire for this wire.
Definition: DFDCPseudo.h:92
class DFDCPseudo: definition for a reconstructed point in the FDC
Definition: DFDCPseudo.h:74
double ds
local coordinate of pseudopoint in the direction along the wire and its uncertainty ...
Definition: DFDCPseudo.h:91
const DFDCHit * hit2
double covxy
Definition: DFDCPseudo.h:95
double s
&lt; wire position computed from cathode data, assuming the avalanche occurs at the wire ...
Definition: DFDCPseudo.h:91
double covyy
Covariance terms for (x,y)
Definition: DFDCPseudo.h:95
double w
Definition: DFDCPseudo.h:89
double time
time corresponding to this pseudopoint.
Definition: DFDCPseudo.h:93
double sqrt(double)
double sin(double)
jerror_t evnt(JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
float t
Definition: DFDCHit.h:32
void MakePseudo(const DFDCHit *hit, const DFDCWire *wire, const DVector3 &pos)
double dw
local coordinate of pseudopoint in the direction perpendicular to the wires and its uncertainty ...
Definition: DFDCPseudo.h:89
const DFDCWire * wire2
class DFDCHit: definition for a basic FDC hit data type.
Definition: DFDCHit.h:20