GeneralBrokenLines V03-01-01
using EIGEN
exampleUtilCdc.cpp
Go to the documentation of this file.
1/*
2 * exampleCdc.cpp
3 *
4 * Created on: 23 Mar 2023
5 * Author: kleinwrt
6 */
7
30#include "exampleUtilCdc.h"
31
32using namespace Eigen;
33
35namespace gbl {
36
38
50GblDetectorLayer CreateWireCdc(const std::string aName, unsigned int layer,
51 double xPos, double yPos, double zPos, double phi, double tanLambda,
52 double stereoAngle, double uRes) {
53 Vector3d aCenter(xPos, yPos, zPos);
54 Vector2d aResolution(uRes, 0.);
55 Vector2d aPrecision(1. / (uRes * uRes), 0.);
56// track direction (N)
57 const double cosLambda = 1. / sqrt(1. + tanLambda * tanLambda);
58 Vector3d tDir(cos(phi) * cosLambda, sin(phi) * cosLambda,
59 tanLambda * cosLambda);
60// wire direction (V)
61 const double rad = sqrt(xPos * xPos + yPos * yPos);
62 const double scale = sqrt(1. + stereoAngle * stereoAngle);
63 Vector3d vDir(-yPos * stereoAngle / rad / scale,
64 xPos * stereoAngle / rad / scale, 1. / scale);
65// measurement direction perpendicular to track and wire direction (U)
66 Vector3d uDir = vDir.cross(tDir).normalized();
67// normal to measurement plane
68 Vector3d nDir = uDir.cross(vDir).normalized();
69
70 Matrix3d measTrafo;
71 measTrafo << uDir[0], uDir[1], uDir[2], vDir[0], vDir[1], vDir[2], nDir[0], nDir[1], nDir[2]; // U,V,N
72 Matrix3d alignTrafo = Matrix3d::Identity(); // I,J,K
73 return GblDetectorLayer(aName, layer, 1, 0.0, aCenter, aResolution,
74 aPrecision, measTrafo, alignTrafo); // no mult. scat.
75}
76
78
90GblDetectorLayer CreateImpactPar(const std::string aName, unsigned int layer,
91 double xPos, double yPos, double zPos, double phi, double tanLambda,
92 double xRes, double yRes, double zRes) {
93// track direction (N)
94 const double cosLambda = 1. / sqrt(1. + tanLambda * tanLambda);
95 Vector3d tDir(cos(phi) * cosLambda, sin(phi) * cosLambda,
96 tanLambda * cosLambda);
97// beam direction (V) = Z
98 Vector3d vDir(0., 0., 1.);
99// measurement direction perpendicular to track and beam direction (U)
100 Vector3d uDir = vDir.cross(tDir).normalized();
101// normal to measurement plane
102 Vector3d nDir = uDir.cross(vDir).normalized();
103// beam variance in U direction
104 const double uVar = uDir[0] * xRes * xRes * uDir[0]
105 + uDir[1] * yRes * yRes * uDir[1];
106 Vector3d aCenter(xPos, yPos, zPos);
107 Vector2d aResolution(sqrt(uVar), zRes);
108 Vector2d aPrecision(1. / uVar, 1. / (zRes * zRes));
109
110 Matrix3d measTrafo;
111 measTrafo << uDir[0], uDir[1], uDir[2], vDir[0], vDir[1], vDir[2], nDir[0], nDir[1], nDir[2]; // U,V,N
112 Matrix3d alignTrafo = Matrix3d::Identity(); // I,J,K
113 return GblDetectorLayer(aName, layer, 2, 0., aCenter, aResolution,
114 aPrecision, measTrafo, alignTrafo);
115}
116
117}
118
Detector layer.
Definition: GblUtilities.h:107
Definitions for exampleUtil(ities) for a Cylindrical Drift Chamber.
Namespace for the general broken lines package.
GblDetectorLayer CreateWireCdc(const std::string aName, unsigned int layer, double xPos, double yPos, double zPos, double phi, double tanLambda, double stereoAngle, double uRes)
Create a drift chamber wire with 1D measurement.
GblDetectorLayer CreateImpactPar(const std::string aName, unsigned int layer, double xPos, double yPos, double zPos, double phi, double tanLambda, double xRes, double yRes, double zRes)
Create detector plane for impact parameters as 2D measurement.