109 std::vector<GblDetectorLayer> layers;
144 <<
"! MillePede-II: constraints for alignables with SINGLE 1D measurements"
146 for (
unsigned int iLayer = 0; iLayer < layers.size(); ++iLayer) {
148 unsigned int numMeas = 0;
149 for (
unsigned int jLayer = 0; jLayer < layers.size(); ++jLayer) {
150 if (layers[iLayer].getLayerID() == layers[jLayer].getLayerID())
155 layers[iLayer].printMP2Constraint();
157 std::cout <<
"! End of lines to be added to MillePede-II steering file"
159 std::cout << std::endl;
161 unsigned int nTry = 10000;
162 std::cout <<
" GblSit $Id$ " << nTry <<
", " << layers.size() << std::endl;
164 clock_t startTime = clock();
167 const double bfac = 0.003;
177 for (
unsigned int iTry = 0; iTry < nTry; ++iTry) {
180 const double genDca = 0.1 *
unrm();
181 const double genZ0 = 0.1 *
unrm();
182 const double genPhi0 = 0.2 * (2. *
unif() - 1.);
183 const double genDzds = 0.3 * (2. *
unif() - 1.);
184 const double genCurv = bfac * qbyp * sqrt(1. + genDzds * genDzds);
189 std::vector<Vector2d> hits;
190 double curv(genCurv), phi0(genPhi0), dca(genDca), dzds(genDzds), z0(
192 const double cosLambda = 1. / sqrt(1. + dzds * dzds);
193 for (
unsigned int iLayer = 0; iLayer < layers.size(); ++iLayer) {
201 Vector2d sigma = layers[iLayer].getResolution();
202 meas[0] += sigma[0] *
unrm();
203 meas[1] += sigma[1] *
unrm();
205 hits.push_back(meas);
208 double radlen = layers[iLayer].getRadiationLength()
212 hlx.
moveToXY(measPos[0], measPos[1], phi0, dca, z0);
213 phi0 +=
unrm() * errMs / cosLambda;
214 dzds +=
unrm() * errMs / (cosLambda * cosLambda);
217 newhlx.
moveToXY(-measPos[0], -measPos[1], phi0, dca, z0);
224 double seedCurv(genCurv), seedPhi0(genPhi0), seedDca(genDca), seedDzds(
225 genDzds), seedZ0(genZ0);
230 const double cosLambdaSeed = 1. / sqrt(1. + (seedDzds * seedDzds));
232 std::vector<GblPoint> listOfPoints;
233 for (
unsigned int iLayer = 0; iLayer < layers.size(); ++iLayer) {
242 Vector2d res(hits[iLayer][0] - measPrediction[0],
243 hits[iLayer][1] - measPrediction[1]);
249 Matrix2d proM2l = transG2l * transM2g.block<3, 2>(0, 0);
251 Matrix2d proL2m = proM2l.inverse();
254 (sArc - sOld) / cosLambdaSeed, cosLambdaSeed, bfac);
260 std::vector<int> labGlobal(6);
261 for (
int p = 0; p < 6; p++)
273 Vector2d scat(0., 0.);
274 Vector2d scatPrec(1. / (errMs * errMs), 1. / (errMs * errMs));
278 listOfPoints.push_back(point);
286 unsigned int ierr = traj.
fit(Chi2, Ndf, lostWeight);
295 LostSum += lostWeight;
299 clock_t endTime = clock();
300 double diff = endTime - startTime;
301 double cps = CLOCKS_PER_SEC;
302 std::cout <<
" Time elapsed " << diff / cps <<
" s" << std::endl;
303 std::cout <<
" Chi2/Ndf = " << Chi2Sum / NdfSum << std::endl;
304 std::cout <<
" Tracks fitted " << numFit << std::endl;
306 std::cout <<
" Weight lost " << LostSum << std::endl;
325 double xPos,
double yPos,
double zPos,
double thickness,
double uAngle,
327 Vector3d aCenter(xPos, yPos, zPos);
328 Vector2d aResolution(uRes, 0.);
329 Vector2d aPrecision(1. / (uRes * uRes), 0.);
331 const double cosU = cos(uAngle / 180. * M_PI);
332 const double sinU = sin(uAngle / 180. * M_PI);
333 measTrafo << 0., cosU, sinU, 0., -sinU, cosU, 1., 0., 0.;
335 alignTrafo << 0., 1., 0., 0., 0., 1., 1., 0., 0.;
337 aPrecision, measTrafo, alignTrafo);
358 double xPos,
double yPos,
double zPos,
double thickness,
double uAngle,
359 double uRes,
double vAngle,
double vRes) {
360 Vector3d aCenter(xPos, yPos, zPos);
361 Vector2d aResolution(uRes, vRes);
362 Vector2d aPrecision(1. / (uRes * uRes), 1. / (vRes * vRes));
364 const double cosU = cos(uAngle / 180. * M_PI);
365 const double sinU = sin(uAngle / 180. * M_PI);
366 const double cosV = cos(vAngle / 180. * M_PI);
367 const double sinV = sin(vAngle / 180. * M_PI);
368 measTrafo << 0., cosU, sinU, 0., cosV, sinV, 1., 0., 0.;
370 alignTrafo << 0., 1., 0., 0., 0., 1., 1., 0., 0.;
372 aPrecision, measTrafo, alignTrafo);
GblTrajectory definition.
unsigned int getRigidBodyGlobalLabel(const unsigned int aPar) const
Get global label.
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).
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