83 std::vector<GblDetectorLayer> layers;
113 unsigned int nTry = 10000;
114 std::cout <<
" GblSit $Id$ " << nTry <<
", " << layers.size()
117 clock_t startTime = clock();
120 const double bfac = 0.003;
130 for (
unsigned int iTry = 0; iTry < nTry; ++iTry) {
133 const double genDca = 0.1 *
unrm();
134 const double genZ0 = 0.1 *
unrm();
135 const double genPhi0 = 0.2 * (2. *
unif() - 1.);
136 const double genDzds = 0.3 * (2. *
unif() - 1.);
137 const double genCurv = bfac * qbyp * sqrt(1. + genDzds * genDzds);
142 std::vector<Vector2d> hits;
143 double curv(genCurv), phi0(genPhi0), dca(genDca), dzds(genDzds), z0(
145 const double cosLambda = 1. / sqrt(1. + dzds * dzds);
146 for (
unsigned int iLayer = 0; iLayer < layers.size(); ++iLayer) {
154 Vector2d sigma = layers[iLayer].getResolution();
155 meas[0] += sigma[0] *
unrm();
156 meas[1] += sigma[1] *
unrm();
158 hits.push_back(meas);
161 double radlen = layers[iLayer].getRadiationLength()
165 hlx.
moveToXY(measPos[0], measPos[1], phi0, dca, z0);
166 phi0 +=
unrm() * errMs / cosLambda;
167 dzds +=
unrm() * errMs / (cosLambda * cosLambda);
170 newhlx.
moveToXY(-measPos[0], -measPos[1], phi0, dca, z0);
177 double seedCurv(genCurv), seedPhi0(genPhi0), seedDca(genDca), seedDzds(
178 genDzds), seedZ0(genZ0);
183 const double cosLambdaSeed = 1. / sqrt(1. + (seedDzds * seedDzds));
185 std::vector<GblPoint> listOfPoints;
186 for (
unsigned int iLayer = 0; iLayer < layers.size(); ++iLayer) {
195 Vector2d res(hits[iLayer][0] - measPrediction[0],
196 hits[iLayer][1] - measPrediction[1]);
202 Matrix2d proM2l = transG2l * transM2g.block<3, 2>(0, 0);
204 Matrix2d proL2m = proM2l.inverse();
207 (sArc - sOld) / cosLambdaSeed, cosLambdaSeed, bfac);
213 std::vector<int> labGlobal(6);
215 for (
int p = 0; p < 6; p++)
216 labGlobal[p] = layerID * 10 + p + 1;
227 Vector2d scat(0., 0.);
228 Vector2d scatPrec(1. / (errMs * errMs), 1. / (errMs * errMs));
232 listOfPoints.push_back(point);
240 unsigned int ierr = traj.
fit(Chi2, Ndf, lostWeight);
249 LostSum += lostWeight;
253 clock_t endTime = clock();
254 double diff = endTime - startTime;
255 double cps = CLOCKS_PER_SEC;
256 std::cout <<
" Time elapsed " << diff / cps <<
" s" << std::endl;
257 std::cout <<
" Chi2/Ndf = " << Chi2Sum / NdfSum << std::endl;
258 std::cout <<
" Tracks fitted " << numFit << std::endl;
260 std::cout <<
" Weight lost " << LostSum << std::endl;
279 double xPos,
double yPos,
double zPos,
double thickness,
double uAngle,
281 Vector3d aCenter(xPos, yPos, zPos);
282 Vector2d aResolution(uRes, 0.);
283 Vector2d aPrecision(1. / (uRes * uRes), 0.);
285 const double cosU = cos(uAngle / 180. * M_PI);
286 const double sinU = sin(uAngle / 180. * M_PI);
287 measTrafo << 0., cosU, sinU, 0., -sinU, cosU, 1., 0., 0.;
289 alignTrafo << 0., 1., 0., 0., 0., 1., 1., 0., 0.;
291 aPrecision, measTrafo, alignTrafo);
312 double xPos,
double yPos,
double zPos,
double thickness,
double uAngle,
313 double uRes,
double vAngle,
double vRes) {
314 Vector3d aCenter(xPos, yPos, zPos);
315 Vector2d aResolution(uRes, vRes);
316 Vector2d aPrecision(1. / (uRes * uRes), 1. / (vRes * vRes));
318 const double cosU = cos(uAngle / 180. * M_PI);
319 const double sinU = sin(uAngle / 180. * M_PI);
320 const double cosV = cos(vAngle / 180. * M_PI);
321 const double sinV = sin(vAngle / 180. * M_PI);
322 measTrafo << 0., cosU, sinU, 0., cosV, sinV, 1., 0., 0.;
324 alignTrafo << 0., 1., 0., 0., 0., 1., 1., 0., 0.;
326 aPrecision, measTrafo, alignTrafo);
GblTrajectory definition.
GblHelixPrediction intersectWithHelix(GblSimpleHelix hlx) const
Intersect with helix.
double getRadiationLength() const
Get radiation length.
Eigen::Matrix< double, 2, 6 > getRigidBodyDerLocal(Eigen::Vector3d &position, Eigen::Vector3d &direction) const
Get rigid body derivatives in local (alignment) frame (rotated in measurement plane).
unsigned int getLayerID() const
Get layer ID.
Eigen::Matrix3d getMeasSystemDirs() const
Get directions of measurement system.
Eigen::Vector2d getPrecision() const
Get precision.
Eigen::Matrix< double, 2, 3 > getCurvilinearDirs() const
Get curvilinear directions (U,V)
double getArcLength() const
Get arc-length.
const Eigen::Vector2d & getMeasPred() const
Get (measurement) prediction.
double getCosIncidence() const
Get cosine of incidence.
const Eigen::Vector3d & getPosition() const
Get position.
const Eigen::Vector3d & getDirection() const
Get position.
void addMeasurement(const Eigen::MatrixBase< Projection > &aProjection, const Eigen::MatrixBase< Residuals > &aResiduals, const Eigen::MatrixBase< Precision > &aPrecision, double minPrecision=0.)
Add a measurement to a point.
void addGlobals(const std::vector< int > &aLabels, const Eigen::MatrixBase< Derivative > &aDerivatives)
Add global derivatives to a point.
void addScatterer(const Eigen::Vector2d &aResiduals, const Eigen::Matrix2d &aPrecision)
Add a thin scatterer to a point.
void moveToXY(double xPos, double yPos, double &newPhi0, double &newDca, double &newZ0) const
Move to new reference point (X,Y)
void milleOut(MilleBinary &aMille)
Write valid trajectory to Millepede-II binary file.
unsigned int fit(double &Chi2, int &Ndf, double &lostWeight, const std::string &optionList="", unsigned int aLabel=0)
Perform fit of (valid) trajectory.
Millepede-II (binary) record.
void exampleSit()
Silicon tracker example.
Definitions for exampleSit.
Namespace for the general broken lines package.
GblDetectorLayer CreateLayerSit(const std::string aName, unsigned int layer, double xPos, double yPos, double zPos, double thickness, double uAngle, double uRes)
Create a silicon layer with 1D measurement.
double unrm()
unit normal distribution, Box-Muller method, polar form
double gblMultipleScatteringError(double qbyp, double xbyx0)
Multiple scattering error.
double unif()
uniform distribution [0..1]
Matrix5d gblSimpleJacobian(double ds, double cosl, double bfac)
Simple jacobian.
GblDetectorLayer CreateLayerSit(const std::string aName, unsigned int layer, double xPos, double yPos, double zPos, double thickness, double uAngle, double uRes, double vAngle, double vRes)
Create a silicon layer with 2D measurement.
Eigen::Matrix< double, 5, 5 > Matrix5d